Mohammad Ali is Bad

You know I’m bad.
Just last week, I murdered a rock,
Injured a stone, Hospitalized a brick.
I’m so mean, I make medicine sick.
I’m so fast, man,
I can run through a hurricane and don’t get wet.
When George Foreman meets me,
He’ll pay his debt.
I can drown the drink of water, and kill a dead tree.
Wait till you see Muhammad Ali.

Bertrand Russell, Humanity, and Logic

Bertrand Russell (1872 – 1970) was a British philosopher, logician, and social critic. He won the Nobel Prize in literature for his humanitarian ideals, discovered the Russell’s Paradox, and co-authored the Principia Mathematica.

Russel’s final political statement was to condemn Israeli aggression in the Middle East, and was presented in a conference in Cairo, one day after his death.

No nation was ever so virtuous as each believes itself, and none was ever so wicked as each believes the other.

This quote reminds me of an excellent TED talk on empathy.

Feature-Centric Design Pattern

The biggest cause for code smell is to under-think your software architecture, and more tangibly, the design patterns in use. Any decent software developer will tell you that there is no silver bullet when it comes to choosing a design pattern, and as such, we often have to choose from off-the-shelf architectures or improvise our own.

In this post I want to share with you a design I found myself using in several projects. I will temporarily refer to it as Feature-Centric Design Pattern (if you have a more creative name please share) and it is becoming especially handy in single-page JavaScript applications.

In its most simple form, a Feature-Centric Design Pattern consists of two areas (or namespaces): Core Classes and Features.

Core Classes

These will consist of any overlapping system/infrastructural functions, namely:
Bootstrapper, used to register features by specifying the name of the feature to be included on startup, and includes the code to load and initialize each feature.
Controller, used as a non-domain-specific orchestrator, for example calling the bootstrapper at startup, showing or hiding views which are loaded from features, etc.
Settings class is just an example of another centralized and generic function, used by features to write or read settings, such as the state of a control or last computed value, etc.


A feature is encapsulated in its own folder and behaves like a separate ecosystem. Ideally, a feature will follow an MVC pattern, hosting all three layers (models, views, and controller) or sometimes HTML, CSS, and JavaScript. A feature is able to listen to events, request the Controller to reveal a specific view, or make use of the Settings helper. All features are registered in the Bootstrapper class, otherwise they will not be loaded.

Also To Consider

I like to have three other areas (or folders) in addition to the two above: libs for libraries such as jQuery and underscore, plugins for self-contained functionality that is not domain-specific, such as shared custom buttons, and finally, a resources folder for the assets. In the Core namespace I also create a Feature class to be extended by all features to help keep things consistent. Click here for for a screenshot showing the structure of my current project.

Why is this good?

This architecture is not for everyone. The greatest benefit is the unparalleled single responsibility and loose coupling. For example, if you have a “Welcome” screen, all the views and logic will be in that one folder/namespace, significantly reducing the risk of bloated controllers. This works great for small and lean applications, especially mobile applications, where you can conceptualize different screens as different features.

Why is this bad?

Have you noticed how all of this is not domain-model friendly? If you plan on having a lot of models and/or complicated workflows, this design is not for you. If your features (i.e. components) need to continually communicate and are highly dependent on each other, consider a different architecture. Plus be mindful of the lack of testing frameworks.

The Road Ahead

I have been using this in the development of one of my mobile apps, based on PhoneGap and HTML/CSS/JS and so far it has been a great success. I am tweaking and improving as I progress. I am posting this to gauge feedback and based on thatI am considering creating a framework. The framework I am proposing will be based on PhoneGap and will only give developers an underlying architecture to dictate how things should be arranged (to be clear: I am not proposing a UI framework like jQuery Mobile , but an underlying design, like Rails) – what do you think?

نقطة زرقاء باهتة

نقطة زرقاء باهتة هو إسم لصورة, إلتقطتها المركبة الفضائية فوياجر 1 لكوكب الأرض, على بعد مسافة ستة بلايين كيلومتر, و بينما كانت تقترب من إطار مجموعتنا الشمسية, أمرت ناسا المركبة أن تدير كاميرتها لتأخذ صورة لكوكب الأرض من بعدها القياسي, بناءاً على طلب من العالم الفلكي كارل سيجان.

أسم الصورة كان أيضاً عنوان كتاب لـكارل سيجان, و قال فيه:

من نقطة النظر هذه قد لا تبدو الأرض ذات أهمية خاصة. لكن بالنسبة لنا, الأمر مختلف. أنظر للنقطة مرة أخرى. إنها هنا! إنها الوطن! إنها نحن!

عليها كل من تحب, كل من تعرف, و كل من سمعت عنه. كل كائن وُجد طوال التاريخ, عاش حياته هناك. محصلة كل الأفراح و الأحزان. ألوف الأديان و النظريات و مذاهب الحياة. كل صياد و قاتل. كل بطل و جبان. كل خالق و هادم لحضارة. كل ملك و فلاح. كل شابين عاشقين. كل أم و أب. طفل ذي أمل, مخترع و مكتشف, كل ناشر لخلقِ حميد, كل سياسي فاسد, كل نجم سنمائي, كل قائد عظيم, كل قديس و آثم في تاريخ وجود كائننا البشري, عاشوا هناك.

على ذرة من غبار, عالقة في شعاع شمسي.

لسيت الأرض سوى بقعة صغيرة للغاية في مسرح كوني عظيم. تفكر لوهلة في أنهار الدماء التي أراقها جنرالات الحرب و أباطرتها, لينتصروا و يصبحوا أسياد لحظيين, على جزء عشري من نقطة. تفكر بالقسوة التي ملأت قلب شعب عاش على إحدى زوايا هذه النقطة, ليغور و يتغلب على شعب آخر, عاش على زاوية أخرى منها, و أنت بالكاد تستطيع التمييز بينهم.

The Life of Hide & Seek

As I was searching for Hide & Seek by Imogen Heap, I couldn’t help but notice the overwhelming display of combinatorial creativity. Here’s a quick list of remixes labeled by their creators:

  1. Roksonix, Dubstep
  2. Murdock, Dubstep
  3. Enigma, Dubstep
  4. Tiesto, Techno
  5. Mt. Eden, Dubstep
  6. Afrojack, House
  7. Otto Knows Bootleg, Techno
  8. Ozo
  9. Enmass
  10. Avicii, House

This should become a publicly accessible KPI for all works of music…