This document introduces the "Software Design Sutra" which provides a step-by-step approach to good software design. It begins by asking which is better, architecture or actual code. It then provides brief biographical information about the author before presenting a simple attendance tracking problem to design a system for. It proceeds to outline 12 sutras or rules for software design, such as gathering control flow decisions and separating referentially transparent and opaque components. Recommended additional reading on object design and design patterns is also provided.
4. 4
S o f t w a r e D e s i g n S u t r a
Z E R O
Good Design makes Future
Changes Easier
5. 5
• B. Tech Mechanical Engineering [1985] from IIT Madras
• Shoper [2011] – Enterprise Retail – Product Owner in Tally (Prod. Mgr. + Engg.
Mgr. + Lead Architect + Test Mgr. + L3 Support Manager)
• Hamsa [2004] – Mail Management – Launched (acquired)
• Plasma [2003] – Enterprise Task Management – ditto
• GoGet [2001] – Customer Management – ditto
• Papyrus [1995] – A Document Manager – Launched
• Konan The Kontroller [1992] – An ERP before people were excited about
ERP’s – Never Launched
Who the heck is this balding guy talking to us?
Wait!
7. A simple assignment
• Create a system that records attendance of an employee.
• When employee enters the office, his face gets scanned automatically.
• When employee exits the office, his face gets scanned automatically.
• Time spent in office has to be more than 7 hours for an employee to
be considered present. If at least 4 hours it is considered half day
• For people who are above grade 3 there is no minimum requirement
of number of hours to be spent.
• For people who are above grade 5 there is no attendance tracking at
all.
• For people from sales department the first scan and the last scan has
to be more than 7 hours (no minimum time spent in office) and 4
hours for half day.
8.
9.
10.
11.
12.
13.
14. S o f t w a r e D e s i g n S u t r a
O N E
Create Abstractions by Writing
Sentences and Write Code that
reflects the sentences
15. Sentences
• Update attendance information for employees for working days
• Get Employee Information
• Get Working dates
• Update attendance Information
• Get Scan Information for the date and update Employee Attendance
• Get Scan Information
• Update Employee Attendance
• Calculate attendance based on employee type
16. • Update attendance information for employees for working days
• Get Employee Information
• Get Working dates
• Update attendance Information
Write Code that reflects the sentences
17. • Get Scan Information for the date and update Employee Attendance
• Get Scan Information
• Update Employee Attendance
• Calculate attendance based on employee type
Write Code that reflects the sentences
18. The sooner you start
to code, the longer the
program will take.
Roy Carlson
19. S o f t w a r e D e s i g n S u t r a
T W O
Gather control flow decisions
based on the requirements into
TRANSLATORS
20.
21. S o f t w a r e D e s i g n S u t r a
T H R E E
Gather control flow decisions
based on the solution into
COORDINATORS
22.
23. S o f t w a r e D e s i g n S u t r a
F O U R
Gather processing /
transormation / calculation into
SERVICE PROVIDERS
24.
25. S o f t w a r e D e s i g n S u t r a
F I V E
Prefer
Referentially Transparent (RT)
over Referentially Opaque (RO)
26. S o f t w a r e D e s i g n S u t r a
S I X
Seperate RT and RO -
TRANSLATORS,
COORDINATORS, SERVICE
PROVIDERS
27. S o f t w a r e D e s i g n S u t r a
S E V E N
Use INPUT INTERFACERS to
retrieve information from
external systems
28. S o f t w a r e D e s i g n S u t r a
E I G H T
Use DATA HOLDERS to pass
information between parts of the
system
29. S o f t w a r e D e s i g n S u t r a
N I N E
Use STATE HOLDERS that only
interact with TRANSLATORS to
eliminate globals
30. S o f t w a r e D e s i g n S u t r a
T E N
Use ITERATORS to walk over
items in a collection
31. S o f t w a r e D e s i g n S u t r a
E L E V E N
All Units Do One and Only One
Thing OOOT
32. S o f t w a r e D e s i g n S u t r a
T W E L V E
Every Entity must be True To its
NAME
33. Recommended Reading
Object Design
by Rebecca Wirfs-Brock and Alan McKean
DesignPatterns Explained
by Alan Shalloway and James R. Trott
The Pragmatic Programmer
by Andrew Hunt and David Thomas
34. Did you find that interesting, may I
request for some assistance in return?