clean systems - github pages · dependency injection • special type of inversion of control. •...

81
Clean Systems Clean Code at the Architecture Level Dean Wampler [email protected] IM’s, Twitter: deanwampler 1 Wednesday, August 6, 2008

Upload: others

Post on 30-Sep-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Clean SystemsClean Code at the Architecture Level

Dean [email protected]’s, Twitter: deanwampler

1Wednesday, August 6, 2008

Page 2: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

2Wednesday, August 6, 2008

Page 3: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

How would you build a city?

3Wednesday, August 6, 2008

Page 4: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

4Wednesday, August 6, 2008

Page 5: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

5Wednesday, August 6, 2008

Page 6: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Cities are modular

• They have appropriate levels of abstraction.

• They separate concerns.

6Wednesday, August 6, 2008

Page 7: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Your software systems?

• Appropriate abstractions?

• Clear separation of concerns?

7Wednesday, August 6, 2008

Page 8: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Clean systems are built on clean code

Leave now if code makes you squeamish...

8Wednesday, August 6, 2008

Page 9: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Separate construction

fromuse

#1

9Wednesday, August 6, 2008

Page 10: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

During construction

• People in hard hats.

• Lots of heavy lifting.

• ...

10Wednesday, August 6, 2008

Page 11: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

During use

• People in nicer clothes.

• Business tasks.

• ...

11Wednesday, August 6, 2008

Page 12: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Software construction vs. use

• Startup is one task.

• Component wiring.

• Running involves different tasks.

12Wednesday, August 6, 2008

Page 13: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public Service getService() { if (service == null) // Good enough default for most cases? service = new MyServiceImpl(...); return service; }

An example

Lazy Initialization Pattern

13Wednesday, August 6, 2008

Page 14: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public Service getService() { if (service == null) // Good enough default for most cases? service = new MyServiceImpl(...); return service; }

What’s Wrong with LI?“Wiring strategy” scattered and tangled.

Specific decisions hard coded.

14Wednesday, August 6, 2008

Page 15: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Other problems...

• Testing

• Must somehow set a mock for service before getService called.

• Must still compile with MyServiceImpl.

• Is MyServiceImpl really the best default?

• Breaks the Single Responsibility Principle

15Wednesday, August 6, 2008

Page 16: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Setup concern

• Requires a global strategy.

• Consistent approach.

• Modularized decisions.

16Wednesday, August 6, 2008

Page 17: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

SolutionDependency Injection

17Wednesday, August 6, 2008

Page 18: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Dependency Injection

• Special type of Inversion of Control.

• Objects are given their dependencies

• Passive vs. Active

• Authoritative mechanism makes wiring decisions.

18Wednesday, August 6, 2008

Page 19: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Options

• Attribute “setters”.

• Constructor arguments.

• Object leaves constructor fully formed.

• Slightly better.

19Wednesday, August 6, 2008

Page 20: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Spring Framework<beans> <bean id="service" class="org.example.services.MyServiceImpl"/>

<bean id="clientOfService" class="org.example.app.ClientImpl" p:service-name= "service"/> ...</beans>

XmlBeanFactory bf = new XmlBeanFactory( new ClassPathResource("app.xml", getClass()));Client client = (Client) bf.getBean("client");

20Wednesday, August 6, 2008

Page 21: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Dependency Injection

• Separates construction from use.

• Decouples abstractions from implementations.

21Wednesday, August 6, 2008

Page 22: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Scale up systems

on demand

#2

22Wednesday, August 6, 2008

Page 23: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Small vs. Large Systems

23Wednesday, August 6, 2008

Page 24: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Common Myth:

Why didn’t you get the design

right the first time?

24Wednesday, August 6, 2008

Page 25: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Design Dilemma

• The perfect design for today’s system.

vs.

• The perfect design for tomorrow’s system.

25Wednesday, August 6, 2008

Page 26: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Agile methods

• Taught us to evolve the design to meet today’s needs,

• But keep it adaptable for tomorrow’s needs

• Without anticipatory design.

26Wednesday, August 6, 2008

Page 27: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Software is unique

• Unlike physical structures,

• We can change everything in software, even the architecture.

27Wednesday, August 6, 2008

Page 28: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Software is unique

• … but only if we keep it agile!

28Wednesday, August 6, 2008

Page 29: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

How not to keep it agileEJB’s versions 1 and 2

29Wednesday, August 6, 2008

Page 30: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Enterprise Java Beans

• Forced tangling of concerns:

• Application logic mixed with

• Container life-cycle, etc.

• Persistence,

• etc.

30Wednesday, August 6, 2008

Page 31: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public interface BankLocal extends javax.ejb.EJBLocalObject { …

Example: Bank EJB

• Forced to subclass an EJB class.

• Can’t use application domain hierarchy.

• Tight coupling to container details.

31Wednesday, August 6, 2008

Page 32: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

… String getCity() throws java.ejb.EJBException; void addAccount(AccountDTO dto) throws java.ejb.EJBException; …

Example: Bank EJB

• Tight coupling for methods, too.

32Wednesday, August 6, 2008

Page 33: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public abstract class Bank implements javax.ejb.EntityBean { …

EJB implementation

• Forced to implement EJB interface

33Wednesday, August 6, 2008

Page 34: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

EJB implementation … public void addAccount(AccountDTO dto) { InitialContext ctx = new InitialContext(); AccountHomeLocal accountHome = ctx.lookup("AccountHomeLocal"); AccountLocal account = accountHome.create(dto); Collection accounts = getAccounts(); accounts.add(account); }

34Wednesday, August 6, 2008

Page 35: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

EJB Implementation

… // Required container methods... public void ejbActivate() {} public void ejbPassivate() {} public void ejbLoad() {} public void ejbStore() {} public void ejbRemove() {} …

35Wednesday, August 6, 2008

Page 36: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

But wait, there’s more!

• Several more classes and interfaces.

• Many more methods.

• XML to define

• Transactions,

• Persistence mapping,

• Security, ...

36Wednesday, August 6, 2008

Page 37: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Forget about:

• Reuse.

• Object orientation of your domain model.

• => Lot’s of duplication between EJB’s and POJO domain objects.

• Easy TDD.

• High productivity...

37Wednesday, August 6, 2008

Page 38: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

But, not all was wrong

• Using XML to specify transactional, persistence, and security behaviors,

• Separated these concerns from code.

• EJBs anticipated Aspect-Oriented Programming.

38Wednesday, August 6, 2008

Page 39: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

SolutionAspect-Oriented Programming

39Wednesday, August 6, 2008

Page 40: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public class BankAccount { private Money balance; public Money getBalance () {…} public void credit(Money amount) { balance += amount; } public void debit(Money amount) { balance -= amount; } …}

Clean Code

40Wednesday, August 6, 2008

Page 41: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

However,

real applications need:

Transactions

Persistence

Security

public void credit(…) { … } public void debit(…) { … }

41Wednesday, August 6, 2008

Page 42: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public void credit(Money amount) throws ApplicationException { try { Money oldBalance = balance; beginTransaction(); balance += amount; persistChange(this); …

So credit becomes…

42Wednesday, August 6, 2008

Page 43: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

catch (Throwable th) { logError(th); balance = oldBalance; throw new ApplicationException(th); } finally { endTransaction(); }}

43Wednesday, August 6, 2008

Page 44: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

We’re mixing multiple domains, with fine-grained intersections.

Transactions

Persistence

Security

“Problem Domain”

“tangled” code

“scattered” logic44Wednesday, August 6, 2008

Page 45: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Objects alone don’t prevent tangling.

45Wednesday, August 6, 2008

Page 46: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Aspects restore modularity by encapsulating the intersections.

Transactions

Persistence

Security

TransactionAspect

PersistenceAspect

SecurityAspect

46Wednesday, August 6, 2008

Page 47: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

AOP tool options

• AspectJ

• “Pure Java” Spring AOP or JBoss AOP

47Wednesday, August 6, 2008

Page 48: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public aspect PersistentBankAccount { pointcut stateChange(BankAccount ba): (call(* BankAccount.debit(..)) || call(* BankAccount.credit(..))) && this(ba);

after(BankAccount ba): stateChange(ba) { persistChange(ba); }}

AspectJ

48Wednesday, August 6, 2008

Page 49: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

public aspect PersistentBankAccount { pointcut stateChange(BankAccount ba): (call(* BankAccount.debit(..)) || call(* BankAccount.credit(..))) && this(ba);

after(BankAccount ba): stateChange(ba) { persistChange(ba); }}

AspectJ“Class-like” construct

When state changes occur.

When and how to persist changes.

49Wednesday, August 6, 2008

Page 50: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Spring AOP<beans> <bean id="bankDataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" p:driverClassName="com.mysql.jdbc.Driver" p:url="jdbc:mysql://localhost:3306/mydb" p:username="me" />

<bean id="bankDataAccessObject" class="com.banking.persistence.BankDataAccessObject" p:dataSource-ref= "bankDataSource"/>

<bean id="bank" class="com.banking.model.Bank" p:dataAccessObject-ref= "bankDataAccessObject"/></beans>

50Wednesday, August 6, 2008

Page 51: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

: appDataSource

: bankDataAccessObject

: bank

getAccounts(): client

“Matryoshka” doll*

* i.e., Russian nested doll51Wednesday, August 6, 2008

Page 52: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

EJB version 3

• Largely adopted the POJO model of Spring AOP.

52Wednesday, August 6, 2008

Page 53: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Aspect-Oriented Programming

• Separates concerns with fine-grained coupling.

• Allows concerns to evolve and scale independently.

• Allows architectures to evolve and scale.

53Wednesday, August 6, 2008

Page 54: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Test drivethe

system architecture

#3

54Wednesday, August 6, 2008

Page 55: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Cities are modular

• Discrete components.

• Minimal coupling.

• Concurrent modifications.

• Concurrent execution.

55Wednesday, August 6, 2008

Page 56: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

They grow from villages

• Dirt roads are replaced by paved roads.

• Highways are added.

• Small buildings are replaced with towers.

The transition can be painful at times.

56Wednesday, August 6, 2008

Page 57: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Big Design Up Front?

• Architecture evolution is possible if,

• The components that implement concerns are decoupled from one another and

• The components are wired together using aspect-like mechanisms.

57Wednesday, August 6, 2008

Page 58: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Hazards of BDUF

• You’re thinking in a vacuum, without feedback from a running system.

• It’s hard to throw the design away when you’ve invested so much into it.

58Wednesday, August 6, 2008

Page 59: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

SolutionTest-Driven Development

59Wednesday, August 6, 2008

Page 60: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

In TDD, tests are proxies for

requirements

60Wednesday, August 6, 2008

Page 61: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Therefore, grow the system in response to

“test pressure”

61Wednesday, August 6, 2008

Page 62: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Optimizedecision making

#4

62Wednesday, August 6, 2008

Page 63: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

The best decisions:

• are made at the last responsible moment,

• when you have the most recent information.

63Wednesday, August 6, 2008

Page 64: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

SolutionIncremental Evolution

64Wednesday, August 6, 2008

Page 65: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

With a test-drivenarchitecture,

you can optimize decision making

65Wednesday, August 6, 2008

Page 66: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Timing decisions

• You can make

• many small decisions,

• rather than big, risky decisions.

66Wednesday, August 6, 2008

Page 67: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

This is only possible with an agile architecture

67Wednesday, August 6, 2008

Page 68: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Use standardswisely,

when they add demonstrable value

#5

68Wednesday, August 6, 2008

Page 69: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Benefits of Standards

• Reuse and encapsulation of

• ideas.

• components.

• Shared expertise.

69Wednesday, August 6, 2008

Page 70: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Drawbacks of Standards

• Slow to emerge.

• Design by committee.

• Bloat.

70Wednesday, August 6, 2008

Page 71: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Does the standardmeet the needs it was

intended to serve?

71Wednesday, August 6, 2008

Page 72: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Minimize themental gap between

requirements and code

#6

72Wednesday, August 6, 2008

Page 73: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Does your coderead like the

problem domain?

73Wednesday, August 6, 2008

Page 74: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

SolutionDomain-Specific Languages

74Wednesday, August 6, 2008

Page 75: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Every Domain has a Language

• Rich vocabulary.

• Idioms and patterns.

• Clear and concise communications.

75Wednesday, August 6, 2008

Page 76: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Code should read like the domain

• DSL’s

• Introduce appropriate levels of abstraction.

• Minimize mental gap between domain concepts and code.

• Optimize communication.

76Wednesday, August 6, 2008

Page 77: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Recap

• Separate construction from use.

• Use dependency injection.

• Scale up on demand.

• Decouple concerns with Aspects.

77Wednesday, August 6, 2008

Page 78: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Recap

• Test-drive the system architecture.

• Requires modular concerns.

• Optimize decision making.

• An agile architecture lets you make decisions at the most appropriate times.

78Wednesday, August 6, 2008

Page 79: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Recap

• Use standards wisely.

• Only if they demonstrate value.

• Use domain-specific languages.

• Map the domain to code.

• Introduce appropriate levels of abstraction.

79Wednesday, August 6, 2008

Page 80: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Final Thought:

Complexity kills. It sucks the life out of developers, it makes products difficult to plan, build and test. ...

Each of us should ... explore and embrace techniques to reduce complexity.

Ray Ozzie, Chief Technology Officer, Microsoft Corporation

80Wednesday, August 6, 2008

Page 81: Clean Systems - GitHub Pages · Dependency Injection • Special type of Inversion of Control. • Objects are given their dependencies • Passive vs. Active • Authoritative mechanism

Thank You!

[email protected]

• http://blog.objectmentor.com

• http://aspectprogramming.com/papers

81Wednesday, August 6, 2008