1 / 66

The Architecture of Uncertainty

Presented at NDC 2013 in Oslo (13th June 2013) <br>Video available on Vimeo: https://vimeo.com/68331684 <br><br>Ralph Johnson defined architecture as "the decisions that you wish you could get right early in a project, but that you are not necessarily more likely to get them right than any other". Given our inability to tell the future how can we design effectively for it? Much project management thinking is based on the elimination of uncertainty, and advice on software architecture and guidance for future-proofing code often revolves around adding complexity to embrace uncertainty. In most cases, this is exactly the opposite path to the one that should be taken. <br><br>The talk looks at how uncertainty, lack of knowledge and options can be used to partition and structure the code in a system.

Kevlin
Télécharger la présentation

The Architecture of Uncertainty

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The Architecture of Uncertainty @KevlinHenney

  2. When a design decision can reasonably go one of two ways, an architect needs to take a step back. Instead of trying to decide between options A and B, the question becomes "How do I design so that the choice between A and B is less significant?" The most interesting thing is not actually the choice between A and B, but the fact that there is a choice between A and B. Kevlin Henney "Use Uncertainty As a Driver"

  3. We have tried to demonstrate by these examples that it is almost always incorrect to begin the decomposition of a system into modules on the basis of a flowchart. We propose instead that one begins with a list of difficult design decisions or design decisions which are likely to change. Each module is then designed to hide such a decision from the others. David L Parnas "On the Criteria to Be Used in Decomposing Systems into Modules"

  4. struct Date { int year, month, day; };

  5. struct Date { int days_since_epoch; };

  6. class Date { public: ... private: ... };

  7. Public APIs, like diamonds, are forever. Joshua Bloch "Bumper-Sticker API Design" http://www.infoq.com/articles/API-Design-Joshua-Bloch

  8. public class RecentlyUsedList { private IList<string> items = new List<string>(); public int Count { get { return items.Count; } } public string this[int index] { get { return items[index]; } } public void Add(string newItem) { if(newItem == null) throw new ArgumentNullException(); items.Remove(newItem); items.Insert(0, newItem); } ... }

  9. public class RecentlyUsedList : List<string> { public override void Add(string newItem) { if(newItem == null) throw new ArgumentNullException(); items.Remove(newItem); items.Insert(0, newItem); } ... }

  10. public class RecentlyUsedList : List<string> { public new void Add(string newItem) { if(newItem == null) throw new ArgumentNullException(); items.Remove(newItem); items.Insert(0, newItem); } ... }

  11. public class RecentlyUsedList { public RecentlyUsedList() { Items = new List<string>(); } public List<string> Items { get; private set; } public void Add(string newItem) { if(newItem == null) throw new ArgumentNullException(); Items.Remove(newItem); Items.Insert(0, newItem); } ... }

  12. public class RecentlyUsedList { private IList<string> items = new List<string>(); public int Count { get { return items.Count; } } public string this[int index] { get { return items[index]; } } public void Add(string newItem) { if(newItem == null) throw new ArgumentNullException(); items.Remove(newItem); items.Insert(0, newItem); } ... }

  13. public class RecentlyUsedList { private IList<string> items = new List<string>(); public int Count { get { return items.Count; } } public string this[int index] { get { return items[Count – index - 1]; } } public void Add(string newItem) { if(newItem == null) throw new ArgumentNullException(); items.Remove(newItem); items.Add(newItem); } ... }

  14. All architecture is design but not all design is architecture. Architecture represents the significant design decisions that shape a system, where significant is measured by cost of change. Grady Booch

  15. Architecture is the decisions that you wish you could get right early in a project, but that you are not necessarily more likely to get them right than any other. Ralph Johnson

  16. Analysis Design Code Test

  17. Analysis Design Code Test

  18. Analysis Design Code Test

  19. Walking on water and Walking on water and developing software developing software from a specification from a specification are easy if both are are easy if both are frozen. frozen. Edward V Berard

  20. Expert Expert Proficient Proficient Competent Competent Advanced Beginner Advanced Beginner Novice Novice

  21. The "defined" process control model requires that every piece of work be completely understood. Given a well- defined set of inputs, the same outputs are generated every time. Ken Schwaber Agile Software Development with Scrum

  22. The empirical process control model, on the other hand, expects the unexpected. It provides and exercises control through frequent inspection and adaptation for processes that are imperfectly defined and generate unpredictable and unrepeatable results. Ken Schwaber Agile Software Development with Scrum

  23. Design Design Design Design

  24. Design

  25. Programming is a design activity. Jack W Reeves "What Is Software Design?"

  26. Coding actually makes sense more often than believed. Often the process of rendering the design in code will reveal oversights and the need for additional design effort. The earlier this occurs, the better the design will be. Jack W Reeves "What Is Software Design?"

  27. Properly gaining control of the design process tends to feel like one is losing control of the design process.

  28. In 1990 I proposed a theory, called Worse Is Better, of why software would be more likely to succeed if it was developed with minimal invention.

  29. It is far better to have an underfeatured product that is rock solid, fast, and small than one that covers what an expert would consider the complete requirements.

  30. interface Iterator { boolean set_to_first_element(); boolean set_to_next_element(); boolean set_to_next_nth_element(in unsigned long n) raises(…); boolean retrieve_element(out any element) raises(…); boolean retrieve_element_set_to_next(out any element, out boolean more) raises(…); boolean retrieve_next_n_elements( in unsigned long n, out AnySequence result, out boolean more) raises(…); boolean not_equal_retrieve_element_set_to_next(in Iterator test, out any element) raises(…); void remove_element() raises(…); boolean remove_element_set_to_next() raises(…); boolean remove_next_n_elements(in unsigned long n, out unsigned long actual_number) raises(…); boolean not_equal_remove_element_set_to_next(in Iterator test) raises(…); void replace_element(in any element) raises(…); boolean replace_element_set_to_next(in any element) raises(…); boolean replace_next_n_elements( in AnySequence elements, out unsigned long actual_number) raises(…); boolean not_equal_replace_element_set_to_next(in Iterator test, in any element) raises(…); boolean add_element_set_iterator(in any element) raises(…); boolean add_n_elements_set_iterator( in AnySequence elements, out unsigned long actual_number) raises(…); void invalidate(); boolean is_valid(); boolean is_in_between(); boolean is_for(in Collection collector); boolean is_const(); boolean is_equal(in Iterator test) raises(…); Iterator clone(); void assign(in Iterator from_where) raises(…); void destroy(); };

  31. interface BindingIterator { boolean next_one(out Binding result); boolean next_n(in unsigned long how_many, out BindingList result); void destroy(); };

  32. Speculative Generality Brian Foote suggested this name for a smell to which we are very sensitive. You get it when people say, "Oh, I think we need the ability to do this kind of thing someday" and thus want all sorts of hooks and special cases to handle things that aren't required. The result often is harder to understand and maintain. If all this machinery were being used, it would be worth it. But if it isn't, it isn't. The machinery just gets in the way, so get rid of it. Martin Fowler Refactoring

  33. The best route to generality is through understanding known, specific examples and focusing on their essence to find an essential common solution. Simplicity through experience rather than generality through guesswork. Kevlin Henney "Simplicity before Generality, Use before Reuse"

  34. We can find generality and flexibility in trying to deliver specific solutions, but if we weigh anchor and forget the specifics too soon, we end up adrift in a sea of nebulous possibilities, a world of tricky configuration options, long-winded interfaces, and not- quite-right abstractions. Kevlin Henney "Simplicity before Generality, Use before Reuse"

  35. You have a problem. You decide to solve it with configuration. Now you have <%= $problems %> problems! Dan North https://twitter.com/tastapod/status/342935892207497219

  36. typedef ... string;

  37. template< typename char_type, typename traits, typename allocator> class basic_string; Trying effective memory management of a container whose representation and management is not fully open to you is like eating with a knife and fork... held with chopsticks... through mittens. Kevlin Henney, "Distinctly Qualified"

  38. Henney's Hypothesis For each additional required template parameter, the potential number of users is halved. Matthew Wilson Extended STL

  39. If you have a procedure with ten parameters, you probably missed some. Alan Perlis

  40. Prediction is very difficult Prediction is very difficult, especially about the future. Niels Bohr

More Related