Friday, March 1, 2019

Introduction to Object Oriented Programming

ready reckoner computer programing 2 programing Paradigm Procedural Programming ? ? style of program in which the programing task is broken down into a serial of operations (called procedures) utilise to selective data (or data social structures) C and Pascal Object-Oriented Programming ? ? ? extension of adjective programming breaks down a programming task into a series of inter arrangeions among different entities or marks Java, C++, and Smalltalk incoming to OOP * retention of STI rascal 1 of 15 Computer Programming 2 Object-Oriented Programming compositors casecast of programming in which programmers define not only the data structures, but too the ypes of operations (methods) that buttocks be applied to the data structure enables programmers to take modules that do not need to be changed when a new type of object is added most widely used paradigm instead of focalization on what the system has to do, focus on ? what objects the system contains ? how they inter act towards settlement the programming problem cornerstone to OOP * Property of STI foliate 2 of 15 1 _________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ _________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ Computer Programming 2 Object-Oriented Programming simile of OOP Introduction to OOP * Property of STI rascal 3 of 15 Computer Programming 2 Object-Oriented Programming Advantages of OOP over conventional approaches ? It provides a clear modular structure for programs which makes it good for defining abstract data types where writ of execution details atomic number 18 hidden and the unit has a clearly efined interface. ? It makes it easy to maintain and falsify existing code as new objects can be created with low-spirited differences from existing ones. ? It provides a good framework for code libraries where supplied software components can be easily adapted and modified by the programmer. This is particularly effectual for developing graphical user interfaces. Introduction to OOP * Property of STI knave 4 of 15 3 __________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ __________________ 4 __________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ Computer Programming 2 Object-Oriented Programming Key OOP concepts ? Objects ? Classes ? Abstractio n ? inheritance ? Encapsulation ? polymorphism Introduction to OOP * Property of STI Page 5 of 15 Computer Programming 2 Objects and Classes Objects ? ? represent things from the literal world made up of attributes characteristics that define an object methods self-contained stopover of program code similar to procedure ? example a motorcars attributes are make, model, year, and purchase price a cars methods are forward and backward Classes ? ? ? ? term that describes a group or collection of objects with common properties define a type of object specifies methods and data that type of object has example Employee Car Introduction to OOP * Property of STI Page 6 of 15 5 _________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ __________________ 6 _________________ ___________________ ___________________ __________ _________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ Computer Programming 2 Abstraction allows a programmer to hide all but the pertinent information (to the problem at hand) about an object in order of magnitude to reduce complexity and increase efficiency closely related to encapsulation and information hiding Introduction to OOP * Property of STI Page 7 of 15 Computer Programming 2 Encapsulation refers to the hiding of data (attributes) and ethods within an object protects an objects data from corruption protects the objects data from imperious and unintended use hides the details of an objects internal implementation from the users of an object separates how an object behaves from how it is implemented easier to modify programs since one object type is modified at a time Introduction to OOP * Property of STI Page 8 of 15 7 __________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ __________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ Computer Programming 2 Encapsulation Illustration of Encapsulation Change Address Change Name View Name cipher in a Course Name Address Course grade point average Drop a Course View GPA Introduction to OOP * Property of STI Page 9 of 15 Computer Programming 2 hereditary pattern the passage by which objects can acquire (inherit) the properties of objects of other class provides reus efficiency, alike(p) adding additional eatures to an existing class without modifying it Introduction to OOP * Property of STI Page 10 of 15 9 _________________ _______ ____________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ 10 ________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ Computer Programming 2 Inheritance getName() etID() Name Student ID setName() setID() Student Introduction to OOP * Property of STI Page 11 of 15 Computer Programming 2 Polymorphism refers to the ability to process objects differently depending on their data type or class the ability to redefine methods for derived classes request for an operation can be made without well-read which specific method should be invoked Introduction to OOP * Property of STI Page 12 of 15 11 _________________ ___________________ ___________________ __________ _________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ __________________ ___________________ 12 _________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ Computer Programming 2 Polymorphism Illustration of Polymorphism Student Application Form s. isRegistered() Car c. isRegistered() Introduction to OOP * Property of STI Page 13 of 15 Computer Programming 2 Abstract Classes class that is not used to create (instantiate) objects designed to act as a buttocks class (to be inherited by other classes) esign concept in program development and provides a base upon which other classes are built can only specify members that should be implemented by all inheriting classes Introduction to OOP * Property of STI Page 14 of 15 13 _____________ ___ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ 14 ________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ __________________ ___________________ ___________________ ___________________ Computer Programming 2 Interfaces allow you to create definitions for component interaction provide another counselling of implementing polymorphism specify methods that a component must implement without very specifying how the method is implemented Introduction to OOP * Property of STI Page 15 of 15 15 _________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ___________________ ________ ___________

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.