architecture and simplicity
play

Architecture and Simplicity UNC COMP 523 Wed Sep 9, 2020 Prof. - PowerPoint PPT Presentation

Architecture and Simplicity UNC COMP 523 Wed Sep 9, 2020 Prof. Jeff Terrell 1 / 31 announcements music today: Stuck in the Middle with You by Stealers Wheel, because maybe that's how components feel grades are up to date it's not too soon to


  1. Architecture and Simplicity UNC COMP 523 Wed Sep 9, 2020 Prof. Jeff Terrell 1 / 31

  2. announcements music today: Stuck in the Middle with You by Stealers Wheel, because maybe that's how components feel grades are up to date it's not too soon to start coding Architecture and Simplicity 2 / 31

  3. assignment checkin finish A3: user stories ☕☕ this week A4: clickable prototype ☕☕☕☕ due next week (you're equipped) A5: APPLES reflection 1 ☕ is easy and requires no equipping A6: application architecture ☕☕☕☕ and A7: architecture diagram ☕ are due the following week (4 cups might be a bit pessimistic for A6) last lecture and today I'm equipping you for A6 and A7 next lecture I'll start equipping you for A8: walking skeleton ☕☕☕☕☕ Architecture and Simplicity 3 / 31

  4. outline announcements assignment checkin architecture concepts architecture diagrams an architecture example the virtue of simplicity quiz 2 Architecture and Simplicity 4 / 31

  5. outline announcements assignment checkin architecture concepts architecture diagrams an architecture example the virtue of simplicity quiz 2 Architecture and Simplicity 5 / 31

  6. architecture concepts architecture describes the structure of something the thing being described is a system with multiple components system : a complex combination of multiple things working together, where each thing can affect others example: the electrical system of a house (notice how the lights dim with the A/C comes on?) example: the plumbing system of a house (similar effects on water pressure) example: living organisms, e.g. the human body component : part of a system, which necessarily interacts with at least one other component Architecture and Simplicity 6 / 31

  7. decomposing responsibility the system has some (perhaps large) set of responsibilities to accomplish decomposing the responsibilities helps us manage the complexity each component is responsible for (at least) one thing each component might depend on others to do their part typically these don't decompose like user stories but are "cross-cutting concerns" with respect to features each component's responsibility can probably be further decomposed Architecture and Simplicity 7 / 31

  8. boundaries with responsibilities defined, you can define an interface for one component to talk to its neighbor this is often called an application programming interface , or API contrast to user interfaces, or UI's, which connect a human user to a computer APIs are consumed by programs, not users might need to fine-tune and negotiate boundaries example: does backend simply serve the numbers and let the frontend compute the stats for display to the user, or does the backend compute the stats and the frontend merely displays the results? once a fully detailed interface is defined, both sides can be implemented in parallel (this is an example of the "pulling work to the front" aspect of project management) Architecture and Simplicity 8 / 31

  9. outline announcements assignment checkin architecture concepts architecture diagrams an architecture example the virtue of simplicity quiz 2 Architecture and Simplicity 9 / 31

  10. architecture diagrams "A picture is worth a thousand words." goal: visually document the composition of the system at a high level what components are there? what are they responsible for? which components talk to each other? target audience: your mentor, future devs, and me include icons/names of chosen technologies (which can concisely convey a lot of information) don't go overboard on details: if you change something and your diagram becomes wrong, that's maybe worse than not having one at all rule of thumb: if the system becomes unavailable or degraded by something becoming unavailable, that thing should appear in the diagram note where there is redundancy or multiplicity Architecture and Simplicity 10 / 31

  11. outline announcements assignment checkin architecture concepts architecture diagrams an architecture example the virtue of simplicity quiz 2 Architecture and Simplicity 11 / 31

  12. ex: client/server arch. for a web app 3 components: multiple clients (i.e. browsers, maybe running "frontend" code) the server (i.e. an always-on "backend" program listening for requests) the database (storing data persistently) if any of these things breaks, the system breaks/degrades note connections: clients don't speak to database directly Architecture and Simplicity 12 / 31

  13. Poll 13 / 31

  14. outline announcements assignment checkin architecture concepts architecture diagrams an architecture example the virtue of simplicity quiz 2 Architecture and Simplicity 14 / 31

  15. What is simplicity? (Much of this content is from Simple Made Easy , a talk by Rich Hickey.) Word origin: one fold or one braid Architecture and Simplicity 15 / 31

  16. Unity Unity of concept, role, or task Not necessarily just one instance or operation The idea: lack of interleaving, not cardinality Opposite: complex, which involves multiple distinct concepts tied together Simplicity is absolute , not relative (Remember from last time that easy is relative, not absolute) Architecture and Simplicity 16 / 31

  17. Why simplicity is superior (1) Reason 1: Understanding How many concepts can you hold in your mind at one time? 7, plus or minus 2 Complex things have multiple ideas and take up multiple slots in your attention Key idea: complexity undermines understanding Architecture and Simplicity 17 / 31

  18. Why simplicity is superior (2) Reason 2: Debugging What's true of every bug? it passed the type checker and the tests So: understanding is essential to debugging your program And complexity undermines this Architecture and Simplicity 18 / 31

  19. A simple tool Architecture and Simplicity 19 / 31

  20. A simple tool (mostly) Architecture and Simplicity 20 / 31

  21. A complex tool Architecture and Simplicity 21 / 31

  22. Another complex tool Farm Bot Architecture and Simplicity 22 / 31

  23. A simple, composable tool Architecture and Simplicity 23 / 31

  24. Simple physical tools They have a unity of purpose and of mechanism Therefore, you understand when and how to use them Architecture and Simplicity 24 / 31

  25. Complex physical tools You must read the manual You hope nothing goes wrong! Because debugging requires understanding You're probably not going to attempt to compose a complex tool with anything else Architecture and Simplicity 25 / 31

  26. An example: simple or complex? Unity of purpose, but not of mechanism Possibly a composition of simple parts Not easy (for me) to debug when there's a problem On the other hand, debugging is isolated to a subsystem Architecture and Simplicity 26 / 31

  27. Case study: Ruby on Rails Ease It truly is easy, and people love it Helped me get consulting work for many years Once you know it, you can develop a web backend rapidly "Emphasizing ease gives early speed [but] ignoring complexity will slow you down over the long haul." -Rich Hickey Architecture and Simplicity 27 / 31

  28. Case study: Ruby on Rails (2) Complexity There's a lot to know! "Convention over configuration"—but there are a lot of conventions It is hard to be productive until you know most of the conventions Even when productive, hard to know how things fit together, so can be difficult to extend things in new directions The ugly side of Rails: upgrading your app to a new version of Rails Lots of breakage. You do have a test suite, right? Difficult to ask clients to spend money on something they can't see Architecture and Simplicity 28 / 31

  29. Case study: frameworks vs. libraries Definitions A library is code that somebody else wrote that you invoke to help you with some aspect of your program. Example: a grid canvas to let you draw lines and points Example: a library to play occasional sound effects A framework is code that somebody else wrote that invokes your code Examples: Rails, Django, Angular.js, Ember.js, Flutter, React Native, Android, Java Spring, etc. Architecture and Simplicity 29 / 31

  30. Case study: frameworks vs. libraries Analysis frameworks tend to be difficult to understand they tend not to be simple you can sometimes function well without understanding...until you need to debug something or extend something a (single-purpose) library is like a physical tool: you know what it's for and when to use it frameworks are more like starting a new job: you must figure out what's expected of you, and although you might function OK on day 1, really getting it takes time Architecture and Simplicity 30 / 31

  31. outline announcements assignment checkin architecture concepts architecture diagrams an architecture example the virtue of simplicity quiz 2 Architecture and Simplicity 31 / 31

Recommend


More recommend