Premium Essay

Object Oriented Programming

In:

Submitted By BooOllie
Words 465
Pages 2
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 be made without changing the rest of the program. Classes within OOP explain a user-defined data type. When a variable is stated, a new object is created. There are several characteristics related within OOP. They are listed in the following paragraphs.
When an object is declared, the constructor is called and when an object is erased, a destructor is called.
Encapsulation refers to the

Similar Documents

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 languages. 1.1.1 Sequence...

Words: 2729 - Pages: 11

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 the...

Words: 813 - Pages: 4

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

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

Object Oriented Programming Definitions

...then be added to the subclass as fit. The inheritance is also one way meaning that the superclass cannot inherit from the subclass Class Sandwich { } Class sub Chicken extends Sandwich { } 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...

Words: 601 - Pages: 3

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

Free Essay

Wek 8 Object Oriented Programming

...as new Water() Declare yes as String While yes = “yes” Display “What flavor of Kool-Aid would you like? Cherry, Lemonade, or Grape” Input Flavors IF Flavors != “Cherry” or “Lemonade” or “Grape” Display “You have Chosen” + Flavors Display “Is this correct? Yes = Y 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...

Words: 390 - Pages: 2

Premium Essay

Procedural Programming Compared to Object Oriented

...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...

Words: 924 - Pages: 4

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 AccountDriver.java and BankAccount.java from the Blackboard. BankAccount.java is complete and will not need to be modified...

Words: 1078 - Pages: 5

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

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: Name.java // Class containing display() method, notice the class doesnt have a main() method public class Name { public void display() { System.out.println("Mohamed Faisal"); } } // filename: DisplayName.java // place in same folder as the Name.java 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: DisplayNameApplet.java 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: Q1.java import java.util.Scanner; // import Scanner libraries for input public class Q1 { public static void main(String[] args) { Scanner input = new Scanner (System.in); int number1; int number2; int number3; System.out.println("Enter the First Number"); www.oumstudents...

Words: 3130 - Pages: 13

Premium Essay

Prg/211

...Programming Fundamentals Paper Programs are very important part in the information technology is ever changing the world. For programmers to design and code a procedures, object, or module program can be very time consuming and complex for the programmer. It makes a lot of sense to use codes that you know work correctly as often as is practical to save time. Being an efficient programmer you need to be able to reuse codes, called the reusability of codes. Programs are a sequence of codes that are made of modules, which performs data using the hardware. The two types of programming languages that will compares in this paper are Procedural and Object-Oriented programming. Programmers can use flowcharts diagram that can represents, and visual the program processes. Key difference between Object-oriented and Procedural programming for the object-oriented program break down programming task into objects, which encapsulate methods and data; and for the procedural programming, which break task in to subroutines and variables of collections. The object-oriented program designing technique that used the top-down aspects to abstract data types with the combined modules and structure design. Object-oriented program design composes of system based on concept of an object. Object-oriented programming supports several characteristics directly. Message, method, object, and class are the attributes or entities in the object-oriented programming. Some benefits are include in the object-oriented...

Words: 508 - Pages: 3

Premium Essay

Organization of Programing Languages

...or CMP 401 ASSIGNMENT | ORGANIZATION OF PROGRAMMING LANGUAGES | | ANZOTSA JOHN ALAKU | BHU/12/04/05/0042 COMPUTER SCIENCE 400 LEVEL | | | ABRSTRACT My objective for these research was to find out about different programming languages and paradigm in which they belong, the most important use in this research are text and journal by other researchers. After all studies where carried out, I came to a conclusion that one programing language can belong to more than one paradigm C++ C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language. Some people say that C++ is a middle language because it has the features of high level and low-level language. As one of the most popular programming languages in the world, C++ is widely used in the software industry. C++ is also used for hardware design to analyze structure. Some of its application domains include systems software, application software, device drivers, embedded software, high-performance server and client applications, and entertainment software such as video games. AspectJ AspectJ is a general-purpose Aspect-Oriented extension to java programming language. It was created at Palo Alto Research Center Incorporated (PARC), now it is an open source project and part of the Eclipse Foundation. AspectJ has everything that Java has and more which...

Words: 3773 - Pages: 16

Free Essay

Chapter11 การออกแบบรายงานด วย Business

...:156: Object Oriented Programming for VB.NET Mr.Anooruk Pomkotka LRU บทที่ 11 การออกแบบรายงานด้วย Business Objects Crystal Report การสร้ างรายงานด้ วย Crystal Report ของบริษัท Business Objects เป็ นโปรแกรมติดตั้งเสริมเพื่อให้ โปรแกรมที่พัฒนาด้ วยภาษาต่างๆให้ มีความสามารถในการสร้ างรายงานได้ ในรูปแบบต่างๆ ซึ่ง การสร้ างรายงาน ด้ วย Crystal Report น้ ีเพียงพอต่อความต้ องการของนักพัฒนาในการสร้ างรายงาน ดั ง นั้ น ในเวอร์ ชั่ น .NET ของ Microsoft Visual Studio จึงได้ มีการผนวกเอาความสามารถการสร้ างรายงานของ Crystal Report บรรจุไว้ ด้ วย ซึ่งทาให้ .NET น้ันมีความสามารถในการสร้ างรายงานโดยไม่ต้องติดตั้ งโปรแกรม Crystal Report เพิ่มเติม จึงมีความสะดวกมากในการพั ฒนาโปรแกรมระบบต่า งๆ ซ่ึงผู้พัฒนาสามารถเลือกติดตั้งโปรแกรม Crystal Report ของบริษัท Business Objects หรือเลือกที่จะสร้ างรายงานจาก Crystal Report ท่ถูกติดตั้งมาพร้ อมกับ ี .NET กได้ ซึ่งเนื้อหาในบทนี้จ ะได้ กล่าวถึงการสร้ างรายงานทั้งสองแบบ จะพบว่ าการสร้ างรายงานที่สองแบบมี ็ ความไม่แตกต่างกันมากนัก นอกจากการออกแบบรายงานด้ วยเครื่องมือของ Crystal Report ท้งสองแบบแล้ ว สิ่งสาคัญในการสร้ าง ั รายงานด้ วยภาษาต่าง จะต้ องมีชุดคาสั่งในการติดต่อกับไฟล์รายงาน ท่ได้ ออกแบบไว้ โดยในบทนี้น้ ีผ้ ูสอนได้ สร้ าง ี คลาสเพื่อใช้ จัดการควบคุมการแสดงผลของรายงานด้ วยแนวคิดเชิงวัตถุ ซึ่ งมีความสะดวกในสาหรับนักศึกษา การ นาไปต่อยอดและประยุกต์ใช้ ต่อไป ในการเชื่อมต่อ (Connect) ระหว่ างฐานข้ อมูลและ Crystal report น้ันในการศึกษาในครั้ งนี้จะขอ ยกตัวอย่ า งกา รเชื่ อ มต่ อผ่ าน ODBC เพื่ อความสะดวกในการศึ กษา ซ่ึ งในการปฏิบั...

Words: 2303 - Pages: 10

Premium Essay

Exploring Programing Languages

...FORTRAN - added structured statements borrowed from Algol to produce Fortran 77. COBOL- more static and only submitted to slight revision in 74. 1980's C++ - a general purpose programming language. It has imperative, object-oriented and generic programming features, while also providing the facilities for low level memory manipulation. Perl - a family of high-level, general-purpose, interpreted, dynamic programming languages. The languages in this family include Perl 5 and Perl 6. Ada - originally designed by a team led by Jean Ichbiah of CII Honeywell Bull under contract to the United States Department of Defense (DoD) from 1977 to 1983 to supersede the hundreds of programming languages then used by the DoD. Objective-C - a general-purpose, object-oriented programming language originally developed in the early 1980s. It is the main programming language used by Apple. Caml ( Categorical Abstract Machine Language) is a dialect of the ML programming language family. 1990's Python - started in December 1989[26] by Guido van Rossum at CWI in the Netherlands as a successor to the ABC language Visual Basic - a third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model first released in 1991. Java - a computer programming language that is concurrent,...

Words: 561 - Pages: 3