Premium Essay

Procedural Programming Compared to Object Oriented

In: Computers and Technology

Submitted By MommySugar36
Words 924
Pages 4
Compare and Contrast Object Oriented Programming and Procedural Programming Languages
Object Oriented Programming 1
Marty Montgomery

Compare and Contrast Object Oriented and Procedural Programming Languages:
Object Oriented Programming and Procedural Programming are two programming paradigms. A programming paradigm is a fundamental style of computer programming, and they differ in the way different elements of the program are represented and how steps for solving problems are defined. As the name suggests, Object Oriented Programming focuses on representing problems using real-world objects and their behavior while, Procedural Programming deals with representing solutions to problems using procedures, which are collections of code that run in a specific order. (Gaddis, 2010)
Procedural Programming is a method of writing software. It is a programming practice centered on the procedures or actions that take place in a program. One of the main concepts of Procedural Programming is the Procedure call. A procedure also known as a subroutine, method or a function contains an ordered list of instructions to be carried out. A procedure can be called at any time during the execution by any other procedure or by itself. Examples of Procedural programming languages are C and Pascal. (Gaddis, 2010)
In OOP, the focus is on thinking about the problem to be solved in terms of real-world elements and representing the problem in terms of objects and their behavior. Object is a data structure that closely resembles some real-world object. Objects contain data fields and methods that represent attributes and behavior of real-world objects. There are several important OOP concepts such as Data abstraction, Encapsulation, Polymorphism, Messaging, Modularity and Inheritance. Some popular OOP languages are Java and C#. However, they can be used to perform Procedural…...

Similar Documents

Free Essay

Wek 8 Object Oriented Programming

...or No = N” Else Display “You have not chosen a correct Flavor” End IF Display “How Many Packs of Kool-Aid did you use? 1 or 2” Input userSugar IF userSugar = “1” Set userWater = newOnePack IF userSugar = “2” Set userWater = newTwoPack End IF Display “Would you like to make more Kool-aid? yes or no” Input yes End While End Program I believe I enjoy object oriented programming a lot more then structured because with OOP I can develop classes to store the data rather than using modules to call the functions that I am using I can just use the class file and create a new variable and inherit the attributes of the class file without having to store multiple lines of code to develop the same process and I can also use multiples of the same class with different variable names and label them as different functions and names OOP is used in game programming to store data regarding players and monsters movements, attacks, and items they can carry. Structured programming is good to use when creating smaller programs with little features with the program itself....

Words: 390 - Pages: 2

Free Essay

Object Oriented Programming Exam

...SAMPLE QUESTION PAPER Object Oriented Programming using Java SEMESTER 1& 2 Question 1 (25 marks) a) Discuss the syntax, purpose and application, with an example for each, of the following: i. if ii. while iii. for iv. switch (4 x 5 marks = 20 marks) b) Write an independent Java method that accepts three sides of a triangle, say a, b and c and returns “Equilateral” if all the three sides are equal, “Isosceles” if any two sides are equal “Scalene” otherwise. (5 marks) Question 2 (25 marks) a) Write an independent Java method that accepts an integer and returns true if it is a prime number, false otherwise. An integer is said to be prime if it is divisible by 1 and itself only. (9 marks) b) Write an independent Java method that accepts an array of integers and returns the smallest of them. (8 marks) c) Write a Java program to accept 10 integers and print the sum of numbers divisible by 5. (8 marks) Question 3 (25 marks) a) Write a Java program to print the sum, average, maximum and minimum of 10 numbers. All numbers must be read from the user. (8 marks) b) What are formal and actual arguments? Explain with a sample program how they work in Java. (8 marks) c) Write a Java program to print first n Fibonacci sequence of numbers. The first two numbers of the sequence are 0 and 1; next number is the sum of the previous numbers. (9 marks) ...

Words: 731 - Pages: 3

Free Essay

It/218 Object Oriented Programming

...Object oriented programming refers to a method of programming in which individual objects, usually called "methods" and "functions", are created and used in junction with each other to perform a function. These objects are organized within the program through use of things called structures or classes. A class is something we use to create a blueprint of sorts for a assortment of variables and components. Similarly, a structure serves the same purpose. The only difference between a structure and a class is that a structure's members are public by default and a classes members are private by default. Another form of "blueprint" used by programmers is the data union. While a union is very primitive in comparison to a structure or class, it is a good tool to use to conserve memory in larger applications. A union uses the same memory block for multiple variables at different points. While two variables in a union cannot be accessed at the same time, a union is a good way to re-use blocks of memory that would normally be left void after a variable is finished with. Now that I have covered the basic points of classes, structures and unions, I will go into more detail of just how powerful a class or structure can be. In basic reference, a class is simply a blueprint to something we create instances of later in the program. This is a very vague statement however, because in object-oriented programming the class is the backbone of the program. It is what makes......

Words: 813 - Pages: 4

Premium Essay

Pt1420 Object Oriented Programing

...Object Oriented Programming Object-oriented programming or OOP is a programming paradigm that represents concepts as “objects” that have attributes that describe the objects and associated procedures known as methods. Objects, which are usually instances of classes, are used to interact with one another to design applications and computer programs. Some advantages of OOP are it provides a clear modular structure for programs which makes it good for defining abstract data types where implementation details are hidden and the unit has a clearly defined interface. It makes it easy to maintain and modify existing code as new objects can be created with small differences to existing ones. And it provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. Some disadvantages are that OOP can be larger than other programs. In the early days of computing, space on hard drives, floppy drives and in memory was at a premium which meant that more money was going to be spent. Another is that it requires a lot of work to create. A great deal of planning goes into an object oriented program well before a single piece of code is ever written. Initially, this early effort was felt by many to be a waste of time. Finally OOP were slower than other programs, partially because of their size. Other aspects of OOP demand more system resources, thus slowing the program down. REST and CRUD CRUD specifies a minimal set...

Words: 367 - Pages: 2

Premium Essay

Object Oriented Programming

...Object Oriented Programming IT/218 Object-Oriented Programming (OOP) provides computer programmers not only a new way to program, but a new way to think in terms of objects. This type of programming (“Object oriented programming,” 2012) allows programmers to use objects as a way of thought versus using a procedural language and organizing by data structures and algorithms. This is a new way of programming centered on objects to develop programs. C++ gives the programmer a way to incorporate encapsulation, inheritance, and polymorphorism and C++ also provides many ways of support Object-Oriented Programming. Programming was once thought upon as using a series of tasks for the computer to perform but object-oriented programming uses a collection of objects. In this type of programming, each object can receive message and process data, as well as send other messages to fellow objects. By placing information where it is not accessible by the entire computer program, OOP (“Object oriented programming,” 2012) calls the data using methods. The methods then act as intermediaries for working on the data they control. Object-oriented programs center on different types of objects. Each object contains a kind of data that manages the information within the program itself. The method of the object will use a system of checks and safeguards that are defined in the types of data the object contains. Because of this system, adaptations to the program can......

Words: 465 - Pages: 2

Premium Essay

Object-Oriented vs. Procedural Programming

...Object-Oriented vs. Procedural Programming Whether it is Object-Oriented or Procedural Programming, programming in general is dealing with or looking at data and the code that can and will change the data (output) in some way. Object-Oriented vs. Procedural Programming can be said to be ways we handle the coding of the data – how it is written perhaps. We need to apply different thinking and strategies when we write code, and it can be either Object-Oriented or Procedural Programming. In Procedural Programming, we group our code into procedures, hence the name Procedural Programming. These procedures are instructions on how we use and manipulate the data. With Procedural Programming we have code that is read line by line, taking input (instructions) to do something with the goal of an output. The code is read (data taken in) in exchange for an output. With Procedural Programming, you can write code all day long that do not have an existing relationship to the data used. Procedural Programming functions use code (data) provided and can access shared data needed, but a relationship does not exist. Procedural Programming uses traditional programming languages like C, COBOL and Pascal. In short, Procedural Programming is about using and choosing data structures, creating your algorithms, and converting algorithms into code. With Procedural Programming, data and operations of the data or with the data are separate (no relationship exist). You send data to procedures...

Words: 720 - Pages: 3

Premium Essay

Object Oriented Programming and Uml

...Object Oriented Programming and UML Implementation modeling is “the development stage for adding fine details to a model that transcend languages. Implementation modeling is the immediate precursor to the actual implementation.”(Blaha & Rambaugh, 2005) Implementation modeling uses the following four steps: fine-tune classes, fine-tune generalizations, realize associations, and preparing for testing. Steps one and two are driven by the theory of transformations. Transformations “is a mapping from the domain of models to the range of models”(Blaha & Rambaugh, 2005) The first step in implementation modeling is fine-tuning classes. It is best to fine-tune classes before writing code because it will help to simplify development or to improve performance. If for some reason you have to alter the design first consider the following possibilities; partition a class, merge classes, partition or merge attributes, or promote an attribute or demote a class. The next step in implementation modeling is fine-tuning generalizations. It is helpful to remove generalization or to add one prior to coding. The third step is realizing associations. This is what holds the class model together by providing paths between objects. The final step is testing. “Testing is a quality assurance mechanism for catching residual errors.” (Blaha & Rambaugh, 2005) It also measures the quality of your software. “Implementation is the final development stage that addresses the...

Words: 319 - Pages: 2

Premium Essay

Introduction to Object-Oriented Programming

...INTRODUCTION Structured programming (known as modular programming) is a subset of procedural programming that enforces a logical structure in the programming being written, to make it more efficient and easier to understand and modify. Structured programming frequently employs a top-down design model, in which developers map out the overall program structure into separate subsections. A defined function or a set of similar functions coded in separate modules can be reused in other programs. After a module has been tested individually, it is then integrated with other modules into the overall program structure. Program flow follows a simple hierarchical model that employs looping constructs such as 'for,' 'repeat' and 'while.' Use of the 'Go To' statement is discouraged in structured programming. Structured programming was first suggested by the mathematicians Corrado Bohm and Guiseppe Jacopini. They demonstrated that any computer program can be written with just three structures: decision, sequences and loops. In structured programming coders break larger pieces of code into shorter subroutines (functions, procedures, methods, blocks or otherwise) that are small enough to be understood easily. In general, programs should use local variables and take arguments by either value or reference. These techniques help to make isolated small pieces of code easier to understand the whole program at once. PASCAL, Ada and C are some of the examples of structured programming......

Words: 2729 - Pages: 11

Premium Essay

Object Oriented

...predetermined inventory quantity. 3 of the 8 sites have this. 8 Chemical Inventory Management Benchmarking Survey Results  Level of Tracking   There was a lot of variation Tracking can be done to a group of buildings, to the building level, a fire zone within a building, to the room level, or to a sublocation within a room (shelf) 9 Chemical Inventory Management Benchmarking Survey Results  More on Tracking…  11 of 12 respondents use “Full-Until-Empty” tracking  10 of 11 respondents track welding, soldering & brazing filler materials  3 sites track lead shielding (blocks, bricks, shot…)  5 sites track toxic machine stock  3 sites track metals such as stainless. One site indicated they track grinding wheels and similar objects  At all but 1 site, chemical ingredients are tracked 10 Chemical Inventory Management Benchmarking Survey Results  Inventory update frequency  Most sites responded “real time/daily” but this generally pertained to getting new chemicals into the system  Updates on existing inventory varied widely • Within two days • As information was received • Monthly • Quarterly • During annual re-baselining 11 Chemical Inventory Management Benchmarking Survey Results  More on Chemical Tracking… 12 Chemical Inventory Management Benchmarking Survey Results What about tracking chemicals brought on-site by others?  7 of 10 sites track subcontractor chemicals  4 of 8 sites track construction trade chemicals ......

Words: 1410 - Pages: 6

Free Essay

Object Oriented Programming in Java ‐ Exercises

...OBJECT ORIENTED PROGRAMMING IN JAVA ‐ EXERCISES    CHAPTER 1    1. Write Text‐Based Application using Object‐Oriented Approach to display your name.    // filename: // Class containing display() method, notice the class doesnt have a main() method public class Name { public void display() { System.out.println("Mohamed Faisal"); } } // filename: // place in same folder as the file // Class containing the main() method public class DisplayName { public static void main(String[] args) { Name myname = new Name(); // creating a new object of Name class myname.display(); // executing the display() method in the Name class } }   2. Write a java Applet to display your age.  // filename: import java.applet.Applet; // import necessary libraries for an applet import java.awt.Graphics; public class DisplayNameApplet extends Applet { public void paint(Graphics g) { g.drawString("Mohamed Faisal", 50, 25); } } // filename: DisplayNameApplet.htm // place in same folder as the compiled DisplayNameApplet.class file Displaying my Name CHAPTER 2    3.  Write a program that calculates and prints the product of three integers.    // filename: import java.util.Scanner; // import Scanner libraries for input public class Q1 { public static void main(String[] args) { Scanner input = new Scanner (; int number1; int number2; int number3; System.out.println("Enter the First......

Words: 3130 - Pages: 13

Free Essay

Object-Oriented Programming Mini Projects

...MANAGEMENT DEVELOPMENT INSTITUTE OF SINGAPORE Advanced Diploma in Information technology AITD2 1422A_AITD2 1421A_AITD2 1420A_AITD2 1419A Objected-oriented Programming Mini Project Question (100 marks) In this project, you will be creating new classes that are derived from a class called BankAccount. A checking account is a bank account and a savings account is a bank account as well. This sets up a relationship called inheritance, where BankAccount is the superclass and CheckingAccount and SavingsAccount are subclasses. This relationship allows CheckingAccount to inherit attributes from BankAccount (like owner, balance, and accountNumber), but it can have new attributes that are specific to a checking account, like a fee for clearing a check. It also allows CheckingAccount to inherit methods from BankAccount, like deposit, that are universal for all bank accounts. You will write a withdraw method in CheckingAccount that overrides the withdraw method in BankAccount, in order to do something slightly different than the original withdraw method. You will use an instance variable called accountNumber in SavingsAccount to hide the accountNumber variable inherited from BankAccount. The UML diagram for the inheritance relationship is as follows: [pic] Task #1 Extending BankAccount 1. Copy the files and from the Blackboard. is complete and will not need to be......

Words: 1078 - Pages: 5

Premium Essay

Procedural Programming Compared to Object Oriented

...Accessing the Internet with a Firewall The Internet's firewall is one of the most important features of the security of the browser when using the Internet. The firewall plays an integral role in preventing compromise to the end user of the Internet from malicious networks. When using the Internet, the traffic is either incoming or outgoing. The control between the incoming networks and the outgoing is managed by the firewall. The protection and the enhancement of the security of the browser through the firewall is done through the creation or formulation of an obstacle which prevents the browser and the network that they are using from other networks that could be potentially harmful to the browser (Siyan, & Hare, 1995). In its action in preventing harmful networks from malicious activities on the user's browser, the firewall prevents the private and potentially dangerous networks from private providers. The firewall has various points of checking, ascertaining that a given network is authorized and subsequently preventing or allowing access. This way, the Internet from the public cannot be capable of transverse the user's network (Chapman, & Zwicky, 1995). There are various types of firewalls, and each firewall serves in protecting the browser at different levels depending on the required level of security. The three types of firewall include the packet filter firewall, the proxies, and the application layer firewalls. Each plays a distinct role in......

Words: 835 - Pages: 4

Free Essay

Object Oriented Programming -Java

........................................................................................ 4 Provide the UML diagrams for the given problem with clear explanations on the design decisions. Derive detailed Use Case diagram, Class diagram & a sequence diagram. Whenever necessary document the relevant assumptions you made. ...................................................................................... 4 TASK B ....................................................................................................................................................... 7 Provide an alternative OO design for the same problem ......................................................................... 7 Object Oriented Known as Methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance. ......................................................................... 7 TASK C ....................................................................................................................................................... 9 There are many system design patterns available in system development. Critically evaluate singleton, factory and abstract factory design patterns and apply the most suitable design pattern for your system development................................................................................................................................. 9 TASK D .................................................

Words: 4819 - Pages: 20

Premium Essay

Object Oriented Analysis and Design

...SOF535 Object oriented analysis and design ABSTRACT This is pages are for downloading of Visual studio and setting up IDE environment.First I have gone to the link and download the IDE from that link so process starts from here.It is the first page of Downloading process visual studioMicrosoft Visual Studio is an integrated development environment (IDE) from Microsoft. It is used to develop computer programs for Microsoft Windows, as well as web sites, web applications and web services. Visual Studio uses Microsoft software development platforms such as Windows API, Windows Forms, Windows Presentation Foundation, Windows Store and Microsoft Silverlight. It can produce both native code and managed code. Visual Studio includes a code editor supporting IntelliSense (the code completion component) as well as code refactoring. The integrated debugger works both as a source-level debugger and a machine-level debugger. Other built-in tools include a forms designer for building GUI applications, web designer, class designer, and database schema designer. It accepts plug-ins that enhance the functionality at almost every level—including adding support for source-control systems (like Subversion) and adding new toolsets like editors and visual designers for domain-specific languages or toolsets for other aspects of the software development lifecycle (like the Team Foundation Server client: Team Explorer). Visual Studio......

Words: 1330 - Pages: 6

Free Essay

Object Oriented Programming Definitions

...Polymorphism Polymorphism is the ability of an object to take on many forms. This can be where a child class is created and extends a parent class to inherit their common variables and add new variables to match the requirements Public interface Food {} Public class Burger {} Public class Bigmac extends Burger implements Food {} Class A class is a blue print from which individual objects are created and modified. There are three type of variables Local variables: Variables that are defined inside method Instance variables: Instance variables are variables within a class but outside any method Class variables: Class variables are variables declared with in a class Interface An interface is a reference type in Java and is made up of a collection of abstract methods. A class implements an interface and inherits the abstract methods of the interface. It can never be declared only implemented Public human { Public void eat (); Public void drink (); } Object This is a representation of a real world entity Objects have states and behaviours. For example a human has states - name, race as well as behaviours –talking, eating etc. An object is also an instance of a class. Public Shivam ( String name, String age){ System.out.print(“My name is” + name + “And my age is” + age); } Constructor Generally used in classes, if the programmer does not create a constructor for the class there is a default one. Objects use this in their creation and needs to......

Words: 601 - Pages: 3