[Catalyst] Wishlist for 2006

raptor raptor at tvskat.net
Fri Jan 13 21:51:50 CET 2006


I too think the the entry to Catalyst is little harder for newcommers,
so i done a quick intro to the concepts...Possibly not finished yet.

If u like it I can finish it :). What do u think ?
(correct me for bad english too :))

================================================================================


Hmmm..... Catalyst, so what is it ?
Catalyst is powerfull MVC framework that...blah, blah,blah..blah,blah...
Ok, what is the idea of all this ?

Note: The facts below does not nececarily follow  hronologicaly the storyline..

During the years Web programming has started as simple CGI scripts, everybody knows the famous CGI.pm module.
The bad thing of this approach is that when the web appliction become bigger it start to become a total mess of all those 'print'-lines and it was usable for very simple web-apps.
In my first days when I was still learning Perl, I had to correct cgi-application (Classifieds) which was one script around 100KB in size and in which i mesured one if-else-elsif that spans ~25 pages...agrhhhhhhhh, I hated this man :")
After the web-programming became popular the needs for more advanced tools was needed. So MS invented ASP which had/have support for events and sessions on the server side, now the web developer was able to track user progress over his navigation of the site  with ease.
There is even Apache::ASP module which does what ASP done and even more..

So far so good, but this approach still was 'stinking', why ?
Even that u didn't need to use alot of print's, the code and the html still resided in the same page, so it was (and it is) like spagetti. (pure PHP uses similar approach as is JSP too). Another problem of this approach is that now two different type of ppl started to work on the web sites, namely web-designers and web-programmers. So the 'spagetti'-approach hindered both of them.

Another thing, now that the sites become bigger alot of Database coding was needed, so the 'spagetti' problem worsened even more.

A new way of thinking was needed so the MVC was born i.e. Model-View-Controller approach. What this mean ?
Now instead of print's or spagetties ppl divided the application in a way that the web-developer and web-programmer can work toggether w/o stepping on each other toes, how's that ?

The VIEW part (mostly HTML, images, css's) which represent mostly the visuals of one web-app is separate entity i.e. is separate files possibly residing in different directory. So now web-developer can freely edit them w/o bothering web-programmer. 
In most of the cases VIEW part is not a pure HTML, but some sort of Template (look at famous Template-toolkit : http://template-toolkit.org ) which loosly resembles PHP/ASP-spagetti with one big distinction (not enforced but assumed), u put only code that is related to visualising things not buisness logic.

As I mentioned this, the second part of the magic is the Controller i.e. the buisness logic. Here are the rules that governs the logic of the web-app (all its where-abouts : logging, access, processing ....).  

The third part of it the Model compromises, mostly the DB-model. It presents a more managable and easy way to access the DB. Instead of hard-coding the SQL queries to the database in the Controller we better separate them in the model, so that  it is easily managable (similar to the way we separate the HTML code).

So now we have the three most important things that we use to build web-app HTML, Perl-code, SQL  in their own directories/files. This allows as to "divide and conquer".

Note: Bear in mind that MVC separation is in most of the cases recomendation not hard-coded thing. Depending on the application u can mix&match them.... but be caution when u do this :)

The drawback now is that it becomes little more complicated to manage these things  and possibly slower (for small sites).
To solve these problems and still use MVC - Catalyst come to the rescue  !!! HOW ?


...yada, yada, yada ....shall i continue :)















More information about the Catalyst mailing list