HND Level 4 Unit 1- Programming Assignment, Essays (university) of Programming Paradigms

LO1 Define basic algorithms to carry out an operation and outline the process of programming an application LO2 Explain the characteristics of procedural, object-orientated and event driven programming, conduct an analysis of a suitable Integrated Development Environment (IDE) LO3 Implement basic algorithms in code using an IDE LO4 Determine the debugging process and explain the importance of a coding standard

Typology: Essays (university)

2019/2020

Uploaded on 08/26/2021

suryshoonteith
suryshoonteith 🇲🇲

4.7

(44)

13 documents

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
~ 1 ~
Movieopedia
Programming
Best way of entertainment
A DEVELOPER'S PERSPECTIVE
ASSIGNMENT
Saving, Display, Searching system
2020
Edition
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

Partial preview of the text

Download HND Level 4 Unit 1- Programming Assignment and more Essays (university) Programming Paradigms in PDF only on Docsity!

Movieopedia

Programming

Best way of entertainment

A DEVELOPER'S PERSPECTIVE

ASSIGNMENT

Movie Information

Saving, Display, Searching system

Edition

Contents

You can use algorithms to solve problems in science, medicine, finance, industrial production and supply, and communication. Algorithms provide support for all parts of a person’s daily life. Any time a sequence of actions achieving something in our life has input, output, and endpoint, we can view it as an algorithm. You can turn even something as simple as frying egg into an algorithm. Here are some interesting uses of algorithms: Calculations One of the common uses of algorithms is as a means of solving formulas. For example, in a quadratic equation, you can find the value of x by using quadratic formula manually and then finding the answer. However, finding answer for x when the given numbers are large can be prone to errors and time consuming. Therefore, an algorithm is created to perform a task. Sorting Determining which order to use to show the data and information is important in light of the fact that the vast majority today suffer from information overload, and putting information in order is one way to diminish the flood of data. Imagine going into Shop.com.mm, finding that over a thousand earphones are available to be purchases there, and yet not having the option to sort them in order of most popular or price. Additionally, numerous mind-blogging algorithms require data in the best possible order to work reliably, in this manner ordering is a significant requisite for taking care of numerous problems. Searching Finding data or confirming that the data you see is the data you want, is a fundamental task. Without algorithms, it wouldn’t be possible to perform any tasks online, such as looking for the shops on the Internet which sells the ideal dress you want to wear to a birthday party. Graph analysis Deciding on the shortest line between two points finds all sorts of uses. For instance, in a routing problem, your GPS uses an algorithm to direct you along the city streets using the shortest route from point A to point B. Transforming Changing one kind of data into another is important to understanding and utilizing data viably. Suppose that, you can understand the imperial system easily, however, the entirety of your sources makes use of the metric system. Transforming between the two systems helps you to understand the data. Pseudorandom number generation Envision playing games that never changed. For example, Minesweeper; all the bombs are in the same spot each time you play. Without the capability to create apparently random numbers, many computer tasks become impossible

Generally, ‘paradigm’ means a pattern or a style of solving something or doing some tasks. In terms of programming, programming paradigms is a method of classifying the programming languages based on their genre and features. There is a lot of programming languages to use when writing a program but all of them have to pursue some pattern when they are written. That pattern is called paradigm. Over the last three decades, three types of programming paradigms have come to light and are well-known all around the world. The three types are:

  • Procedural Programming Paradigms
  • Object-Oriented Programming Paradigms
  • Event-Driven Programming Paradigms Procedural Programming is a type of programming paradigms which relies on procedures containing a series of computational steps to be performed. It is the oldest among all the paradigms and it is also known as imperative programming. In this model, both the variables and the programs are stored together and the programs consists of a series of procedures operates on the variables like accepting input, giving output and performing calculations. Example Here the codes are divided into different methods instead of writing all the codes in the main method. Therefore, the sum method and the average method can be called and use in the main method for several time without having to retype all the codes. Procedural Programming Paradigms is often used for separating a programming task into many different procedures which consist of collection of variables, subroutines and data structure. For instance, if you want the user to see clearly about the different states of the application like ‘Display array before sorting’, ‘Display array after sorting’, then this paradigm is used. It’s better to not use this to handle UI and when there are many simple individual tasks to do.

Get and Set Value is returned with the get method and is set with the set method in order to update and access those private variables Below is an example, In this example, a new private string called ‘name’ is created and the get method is used to return the data of the variable ‘name’. In the set method, the ‘name’ variable is assigned with another parameter called ‘newName’. The keyword ‘this’ is used in order to refer to the current object. Inheritance For inheritance, the classes are written in hierarchies which means that the one class passes down its methods and structure to another class like from parents to child. Therefore, it means less codes need to be written adding new functions to the complicated systems. There are five types of inheritance: Single inheritance, Multiple inheritance, Multilevel inheritance and Hierarchical inheritance Single Inheritance Multiple Inheritance One class is extended from another class One class is extended from many classes Class A Class B Class A Class B Class C

Multilevel Inheritance Hierarchical Inheritance One class is extended from another class and the extended class becomes the base class for another newer class Many classes are extended from only one class The aim of using inheritance is for its ability to reuse code from one class to another by extending the common properties and functionalities from the base class to another new class. The class whose properties are extended from is called as parent class and the class where the properties are extended to is called as the child class. The main benefit of inheritance is that the codes that are written in the parent classes do not need to be rewritten in the child class. Therefore, it saves time when writing codes and provides clear visibility of the codes. Below is an example of how inheritance works. In this example, the ‘Car’ class inherits the structures and methods from ‘Vehicle’ class. Class A Class B Class B Class A Class C Class B

Method Overriding Overriding occurs when the child class has the same method name and parameters with the parent class Example In this example, a parent class called ‘Vehicle’ is created and ‘Bike2’ class inherits from ‘Vehicle’ as the child class witht the same methods and parameters inside. Therefore, it is called as method overriding. Benefits of using OOP

  • Easy management
  • Easier troubleshooting
  • Easier to understand as it relates to the real world
  • The objects can be used again in other programs Event-driven programming is a programming paradigm in which the sequence of input event is not controlled and the flow of the program depends only the events created by the user. In EDP, event means and actions created by the users like mouse clicks or key presses in order to give response back to the system. Events are observed by the a code called as event listener which will trigger a callback function once it finds that an assigned event has occurred. The called back function also known as event handler, will perform the event according to the event listener. The most common example of event-driven program is Graphical User Interface (GUI) which can be found on computers and smart gadgets these days. Event-driven programs are also used for web-based applications. For instance, an online registration system must be ready to interact with the user no matter what the next action of the user might be: adding name, adding age, adding address and so on. An online flight booking system must be able to respond based on the user actions like changing the date of travel or destination.

Example In this example, there is a main loop that runs spontaneouly until the program is stopped. If an event occurs, the scheduler will decide the type of event and choose a suitable event handler. Debugging is a method used by the computer programmers to test their code and find out if they have solved the errors or if something is going wrong, they can use debugging to find where it is going wrong so that they know where to fix their code. Debugging doesn’t mean coding around the errors to make the symptoms go away, it actually means finding the main reason for the error and fixing the code so that the error is eliminated. Normally, debugging is done right after completing the code and before doing a code review. The aim of debugging is to find out, isolate and correct the errors in the program. Example for Debugging The aim of this program is to calculate average for all the values entered as command-line arguments. The program runs without any errors and problems however, when the numbers 1,2,3 are entered, the result is 6.0 while the result should be 2.0. First and foremost, it’s time to think about where is error is at. It can be assumed that the error is not at print statements rather at ‘findAverage’ method. So, in order to find the cause of the error, breakpoints need to be set at the suspected line of code. Breakpoints prevent that line of code form executing when running the program and also marks which line is being prevented.

After error correction is done, the debugging process is stopped and the program is run again to make sure that it works fine. Code Highlighting If the IDE notice an syntax error, it will highlight the part of the error where it found the error so that it can be seen cearly by the developer Breakpoints Breakpoint is one the most valuable debugging tool in the IDE. It is a place in the program where the execution of the code will be paused in order to check the value of the variables. Normally, the breakpoints can be found as red circles above the line number. Steppers Steppers also works almost the same breakpoints. They will stop the execution of the code at a particular line however, it can also continue code execution line by line after clicking a certain key on the keyboard

They are a series of guidelines that can be defined for a specific programming language indicating a programming style, practices and methods which can be for different aspects of the program written in that language. Here are the fundamental areas where individual in a group frequently have various preferences and might need to agree on something.

1. Naming Convention It is recommended to write the name by its purpose clearly and shortly so that it can help anyone to comprehend the reason of using it. E.g. MethodExe (using BumpyCase) E.g. Method_Exe (using Underscore) 2. Formatting and Indentation It is fitting to utilize proper indentation while writing a code in order to increase the meaningfulness of the code. There is no specific style of indentation and any style of indentation can be picked however, a consistent indentation must be used all through the code. For Example, public class ArrayExe1 { public static void main(String[] args) { String[] stulist = new String[5]; Scanner sc = new Scanner(System.in); for(int i = 0; i<stulist.length ; i++){ System.out.println("Enter a Name: "); stulist [i] = sc.nextLine(); } 3. Code comments and proper documentation It is a good idea to write comments while writing code so that other developers can read and understand the code easily. It is fitting to begin each method or statement with a comment indicating what it does, how does it work and the possible errors that could occur. For Example //Using Random class to generate randomly results System.out.println("This is random answer using random class"); Random r = new Random(); int result = r.nextInt(); //randomly generate thirty two bit intergers System.out.println("the result is " + result);

  • P1 Algorithms
    • Why do we need to learn algorithms?
    • Uses of algorithms
  • P2 Programming Paradigms
    • Procedural Programming
    • Object-Oriented Programming
    • Event-driven Programming
  • P4 Debugging
    • Debugging facilities in IDE
  • P5 Coding standards
    • Coding standards
    • What are the coding standards?
  • Flowchart.............................................................................................
  • M1 Steps from writing code to execution
    • Functions of Data storing method
    • Functions of Movie information display method
    • Functions of Search by Movie Name method
    • Functions of Search by Released Year method
    • Functions of Search by Actor Name method
    • Functions of Search by Search by Director Name method
    • Functions of Search by Search by Genre method
  • M2 OOP vs. POP vs. EDP
  • M4 Benefits of Debugging
  • D1 Implementation of an algorithm
  • D2 Technical Guide
  • D3 Using IDE vs. Not using IDE
    • What is IDE?
    • Using IDE
    • Not using IDE
  • D4 Advantages of Coding Standard
    • For Individual..........................................................................................................
    • For Team
  • Part
  • Part
  • Part
  • Part

❖ Ask “Search by Genre” to user and accept the input ❖ Check if the genre exists or not in Genre array ❖ If exist, display the movie information with that genre ❖ Else, display “Sorry. The movie with that genre does not exist” In this program, the user is asked to enter an english alphabet and the program will check whether the enterd letter is a vowel or a consonant by using If statement.

Differences

Procedural Programming Object-Oriented Programming Event-Driven Programming Offers CLI to write programs Offers command writing in modules Offers GUI to write programs Uses commands Uses objects and functions Uses events Steps are executed in serial order Steps depends on objects and data Steps Depends on user selection Data cannot be hidden Can hide data by using encapsulation hence more secure Data cannot be hidden C, C++, PHP, Python C++, Java, C# Visual basic, Javascript, Elm

Time saving By debugging, the developers can save a huge amount time since they can avoid the one-time testing code. With debugging, they can easily detect the error and fix the bug right away instead of wasting time looking for the possible error. Therefore, they can complete the program quickly. Immediate error detection The reasons why debugging is important in programs is because it reports the error as soon as it is detected therefore, the software development process is easier and unproblematic. When the error is detected only after completing the program, it can be difficult. Easy to understand Debugging also helps programmers to eliminate useless information. Thus, after elimination, the program becomes simpler and provides clear visibility to the developers. In case, another developer takes over the A lesson to learn from Using debugging in the correct way will assist the developers to understand more about the analytical and logical arrangement of the codes, which is the main ability a developer should have. Debugging will cause the developer to examine through the code which in turns helps them to understand more about the matrix. The errors can be viewed as a chance to learn more about themselves and improve their skills. Surprises can be good Repairing a buggy program is a process of making sure that the several things you guessed true are actually true. And if one of your assumptions proves to be wrong or incorrect. It can be a really surprising twist and can lead you to the real location of the error.