069

Published on
Jun 18, 2010

The modern belief can explain many different things. One amongst them is the reason why you are here. Whilst the majority of great minds are facing other important challenges such as exploring different planets and struggling with the main proof for an abstract pleasure and it's relevance to subjective life, I will not try to to continue the line! Instead let me bring you really good news!

We're gonna understand what are web design patterns! It will take some time to achieve this goal, but we're on a mercy of civilization / modernization / etc.. aren't we?

So before we start, please note that this website, is under development. Not heavy devlopment, not construction - as it was told long time ago - but, under development, which means, it builds itself!

Now, let's talk about the well known 960 grid system.
If you don't know what it is, great. But if you really wanna learn something new, please visit here.
It's a really nice system. But the question to be asked, is this: how useful will it be to me? And the answer is: it depends. But my statistical intuition whispers, the chance that you'll need it for your own website is nearing zero, unless you wanna to prove me the opposite :)
960 is great for big portals, and the reason for it's greatness is of course - the ability to quickly rearrange your visual representations from say, 3 columns to 5, without calculating much pixels.
Anyway.
I have two other ways to propose you doing the same and you decide what's good for you.
This system is called wdp-1 (who cares about the name, anyway?).
First you need to decide what's the width of your website will be. Say, it will be 900px. Then you decide how many columns you want. Say 3. Then you divide 900 by three, and get 300. Great!
But what if you get a remainder after division? What if you choose 7 damned columns instead of the blessed 3??? - I told you I will give you two solutions, so please be patient...
Well, you can't divide nine hundreds by seven, but you can use... modulo! So, 900 mod 7 gives us 4! So we extract these four from nine hundred and we get 896. Now we can divide it by seven and get 128!!! It's not a coincidence that we got a number equal to two in the power of seven! But I want to leave this philosophy for the future!
Let's get familiar with the second method. If you came here, then probably you've heard about Firebug.
I want to share with you a piece of code that I wrote, which takes two parameters, that you can play with:
maxWidth is the width of your planned page, and minDivisors is the minimal number of divisors that you want to get between 1 and up to maxWidth. I mean, if you take 1 as minDivisors, then you'll get all the results.

var maxWidth = 1400; //px
var minDivisors = 25;

for (iWidth=0; iWidth < maxWidth; iWidth++) {
   var numDivisors=0;
   for (iDivisor=0; iDivisor < iWidth; iDivisor++) {
     if (iWidth % iDivisor == 0) {
       numDivisors++;
     }
   }
   if (numDivisors >= minDivisors) {
     console.log('w:' +iWidth+ ' | ' + 'd:' + numDivisors );
   }
}

Isn't it great!?
So, for example with the default parameters, just if you copy-paste this code, you will get this output:
w:720 | d:29
w:840 | d:31
w:900 | d:26
w:960 | d:27
w:1008 | d:29
w:1080 | d:31
w:1200 | d:29
w:1260 | d:35
w:1320 | d:31
w:1344 | d:27
Which means, that for width of 840px there are 31 possibilities to arrange columns in an equal way - 5 possibilities more that in 960 system!
Well well...
If it's not nice, then what it is?
I hope you enjoyed this short intro to Web Design Patterns. Sorry if you didn't learn much out of it (after all I hope that you enjoyed!).
So see you in the next tutorial, and don't forget to bookmark this page if you liked it!