Powerful Software Systems,
What, why, how and more
Naveen Muguda
• ‘Analogy is a powerful cognitive mechanism that people use to make
inferences and learn new abstractions’
• Anecdotes, analogies, metaphors and memes
Rocket and Horses story
Knowledge
• Anecdotal(person)
• Tribal (group)
• Scientific (intelligentsia)
• Odds(Tribal Knowledge being right && Scientific knowledge being
wrong) << 1
• Odds(Anecdotal knowledge being right && Scientific knowledge being
wrong) << 1
• “Software development can only be considered immature because of
how we use our experience, not because we lack experience.”–
Kevlin Henney
Two flag problem
1. array of numbers => time complexity : O(nlgn)
2. Array with k distinct values =>time complexity: O(n) two iterations
3. Array with 2 values => time complexity: O(n), 1 iteration
• Right Fit
• Right Fit
• Simplicity won’t suffice
Complicated
• a complicated issue is one in which you can’t get a firm handle on the
parts and there are no rules, algorithms, or natural laws.
• "Things that are complicated have no such degree of order, control,
or predictability"
• A complicated thing is much more challenging--and different--than
the sum of its parts, because its parts can interact in unpredictable
ways.
Complex
• "the components can be separated and dealt with in a systematic
and logical way that relies on a set of rules or algorithms.”
• allows you to deal with it in a repeatable manner.
Entropy
Number of elements
Simple
Complicated
Complex
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
||||||||||
||||||||||
||||||||||
||||||||||
||||||||||
||||||||||
||||||||||
|||||||||
• CXI – XXIII
• Hindu Numerals
Tally Roman Hindu
Represent Zero N N Y
Suitable for small numbers Y Y Y
Suitable for Large Numbers N Some What Y
Conducive to basic
operations
N N Y
• Right Fit
• Simplicity won’t suffice
• Simplicity isn’t an option for long
• 9008723875
• 1234567890
• 1111122222
• Right Fit
• Simplicity won’t suffice
• Simplicity isn’t an option for long
• Complicatedness isn’t the best option
• “We now know that it was as early as the third century that
mathematicians in India planted the seed of the idea that would later
become so fundamental to the modern world. ”
• “According to Nils-Bertil Wallin of YaleGlobal, by 773, zero reached
Baghdad where it became part of the Arabic number system, which is
based upon the Indian system.”
• Right Fit
• Simplicity won’t suffice
• Simplicity isn’t an option for long
• Complicatedness isn’t an option (for humans)
• Moving from complicated to complex takes time and effort
“Medieval religious leaders in Europe did not support the use of zero,
van der Hoek said. They saw it as satanic. "God was in everything that
was. Everything that was not was of the devil," she said.
Wallin points out that the Italian government was suspicious of
Arabic numbers and outlawed the use of zero. ”
• Right Fit
• Simplicity won’t suffice
• Simplicity isn’t an option for long
• Complicatedness isn’t an option (for humans)
• Moving from complicated to complex takes time and effort
• ^^ will be met with resistance
Subtraction with carry over
• Right Fit
• Simplicity won’t suffice
• Simplicity isn’t an option for long
• Complicatedness isn’t an option (for humans)
• Moving from complicated to complex takes time and effort
• ^^ will be met with resistance
• ‘view’ of simplicity is provided by a complex system
Dimension Benefits
Skill Score runs
Stamina will bat for long
Flexibility Avoid/reduce injuries
Strength score big hits
Diet recover in time, build strength, provide
nutrition
Mental Strength deal with challenges
Speed Convert 1s to 2s, 2s to 3s, …
• Challenges are often multi-dimensional
World(Business, Domain, Legislation)
People(Devs, Ops, Users, Mgrs, PMs)
Infra(HW, VM, Data Stores, ..)
Time(Time to Market, MTBF, MTTF)
Money(Revenue, Profit, Opportunity Cost)
Skill
Strength
Speed
Stamina
X
X
X
X Z
Z
Z
Z
Deliberate practice
Strength Training
cardio
Strength training, cardio
• Challenges are often multi-dimensional
• Multi-D model can represent challenges, capabilities, mechanisms
to improve capabilities
Anecdote1:
• Supply Chain at Amazon | Flipkart
• Ex-Yahoos at E-Kart
• Challenges are often multi-dimensional
• Multi-D model can represent challenges, capabilities, mechanisms to
improve capabilities
• Capabilities in one dimension can’t satisfy inadequacies in another
Human needs
Human needs
• Observe there is no mention of wealth/money
Happiness vs wealth co-relation
• Wealth is a means to satisfy needs
Strength
Stamina
Speed
Cardio
Strength Training
Sleep
• Challenges are often multi-dimensional
• Multi-D model can represent challenges, capabilities, mechanisms to
improve capabilities
• Capabilities in one dimension can’t satisfy inadequacies in another
• Mechanisms can influence | alleviate multiple dimensions
What are Programs
What are Programs
• “Data Structures + Algorithms = Programs” -Niklaus Wirth
software
• Codified Knowledge + Executable ideas = Software
• “Sneak peek into my morning cardio session. 15 minutes on the bike
at level 3 maintaining an rpm of 120 throughout then straight onto
the treadmill for 10 strides of 20 seconds each and step on the sides
for 10 seconds rest in between. 10 of these back to back at a speed of
19 km/hr and level 1 on incline. All of this using the altitude training
mask which makes it twice as hard. Train hard train smart. Wish
everyone a active and healthy day.”
• World isn’t simple, appears complicated but usually is complex.
perspective
• programming properly should be regarded as an activity by which the
programmers form or achieve a certain kind of insight, a theory, of
the matters at hand. This suggestion is in contrast to what appears to
be a more common notion, that programming should be regarded as
a production of a program and certain other texts.” - Peter Naur
perspective
• programming properly should be regarded as an activity by which the
programmers form or achieve a certain kind of insight, a theory, of
the matters at hand. This suggestion is in contrast to what appears to
be a more common notion, that programming should be regarded as
a production of a program and certain other texts.” -Peter Naur
Model building
• Order, dependencies, ‘instance of’, inheritance, happens before,
containment, occurs-at, concurrent with, atleast-once, atmost-once,
exactly-once, cardinality
World
People
Infra
Thinking in Models
Chinese whisper
Stack
Stack
• Any user can break the stack invariants(like the human in the Chinese
whisper)
Build domain models
• Data Model isn’t Domain Model
• Request | Response model isn’t Domain Model
• Anemic Domain Model vs Rich Domain Model
That vs How
• 5 * 6 => knowing that
• 47 * 78 => knowing how
Infrastructure
• “Infrastructure != Platforms. Platforms are business context aware” –
Raghu Hiremagalur
Partially complete
• Are platforms at app-level or infrastructure
Target checkout platform
• Different kinds of stores
• Different kinds of tenants
• Different kinds of experiences
home
Physical store
Guest Location
fulfilled by
store
Fulfilment center
mode
guest
assisted
payment
cash
Credit card
World
People
Infra
Platform Oriented Thinking
Ad-Review platform
• Write a reviewer
• Get routing, metrics, analytics, auditing for free
Why do we write software
• Power of software proportional to degree and dimension of
automation.
Fast Serve in CV
dumb
Modular programming
An example
Cstool
Cs-network
BAMReview-queue
AccessManager
UserSqlRepository
funp
Time
People
Money
Automation
UserGrants grants = whenNull(user.getGrants(), UserGrants::new);
UserGrants grants;
if(user.getGrants() != null)
grants = user.getGrants();
else
grants = new UserGrants();
public CsUser getCsUser(final String login) throws InternalException {
try {
List<CsUser> csUserList = _dBAutoCommitManager.execute(new DBExecCallback<List<CsUser>>() {
public List<CsUser> doExecute(DBExecContext dbExecContext) throws SQLException, TransactionException {
Object[] args = { login };
try {
return (List<CsUser>) dbExecContext.getJdbcTemplate().query(SQL_GET_CS_USER_BY_LOGIN, args,
new CsUserExtractor());
} catch (EmptyResultDataAccessException e) {
return null;
}
}
});
if (csUserList == null || csUserList.size() == 0) {
return null;
}
return csUserList.get(0);
} catch (TransactionException e) {
throw new InternalException("Error getting CS user by login, login=" + login, e);
}
}
Essence Over Ceremony
public CsUser getCsUser(@Nonnull final String login) throws InternalException {
return _userRepoMapper.wrap(
userRepository -> userRepository.byLogin(login).orElse(null),
"Error getting CS user by login, login=" + login
);
}
public <E> E wrap(CheckedFunction<UserRepository, E> mapper, String message) throws InternalException {
return ExceptionMapper.getOrError(() -> apply(mapper), message);
}
public <E> E apply(CheckedFunction<UserRepository, E> mapper) throws TransactionException {
return _workManager.unit(context -> mapper.apply(context.userRepository()));
}
private void updateRoles(RepositoryContext repoContext, CsUser user) {
OrgGrantRepository orgGrantRepository = …
OrgMappingRepository orgMappingRepository = …
UserRepository userRepository = …
String department = user.getDepartment;
Condition notEqual = field(“department”).notEquals(department).
..
orgGrantRepository.remove(new Specification(notEqual));
Set<Long> roleIds = orgGrantRepository.add(newGrants(orgMappingRepository.get(department), user));
user.setRoles(roleIds);
userRepository.update(user);
}
consumption
Org ManagementAudit Log
Access Manager
Unit of WorkRepository
Raising the level of Abstraction
• Identify a pattern and codify
• learning curve
Time
People
Money
Raising the level of abstraction
• Code is a medium of conveying knowledge between people.
knuth
• The Art of Computer Programming.
• “The main intention behind this approach was to treat a program as
literature understandable to human beings”
Write for readability
Time
People
Money
Write for readability
Modularity
• Responsibility Driven Design
• Domain Driven Design
• Test Driven Design
• Component Based design
• Functional Programming
• Logic programming
Theory vs practice
• Practice without theory is useless
• https://jamesclear.com/deliberate-practice-theory
• You think you know theory, until you practice
Day to day
Entropy
Number of elements
Simple
Complicated
Complex
complexify
simplify
Broken window theory
• is a criminological theory that states that visible signs of crime, anti-
social behavior, and civil disorder create an urban environment that
encourages further crime and disorder, including serious crimes.
• The theory suggests that policing methods that target minor crimes
such as vandalism, public drinking, and fare evasion help to create an
atmosphere of order and lawfulness, thereby preventing more
serious crimes.
Boy scout rule
• I never understand code when I read it, and when I do I want to
rewrite it
• When you raise an RB, when you review an RB
Tools
• Thinking in Models
• Platform(reuse) Oriented Thinking
• Modularity
• Human Centric Development
• Iterate
• Refactor
• Refine | throw away models

Powerful software linkedin