Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Timeless Way of Building

The Timeless Way of Building

"Design patterns" is a common phrase that is often spoken in the course of design and development of web applications. But it's genesis is not from programming, but Architecture. They come from a trio of books in the 1970s by Christopher Alexander, the most famous of which is the middle book: "A Pattern Language". The issue arises that Pattern Languages, much like spoken languages, are most effective when the speaker is fluent. We'll look at the origin of pattern languages and why they can be dangerous and even detrimental tools in the hands of the inexperienced designer and developer through examples of bad grammar and poor idiomatic choices (aka antipatterns), and perhaps some architecture as well.

John Athayde

June 15, 2013
Tweet

More Decks by John Athayde

Other Decks in Programming

Transcript

  1. A design pattern systematically names, motivates, and explains a general

    design that addresses a recurring design problem in object-oriented systems. It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. The solution is a general arrangement of objects and classes that solve the problem. The solution is customized and implemented to solve the problem in a particular context.
  2. “Design patterns help you identify less-obvious abstractions and the objects

    than can capture them. For example, objects that represent a process or algorithm don’t occur in nature, yet they are a crucial part of flexible designs.”
  3. “How can you distribute responsibility for design through all levels

    of a large hierarchy, while still maintaining consistency and harmony of overall design?” — M. J. Dominus 2002 ALEXANDER’S QUEST:
  4. DRY

  5. “Engineers frequently have to make decisions of great practical consequence

    in the face of incomplete and uncertain knowledge.” — Walter Vincenti ON ENGINEERS:
  6. D

  7. 2

  8. D

  9. class Customer < ActiveRecord::Base has_one :address has_one :account ... def

    state address.state end ... end @account.customer_state 2
  10. class RemoteProcess < ActiveRecord::Base scope :running, where(:state => ‘Running’) scope

    :system, where(:owner => [‘root’, ‘mysql’]) scope :sorted, order(“percent_cpy desc”) scope :top, lamda {|1| limit(1)} end RemoteProcess.running.sorted.top(10) RemoteProcess.running.system.sorted.top(5) sample from Rails Antipatterns pp 37 2
  11. <p> <% if location.present? %> Located in <%= @client.location %>

    <% else %> <span class="none">Location Unknown</span> <% end %> </p> 2
  12. 2

  13. 2

  14. “ design patterns are suggested approaches seen in the wild.

    - B R I A N H O G A N ” T H I S B E A R S R E P E A T I N G :
  15. “The best way to learn to write simple code is

    to write simple code! Patterns, like all forms of complexity, should be avoided until they are absolutely necessary. That’s the first thing beginners need to learn. Not the last thing. ” — Je Atwood c. 2005
  16. “ You cannot say that you are correctly applying a

    design pattern unless you are confronting the problem that the pattern is supposed to solve – R U S S O L S O N ”
  17. “...mediocre developers never even ask why. They just arrive at

    the first solution that works and keep plowing ahead.” — Je Atwood, c.2005
  18. “Indeed this ageless character has nothing, in the end, to

    do with languages. The language, and the processes which stem from it, merely release the fundamental order which is native to us.” — The Timeless Way of Building, Chapter 27
  19. “They do not teach us, they only remind us of

    what we know already, and of what we shall discover time and time again, when we give up our opinions, and do exactly what emerges from ourselves.” — The Timeless Way of Building, Chapter 27
  20. “To make a building egoless, the builder must let go

    of all his willful images, and start with a void. You are able to do this only when you no longer fear that nothing will happen, and you can therefore afford to let go of your images. At this stage, the building’s life will come directly from your language.” — The Timeless Way of Building, Chapter 27
  21. “Yet , at the very moment when you first relax,

    and let the language generate the buildings in your mind, you will begin to see how limited your language is. One place can have good patterns in it and be dead. Another place can be without the patterns which apply to it, and yet still be alive. ” — The Timeless Way of Building, Chapter 27
  22. “The pattern ALCOVE–which first functioned as an intellectual crutch–is no

    longer necessary to you. You see reality directly, like an animal. You make the alcove as an animal might make an alcove–not because of the concept– but directly, simply because it is appropriate.” — The Timeless Way of Building, Chapter 27