ITM305 Week 8 Object-Oriented Design PDF
Document Details
Uploaded by MemorableRadiance
null
Tags
Summary
This document provides an overview of object-oriented design concepts, specifically focusing on design class diagrams, attributes, methods, and object-oriented programming principles. It includes examples and explanations for different object-oriented programming elements, such as attributes, visibility, and methods, providing a good introduction to the topic.
Full Transcript
# Week 8 ## Steps of Object-Oriented Design - Object-oriented design - The process to identify the classes, their methods and the messages required for a use case - Use case driven - Design is carried out use case by use case ## Design Class Diagrams - **Stereotype:** a way of categorizi...
# Week 8 ## Steps of Object-Oriented Design - Object-oriented design - The process to identify the classes, their methods and the messages required for a use case - Use case driven - Design is carried out use case by use case ## Design Class Diagrams - **Stereotype:** a way of categorizing a model element by its characteristics, indicated by guillemots (<<>>) - **Persistent class:** an class whose objects exist after a system is shut down (data remembered) - **Entity class:** a design identifier for a problem domain class (usually persistent) - **Boundary class or view class:** a class that exists on a system's automation boundary, such as an input window form or Web page - **Controller class:** a class that mediates between boundary classes and entity classes, acting as a switchboard between the view layer and domain layer - **Data access class:** a class that is used to retrieve data from and send data to a database ## Notation for a Design Class - **Syntax for Name, Attributes and Methods** ### Attributes - **Visibility:** indicates (+ or -) whether an attribute can be accessed directly by another object. Usually private (-) not public (+) - **Attribute name:** Lower case camelback notation - **Type expression:** class, string, integer, currency, date, time - **Initial value:** if applicable the default value - **Property:** if applicable, such as {key} **Examples:** - `-accountNo: String {key}` - `-startingJobCode: integer = 01` ### Method Signature - The notation for a method, contains the information needed to invoke a method ### Methods - **Visibility:** indicates (+ or -) whether a method can be invoked by another object. Usually public (+), can be private if invoked within class like a subroutine - **Method name:** Lower case camelback, verb-noun - **Parameters:** variables passed to a method - **Return type:** the type of the data returned **Examples:** - `+getName(): string` (what is returned is a string) - `-check Validity(date): int` (assuming int is a returned code) - **Class level method:** applies to class rather than objects of class (aka static method). Underline it. - `+findStudents Above Hours(hours): Array` - `+getNumberOfCustomers(): Integer` - **Class level attribute:** applies to the class rather than an object (aka static attribute). Underline it. - `-noOfPhoneSales: int` - **Abstract class:** class that can't be instantiated. Only for inheritance. Name in *Italics*. - **Concrete class:** class that can be instantiated