jagomart
digital resources
picture1_Object Oriented Design Pdf 196161 | Section1


 153x       Filetype PDF       File size 0.06 MB       Source: personal.ee.surrey.ac.uk


File: Object Oriented Design Pdf 196161 | Section1
objectives objectives object oriented design and c understand object oriented program design techniques implementation of ood in c richard bowden prerequisites cvssp http www ee surrey ac uk personal r ...

icon picture PDF Filetype PDF | Posted on 07 Feb 2023 | 2 years ago
Partial capture of text on file.
                                                                                                                                                                                                                                    Objectives
                                                                                                                                                                                                                                    • Objectives 
                                                       Object Oriented Design and C++                                                                                                                                                       – Understand object-oriented program design 
                                                                                                                                                                                                                                                 techniques
                                                                                                                                                                                                                                            – Implementation of OOD in C++
                                                                                                      Richard Bowden                                                                                                                • Prerequisites
                                                                                                               CVSSP
                                                                     http://www.ee.surrey.ac.uk/Personal/R.Bowden                                                                                                                           – C Programming
                                                                                              r.bowden@surrey.ac.uk                                                                                                                         – Experience of UNIX environment
                                                      • Course Structure                                                                                                                                                            • Lectures
                                                             – Introduction to Object-Oriented Programming                                                                                                                                  – Tues 11-1 22AA04
                                                             – Revision of C                                                                                                                                                        • Lab Sessions
                                                             – OOD in C++
                                                      • Assessment                                                                                                                                                                          – Friday 2-4 Starting week 2
                                                             – C++ Assignment (30%)                                                                                                                                                                 • 32BB03
                                                                     • Design, Implementation and Documentation                                                                                                                                     • 34BB04
                                                                     • Set in week 5                                                                                                                                                                • 34aBB04
                                                                     • Design due week 8 - 4pm Mon 24/11/2014                                                                                                                                       • 34BB03
                                                                     • Final submission week 11 - 4pm Mon 15/12/2014                                                                                                                • Webpage
                                                                     • Tutorials 5-6pm weeks 7-10
                                                             – Examination (70%)                                                                                                                                                            http://www.ee.surrey.ac.uk/Personal/R.Bowden/cpp
                                                                     • Section A - 20 Compulsory Multiple Choice Questions                                                                                                             All notes, supplementary material and details of laboratory 
                                                                     • Section B - Choose 2 out of 3 questions                                                                                                                                                           exercises are on the web page
                                                      Books
                                                                                                                                                                                                                                Introduction to OOD
                                                           	




                                                                    
                                                           

                                                                                                                                             • Object Oriented Design (OOD)
                                                                    
	

	

	

                                                                                                                                                                                                                                        – Does not rely on any particular programming 
                                                           	 

	

                                                                                                                                                           language
                                                                    !"

                                                                                                                                         • Object Orientated Programming
                                                       		#$
%&	#
                                                           $
#	
	#                                                                                                                                                    – Uses OOD to develop a program 
                                                       '	

                                                           ())***++#+	+ )
	$),+*
)
                                                       
$
(
                                                           ())***+$$+)                                                                                                                                                                                            OOD                     OOP
                                                                                                                                                                                                                                                                                 		
          $
	

                                                                                                                                                                                                                                                                                                                                                                                                    1
                                                OOD -Object Oriented Design                                                                                                                                  Example of OOD: Shapes
                                                                                                                                                                                                                                                               	(
                                          •     Aims to produce a direct representation of programmers ideas                                                                                                 •    Base Object                                         
		
                                                                                                                                                                                                                                                                              

                                                                                                                                                                                                                                                                              $
                                            -

			
	

!		
	
		*

.                                                                                                         
	

                                                                                                                                                                                                                                                                              $	

                                                                                                                                                                                                                                                                              	
$	

                                          •     Why OOD ?
                                                  – Better management of large software projects
                                                  – Development of software by multiple people                                                                                                                                                                                                                   $	(
                                                  – Reuse of code (efficient development and fewer bugs)                                                                                                     •    Derived Objects                                                                                       		
                                                                                                                                                                                                                                                    	

$	(             0		(                               	
                                          •     Feature of OOD                                                                                                                                                                                              		                         		                           	

                                                                                                                                                                                                                                                                    /
                    1
                      	*
                                                  – Objects containing both data and operations                                                                                                                                                             	
                   	

                                                                                                                                                                                                                                                                    	                      	
                                                  – Object is accessed via a ‘simple’ interface                                                                                                                                                                     	*                        	*
                                                  – Hierarchical structure which inherit common properties
                                                Thinking about programming                                                                                                                                   Thinking about programming
                                            • 3 stages                                                                                                                                                    • Key to writing good programs:
                                                   1.  Analysis: Clear understanding of the problem                                                                                                              – Design objects (classes) that clearly represent a single 
                                                   2. Design: Identify key concepts involved in solution                                                                                                             concept
                                                   3. Programming: Express the solution in a program                                                                                                      • Focus on questions:
                                                                                                                                                                                                                 – How are objects created?
                                            • Problem and concepts are often not clearly                                                                                                                         – Can objects be copied/destroyed?                                                                       2
		
                                                                                                                                                                                                                                                                                                                          $	

                                                 understood before programming                                                                                                                                   – What operations are applied to an object?                                                              !
                                                   – Results in badly structured code which is difficult to                                                                                                      – How does the object interface to other objects?
                                                       modify, maintain and use.
                                                   – Critical for large programs with multiple users
                                                Simple Example of OOD                                                                                                                                      Simple Example of OOD
                                                                                                                                                                                                        • Design:
                                                • Problem:                                                                                                                                                      – Storage of exam marks for each student
                                                                                                                                                                                                                       • Option 1: Allocate a ‘big’ array that is always bigger than the number 
                                                       – Generation of exam marks for each student on                                                                                                                     of students
                                                            the OOD course (exam mark + project mark)                                                                                                                         – make sure I don’t access outside the array
                                                • Analysis:                                                                                                                                                            • Option 2: Dynamically allocate an array to size
                                                                                                                                                                                                                              – remember to delete
                                                       – How many students ? Unknown                                                                                                                                          – make sure I don’t access outside the array
                                                                                                                                                                                                                       • Option 3: Design an ‘object’ which is a dynamic array & manages 
                                                       – Input ? User supplies marks + n’ of students                                                                                                                     creation/deletion/access
                                                       – Output? Table of final marks                                                                                                                                         – Simple user interface for array
                                                                                                                                                                                                                              – safe memory management
                                                                                                                                                                                                        • Program: 
                                                                                                                                                                                                                – Use simple dynamic array object + input and output
                                                                                                                                                                                                                                                                                                                                                             2
                             Programming Paradigms                                                                         Procedural Programming
                             •  Procedural                                                                                 • original programming paradigm
                                 – separate data and operations                                                            • focus on the ‘best algorithm’ to perform an 
                             •  Modular                                                                                       operation
                                 – Organise data into modules
                             •  Data Abstraction                                                                           • program based on performing a set of operations 
                                 – Modules with associated operations                                                         (functions) on the data
                             •  Object Oriented                                                                            • pass data to function and return result
                                 – encapsulation of data and operations                                                    • typical of programs written in C/Fortran/Pascal
                                 – hierarchical
                             •  Generic
                                 – Common operations between different data
                             Procedural Programming                                                                        Modular Programming
                             Example:                                                                                      • data hiding
                                 double square(double x)                                                                   • focus on organising data
                                 {
                                    return x*x;                                                                            • group procedures with related data ‘module’
                                 }                                                                                         • user code is insulated from data 
                                 void some_function()                                                                         representation
                                 {
                                    …                                                                                      • necessary for large programs
                                    double sqr=square(2.0);                                                                • typical of programs in Modula2
                                    …
                                 }
                             Modular Programming                                                                           Data Abstraction
                             Example:                                                                                      • modules not sufficient to express complex 
                             stack {                                                                                          systems
                                data: set of data items on stack
                             }                                                                                             • focus on user-defined types
                             operations:               stack_push(stack,double x)
                                                       double stack_pop(stack)                                             • use modules to define types with associated 
                             void some_function()                                                                             operations
                             {
                                stack_push(10);                                                                            • provide a user interface for data
                                …
                                double x=stack_pop();                                                                      • user interface should be independent of 
                                …                                                                                             internal data representation
                             }
                                                                                                                                                                                                                 3
                                  Data Abstraction                                                                                             Object Oriented Programming
                                  Example:                                                                                                     • data abstraction + object hierarchy
                                  stack {
                                      data: set of data items on stack
                                      operations:     construct(int size)                                                                      • focus on common relationships between sets of 
                                                      destruct()                                                                                   objects
                                                      push(double x)
                                                      double pop()
                                  }                                                                                                            • structured programs which reuse code for common 
                                  stack globalstack.construct(10);                                                                                 operations between a set of objects
                                  void some_function()                                                                                         • object oriented languages support object hierarchies
                                  {
                                      stack localstack.construct(5);                                                                           • supported by C++/Java => classes/inheritance
                                      …
                                      localstack.push(3);
                                      …
                                      double x=localstack.pop();
                                      globalstack.push(x);
                                      localstack.destruct();
                                  }
                                                                                                                                        Example        Object Oriented Programming
                                                                                                                                        class baseShapeC{
                                  Object Oriented Programming                                                                               private:
                                                                                                                                                  point centre;
                                                                                                                                                  colour col;
                                                                                                                                            public:
                                                                                                                                                  baseShapeC(point p, colour c);// Constructor centre & colour
                                  • Design                                                                                                        ~baseShapeC();
                                                                                                                                                  point getlocation();
                                       1 Identify objects with data and operations                                                                colour getColour();
                                                                                                                                                  void translate(vector t);
                                       2 Identify commonality between data/operations                                                   };
                                          for sets of objects                                                                           class triangleC : public baseShapeC{
                                                                                                                                            private:
                                                                                                                                                  point vertex1,vertex2,vertex3;
                                       3 Define base objects with common                                                                    public:
                                                                                                                                                  triangleC(point v1, point v2, point v3, point p, colour c);
                                          data/operations                                                                                         void rotate(double angle);    // Rotate by angle
                                                                                                                                                  void draw();
                                       4 Define derived objects for specific                                                            };
                                                                                                                                        class circleC: public baseShapeC{
                                          data/operations                                                                                   private:
                                                                                                                                                  double radius;
                                                                                                                                            public:
                                                                                                                                                  circleC(double r, point p, colour c);
                                                                                                                                                  void draw();
                                                                                                                                        };
                                  Example of OOD: Shapes                                                                                       Generic Programming
                                                                     	(
                                  •   Base Object                         
		
                                                                                
                                                        • Objects which work for multiple types of data
                                                                                $
                                                                          
	
                                                    • focus on expressing algorithm independent of data 
                                                                                $	

                                                                                	
$	
                                                       type
                                                                                                                                               • used for containers, i.e. stack of 
                                                                                                        $	(                            char/int/double require common access 
                                  •   Derived Objects                                                        		                                  functions.
                                                             	

$	(    0		(                  	
                                                                  		                 		                  	

                                                                        /
            1
             	*                       • Supported by C++ as ‘templates’
                                                                  	
           	

                                                                        	              	
                                                                        	*                	*
                                                                                                                                                                                                                                                    4
The words contained in this file might help you see if this file matches what you are looking for:

...Objectives object oriented design and c understand program techniques implementation of ood in richard bowden prerequisites cvssp http www ee surrey ac uk personal r programming experience unix environment course structure lectures introduction to tues aa revision lab sessions assessment friday starting week assignment bb documentation set abb due pm mon final submission webpage tutorials weeks examination cpp section a compulsory multiple choice questions all notes supplementary material details laboratory b choose out exercises are on the web page books does not rely any particular language orientated uses develop oop example shapes aims produce direct representation programmers ideas base...

no reviews yet
Please Login to review.