Jump to content

ATK Design Principles

From NusaATK
Revision as of 14:07, 23 December 2009 by bahtiar (talk | contribs)

ATK follows a number of design principles. Understanding these principles will help you understand how ATK works and will help you create applications more efficiently.

The Hollywood Principle

Most frameworks consists of components that have an API that allows you to invoke certain functionality. While of course ATK has these APIs as well, the most important parts of the framework follow what is called the so-called 'Hollywood Principle'.

The 'Hollywood Principle' gets its name from the process of recruiting actors for movies. At the end of a screening, the candidates would hear "Don't call us, we'll call you". For ATK, this means that the main application flow is not run by you as the developer of an application, but by ATK itself. To do its work, ATk will then call methods in your classes to get things done.

I.e. instead of you saying "hey present me a form" to ATK, ATK will turn things around. ATK knows when it needs to present a form, so instead it will say to you "I'm going to present a form; give me the fields you want to have in the form"

This makes ATK very powerful, but also slightly confusing to novice developers. They're not accustomed to this 'inversion of control', and furthermore, documenting the framework is a bit more difficult.

Code Minimization

We are lazy developers. This means we don't like to write too much code. ATK is completely focused on getting as much done as possible, using as few lines of code as possible. So instead of giving you many objects that can do an enormous amount of things for you, we have a very minimal API that does things that you might expect from a CRUD application, because in the end, most applications work more or less the same. This means that we do not only abstract features, we abstract the whole concept of an application. This is why we can have the slogan 'an application in 10 lines of code'. You only code what makes your app different from other apps. (In other words, you can focus on your business logic). Security, form building, session handling, templating; all of that is 'been there, done that' for most developers anyway, so ATK takes care of all of this for you.

Assumption Driven Development

To be able to minimize code, ATK adheres to what we call 'assumption driven development'. We assume a lot. We assume that when you build a CRUD application, you want to have a list of records with edit and delete buttons. We assume that if you make a field unique that you'll want to let the user know if he violates this, we'll assume that you'll want a calendar when you edit a date field. Or even for small internal details. Like "I'm assuming that if you want to hide a field for the user, that we can leave it out in the query that retrieves your record".

ATK basically says "look, I'm going to assume you'll want to have things this way; tell me if you want things otherwise". This principle makes ATK very Rapid, because if you don't tell it to change its assumptions, it will assume things in such a way that it can build an app for you.

ATK then provides an enormous amount of Hooks that you can implement to change its behaviour.