100 likes | 304 Views
CSE 2341 Object Oriented Programming with C++ Note Set #4. Quick Look. Procedural/structures vs. OOP First Class. Procedural vs OOP. Procedural focused on procedures that take place in a program data is secondary to functionality Object Oriented Programming (OOP)
E N D
Quick Look • Procedural/structures vs. OOP • First Class
Procedural vs OOP • Procedural • focused on procedures that take place in a program • data is secondary to functionality • Object Oriented Programming (OOP) • concerned with understanding the objects involved in a problem and how they interact.
Problems with Procedural Programming • excessive global data • larger solutions are complex and convoluted • can be very difficult to understand, modify, and extend
OOP • focuses on the objects and their interaction based on the problem domain • packages together the data and methods to operate on that data • sometimes called attributes and behavior
Concept Create a Point class that represents a point in 2D space Point int x int y getX() setX(newX) interface distance(anotherPoint) Private Data and Methods to operate on that data
Objects • Range of possibilities is limited by programmers imagination • Usually very specific or very general • general purpose: Vector class, some datatype not part of language such as date, GUI objects • specific purpose: objects created for a specific application domain such as inventory
Benefits of OOP • Data abstraction • details of classes only visible to its methods • Compatibility • easier to combine software components • Flexibility • classes provide units for task allocation
Benefits of OOP • Reuse • easier to develop reusable software • Extensibility • inheritance allows new classes to be built from old ones • Maintenance • The natural modularity of the class structures makes it easier to contain the effects of change
Fini ?