














Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!















After you have translated your design into a computer program (usually filling in a lot of details in the process), you will need to send it to the computer to see how it worked (Zhang and Wong, 2015, pp. 434-
.
The process, compilation refers to converting a program written in a high-level programming language into a machine code consisting of 0's and 1's (that is understood only by a computer). Compilation is a compulsory process because the chip that makes your computer run only understands binary machine code – (which isn’t something that every human can understand) because, it looks something like this: 01110110 01101101 10110111 00101100 00110101 Initially, programmers used that style to write their programs, but they soon learned how to write programs that could be translated into a better-understandable language and translate it into this pigeon-eating language. These programs are known as Compilers. Compilers are the programs that read programming languages, translate them, and generate machine code based on them. They are also referred to as Interpreters. Although, compilers have a reputation for being extremely picky in nature. If you don't write the right program, they will complain. Consider them as the most-strict type of English teacher, catching you for every misplaced apostrophe, grammatical error, and missing comma. (Zhang, et al, 2020, p.170501).
It is at this point that debugging is necessary, because the compiler is likely to report a wide array of errors after it has examined your program. But don’t be concerned about that, it’s totally normal; even the most-experienced programmers can make mistakes. Debugging is the process of analyzing the original program, finding errors, removing coding mistakes, and recompiling the program. It is often necessary to repeat this cycle of code -> compile -> debug many times before the compiler is satisfied with the result. However, the compiler is not involved in this process, whereas programmers do.
At this point, you don't need to write the entire program before you begin compiling and debugging. While in most of the cases, it's better to write a small piece of code first, get it to run, then move on to the next phase. By doing this, the amount of code that needs to be debugged each time is reduced, and it generally provides a sense of “accomplishment” when each section is completed. (Kirschner, Soremekun, and Zeller, 2020, pp. 75-86).
For example, in a company, the services of a programmer are needed. They call you to analyze a problem in a program. Defining the problem is a process which consists of determining what you already know (data provided by input) and what you would like to accomplish (output - result).
perhaps both, are two typical ways to plan a Problem-Solving Process. Basically, a flowchart is a visual representation to solve a problem step-by-step. It contains arrows, that indicates the direction of the program, boxes and other symbols which represents actions. The simple English description of an algorithm by a computer programmer that defines the flow and function of a program is called pseudo code. It is a general term for a structural flow of programmers that does not refer to a specific programming language. Let’s take an example of a real-world problem: A problem could be sort out the array in ascending order using bubble sorting [30, 20, 15, 19, and 4]
1.) Begin. 2.) Take input of array elements from the user. 3.) Compare the first number with the number next to it (adjacent). 4.) If the first number is greater than the adjacent number, then perform swapping. 5.) Else, move to the next number. 6.) This swapping process will continue, until all elements of an array are sorted. 7.) End.
Figure 1 Flowchart
Initialize n = Length of Array Bubble Sort (Array List, n) {For I = 0 to n- {For j = 0 to n- { If Array List[j] > Array List [j+1] { Swap (Array List[j], Array List [j+1]) {Else if End for endive break } } } } }
As we have planned the solution so far. The next step is to intimate the solution in a programming language. We will convert the solution from the pseudo-code or flowchart to a programming language. As we previously stated that a programming language is a cluster of guidelines to direct the computer on what function to perform next. Figure 2: C++ Code of Bubble Sort --
As we have successfully done with the coding part, now we are only left with the testing part, to ensure whether our code works or not. Let’s test it with debugging. Debugging is the process of
Procedural programming is one of the two main paradigm of computer programming. It is based on the concept that programs are composed of series of instructions that must be followed in order for them to be executed. As a part of the approach, they emphasize the importance of breaking down programs into named groups of instructions called procedures, which are similar to functions. In addition to accessing and altering global data variables, procedures are capable of storing local data that is unavailable outside of the process scope (Lukkarinen, Malmi, and Haaranen, 2021, pp.1-31).
1.) In program, data is free to move around. 2.) It's simple to follow a program's logic. 3.) A top-down method is used in procedural programming. 4.) The program being divided in different segments of code called functions, where each segment of code executes a specific task. 5.) Functions and data are separated from one another. 6.) Function can have access to other function’s data just by calling it. Object-oriented programming (OOP) emphasizes the objects rather than the logic which must be used in order to manipulate them. Because of its versatility, this programming style is ideal for large, complex, and frequently updated or maintained projects. It includes software for manufacturing and design, as well as mobile applications; for example, OOP may also be used to simulate manufacturing systems. Although, at this time OOP has become the most popular paradigms.
1.) The first characteristics of OOP is that it emphasis on objects & [Object-oriented Development (OOD)] is the process that programmers use to create these objects. 2.) [Encapsulation] is the process by which programmers gather and isolate the data from hackers and other outsiders. Encapsulation the data is an important aspect of OOP. 3.) [Abstraction] in OOP is basically to display most important attributes, while hiding what is not necessary. The basic purpose of the abstraction is to keep users from additional information (the information that not everyone needs to know). 4.) [Polymorphism] is inextricably linked to OOP and it is a fundamental concept in all the languages of OOP. Generally, different contexts can lead to different forms for an object or reference. ‘Poly’ in polymorphism refers to many while morph refers to forms. In a nutshell, it would be a characteristic of having several forms. 5.) [Inheritance] is the procedure that essentially allows one object to create another and inherit the methods, properties and other characteristics of another object. The process involves creating a class from base class that has all of the base class's characteristics as well as its own also. It allows the programmers to reuse the elements and create another unique object. 6.) Class is OOP's essential building element and is a single unit that combines data and data manipulations. In event-driven programming, events determine the execution of the programs. Software of this type detects events as soon as they occur and responds to them by means of a method or callback function, depending on the event. All programming languages allow event-driven programming, but the implementations may differ. For instance, they are easy to use in languages that provide a high degree of abstraction. (Fischer, Majumdar, and Millstein, 2007, pp. 134-143).
1.) [Service-oriented programming]is a significant component of event-driven programming, which is used to develop software for services. Service-oriented programming consumes very little CPU power and is usually work in the background by the operating system. 2.) [Time driven]is a type of characteristic of event driven programming that runs at a predetermined interval, it could be once in a week, or twice in a week, or daily, many possibilities exist. It's a scheduled activity. For example, Software-Update is a time-
takes place. The execution of code is faster is procedural programming. The flow of program can be easily tracked. The memory required for code storage is less than as compare to others. Due to the fact that the source code is portable, it can be adapted to target a variety of processors (CPU). The drawbacks are at many occasions the code is not reusable, which ultimately led to recreation of code. It is not secure because entire data is exposed in the program. The procedure is prioritized over the data, which may cause some data-sensitive problems. Now let’s discuss about some advantages of event-driven programming. It provides GUI (Graphical User Interface) which makes it very efficient and easy to use. It is easily edible, if user want to modify the program at any spot, like changing the button name, so it can be easily done through toolbar. It is very easy to understand. Moreover, it allows interaction of hardware with the software. The drawbacks are, it is less logical. GUI takes a lot of time to load, in case RAM is not sufficient Head-to-Head ( Weatherhead, 2016, p.13).
It focuses on step-wise execution of the program. It focuses more on objects and classes (grouped data) It mostly focuses on user interface settings. CUI (character user interface) is used. The modules used are command writing. To create a program, graphical user interface is used. Execution and writing of command is done linearly Any task is performed by preparing objects and methods Events are defined by actions. Like pressing a button on keyboard Focuses on algorithm Focuses on data Focuses on events Example COBOL, Fortran Example Java , C++ Example, C#. Visual Basic.
I have created a program using all three paradigms. I have created same programs using different paradigms, so that I can evaluate in a best way possible. I have used C++ language for all
#include
Figure 7 Result
} }; int main() { rectangle r1; rectangle r2; // using OOP we can make as many instances of the class and then apply functions separately on them r1.area(10,5); r2.area(2,3); }
Figure 8: Result
Module Module Sub Main() Dim r1 As Rectangle Dim r2 As Rectangle Dim L As Single = 0.0F Dim L1 As Single = 0.0F Dim W As Single = 0.0F Dim W1 As Single = 0.0F Dim A As Single = 0.0F Dim A1 As Single = 0.0F for r r1.L =10.0 //length of rectangle 1 r1.W =5.0 //width of rectangle 1 'for r r2.L1 =3.0 //length of rectangle 2 r2.W1 =2.0 //length of rectangle 2
Public length As Double Public width As Double Public Sub setLength(ByVal len As Double) length = len End Sub Public Sub setWidth(ByVal wid As Double) width = wid End Sub Public Function getArea() As Double Return length * width End Function End Class Sub Main() Dim r1 As rectangle = New rectangle() Dim r2 As rectangle = New rectangle() Dim Area As Double = 0. ' for r
r1.setLength(10.0) r1.setWidth(5.0) 'for r r2.setLength(3.0) r2.setWidth(2.0) ' volume of r Area = r1.getArea() Console.WriteLine("Area of Rectangle r1 : {0}", Area) 'volume of r Area = r2.getArea() Console.WriteLine("Area of Rectangle r2 : {0}", Area) Console.ReadKey() End Sub End Module Result: