180 likes | 288 Views
Topic 4: Structural and Object Oriented Programming. Visual Programming. Learning outcomes. By the end of this topic, you should be able to: 1. Differentiate between structural and object oriented programming; and 2. Explain the components of object oriented programming.
E N D
Topic 4: Structural and Object Oriented Programming Visual Programming
Learning outcomes • By the end of this topic, you should be able to: • 1. Differentiate between structural and object oriented programming; and • 2. Explain the components of object oriented programming.
The criterion for choosing the appropriate program depends on the type of solutions needed, the method of input by the user, the process involved and the output displayed
Basic concepts of structural programming • Structural programming is a sequential program. This means that the instructions are processed one at a time. After the first instruction is executed, the second instruction is achieved and the process continues until the final instruction is completed.
In structural programming, a program is divided into functions and modules. Solving big and complex problems in structural programming requires dividing tasks into subprograms. The division of tasks to smaller subprograms is known as the 'divide and instruct' concept. • For example, if two numerical values need to perform addition, subtraction, division and multiplication functions, the program will need to divide the main program into smaller programs. • Each task, addition, subtraction, division and multiplication will have its own program. Therefore, the task of the main program is divided into these smaller programs. This enables easier and more effective support.
Structural programming requirements • Structural programming requires a program development environment, language and library. The important requirements are as follows: • 1. Program development environment is the method of writing and implementing a structural program. • 2. Language is the instruction pertaining to the syntax and suitable algorithms. • 3. Library is the support functions that must be prepared to enable the implementation of a structural program by a computer
Importance of structural programming • Structural programming is important because: • (i) It is the basic of learning about other programs. • (ii) It is useful as a student’s first exposure to learning about programming. • (iii) It is easily implemented to simpler programming problems. • (iv) The concept can be applied to complex and big programming problems, but this involves a critical and accurate planning and implementation process
Object oriented programming • Object-oriented programming is a useful programming technique. • The fundamental idea behind an object-oriented language is to combine both data and the functions that operate that data into one single unit. Such a unit is called an object. • An object function, called member functions is to provide the only way to access its data. In object-oriented programming, each object that is built will be used by other programs. • The object is used to receive messages that will result in problem solving. Problem solving needs a different approach
Basic concepts of object oriented programming • In object-oriented programming, you need to be familiar with three basic components: • (a) Object • (b) Relationship of object behavior and state. • (c) Object interface.
object • An object is the most important element in object-oriented programming. It plays an important role in executing object-oriented based software. • Furthermore, each action by the object-oriented software is the result of the cooperation of the objects in the software that interact with each other to generate a specific action. How can an object be defined? • An object is something that has condition, behavior and identify
Relationship between object and behavior state • The second component to look into in object-oriented programming is object behavior and state. Object behavior and state are very closely related. • The current state of an object represents the cumulative results of the object’s behavior. The object state influences its behavior
Object interface • The final component is object interface. Objects receive messages from servers that require a reaction. The list of messages that are associated with an object is known as the object interface. • In object orientation, the object interface determines the interaction with that object
Class • The objects that are involved in a program are too numerous to be specified one by one. Therefore, the class concept can be used to overcome this problem. • The class concept can be divided into two parts: • (i) Attribute list that is contained in each object in a particular class. • (ii) Behaviour list for each object from that particular class, which is how the object reacts to each message that it understands
Importance of object oriented programming • In the object-oriented concept, there are three important points that you need to know, which are: • (a) Objects and classes can be reused without constructing new ones. • (b) Object-oriented software is easier to operate and modify. • (c) The polymorphisms method, which has not been discussed in this topic, is available in object orientation. It is capable of performing two processes at one time
Summary • Structural and object-oriented programmings are two different concepts. • The criterion for choosing the appropriate program depends on the type of solutions needed, the method of input by the user, the process involved and the output displayed. • Structural programming is a sequential program. This means that the instructions are processed one at a time. • In structural programming, a program is divided into functions and modules. • Structural programming requires a program development environment, language and library
In object-oriented programming, you need to be familiar with three basic components, which are object, relationship of object behavior and state, and object interface. • The class concept can be used to overcome the problem of too numerous objects involved in a program. Two parts of the class concept are attribute list and behaviour list. • Example of a program is given. They are Program 1 and Program 2. The two programs are dependant on each other. Both programs use the Java programming language