in Back to PHP

My Way to PHP: Day 16 of 75

Great, day 16. Today, I want to hit my goal of reading 50 pages. I’m currently at the start of Chapter 20. 50 Pages is actually just short of the index. Cool!


Command Processor

Uniform interface for commands, allows undo

  • CommandObject: Represents the command
  • Controller: Takes user input and creates CommandObjects
  • Command processor: Executes CommandObject
  • Supplier: Helps CommandObject

View Handler

Manages views

  • View Handler: open, close, update, split, etc.
  • Views
  • Supplier: data sources for views

Forwarder-Receiver

Sending something over I/O

  • Forwarder: Forwards a message from a peer, packages it and sends it to a receiver
  • Receiver: Watches for message, unpacks it and delivers it to a peer

Dispatcher

Provides a name service

  • Light weight Broker
  • Client: sends name resolution, does request for itself
  • Dispatcher: looks up name, returns channel
  • Server

Publisher-Subscriber

  • Light weight observer
  • Publisher: publish, holds subscriptions
  • Subscriber: updates

Part 5, last part.

Some patterns the author thinks you need to know:

  1. Special case / Null Object: Two classes normal case and special case inherits
  2. Do Food: Talking with people is easier with food
  3. Leaky Bucket Counter: Count how many warnings/problems you had, instantiate action when a threshold is reached
  4. Release Line: Different branches for different versions, merge bug fixes over different branches
  5. Architects also implement!

The last two chapters are about books about pattern and writing your own patterns.

One last word from the author:

Please don’t hype patterns, though. I remember too well the days when we were told that “[pick your innovation] would save the world,” only to later find that, although it was a useful tool, it wasn’t the last word in software.


Wow, that was surprisingly good! Really great book! It was completely different to the other pattern books. Less emphasis on the ‘coding’ part and more learning about the problem and a general view on implementing them. I also liked that it doesn’t just contain design patterns. Recommended!


I think for the sake of completeness it would be a good idea to write individual posts for all the books I read in the past 2 weeks. Let’s do this!

So, I’ve written the first 4 super short reviews. I’ll probably write a few more the next days. Also I’m going to write these immediately after I read the book.

And I’ve written the last 6 ones. I also noticed that I have a big backlog of notes on books from this year. I’ll probably publish them when my Way to PHP get shorter.


After my new view on patterns I looked for books related to the last one and found Elemental Design Patterns by Jason McColm Smith. I don’t know much about the book but the reviews were good.

  • Elemental Design Patterns (EDP) collection of fundamental programming ideas

The idea is to find the underlying principles which I quite like. I think SOLID captures most principles pretty good but I’m open for a better way.

Tribal wisdom is what design patterns were intended to collect. Sadly, they are frequently (mis)treated as tribal mythology, by applying the how without a clear comprehension of the why.

n.c.

As I read his first and, at least within the software engineering community, least-cited treatise on design patterns, Notes on the Synthesis of Form, I realized something important had been lost: patterns are concepts, not constructs

n.c.


He reduced the list of interesting elements of programming to:

  • Objects
  • Methods
  • Fields
  • Types

Then he looks on how similar objects and methods are. Which brings us to the last part the design space.

objectmethodThat’s rather interesting. He looks at the similarities of objects and functions and so creates a taxonomy of EDPs:

  • Recursion: one method of one object, e.g. tree traversal
  • Delegation: several methods of several objects, e.g. managers
  • Redirection: similar method of several objects, e.g. proxy
  • Conglomeration: several methods of one object, e.g. run()

Now, he compares object similarity with object type similarity.

objecttypeThe names are pretty self-explaining.


Chapter 3: Pattern Instance Notation (PIN)

The idea is to create a simpler notation for patterns.

PINbox: represents a single pattern instance

It has a name (name of the pattern) and is surrounded by a thick gray border which can include the collaborators of a pattern. It’s pretty neat and easy to read.


Chapter 4: Working with EDPs

Here he shows how to construct a new pattern from other patterns. He used the PINbox for that and it really shows its beauty. Once, the idea of the PINboxes are great. Secondly, I love how he constructs things from smaller things. Like the lambda calculus.

He defends his approach but I think it’s better than the current one. Simplicity and abstraction hinders someone from thinking too much in implementation but supports thinking in concepts.

The section on refactoring is super interesting. He shows how a simple refactoring of extracting the method changes the EDP. His approach sounds like some deep insight for static code analysis.

I really wonder how that idea will develop over time and if we see production ready systems which help to refactor code on a design level in the next 10 – 20 years. That would be insane.


Chapter 5 presents a catalogue of EDPs. Chapter 6 then introduces intermediate pattern which are made up of EDPs but are useful for more ‘traditional’ design patterns.

  • Fulfill Method Provides implementation of abstract interface.
  • Retrieve New returns a new object
  • Retrieve Shared returns a reference to a shared object
  • Objectifier a collection of fulfill methods on the same abstract interface
  • Object Recursion Trusted recursion (polymorphic) on a objectifier

Chapter 7: Gang of Four Pattern Compositions. I really like the examples in this (short) chapter. He shows how you can use EDPs and intermediate patterns to create GoF patterns. The examples are simple and understandable. Especially interesting was the similarity between patterns which matched my observation of the past.

I really felt that understanding these basic elements helped me to gasp the idea of pattern better. It also gave me insight into some of my observations. I felt that I had missed something but the more I read about all the stuff the more I see that there are people trying to make patterns mysterious but really they aren’t.

The last chapter, which is the appendix covers the rho-calculus. I didn’t go into that. Maybe when I have some interest in it but not know.

Nonetheless, the book was really good!


So, I spent some time again on my project. It’s taking shape. The organization is now a bit better. I started to write the README file. It’s pretty good now. Just a few tweaks then I can test it on my live server.


I wanted to watch one talk today and just decided to take the oldest in my watch list:

The first 200 milliseconds of HTTPS

  • TLS does automatic validation
  • Not every TLS is encrypted theoretically
  • Client shows cipher options, server decides
  • ssllabs.com to test your SSL configuration!
  • Servers can request a certification from the client
  • Add perfect forward secrecy (PFS)

Really good talk!


The speaker was quite opinionated on CAs. Here’s a discussion I recommend on that topic featuring Whitfield Diffie and Moxie:


Updates Goals:

  • Get a bit more exposure to OOP and OOD
  • Learn a bit more about MySQL
  • Learn Symfony2
  • Write at least one web app using Symfony2 and its core components (templating, testing, forms, validation, security, caching, i18n)
  • Watch one video per day on average

Progress status

Done

  • Reading Pattern-Oriented Software Architecture For Dummies [done]
  • Reading Elemental Design Patterns [done]
  • Writing short reviews for books that I read

In Progress

  • Watch one video per day on average [42 of 75]

Write a Comment

Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.