ooad presentation
DESCRIPTION
TRANSCRIPT
Object-Oriented
Analysis and Design
How do you write great software every
time?
Great software?
The software must do what the customer wants it to do
Make your code smart
Well-DesignedWell-Coded
Easy to mantain
Easy to reuseEasy to extend
Great software satisfies the customer and the programmer
Programmers are satisfied when:
Their apps can be REUSED Their apps are FLEXIBLE
Customers are satisfied when:
Their apps WORK Their apps KEEP WORKING
Their apps can be UPGRADED
Ok but… what shall the software do?
Gathering requirements
Pay attention to what the system needs to
You can figure out how later
Requirement?
It’s a specific thing
Yoursystemhas to do
towork correctly
Usually a single thing, and you can test that thing to make sure you fullfilled the requirement
The complete app or project you are working on
2 - so if you leave out a requirement or even if they forget to mention sth your system isnt working correctly
1 - The customer decides when a system works correctly,
Your software has a context
Developers viewpoint(the perfect world)
Real world
+ Analysis =
Real world context
Textual analysis = nouns / verbsUse cases
Diagrams
Nothing ever stay the same
No matter how much you like your softwareRight now, it’s probably going to changeTomorrow…
Good design = flexible and resilient design
Design principles
Techniques that can be applied for designing or writing code to make that code more Mantainable, flexible or extensible
OCPOpen-closed
princople
DRYDon’t repeat
yourself
SRPSingle
responsibility principle
Classes are open for extensionAnd closed for modification
Avoid duplicate code by abstractingThings that are common
Every object in your project should have a single responsability
Open-closed principle
class Printer{public final void print(Printable p){
…}
}
class SquarePrinter extends Printer{public void print(Square s){
…}
}OPEN = Extending functionality
ClOSED = NO OVERRIDES
Single responsibility principle
public class MobileCaller{
public void callMobile(MobileNo mobileNo){ ... }}
public class ValidationService{
public static boolean validateMobileNumber(MobileNo mobileNo){ ... }
}
Responsibility #1: Call
Responsibility #2: validate number
DRY – Don’t repeat yourself
By Contract / Defensive
programming
programming
defensively means you’re making sure the
client gets “safe” response, no matter what the client wants to have happen
Programming by contract means you are working with a client code
to agree on how you’ll handle problem situations
Defensive programming