UB CS 400 - Object-Oriented Programming with C++

Unformatted text preview:

Object-Oriented Programming with C++Problem-SolvingEvolution of Object-Oriented ProgrammingObject-Oriented ProgrammingObject-Oriented DesignAbstractionSeparationClasses, Objects, and Abstract InterfacesConcept of CompositionGeneralizationGeneralizationPutting it All TogetherUnified Modeling Language (UML)Building Blocks of the UMLBasic Structural ModelingBuilding Blocks of the UMLClass DiagramsClass definition and ObjectsEfficiency Issues of ObjectsA Task ClassConstructors and the DestructorFunction Calls and Argument PassingProblem Solving With ObjectsOptional and Variable-Length ArgumentsInheritanceConstructors & Destructor under InheritanceA sequence HierarchyBank AccountMultiple InheritanceDerivation PrinciplesMultiple InheritancePolymorphismBank AccountVirtual FunctionsObject-Oriented DesignThe .NET FrameworkEvent-Driven ProgrammingEvent-Driven Programming (2)Event-Driven Programming (3)User InterfacesUser Interfaces (2)TextBox, RadioButton and ComboBoxSelectPictureBoxException HandlingMenus and DialogsMenuDialog.csNetworkingMaking a connectionClient-ServerVerySimpleWebServerTObjectObject--Oriented ProgrammingOriented Programmingwith C++ with C++ Mostafa M. ArefUniversity of BridgeportDepartment of Computer Science & Engineering2ProblemProblem--SolvingSolvingz Problem - Reasoning - Solution - Testz Analytic Approachz Algorithmic Approach– Input, Process, Output– Algorithm is a sequence of executable instructionsz no ambiguity (instruction or sequence)z finite (steps or execution) – Sequence: I/O, variables assignment – Selection:If . . . Else– Repetition: looping– Condition Looping: while or until z Software Engineering– Requirement Specification– Analysis (Input, Output, Formula, Units)– Design (algorithm, verification)– Implementation (Language)– Testingz Waterfall ModelSpecificationAnalysisDesignImplementationTesting3Evolution of ObjectEvolution of Object--Oriented Oriented ProgrammingProgrammingzzVariablesVariables– A variable is a value that can change, depending on conditions or on information passed to the program.zzData typesData types– A set of values from which a variable, constant, function, or other expression may take its value. A type is a classification of data that tells the compiler or interpreter how the programmer intends to use it.zzUser defined data typesUser defined data typeszzAbstract Data typesAbstract Data types– A type whose internal form is hidden behind a set of access functions. Objects of the type are created and inspected only by calls to the access functions. This allows the implementation of the type to be changed without requiring any changes outside the module in which it is defined.– Abstraction– EncapsulationzzObjectObject--Oriented ProgrammingOriented Programming4ObjectObject--Oriented ProgrammingOriented ProgrammingzzAdvantages of ObjectAdvantages of Object--Oriented Oriented ProgrammingProgrammingz Simplicity Modularity Modifiabilityz Extensibility Flexibility Maintainabilityz ReusabilityzzObjectObject--Oriented featuresOriented featuresz Abstraction: The process of capturing the essential features and ignoring the detailz Encapsulation: information hiding mechanism– Object: An entity which has both variables and methodsz Variables comprise the state of the objectz Methods are mechanisms for accessing or changing the state of the objectz Public variables or methodsz Private variables and methods– Class: a template that can be used to create many objects with a different name and identity yet sharing the method code and shared variablesz Instantiation: The process of creating objects using the description of a class Myclass m1 = new Myclass ();– Message Passing: an object sends a message to another requesting that a service be performed.z Inheritancez Polymorphism: the same message is sent to a collection of objects & each object will be able to respond in its own way5ObjectObject--Oriented DesignOriented Designz Object-Oriented StrategiesDefinitionDesign StrategyIdentifying common elements among different entities in one of three ways: hierarchy polymorphism patterns GeneralizationBuilding complex "whole" systems by assembling simpler "parts" in one of two basic ways: Association Aggregation CompositionTreating independently "what" an entity does from "how" it does itSeparationSimplifying to its essentials the description of a real-world entityAbstraction6AbstractionAbstractionz Object-Oriented Strategiesz Properties of a Good Abstraction– Well named – Coherent – Accurate – Minimal – Complete7SeparationSeparationz Software Interface: the external, visible aspects of a software artifact by which the behavior of the artifact is elicited. z Software Implementation: The programmed mechanism that realizes the behavior implied by an interface.z Separation: In software systems, the independent specification of a software interface and one or more software implementations of that interface. HowWhatPlans Mechanism Process, Implementation Means Goals Policy Product (Interface, specification, requirement) Ends8Classes, Objects, and Abstract InterfacesClasses, Objects, and Abstract Interfaces9Concept of CompositionConcept of Compositionz Composition: An organized collection of components interacting to achieve a coherent, common behaviorz Association: A composition of independently constructed and externally visible partsz Advantages of an association:– Parts may be shared between different compositions. – parts in an association can be dynamically changed.z Aggregation: A composition that encapsulates (hides) the parts of the compositionQuarksAtomsMoleculesProcessor chipMother boardComputerPistonsEngineAutomobileSub-Sub-ObjectSub-ObjectObject10GeneralizationGeneralizationz Generalization: The identification, and possible organization, of common properties of abstractions. Object-Oriented Strategiesz Hierarchy: a generalization in which abstractions are organized into a directed acyclic graph whose arcs denote an "is-a" relation between a more generalized abstraction and the one or more derived specializations. z Four major purposes– It provides a form of knowledge representation. – The names of the intermediate levels in the hierarchy provide a vocabulary that can be used among developers and between developers and domain experts.– The hierarchy can be extended by adding new


View Full Document

UB CS 400 - Object-Oriented Programming with C++

Download Object-Oriented Programming with C++
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Object-Oriented Programming with C++ and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Object-Oriented Programming with C++ 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?