SlideShare a Scribd company logo
1 of 27
Download to read offline
Object-oriented Analysis,
Design & Programming
Allan Spartacus Mangune
Delivery
• Lectures – 2.5 hours
• 2 case studies and exercises – 30 minutes each
Agenda
Object-oriented Analysis
Object-oriented Design
Object-oriented Programming
Object-oriented Analysis
Best done in iterative and incremental approach
• Refine as you learn more about the system and implementation constraints
Develop the models of the system based on functional requirements
• Does factor implementation constraints of the system into the model
Organize requirement items around objects that interact with one another
• Requirement items are mapped to the real things of the system
• Each item may be defined as object with data and behavior
Process
Model the system of its intended use taking into account the description and
behavior of each object
• Emphasize on what the system does
Define how objects interact with one another
Commonly used process tools
• Use case
• Conceptual models (also referred to Domain Models)
Use Case
Source:
http://en.wikipedia.org/wiki/File:Use_case_restaurant
_model.svg
A sequence of related actions to accomplish a specific goal
Each role in the system is represented as actor
The actor can be a human or other systems
• Identify the main task of each actor
• Read
• Write/Update
• Notification of effects of action taken on internal and/or external system
Conceptual Models
Abstract ideas in problem domain
Describes the each object of the system,
its behavior and how objects interact with
one another
• Attributes, behaviors and constraints
Use this model to build the vocabulary of
concepts and validate your understanding
of problem domain with domain experts
• Defer encapsulation details to the design phase
Source: http://en.wikipedia.org/wiki/File:Domain_model.png
Object-oriented Design
System
planning
process
Solve specific
problem
Promotes
correct
program flow
Starting the Design Phase
Can be started in parallel with analysis phase
• Incremental approach is preferred
Use the artifacts in analysis phase as inputs
• Use case models
• Conceptual models
Key Concepts of Object-oriented Design
Objects and
Classes
Encapsulation
and Information
Hiding
Inheritance
Polymorphism Interface
Objects
The most basic elements in object-oriented design
An object represents a real entity with attributes and behaviors
• Has a unique identity in the system
Objects interactions
• Interface is defined to describe all the actions an object must perform
Class
Represents the blue-print of an object
• An object that is created based on a class is called an instance of
that class
Contains attributes, data and behaviors that act on
the data
Defines the initial state of data
May contain interface that defines how the class
interact with the other parts of the system
• For this purpose, an interface is a set of methods and properties
exposed through public access modifier
Encapsulation and Information Hiding
The internals of an object is hidden
• Restricting access to its data
Prevents external code from setting the data in invalid state
Access to the data can be provided indirectly through public properties and methods
Reduces complexity of the system
Inheritance
When a class derives from another class
• The class that inherits from a based class is called
inheriting class or subclass
Promotes code reuse
• Base class inherits all of the base class operations, unless
overridden
Subclass may define its own implementation
of any of the operations of the base class
Polymorphism
Ability of the inheriting class to change one
or more behaviors of its base class
• This allows the derived class to share the
functionality of the base class
Interface
An abstract class that contains methods
without implementations
• Defines the rules for method signature and return type
• Implementation is deferred to the class the implements
the interface
Enforces rules to one or more classes that
implement the interface
Object-oriented Programming
Classes and
Objects
Access
Modifiers
Member Fields
and Properties
Methods
Inheritance Polymorphism Interface
Access Modifiers
public
• The type or member can be accessed by any other code in
the same assembly or another assembly that references it.
private
• The type or member can only be accessed by code in the
same class.
protected
• The type or member can only be accessed by code in the
same class or in a derived class.
internal
• The type or member can be accessed by any code in the
same assembly, but not from another assembly.
protected internal
• The type or member can be accessed by any code in the
same assembly, or by any derived class in another assembly
Source: http://msdn.microsoft.com/en-
us/library/dd460654.aspx#Interfaces
Classes and Objects
A class describes the object
An object in an instance of a class
• An object is instantiated through the
constructor of the class
public class Customer
{
public Customer() {}
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public Customer Add()
{
return ….
}
}
Customer customer = new Customer()
Member Fields and Properties
Local variables that must be private to the class
• Holds the data of the class
External access to the fields are usually
provided through public Properties
public class Customer
{
private int id;
private string firstName;
private string lastName;
public int Id {
get { return id; }
set { id = value; }
}
public string FirstName { … }
public string LastName { … }
}
Customer customer = new Customer()
customer.FirstName = “Allan Spartacus”
Methods
Defines the behaviors of the class
May or may not return a type
• void – no return type
Can be overloaded
• The signature of each method must be
unique
public class Customer
{
…
public Customer Add () { … }
public Customer Add(Customer customer){ … }
public Customer Edit () { … }
public bool Delete(int id) { … }
private void ConcatName(){ … }
}
Customer customer = new Customer()
customer.Add();
customer.ConcatName();
Inheritance
Enables a new class to reuse, extend and
change the behavior of a base class.
• All classes written in C# implicitly inherits from
System.Object class
• A C# class can only inherit from a single base class
public class Person {
public int Id { get; set; }
public string FirstName { get; set; }
}
public class Customer : Person {
public string CompanyName { get; set; }
}
public class Employee : Person {
public string EmployeeNumber { get; set; }
}
Employee employee = new Employee();
employee.Id = 1;
employee.FirstName = “Allan Spartacus”;
employee.EmployeeNumber = “GF4532”;
Sealed Class
To prevent a class from inheriting
from, define it as a sealed class
public sealed class Vendor : Person {
public string CompanyName { get; set; }
}
public class InternationaVendor : Vendor {
}
Abstract Class
When a class is intended as a base class that
cannot be instantiated, define it as abstract class
• Multiple derived classes can share the definition of an
abstract class
An abstract class can be used as interface by
defining abstract methods
• Abstract methods do not have implementation code
• Implementation code is defined in the derived class
public abstract class Manufacturer {}
Manufacturer manufacturer = new Manufacturer()
public abstract class Item {
public abstract void Add();
}
public class Product : Item {
public override void Add() {
….
}
}
public class Service : Item {
public override void Add() {
….
}
}
Interface
A collection of functionalities that can be implemented by
a class or struct
While a class is limited to inherit from a single base class, it
can implement multiple interfaces
A class that implements an interface must define methods
that have similar signatures defined in the interface
interface class IItem {
void Add();
}
public abstract class Product : IItem {
public void Add() {
….
}
}
public class Service : IItem {
public void Add() {
….
}
}
References
Object-oriented analysis -http://www.umsl.edu/~sauterv/analysis/488_f01_papers/wang.htm
http://en.wikipedia.org/wiki/Use_cases
Object-oriented design - http://en.wikipedia.org/wiki/Object-oriented_design
Object - http://en.wikipedia.org/wiki/Object-oriented_programming
Encapsulation and data hiding - http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)
Polymorphism - http://en.wikipedia.org/wiki/Object-oriented_programming
Interface - http://en.wikipedia.org/wiki/Object-oriented_programming
Inheritance - http://en.wikipedia.org/wiki/Object-oriented_programming
Copyright (C) 2014. Allan Spartacus Mangune
This work is licensed under a Creative Commons Attribution-
NonCommercial-ShareAlike 4.0 International License.
License URL: http://creativecommons.org/licenses/by-nc-
sa/4.0/

More Related Content

What's hot

upload ppt by browse button
upload ppt by browse buttonupload ppt by browse button
upload ppt by browse button
techweb08
 
Justin Presentation PPT Upload
Justin Presentation PPT UploadJustin Presentation PPT Upload
Justin Presentation PPT Upload
techweb08
 
alka ppt upload no code change
alka ppt upload no code changealka ppt upload no code change
alka ppt upload no code change
techweb08
 
justin presentation upload PPT june 19
justin presentation upload PPT june 19justin presentation upload PPT june 19
justin presentation upload PPT june 19
techweb08
 
justin presentation slideshare1
justin presentation slideshare1justin presentation slideshare1
justin presentation slideshare1
techweb08
 
justin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCEDjustin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCED
techweb08
 

What's hot (16)

Skillwise Integration Testing
Skillwise Integration TestingSkillwise Integration Testing
Skillwise Integration Testing
 
Keyword Driven Testing using TestComplete
Keyword Driven Testing using TestCompleteKeyword Driven Testing using TestComplete
Keyword Driven Testing using TestComplete
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - KenyaUnit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - Kenya
 
Power-Up Your Test Suite with OLE Automation by Joshua Russell
Power-Up Your Test Suite with OLE Automation by Joshua RussellPower-Up Your Test Suite with OLE Automation by Joshua Russell
Power-Up Your Test Suite with OLE Automation by Joshua Russell
 
Paper Ps
Paper PsPaper Ps
Paper Ps
 
upload ppt by browse button
upload ppt by browse buttonupload ppt by browse button
upload ppt by browse button
 
Justin Presentation PPT Upload
Justin Presentation PPT UploadJustin Presentation PPT Upload
Justin Presentation PPT Upload
 
Paper CS
Paper CSPaper CS
Paper CS
 
alka ppt upload no code change
alka ppt upload no code changealka ppt upload no code change
alka ppt upload no code change
 
Paper Ps
Paper PsPaper Ps
Paper Ps
 
alkatest7
alkatest7alkatest7
alkatest7
 
Paper Ps
Paper PsPaper Ps
Paper Ps
 
justin presentation upload PPT june 19
justin presentation upload PPT june 19justin presentation upload PPT june 19
justin presentation upload PPT june 19
 
justin presentation slideshare1
justin presentation slideshare1justin presentation slideshare1
justin presentation slideshare1
 
justin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCEDjustin presentation upload PPT june 25 ADVANCED
justin presentation upload PPT june 25 ADVANCED
 
How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?How to Build Your Own Test Automation Framework?
How to Build Your Own Test Automation Framework?
 

Viewers also liked

Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Haitham El-Ghareeb
 
Rosinesita
RosinesitaRosinesita
Rosinesita
galcec
 
Inventions: The computer
Inventions: The computerInventions: The computer
Inventions: The computer
andreasupertino
 
US in the Middle East Part 2
US in the Middle East Part 2US in the Middle East Part 2
US in the Middle East Part 2
skallens
 
On The Day the Last Nuclear Weapon is Destroyed
On The Day the Last Nuclear Weapon is DestroyedOn The Day the Last Nuclear Weapon is Destroyed
On The Day the Last Nuclear Weapon is Destroyed
kenleybutler
 
1948 Arab–Israeli
1948 Arab–Israeli1948 Arab–Israeli
1948 Arab–Israeli
jakblack
 
Topic.09 The Civil Rights Movement
Topic.09 The Civil Rights MovementTopic.09 The Civil Rights Movement
Topic.09 The Civil Rights Movement
mr.meechin
 
Javascript for php developer
Javascript for php developerJavascript for php developer
Javascript for php developer
Dang Tuan
 
Israeli-Palestinian Conflict
Israeli-Palestinian ConflictIsraeli-Palestinian Conflict
Israeli-Palestinian Conflict
theironegoodson
 

Viewers also liked (20)

Structured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and DesignStructured Vs, Object Oriented Analysis and Design
Structured Vs, Object Oriented Analysis and Design
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Dice Game Case Study 11 30 6
Dice Game Case Study 11 30 6Dice Game Case Study 11 30 6
Dice Game Case Study 11 30 6
 
Rosinesita
RosinesitaRosinesita
Rosinesita
 
Inventions: The computer
Inventions: The computerInventions: The computer
Inventions: The computer
 
US in the Middle East Part 2
US in the Middle East Part 2US in the Middle East Part 2
US in the Middle East Part 2
 
Donald Wilhite, University of Lincoln: Integrated national drought management
Donald Wilhite, University of Lincoln: Integrated national drought managementDonald Wilhite, University of Lincoln: Integrated national drought management
Donald Wilhite, University of Lincoln: Integrated national drought management
 
A global picture of drought occurrence, magnitude, and preparedness
A global picture of drought occurrence, magnitude, and preparednessA global picture of drought occurrence, magnitude, and preparedness
A global picture of drought occurrence, magnitude, and preparedness
 
On The Day the Last Nuclear Weapon is Destroyed
On The Day the Last Nuclear Weapon is DestroyedOn The Day the Last Nuclear Weapon is Destroyed
On The Day the Last Nuclear Weapon is Destroyed
 
Chapter7
Chapter7Chapter7
Chapter7
 
1948 Arab–Israeli
1948 Arab–Israeli1948 Arab–Israeli
1948 Arab–Israeli
 
Report on HISTORY OF MONEY IN CHINA
Report on HISTORY OF MONEY IN CHINAReport on HISTORY OF MONEY IN CHINA
Report on HISTORY OF MONEY IN CHINA
 
Topic.09 The Civil Rights Movement
Topic.09 The Civil Rights MovementTopic.09 The Civil Rights Movement
Topic.09 The Civil Rights Movement
 
D3 (drought management and risk reduction in pakistan) brig. kamran shariff
D3 (drought management and risk reduction in pakistan)  brig. kamran shariffD3 (drought management and risk reduction in pakistan)  brig. kamran shariff
D3 (drought management and risk reduction in pakistan) brig. kamran shariff
 
Chapter9
Chapter9Chapter9
Chapter9
 
Egypt
EgyptEgypt
Egypt
 
Topic 1 intro power and ideas
Topic 1 intro power and ideasTopic 1 intro power and ideas
Topic 1 intro power and ideas
 
Javascript for php developer
Javascript for php developerJavascript for php developer
Javascript for php developer
 
Israeli-Palestinian Conflict
Israeli-Palestinian ConflictIsraeli-Palestinian Conflict
Israeli-Palestinian Conflict
 
“Digital democracy” helen milner digital leaders annual lecture 24 february 2015
“Digital democracy” helen milner digital leaders annual lecture 24 february 2015“Digital democracy” helen milner digital leaders annual lecture 24 february 2015
“Digital democracy” helen milner digital leaders annual lecture 24 february 2015
 

Similar to Object-oriented Analysis, Design & Programming

Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02
Getachew Ganfur
 

Similar to Object-oriented Analysis, Design & Programming (20)

VB.net&OOP.pptx
VB.net&OOP.pptxVB.net&OOP.pptx
VB.net&OOP.pptx
 
Better Understanding OOP using C#
Better Understanding OOP using C#Better Understanding OOP using C#
Better Understanding OOP using C#
 
Introduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptIntroduction to Design Patterns in Javascript
Introduction to Design Patterns in Javascript
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
PHP - Introduction to Object Oriented Programming with PHP
PHP -  Introduction to  Object Oriented Programming with PHPPHP -  Introduction to  Object Oriented Programming with PHP
PHP - Introduction to Object Oriented Programming with PHP
 
C++ Programming Course
C++ Programming CourseC++ Programming Course
C++ Programming Course
 
Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02Ccourse 140618093931-phpapp02
Ccourse 140618093931-phpapp02
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
03 classes interfaces_principlesofoop
03 classes interfaces_principlesofoop03 classes interfaces_principlesofoop
03 classes interfaces_principlesofoop
 
OOPS – General Understanding in .NET
OOPS – General Understanding in .NETOOPS – General Understanding in .NET
OOPS – General Understanding in .NET
 
Oops
OopsOops
Oops
 
Java chapter 5
Java chapter 5Java chapter 5
Java chapter 5
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Chapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.pptChapter 4_Introduction to Patterns.ppt
Chapter 4_Introduction to Patterns.ppt
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Synapseindia reviews.odp.
Synapseindia reviews.odp.Synapseindia reviews.odp.
Synapseindia reviews.odp.
 

More from Allan Mangune (6)

From the Trenches: Effectively Scaling Your Cloud Infrastructure and Optimizi...
From the Trenches: Effectively Scaling Your Cloud Infrastructure and Optimizi...From the Trenches: Effectively Scaling Your Cloud Infrastructure and Optimizi...
From the Trenches: Effectively Scaling Your Cloud Infrastructure and Optimizi...
 
DDD and CQRS for .NET Developers
DDD and CQRS for .NET DevelopersDDD and CQRS for .NET Developers
DDD and CQRS for .NET Developers
 
Configuring SQL Server Reporting Services for ASP.NET Running on Azure Web Role
Configuring SQL Server Reporting Services for ASP.NET Running on Azure Web RoleConfiguring SQL Server Reporting Services for ASP.NET Running on Azure Web Role
Configuring SQL Server Reporting Services for ASP.NET Running on Azure Web Role
 
Developing Software As A Service App with Python & Django
Developing Software As A Service App with Python & DjangoDeveloping Software As A Service App with Python & Django
Developing Software As A Service App with Python & Django
 
Agile planning and iterations with Scrum using Team Foundation Server 2013
Agile planning and iterations with Scrum using Team Foundation Server 2013Agile planning and iterations with Scrum using Team Foundation Server 2013
Agile planning and iterations with Scrum using Team Foundation Server 2013
 
Game Development with Windows Phone 7
Game Development with Windows Phone 7Game Development with Windows Phone 7
Game Development with Windows Phone 7
 

Recently uploaded

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
masabamasaba
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 

Recently uploaded (20)

%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
%+27788225528 love spells in Huntington Beach Psychic Readings, Attraction sp...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 

Object-oriented Analysis, Design & Programming

  • 1. Object-oriented Analysis, Design & Programming Allan Spartacus Mangune
  • 2. Delivery • Lectures – 2.5 hours • 2 case studies and exercises – 30 minutes each
  • 4. Object-oriented Analysis Best done in iterative and incremental approach • Refine as you learn more about the system and implementation constraints Develop the models of the system based on functional requirements • Does factor implementation constraints of the system into the model Organize requirement items around objects that interact with one another • Requirement items are mapped to the real things of the system • Each item may be defined as object with data and behavior
  • 5. Process Model the system of its intended use taking into account the description and behavior of each object • Emphasize on what the system does Define how objects interact with one another Commonly used process tools • Use case • Conceptual models (also referred to Domain Models)
  • 6. Use Case Source: http://en.wikipedia.org/wiki/File:Use_case_restaurant _model.svg A sequence of related actions to accomplish a specific goal Each role in the system is represented as actor The actor can be a human or other systems • Identify the main task of each actor • Read • Write/Update • Notification of effects of action taken on internal and/or external system
  • 7. Conceptual Models Abstract ideas in problem domain Describes the each object of the system, its behavior and how objects interact with one another • Attributes, behaviors and constraints Use this model to build the vocabulary of concepts and validate your understanding of problem domain with domain experts • Defer encapsulation details to the design phase Source: http://en.wikipedia.org/wiki/File:Domain_model.png
  • 9. Starting the Design Phase Can be started in parallel with analysis phase • Incremental approach is preferred Use the artifacts in analysis phase as inputs • Use case models • Conceptual models
  • 10. Key Concepts of Object-oriented Design Objects and Classes Encapsulation and Information Hiding Inheritance Polymorphism Interface
  • 11. Objects The most basic elements in object-oriented design An object represents a real entity with attributes and behaviors • Has a unique identity in the system Objects interactions • Interface is defined to describe all the actions an object must perform
  • 12. Class Represents the blue-print of an object • An object that is created based on a class is called an instance of that class Contains attributes, data and behaviors that act on the data Defines the initial state of data May contain interface that defines how the class interact with the other parts of the system • For this purpose, an interface is a set of methods and properties exposed through public access modifier
  • 13. Encapsulation and Information Hiding The internals of an object is hidden • Restricting access to its data Prevents external code from setting the data in invalid state Access to the data can be provided indirectly through public properties and methods Reduces complexity of the system
  • 14. Inheritance When a class derives from another class • The class that inherits from a based class is called inheriting class or subclass Promotes code reuse • Base class inherits all of the base class operations, unless overridden Subclass may define its own implementation of any of the operations of the base class
  • 15. Polymorphism Ability of the inheriting class to change one or more behaviors of its base class • This allows the derived class to share the functionality of the base class
  • 16. Interface An abstract class that contains methods without implementations • Defines the rules for method signature and return type • Implementation is deferred to the class the implements the interface Enforces rules to one or more classes that implement the interface
  • 17. Object-oriented Programming Classes and Objects Access Modifiers Member Fields and Properties Methods Inheritance Polymorphism Interface
  • 18. Access Modifiers public • The type or member can be accessed by any other code in the same assembly or another assembly that references it. private • The type or member can only be accessed by code in the same class. protected • The type or member can only be accessed by code in the same class or in a derived class. internal • The type or member can be accessed by any code in the same assembly, but not from another assembly. protected internal • The type or member can be accessed by any code in the same assembly, or by any derived class in another assembly Source: http://msdn.microsoft.com/en- us/library/dd460654.aspx#Interfaces
  • 19. Classes and Objects A class describes the object An object in an instance of a class • An object is instantiated through the constructor of the class public class Customer { public Customer() {} public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public Customer Add() { return …. } } Customer customer = new Customer()
  • 20. Member Fields and Properties Local variables that must be private to the class • Holds the data of the class External access to the fields are usually provided through public Properties public class Customer { private int id; private string firstName; private string lastName; public int Id { get { return id; } set { id = value; } } public string FirstName { … } public string LastName { … } } Customer customer = new Customer() customer.FirstName = “Allan Spartacus”
  • 21. Methods Defines the behaviors of the class May or may not return a type • void – no return type Can be overloaded • The signature of each method must be unique public class Customer { … public Customer Add () { … } public Customer Add(Customer customer){ … } public Customer Edit () { … } public bool Delete(int id) { … } private void ConcatName(){ … } } Customer customer = new Customer() customer.Add(); customer.ConcatName();
  • 22. Inheritance Enables a new class to reuse, extend and change the behavior of a base class. • All classes written in C# implicitly inherits from System.Object class • A C# class can only inherit from a single base class public class Person { public int Id { get; set; } public string FirstName { get; set; } } public class Customer : Person { public string CompanyName { get; set; } } public class Employee : Person { public string EmployeeNumber { get; set; } } Employee employee = new Employee(); employee.Id = 1; employee.FirstName = “Allan Spartacus”; employee.EmployeeNumber = “GF4532”;
  • 23. Sealed Class To prevent a class from inheriting from, define it as a sealed class public sealed class Vendor : Person { public string CompanyName { get; set; } } public class InternationaVendor : Vendor { }
  • 24. Abstract Class When a class is intended as a base class that cannot be instantiated, define it as abstract class • Multiple derived classes can share the definition of an abstract class An abstract class can be used as interface by defining abstract methods • Abstract methods do not have implementation code • Implementation code is defined in the derived class public abstract class Manufacturer {} Manufacturer manufacturer = new Manufacturer() public abstract class Item { public abstract void Add(); } public class Product : Item { public override void Add() { …. } } public class Service : Item { public override void Add() { …. } }
  • 25. Interface A collection of functionalities that can be implemented by a class or struct While a class is limited to inherit from a single base class, it can implement multiple interfaces A class that implements an interface must define methods that have similar signatures defined in the interface interface class IItem { void Add(); } public abstract class Product : IItem { public void Add() { …. } } public class Service : IItem { public void Add() { …. } }
  • 26. References Object-oriented analysis -http://www.umsl.edu/~sauterv/analysis/488_f01_papers/wang.htm http://en.wikipedia.org/wiki/Use_cases Object-oriented design - http://en.wikipedia.org/wiki/Object-oriented_design Object - http://en.wikipedia.org/wiki/Object-oriented_programming Encapsulation and data hiding - http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Polymorphism - http://en.wikipedia.org/wiki/Object-oriented_programming Interface - http://en.wikipedia.org/wiki/Object-oriented_programming Inheritance - http://en.wikipedia.org/wiki/Object-oriented_programming
  • 27. Copyright (C) 2014. Allan Spartacus Mangune This work is licensed under a Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International License. License URL: http://creativecommons.org/licenses/by-nc- sa/4.0/