Tuesday, January 15, 2013

Code Today's Requirements Today

In Part 1 of this series, Do You Know What Day It Is? (written a mere 6 months ago, I really ought to update this blog more often), we looked at Ken's First Law of Architecture:

Today's Constant is Tomorrow's Variable


If you do not know this, there are two mistakes you can make.

Mistake 1: You Ain't Gonna Need It


Mistake 1 is creating a variable, option, switch, parameter, or other control for something which as far as we know for today is a constant.  You can avoid this principle if you remember that You Ain't Gonna Need It.

It is this simple: you can invent an infinite number of variables that the user may wish to control in the future, but the chance of guessing which ones they will actually want to control is near zero.  It is a total complete waste of time.

Let's take an example.  Imagine you are asked to do a task.  Any task.  It does not even have to be programming.  The task will be loaded with points where programmers invent decisions that nobody asked them to make.  For example, consider this blog post.

1) Should I have used a different background color up there in that green box?
2) Should I have used a sub-section heading by this point, maybe I should go back and do that?
3) Should this list be numbered or maybe just bullets instead?

Notice that this list is kind of arbitrary.  I did not think of it very hard, I just made up those questions.  Another person might have made up different questions.  The problem is that the list never ends.

This can never be eradicated, it is fundamental to the human condition.  Well meaning individuals will raise irrelevancies in an effort to be helpful and the rules of polite society work against weeding these out.  Committees will put two heads on a horse and you will end up with a bunch of YAGNI options.  But we can still fight against them.

Mistake 2: Constants in Code - Nobody Does That!


It is possible to go the other way, which is to embed constants into your code so that when you need to change them you find it is expensive, difficult and error prone.  Most of us learn not to do this so early that it seems unthinkable to us.  Why even write a blog post about it in 2013?

Well the very good reason to write about it is that we all still embed "constants in code" in ways that we never think about.

For example, if you are using a relational database, then the structure of your table is a "constant in code", it is something that is woven through every line.  Your code "knows" which tables are in there and what columns they have.  When you change the structure you are changing something very much "constant" in your system.   This is why it is so important to use a lot of library code that itself reads out of data dictionaries, so that you have removed this particular "constant in code."

The great problem here is that we cannot see the future, and you never think that a basic feature of your system is an embedded constant in code.  In a simpler period in my life a system lived on a server.  One server, that was it, who ever heard of a server farm?  That was a constant: number of servers=1, and all of my code assumed it would always be true.  I had to weed out that constant from my code.

Those who understand this basic inability to see the future are most at risk of slipping into over-generalization and generating YAGNI features.  It is an attempt to fight the very universe itself, and you cannot win.

Keep it Simple, Keep it Clean


In the end you can only write clean code, architect clean systems, follow the old knowledge and be the wise one who learns to expect the unexpected.

13 comments:

Danilo Piazzalunga said...

Very insightful, as always.

Geoff said...

Both lines of reasoning make sense, but don't they directly conflict with each other? Wouldn't YAGNI argue that if you don't need multiple servers today, you shouldn't code as if you do?

How do you decide when to apply one principle or the other?

Charlene said...

Great!

Joshua Thai said...

Fact!!! Thanks for sharing complete point…one more company has articles about Webdesign Agenter website pixo web design.

Finn said...

Your argument is excellent!! Unique points in the same, here one more website I like joomla development company.

all white said...

I really appreciated with your content and completely agree with you, here also I was visit a company website Digital zona.

Affity Solutions said...

Thanks for your ideas. You can also find the details on Affity Solutions, at the System Programming. The main object of the Affity Solutions is to provide quality web services and is among the few software development company in Nagpur.

Tegar Fajar said...

Prediksi Bola | Judi Online | Bursa Taruhan Casino | Taruhan Bola
Judi Bola Terpercaya | Bandar Bola Online | Agen Taruhan
Prediksi Bola | Judi Online | Agen Casino | Taruhan Bola
Casino Online | Agen Bola | Prediksi Dan Berita Sepakbola
Agen Bola Online | Bandar Bola | Agen Casino| Situs Judi
Agen Bola | Taruhan Online | Bandar Judi Terpercaya
Agen Bola | Taruhan Bola Online | Agen Casino Terpercaya
Taruhan Bola | Judi Online | Agen Casino Terpercaya
Agen Bola Online, Situs Judi Casino Online, Bandar Taruhan Bola
Agen Casino | Judi Online | Bursa Taruhan | Bandar Bola
Agen Judi Bola | Bandar Bola Online | Casino Online
Informasi Terupdate | Sumber Berita | Sumber Inspirasi
Berita Terbaru | Inovatif
Berita Bola | Prediksi Bola Jitu
Hanya Untuk Anda Pecinta Dunia Maya
Info Masa Depan | Ulas Bola Hari Ini
Info Terupdate | Berita Inovatif | Berita Pilihan
Prediksi Skor | Berita Bola | Jadwal Bola
Prediksi Bola | Pasaran Bola | Berita Bola Online
Informasi Terkini | Prediksi Dan Berita Sepakbola
Info Berita Terbaik | Bursa Taruhan
Berita Terhangat | Info Masa Depan
Berita Terupdate | Sumber Berita
Hasil Skor | Prediksi Bola Terpercaya
agen texas poker dan domino
bola pelangi agen bola sbobet
Judi Online
Taruhan Bola
Agen Casino
Bandar Bola
Agen bola, poker, judi on-line, Prediksi bola, togel

Tegar Fajar said...

Prediksi Bola | Judi Online | Bursa Taruhan Casino | Taruhan Bola
Judi Bola Terpercaya | Bandar Bola Online | Agen Taruhan
Prediksi Bola | Judi Online | Agen Casino | Taruhan Bola
Casino Online | Agen Bola | Prediksi Dan Berita Sepakbola
Agen Bola Online | Bandar Bola | Agen Casino| Situs Judi
Agen Bola | Taruhan Online | Bandar Judi Terpercaya
Agen Bola | Taruhan Bola Online | Agen Casino Terpercaya
Taruhan Bola | Judi Online | Agen Casino Terpercaya
Agen Bola Online, Situs Judi Casino Online, Bandar Taruhan Bola
Agen Casino | Judi Online | Bursa Taruhan | Bandar Bola
Agen Judi Bola | Bandar Bola Online | Casino Online
Informasi Terupdate | Sumber Berita | Sumber Inspirasi
Berita Terbaru | Inovatif
Berita Bola | Prediksi Bola Jitu
Hanya Untuk Anda Pecinta Dunia Maya
Info Masa Depan | Ulas Bola Hari Ini
Info Terupdate | Berita Inovatif | Berita Pilihan
Prediksi Skor | Berita Bola | Jadwal Bola
Prediksi Bola | Pasaran Bola | Berita Bola Online
Informasi Terkini | Prediksi Dan Berita Sepakbola
Info Berita Terbaik | Bursa Taruhan
Berita Terhangat | Info Masa Depan
Berita Terupdate | Sumber Berita
Hasil Skor | Prediksi Bola Terpercaya
agen texas poker dan domino
bola pelangi agen bola sbobet
Judi Online
Taruhan Bola
Agen Casino
Bandar Bola
Agen bola, poker, judi on-line, Prediksi bola, togel

Tegar Fajar said...


Info Skor Hari Ini | Update Bola
Prediksi Online | Bursa Taruhan Bola
Berita Terkini | Informasi Akurat Berimbang
Jadwal Dunia Sepak Bola | Prediksi Skor
Dapatkan Info Berita Bola Terbaru
Informasi | Berita Terbaru Era Masa Kini
Harian Bola | Bursa Online dan Berita Bola
Info Terakurat dan Terpercaya
Opini Info Terkini
Info Terkini | Kumpulan Informasi
Info Online | Berita Bola | Prediksi Skor | Cerita Dewasa
Semua Tentang Bola dan Khusus Dewasa
Portal Berita Bola | Prediksi Skor
Berita Informasi Terkini | Harian Bola | Ulas bola
Info Akurat | Prediksi Bola - Berita Bola - Jadwal Bola
Info Berita Bola | Prediksi Skor | Cerita Dewasa
Sumber Informasi Terkini | Cerita Dewasa
Berita Akurat Bola | Cerita Sex dan Foto Bugil | Prediksi Bola
Info Akurat | Cerpen Dewasa | Foto Seksi
Info Bola | Bursa Bandar Bola | Dewasa News
Prediksi Bola Malam | Berita Bola
Berita Baru dan Selalu Update
Informasi Terkini | Prediksi Dan Berita Sepakbola
Berita Terkini Dan Terpecaya
Bocoran Togelria.com | Prediksi Togel Singapura | Hongkong | Macau
Info Asia Skor | Prediksi Skor | Berita Bola
Info Berita | Prediksi Skor | Berita Bola | Tips Dan Trik
Ulas Bola Hari Ini | Prediksi Skor | Jadwal Bola
Agen Bola Sbobet
Agen Bola Sbobet - Judi Online | Bursa Taruhan Bola
Agen Bola Terpercaya | Judi Bola | Taruhan Bola Indonesia

Tegar Fajar said...



Buahpoker.com Agen Poker Domino Online Uang Asli Tanpa Robot
BUNDAPOKER.COM Agen Texas Poker dan Domino Online Indonesia Terpercaya
DaunPoker.Net Agen Poker Domino Online Indonesia Terbaik Terbesar dan Terpercaya
SaranaPoker.COM Agen Texas Poker Dan Domino Online Indonesia
GLOBALBOLA.COM Agen Bola Piala Dunia 2014 SBOBET IBCBET Casino Poker Tangkas Togel Online Terbaik Terbesar Dan Terpercaya
Buahpoker.com Agen Poker Domino Online Uang Asli Indonesia Terpercaya Tanpa Robot
DAUNPOKER.NET AGEN POKER DOMINO ONLINE INDONESIA TERBAIK TERBESAR DAN TERPERCAYA
Buahpoker.com Agen Poker Domino Online Uang Asli Indonesia Terpercaya Tanpa Robot
Daunpoker.net Agen Poker Domino Online Indonesia Terbaik Terbesar Dan Terpercaya
BUNDAPOKER.COM AGEN TEXAS POKER DAN DOMINO ONLINE INDONESIA TERPERCAYA
SARANAPOKER.COM AGEN TEXAS POKER DAN DOMINO ONLINE INDONESIA TERPERCAYA

Rafatta 99 said...

wow artikelnya HOT bagus bagus... tetap lanjut...
saya lg blogwolking klo berkenan kunjungi website saya... min... terimakasih

Agen Vimax Asli Original Canada.
KLG Pills Obat Pembesar Penis.
Vigrx Plus Obat Pembesar Penis.
Vimax Obat Pembesar Penis.
Vakum Pembesar Penis.
Boneka Full Body.
Penis Ikat Pinggang.
Obat Kuat Maximum.
Obat Kuat Viagra USA.
Vagina Senter.
Perangsang Potenzol.
Vakum Pembesar Payudara.
Penis Tekuk Manual.
Cobra Oil Pembesar Penis.

Kepuasan Customer Adalah Perioritas Bagi Kami. Terima Kasih
Selamat Berbelanja.

Affity Solutions said...

Thanks for your ideas. You can also find the details on Affity Solutions, at the System Programming. The main object of the Affity Solutions is to provide quality web services and is among the few software development company in Nagpur.