Archive for September 2007


DBDesigner2Cake 1.2 Roadmap.

September 25th, 2007 — 12:11am

Hi all,

As many may have noticed, dbdesigner2cake was made stable and many of the fundamental features are already implemented.

Beside the basic homework (code organisation and documentation), I have few ideas for dbdesigner2cake 1.2 branch:

  • Reverse Engineering: It would analyse Model classes and create a DBDesigner XML file.
  • Automated Scaffolding: It would watch a XML file for changes, whenever it realised a file change it would automatically re-scaffold the application.
  • Non-destructive scaffolding: It would modify Model classes thus preserving the developer created methods.

Another idea I had was a modified version of app_model.php that would parse DBDesigner XML file on fly, simplifying the Model Classes files. An example, instead of this:

<?php

class Post extends AppModel {

        var $name = “Post”; 

        var $hasMany = array(’Tag’ => array(’className’ => ‘Tag’));

        var $belongsTo = array(’Subject’ => array(’className’ => ‘Subjects’)); 

        function yetAnotherMagicalMethod(){

                …

        }

}

?>

It would be:

<?

class Post extends DBDesignerModel {

        var $name = “Post”; 

        //Relationships would be automagically loaded - and cached.

        function yetAnotherMagicalMethod(){

                …

        }

}

?>

Bye!

Comment » | DBDesigner2CakePHP, Technology

IMHO, CakePHP made PHP bondage-and-discipline.

September 24th, 2007 — 11:56pm

Hi everyone,

In My Humble Opinion, I think CakePHP made PHP bondage-and-discipline.

The first time I heard about RubyOnRails, CakePHP, PHPonTrax, JavaOnSails &c… I thought: “Hey! it’s no novelty, actually there’s a book named ‘Design Patterns’ that deals with all that stuff of Active Records and so on… What’s the need of such things?”

I never paid too much attetion to them, in fact I related them to the dreaded COBOL - but Ruby and PHP are not as verbose as COBOL-fingers.

As everybody knows, a well respected hacker will never admit to have learned COBOL - but unfortunately I have learned it in College, so I am not a hacker (yet :-) ). Hey! Hold on! It was just a semester in that bloody Mackenzie’s (yes, we have a Mackenzie in Brazil) and I’ve abandoned it in the middle of the discipline.

You know, COBOL has a very strict structure on how programmes should be engineered and written. There are only two level of tabs, and those DIVISIONs on each you define variables, file descriptors, io masks - this sort of pedantic way of programming.

But COBOL enabled brain-dead people to develope all types of commercial softwares. COBOL was written in english and supposedly an english-speaking person should be able to create, read, understand and modify any routines made by someone else. COBOL even had paragraphes.

This characteristic could only be achieved if everyone did everything in a single and common way - I should be guided, through the language syntax, to write the same solutions in the same way as you would do. Gosh, was COBOL the computer’s NewSpeak?

Well… Time has passed, those dinosaurs mainframe were gradually replaced by new servers, and the languages evolved into a more structured and more free syntax, like C.

The issue with C, Perl, PHP, Java and all-alike, is that you can always do the very same thing in a different way, opposed to COBOL which is bondage-and-discipline.

The phisolophy of “Convention over Configuration”, or whatever you call it, is just a modern way to enforce bondage-and-discipline on programmers. Convention itself is harmless, Kernighan and Ritchie have the blessed ident style and so Java people, GNU people.

The problem rises when Convention replaces Freedom - a forced standardisation of programming which affects almost every aspect of coding: naming style, code organisation and even the “best practices”.

Someone thought to consolidate all those Design Patters in a single project and give a name to it. CakePHP was inspired by RubyOnRails, both share some features - and both turned vanilla languages into bondage-and-discipline.

RubyOnRails and CakePHP are not only tools which would help the developer to be more productive - oh no… they’re schools of thoughts. They have a way on doing things which are considered “best practices” and should be followed closely.

Bondage-and-discipline is not Bad And Wrong. It is a leverage for those who are more pragmatic in solving problems or creating fast-food solutions - to problems which the kernels are the same among near 80% of them.

I like CakePHP… But I like PHP better. Sometimes I want to have freedom to model a solution according to a very special line of thoughts that oftenly is not the same of CakePHP. Now I have arrived to the point I wanted.

As CakePHP makes PHP into bondage-and-discipline language, programmers - specially the begginners - tend to adapt their solutions into CakePHP frame… Sometimes the best step is something quicker and more direct, but CakePHP, RubyOnRails or [your language of choice]on[transportation of choice] forces flowing or spliting the solution into meaningless parts.

In an exaggerated representation: “Hey, I just want to print out a formatted number! Why create a helper_to_format_number method in the PrintHelper class?” or “Why am I iterating all the result set in Model class into an array to iterate again in the View?” Or even, “I must structure this data into that framework-structure to output using the MagicalOutputHelper class…” (which likely would take longer to do).

I don’t if I am being clear here. These frameworks are wonderful tools - actually I develope a tool for CakePHP named dbdesigner2cake - but I don’t twist my solutions logic to fit the CakePHP’s mold. Don’t you even bother to talk about that vendor directory on CakePHP, because few things just won’t work; some third-party modules count on the fact that’s being run standalone or isolated - not within a framework.

There are situations that RubyOnRails (that’s gonna ache on the Ruby Envy guys) and CakePHP just won’t do, they’re closures with programmers stuck inside.

Design Patterns should be used a la carte. “Oh God! My code is messed up, let me organise it using MVC”, “Ahan, I am just doing CRUD here, I guess Active Record will fit just fine”, and so on.

Perhaps there’s something to learn with DJango guys, they actually stated they’re against auto-magic. As they don’t hide the magic behind the stage of an all-mighty framework, the programmer DOES HAVE the option to use or not one of the magics available without being considered too unelegant. Or extend it to make it able to do the desired functionality. When the framework is too magical simply there is not sockets to connect an extension…

These frameworks do the dirty work for the programmer charging a price: less flexibility and freedom of choice of how to do things. Is this good? I don’t think so…

I love CakePHP productivity, but I dread that it will make all programmers to code all the same code. Oh you don’t agree… If you want to make a blog with the too-obvious table Posts on it, unless we’re talking about different frameworks, on CakePHP the model class would be exactly like this:

<?php

class Post extends AppModel {

var $name = “Post”;

}

?>

See? There are thousand of ways on naming, invoking and accessing a database table in PHP. But in CakePHP this is the only way.

The same applies to [Your Rail Framework Of Choice]. Or even [Your language-of-choice] made bondage-and-discipline.

UPDATE: I found in Technorati two blogs supporting my point of view:

http://www.jonlee.ca/switching-from-rails-back-to-php/

http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html

2 comments » | Technology

dbdesigner2cake supports CakePHP 1.1 and 1.2

September 21st, 2007 — 7:28pm

Hello All,

Dbdesigner2cake now officially supports CakePHP 1.1 and 1.2. Actually, when you use it on CakePHP 1.2 it offers a new parameter, which is shown below:

  -wb, –with-bake             generate controller and view code using bake shell.

This options scaffold your application creating the controller and view files instead of activating the $scaffold variable. I think it’ll be even more handy for those who want to save time.

Well, as I usually finish such release notes:

You are welcome to download the 1.0.3 version at
http://www.cirello.org/dbdesigner2cake/download.html 
or
http://cakeforge.org/frs/?group_id=162 .

Any doubts please submit to
http://groups.google.com/group/dbdesigner2cake.

Bye

Comment » | DBDesigner2CakePHP, Technology

Vergonha Nacional

September 14th, 2007 — 7:37pm

O Senado Federal do Brasil é uma vergonha.

Se bem que eu não estou nem um pouco surpreso com o resultado, alguém tinha dúvida que ia dar nisto depois que resolveram fazer sessão fechada?

É… Depois reclama que Brasileiro não tem orgulho. Vou comer pizza, fui.

Comment » | Política

Preliminary Tutorial for DBDesigner2Cake

September 12th, 2007 — 11:44am

Hi!

 I am preparing yet a more complete tutorial, but as appeared some demands on how to use dbdesigner2cake I decided to release a preliminary tutorial.

 Well, I assume you know how to use DBDesigner, your database of choice and some shell operation. I assume also that you have unpacked CakePHP’s files into a directory and had it configured, and the tables drawn in DBDesigner are stored in database too.

Let us take an ER diagram like this:

ER Modelling by DBDesigner

 Please note that the relationships created fields on the tables, for instance, users relates to posts through “user_id” field. You will also notice that DBDesigner create fields in plural instead of singular (tags_id versus tag_id), thus you should rename then to singular flexion. Also we have both a hasMany relationship and a hasAndBelongToMany relationship.

  Unpack CakePHP’s zip file, put dbdesigner2cake.php and save DBDesigner’s XML file in the same root directory like this:

# find -maxdepth 1
.
./sql
./app
./cake
./docs
./index.php
./vendors
./.htaccess
./dbdesigner2cake.php
./modelling.xml <– the ER diagram saved as XML by DBDesigner.

 Now you should generate the scripts using dbdesigner2cake.php

# php dbdesigner2cake.php modelling.xml
Scaffolding Post — done
Scaffolding User — done
Scaffolding Tag — done
Skipping PostsTag - HABTM table.
Done

Well, point your browser either to
http://yourhost/application/post/ or
http://yourhost/application/user/ or
http://yourhost/application/tag/

And you’ll see that your application is working (at least in theory).

14 comments » | DBDesigner2CakePHP, Technology

dbdesigner2cake : DBDesigner 4 Scaffold Tools for CakePHP - 1.0.0 FINAL

September 8th, 2007 — 1:08am

Hello,

The final version is released. Just a tiny bug found regarding the –app parameter.

I hope you guys enjoy it as much as I did.

Currently I am working on the tutorial and perhaps a screencast, afterwards I will look for CakePHP 1.2 support.

You are welcome to download the final version at
http://www.cirello.org/dbdesigner2cake/download.html 
or
http://cakeforge.org/frs/?group_id=162 .

Any doubts please submit to
http://groups.google.com/group/dbdesigner2cake.

Bye

Comment » | DBDesigner2CakePHP, Technology

Windows Live Writer versus FogCreek’s CityDesk

September 4th, 2007 — 12:26am

Bom, no dia 19 de agosto eu postei um texto falando do CityDesk da FogCreek, fiz umas duas críticas contra ele. Fiquei matutando inclusive que o programa era uma ótima idéia, pois era simples de produzir modelos de layout (templates) e era particularmente fácil de produzir conteúdo nele.

Ora, se a FogCreek poderia fazer o CityDesk por que motivo ninguém pensou em coisa semelhante para o WordPress. Digo, o Wordpress tem uma API que permite você pintar e bordar, fazer um programa standalone em .Net ou Java que poste tipo o que o CityDesk já deveria ter sido feito.

Fiquei com a pulga atrás da orelha e lembrei de um programa que eu havia visto no ano passado que a Microsoft tinha feito, era um dos primeiros programas da plataforma Windows Live fora o MSN: Windows Live Writer.

O Windows Live Writer era um editor de Blogs, que eu lembro que não usei tanto por não ter um blog como também não funcionar direito na época que havia sido lançado. Porém, depois de um ano de trabalho está bem melhor. E exceto pela usabilidade e aparência, faz quase todas as coisas que o CityDesk faz.

Calma, fãs de Santo Joel, eu sei que o CityDesk e o Windows Live Writer tem objetivos bem diferentes. O CityDesk serve para você administrar um site, enquanto o Windows Live Writer serve para administrar um Weblog.

Mas para mim, do meu ponto de vista, o Wordpress pode ser o meu CMS - forçando um pouco a barra talvez, mas pode ser sim. Ele tem tanto serviço de posts como funcionalidades de páginas, e se eu tiver um programa que seja este front-end para mim, não vejo motivo para não usá-lo.

Neste momento você achata na mesma area ambos: CityDesk pode criar sites blogs, e o WL Writer pode criar sites de conteúdo.

Posto isto chego ao ponto que eu queria: por que pagar US$ 299,- pelo CityDesk se eu posso ter o WL Writer+Wordpress de graça?

Queria entender melhor o CityDesk e saber que vantagens ele tem sobre as ferramentas gratuitas, neste meio tempo, eu vou levando de Wordpress mesmo - com a vantagem que posso editar de qualquer lugar do mundo. Humn :-)

2 comments » | Technology

Del camino a la vereda

September 3rd, 2007 — 11:57pm

Comment » | Chronicles, Músicas

Back to top