Sie sind auf Seite 1von 8

OBJECT ORIENTED PROGRAMMING

Jun. 18, 12

1.

EVOLUTION OF PROGRAMMING LANGUAGES

First-generation programming language (1GL) Binary I think there is a world market for maybe five computers. -Thomas Watson It makes sense Watson would say this seeing as how the earliest computerswere programmed entirely in binary. These computers were programmed with no abstraction at all. I, for one, do not envy our forefathers in regard to this task. While the programs were small, all operations, data and memory had to be managed by hand in binary.

Introduced in the 1940s Instructions/Data entered directly in binary Memory must be manually moved around Very difficult to edit/debug Simple programs only

Examples: Architecture specific binary delivered on Switches, Patch Panels and/or Tape.

Second-generation programming language (2GL) Assembly He who hasn't hacked assembly language as a youth has no heart. He who does as an adult has no brain. -John Moore Assembly languages were introduced to mitigate the error prone and excessively difficult nature of binary programming. While still used today for embedded systems and optimization, they have mostly been supplanted by 3GL languages due to the difficulties in controlling program flow.

Introduced in the 1950s Written by a programmer in an intermediate instruction language which is later compiled into binary instructions Specific to platform architecture Designed to support logical structure, debugging Defined by three language elements: Opcodes (CPU Instructions), Data Sections (Variable Definitions) and Directive (Macros)

PEREZ, JOHN RAYMOND S. BIT 3C-G1

Page | 1

OBJECT ORIENTED PROGRAMMING

Jun. 18, 12

Examples: Almost every CPU architecture has a companion assembly language. Most commonly in use today are RISC, CISC and x86 as that is what our embedded systems and desktop computers use.

Third-generation programming language (3GL) Modern Real programmers can write assembly code in any language. - Larry Wall Third generation languages are the primary languages used in general purpose programming today. They each vary quite widely in terms of their particular abstractions and syntax. However, they all share great enhancements in logical structure over assembly language.

Introduced in the 1950s Designed around ease of use for the programmer Driven by desire for reduction in bugs, increases in code reuse Based on natural language Often designed with structured programming in mind

Examples: Most Modern General Purpose Languages such as C, C++, C#, Java, Basic, COBOL, Lisp and ML.

Fourth-generation programming language (4GL) Application Specific "A programming language is low level when its programs require attention to the irrelevant." -Alan J. Perlis A fourth generation language is designed with making problems in a specific domain simple to implement. This has the advantage of greatly reducing development time cost. At the same time there is the disadvantage of increasing developer learning cost.

Introduced in the 1970s, Term coined by Jim Martin Driven by the need to enhance developer productivity Further from the machine Closer to the domain

Some examples: SQL, SAS, R, MATLAB's GUIDE, ColdFusion, CSS

PEREZ, JOHN RAYMOND S. BIT 3C-G1

Page | 2

OBJECT ORIENTED PROGRAMMING

Jun. 18, 12

Fifth-generation programming language (5GL) Constraint Oriented There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult. - Tony Hoare It has been argued that there is no such thing as a 5GL language. This seems to me ridiculous as working with domain specific syntax is hardly an abstractional dead end. This cynicism is likely a result of the many false claims of 5GL for the sake of marketing. Many researchers speak of 5GL languages as constraint systems. The programmer inputs a set of logical constraints, with no specified algorithm, and the AI-based compiler builds the program based on these constraints.

Introduced in the 1990s Constraint-based instead of algorithmic Used for AI Research, Proof solving, Logical Inference Not in common use

Some examples: Prolog, Mercury 2.1 OOP

Object Oriented Programming or OOP is the technique to create programs based on the real world. Unlike procedural programming, here in the OOP programming model programs are organized around objects and data rather than actions and logic. Objects represent some concepts or things and like any other objects in the real Objects in programming language have certain behavior, properties, type, and identity. In OOP based language the principal aim is to find out the objects to manipulate and their relation between each other. OOP offers greater flexibility and compatibility and is popular in developing larger application. Another important work in OOP is to classify objects into different types according to their properties and behavior. So OOP based software application development includes the analysis of the problem, preparing a solution, coding and finally its maintenance. Java is a object oriented programming and to understand the functionality of OOP in Java, we first need to understand several fundamentals related to objects. These include class, method, inheritance, encapsulation, abstraction, polymorphism etc.

PEREZ, JOHN RAYMOND S. BIT 3C-G1

Page | 3

OBJECT ORIENTED PROGRAMMING

Jun. 18, 12

2.2

OOD

A software development technique in which the system is seen as a collection of objects that communicate with other objects by passing messages. Design is targeted toward defining the kinds of objects, the methods (i.e. procedures of objects), and the messages passed. OOD is based on the principle of information hiding.

2.3

OBJECT

Objects are the basic unit of object orientation with behavior, identity. As we mentioned above, these are part of a class but are not the same. An object is expressed by the variable and methods within the objects. Again these variables and methods are distinguished from each other as instant variables, instant methods and class variable and class methods. 2.4 ATTRIBUTES VS BEHAVIOR

2.5

CLASS VS INSTANCE

A Class is actually a blueprint or a representation of how an Object has to be instanciated. Whereas an Object is called as the Instance of a Class. 2.6 ENCAPSULATION

This is an important programming concept that assists in separating an object's state from its behavior. This helps in hiding an object's data describing its state from any further modification by external component. In Java there are four different terms used for hiding data constructs and these are public, private, protected and package. As we know an object can associated with data with predefined classes and in any application an object can know about the data it needs to know about. So any unnecessary data are not required by an object can be hidden by this process. It can also be termed as information hiding that prohibits outsiders in seeing the inside of an object in which abstraction is implemented.

2.7

ABSTRACTION

The process of abstraction in Java is used to hide certain details and only show the essential features of the object. In other words, it deals with the outside view of an object (interface). 2.8 INHERITANCE

This is the mechanism of organizing and structuring software program. Though objects are distinguished from each other by some additional features but there are objects that share certain things common. In object oriented programming classes can inherit some common
PEREZ, JOHN RAYMOND S. BIT 3C-G1 Page | 4

OBJECT ORIENTED PROGRAMMING

Jun. 18, 12

behavior and state from others. Inheritance in OOP allows to define a general class and later to organize some other classes simply adding some details with the old class definition. This saves work as the special class inherits all the properties of the old general class and as a programmer you only require the new features. This helps in a better data analysis, accurate coding and reduces development time. 2.9 DERIVED CLASS VS BASE CLASS

The derived class derives, or inherits, from the base class. The derived class is like a "child", and the base class, the "parent". The child class has the attributes of the parent class its variables (those defined at the class level) and methods. Changes done to the parent class (the base class) will affect the child class (the derived class). 2.10 POLYMORPHISM

It describes the ability of the object in belonging to different types with specific behavior of each type. So by using this, one object can be treated like another and in this way it can create and define multiple level of interface. Here the programmers need not have to know the exact type of object in advance and this is being implemented at runtime.

2.11

DEBUGGING

Debugging is a methodical process of finding and reducing the number of bugs, or defects, in a computer program or a piece of electronic hardware, thus making it behave as expected. Debugging tends to be harder when various subsystems are tightly coupled, as changes in one may cause bugs to emerge in another.

3.

Object-Oriented Programming vs. Procedural Programming

Programs are made up of modules, which are parts of a program that can be coded and tested separately, and then assembled to form a complete program. In procedural languages (i.e. C) these modules are procedures, where a procedure is a sequence of statements. In C for example, procedures are a sequence of imperative statements, such as assignments, tests, loops and invocations of sub procedures. These procedures are functions, which map arguments to return statements. The design method used in procedural programming is called Top Down Design. This is where you start with a problem (procedure) and then systematically break the problem down into sub problems (sub procedures). This is called functional decomposition, which continues until a sub problem is straightforward enough to be solved by the corresponding sub procedure. The difficulties with this type of programming, is that software maintenance can be difficult and
PEREZ, JOHN RAYMOND S. BIT 3C-G1 Page | 5

OBJECT ORIENTED PROGRAMMING

Jun. 18, 12

time consuming. When changes are made to the main procedure (top), those changes can cascade to the sub procedures of main, and the sub-sub procedures and so on, where the change may impact all procedures in the pyramid. One alternative to procedural programming is object oriented programming. Object oriented programming is meant to address the difficulties with procedural programming. In object oriented programming, the main modules in a program are classes, rather than procedures. The object-oriented approach lets you create classes and objects that model real world objects. 4.

Visual Basic is more than just a computer language. It is a project building environment. Within this one environment, we can begin and build our project, run and test our project, eliminate errors (if any) in our project, and save our project for future use. With other computer languages, many times you need a separate text editor to write your program, something called a compiler to create the program, and then a different area to test your program. Visual Basic integrates each step of the project building process into one environment. Lets look at the parts of the Visual Basic environment.

PEREZ, JOHN RAYMOND S. BIT 3C-G1

Page | 6

OBJECT ORIENTED PROGRAMMING

Jun. 18, 12

Main Window The Main Window is used to control most aspects of the Visual Basic project building and running process. The main window consists of the title bar, menu bar, and toolbar. The title bar indicates the project name and the current Visual Basic operating mode (design, break, run). The menu bar has drop-down menus from which you control the operation of the Visual Basic environment. The toolbar has buttons that provide shortcuts to some of the menu options. Look for the buttons we used in Chapter 1 to open a project, start a project, and stop a project. Form Window The Form Window is central to developing Visual Basic applications. It is where you develop your application. Toolbox Window The Toolbox Window is the selection menu for controls used in your application. Many times, controls are also referred to as tools. So, three words are used to describe controls: objects, tools, and, most commonly, controls.

If the toolbox window is not present on the screen, click View on the main menu, then Toolbox. See if you can identify controls we used in Class 1 with our Sample project. Properties Window The Properties Window is used to establish initial property values for controls. The drop-down box at the top of the window lists all controls on the current form. Under this box are the available properties for the currently selected object.

5.

Controls providing users choices o CheckBox** The user can select one or more from a set of these. Value = Value. Prefix = chk. o OptionButton** A set of these are grouped into option groups by the form or by a frame within a form. The user can select only one from the set. Value = Value. Prefix = opt.

PEREZ, JOHN RAYMOND S. BIT 3C-G1

Page | 7

OBJECT ORIENTED PROGRAMMING


o

Jun. 18, 12

TextBox** Provides the user a choice to enter text. Value = Text. Prefix = txt or tbx.. o ListBox** Provides the user a choice of one or more from a list of any length. Value = Text. Prefix = lst or lbx. o ComboBox** Provides a choice of one or more from a list, or to enter text. Value = Text. Prefix = cbo. CommandButton Carries out code when a user chooses it. Value = Value. Prefix = cmd. o If Command.Cancel = True, then the button is clicked whenever ESC is pressed. o If Commnad.Default = True, then the button is clicked whenever RETURN is pressed. Graphic Controls o Label** Displays text that the user cannot modify or interact with. Value = Caption. Prefix = lbl. o Shape Draws simple shapes (rectangles and ellipsoids) on the form, frame, or picture box. Prefix = shp. o Line Draws straight line segments on the form. Value = Visible. Prefix = lin. o Image** Displays a picture (BMP, ICO, WMF, JPG, or GIF). Can also act like a command button. Value = Picture. Prefix = img. o PictureBox** Like an image control but it can also be a visual container for other controls. It has multiple methods including ways to animate. Value = Picture. Prefix = pic. o Frame Provides a visual and functional container for other controls. Value = Caption. Prefix = fra. o HScrollBar and VScrollBar Allows the user to use scroll bars to view data. Value = Value. Prefix = hsb & vsb. File System Controls o DriveListBox A list box showing drives available to the user. Value = Drive. Prefix = drv. o DirListBox A list box showing directories in the selected drive. Value = Path. Prefix = dir. o FileListBox A list box showing files in the selected directory. Value = FileName. Prefix = fil. Timer Executes code at recurring intervals. Value = Enabled. Prefix = tmr. Data Enables a connection to a database (usually DOA) and allows the user basic navigation through the database. Value = Caption. See also the ActiveX control called adodc. Value = Caption. Prefix = dat or dc. OLE** Provides access to OLE enabled applications. Usually embeds data into the application. Prefix = ole.

PEREZ, JOHN RAYMOND S. BIT 3C-G1

Page | 8

Das könnte Ihnen auch gefallen