A few things about CakePHP, PostgreSQL and Xapian

While on part-time holidays from Dokeos, I'm looking into some of the stuff I will need to be aware of when working on Dokeos for the next year. I think you can call that technology watch. Anyway, I'm looking into CakePHP, PostgreSQL and most of all Xapian (although I did not yet reach that point). CakePHP is the closest thing to a "PHP on Rails" (or so I though at the time of writing this article - turns out there are much closest matches - see comments to this post). You can develop ugly but functional web applications really fast, then start working on the things that really matter in terms of graphics. I've barely done a few pages but I have read a lot. Although the next version (1.2), integrating l10n and i18n is only in beta at the time of writing, it does look promising and I bet in a year or so it might be quite easy to do a simple e-learning system with that. However, we are going our way in the same direction too, with the preparation of Dokeos 2.0, which will bring object-oriented code which will (hopefully) speed up our developments. I need a file upload feature (to index text files) and a users and permissions management for a small application I'm working on (to prepare for indexation in Dokeos) and I have found enough websites to get me going... (see references below) About PostgreSQL now, I just realised there is no known way of retrieving PostgreSQL arrays directly from PHP. You have to fetch them as strings and then "parse" the string to get an array. That sounds quite bad to me. Apparently, there is a very recent version of Perl's DBI that allows that, but I haven't been able to confirm that just yet. One solution might be to develop a stored procedure in PostgreSQL to do that, but I don't really fancy the idea of delving into DBMS-specific internals (although arrays are one specific internal of PostgreSQL). Xapian seems nice. I'm getting more precise in my questions on the Xapian mailing-list, because I know what I want and need now, but I haven't been able to put it in practice just yet. That's going to have to wait for next week, probably. Xapian is comparable in many ways to Lucene, a Java-based indexing and search engine. I'm working on this small app' with my father, who's spear-heading the Lucene alternative while I'm trying to get my hands deep into Xapian+PHP The good thing in all this is that all these tools are easily (all things being equal) combined to provide a powerful application for document indexing, storage and retrieval. CakePHP has a fully-functional PostgreSQL mode (which apparently cannot be said about its ADODB mode). Xapian works well with PHP and has a Debian package (php5-xapian) which eases its integration. Let's see where that leads us... Exciting! References File upload with CakePHP (although not exactly what I'm looking for) HasAndBelongsToMany relationship (what I'm looking for for the user-group relationship)

Comments

Since i port myself from java world to php world, checked some MVC frameworks like prado, codeigniter, ez, qcodo and finally cakephp. Well, loved that cake :)
Also i saw the code of dokeos. Guys, you really need to go with cakephp.
1.2 is near stable and some few troubles can easily be solved with a great community. Built in Ajax, web services and bunch of components are waiting for the best development experiment. I've done 3 big projects with it. Please do not hesitate to ask about any technical questions, before decide to go with cake.

Take care,
Kunth

Hi Kunth,

We are definitely not going to use CakePHP for Dokeos, for two reasons:
- it is still a project that needs a little bit more maturity before we can adopt it
- we are already redesigning the core of Dokeos for Dokeos 2.0 and the work has been going on for a year or so and is scheduled to reach maturity in the middle of 2009. This is based on state-of-the-art objected oriented patterns and proves much more flexible.

Dokeos is also a very large application, with hundreds of features which are invisible to the simple user but which nevertheless can be modified to change the application behaviour, which means reimplementing the code takes in the thousands of man hours. Sadly, the community contributions are not too common in this particular field of software development (e-learning applications are not made by motivated people that want to push it ahead as a challenge, they are made by professionals that have very specific requirements, which consequently reduces the contributor's base). This also means that we are driven by customer demand rather than research for coding perfection, which can have downsides in terms of code organisation, but that's why we're having the core redesigned slowly but carefully.

Of course, I can only admit that the Dokeos code has many flaws at the moment. It has inherited a lot of code from unexperienced developers or from a period where coding structure theory was not fully applicable to PHP applications.

The CakePHP study was actually made for a side-project, not related to Dokeos (and it is an unfinished work so far).

I do appreciate the qualities of CakePHP though. I think it's a great tool, I'm just worried I will not be able to get my head at the same time in this framework and the Dokeos framework, but we will certainly reuse a few ideas from Cake along the way if they prove really practical.

Thanks for your comment,

Yannick

Cake is not the closest to Rails you can get on PHP http://fon.gs/php_on_rails.

You should really try Akelos http://akelos.org which is a real Rails Port, not just a wannabe.
It has ported all the quality models from Rails and they have a stable trunk as they take testing very seriously.

Just have a look at its code and you'll see these guys are serious about computer theory.

I wouldn't underestimate the benefits of using a multilingual Framework like Akelos, I've read on the Moodle lists they were considering it for upcoming versions, plus I'd love to make Dokeos on Akelos happen :)

As I said, it is far too late to start on any framework at the moment as there is a team working on our new kernel since long ago now and they are doing a great job.

Nevertheless, I didn't know Akelos and I'm glad you pointed me to it. I will start trying it out as soon as I can (probably as soon as Dokeos 1.8.5 is out) as I have other little projects that might benefit from using a good framework.

cakephp sucks, we´re building a php app and the most trivial thing its so hard to achieve, we had to go back to plain php because we could not insert data in HasAndBelongsToMany relationship (HABTM) tables

I wouldn't be so harsh on CakePHP. It certainly still lacks a bit of maturity, but it is good for making quick apps. I'm looking more into Akelos when I get the opportunity, but I think frameworks in general should stay, for now, at the level of small to medium-sized web applications.

What have you been trying to do with it, if I may ask?

we had been trying to insert data from a form to a few tables with hasAndBelongsToMany relation and we lost almost a week trying to achieve it , and finally we couldn't make it.
with "plain php" i don`t mean that we wont use MVC, we still use design patterns but in a more straightforward fashion.

I'm happy to report that we (at Dokeos Latinoamérica) have been using Akelos for a few weeks and are starting to get to grips with its mechanism. The multi-lingual system works nicely, there are some examples around of application installers (which are great to implement for an open-source solution) and of CSS styling, the different controllers and views created by default make sense, the migrations work great and we are trying to document step by step how to make relations of type habtm between several tables with additional fields.

All in all, it saves a lot of time in easy things and makes us loose a considerable amount of time learning consistent programming and styling, which is never really lost after all.

We haven't started to use unit testing yet, but that will come shortly.

"cakephp s****" is the definitive phrase, been trying to use some validation -> php errors in framework.. looked into it.. 3000 lines of code, if u get to that amount of lines in a file u should ask yourself about your architectural skills tbh.. link some models with has many to wtv relationship.. didn't work.. ok.. basic hasMany relationship -> update query with join!! LOL!..
For many of you out there who think cakephp is *censored* I suggest trying ZendFramework.. or simply write your own like I did!

En réponse à par YW

Permalien

There is a lot of good things said about the Zend Framework indeed (PHPArchitect has been hammering on that nail for a few months now - which I find a bit unethic), but I would certainly *not* recommend writing a new framework. There are loads of them around already, saturating the market and making it complicated to find one that will cover 90% of your needs, although there is one, in any case.

En réponse à par YW

Permalien

The PHP community as a whole already has a mess of mock-up "frameworks" and "scripts" available, but nobody complains about them formally except until somebody thinks that they suck and they should just start from scratch, where the developers aren't actually on crack this time. I don't get this logic.

The idea of a framework is that it in most cases adds a certain amount of unwanted logic to your simple application.. if the framewrok is not decoupled enough through its components.. as I worked with zend and cake and amodules. I have never seen versions being as light wieght as i wanted them to be.. so i reccured to writing my own for simple and faster applications. As long as you do not waste too much time on them it is ok.

My experience with CakePHP

I decided to learn cakephp in november 2008, based on some friend’s suggestions and the whole hype around it. I followed their "manual" STEP BY STEP, getting errors all along the way. I was following their very own docs, so there appeared to be nowhere else to look for help but the community. When I asked for help in the community (both forums and irc channel on freenode), 5 out of 10 times I got replies like "RTFM", but NO LINK TO NOWHERE. Being a newbie, I had to lookup the acronym up on Google… very frustrating, especially given the hyped up "extremely friendly community" written off all over CakePHP´s website.

When I told them I was having trouble with the tutorial (it was NOT WORKING), they asked me which version of cake I was using, I said 1.2, they said the tutorial/manual was for 1.1. I then asked where the 1.2 docs were, they told me it wasn’t released yet (WHAT? THEY RELEASED AN UNDOCUMENTED BRANCH?) So I asked if I should fall back to 1.1, and they said that I should just check the forums for support on 1.2, ´cause most of the questions were being answered within the day (WOW! PROS!). I asked "can I get help here in the irc channel?", and the reply was "If it’s not on the docs (WHAT DOCS?) and in the forums, we will be happy to help.

Well, they were not. Those guys are living proof that even NERDS gang up to beat weaker people. They will take a full hour off their time to tell you you’re stupid, lazy, idiotic, unworthy of CakePHP, tell you that you are not needed in the CakePHP community because it’s so big and great and fast-growing and slap you around with a trout a hundred times, but THEY WILL NOT HELP YOU, unless you are deep advanced in programming.
They will say things like “Do you even know what a framework is?”, or “Do you even know PHP?”, and “Have you ever programmed in you life?”, and even “Why are you here?”. By the way, I didn’t know what a framework was, but my intention was exactly to learn that. Guess you HAVE TO KNOW A FRAMEWORK before doing cake. At least according to the community!

What those NERDS are forgetting is that the most important part of any “growing“ community are precisely the newcomers, the babies, the young. No community will ever grow if newbies are stepped on because they’re newbies. It doesn’t make any sense! They said they don´t help newbies because newbies demand a lot of time. Well, the newbies of today are the experts of tomorrow. And in time, your team of ‘helpers’ will have grown, lightening the talk of everyone. Go into FreeNode and joing the cakephp channel… You´ll probably see one guy GOING MAD BY HIMSELF, trying to help everyone at the same time, being rude and dismissing any questions that he cannot answer with a single line of text.

I cannot express my dissatisfaction with that bunch of little HALF LIFE NERDS, and nothing in this world can make up for the 3 MONTHS I FOUGHT that pathetic community for help, to the point if being ridiculed as "GAY" (???), "TOO OLD TO LEARN CAKE", "TOO STUPID TO LEARN CAKE" and other things I will not mentions in the forum. Too old? too stupid? Is it or isn’t it CAKE??
NOT. I recognize that CakePHP is being well driven by many people, but they MUST change their attitude in that pathetic community, they MUST stop bashing the people who are not well aligned with their FLIMSY DOCUMENTATION, and they MUST TAKE A STAND to correct these problems, otherwise people will eventually just leave!

PHPNUT, if you ever read this, check the logs to see how amused they were at stepping on YOUR OWN HEAD.

The result of my sad journey into CakePHP was that I left, joined the community of another PHP Framework, where I found a bunch of ex-cakephp users who had left cakephp for precisely the same reasons I did, and welcomed me into a solid community of people interested in helping each other, rather than just taking a dump on newcomers to feel better about themselves. For all that and a lot more I haven’t said here say, I wish for growth and maturing for the CakePHP project as a whole, and I hope the people who are being asses in the community are properly punished or reprimanded. There is not much more I can ask or hope for.

Bye.

En réponse à par YW

Permalien

I can understand your frustration and I certainly agree. Being on the other side of the fence for Dokeos, I must also admit that some people are clearly disgusting people of contributing to an open-source project (I remember having to argue with a very nervous guy that I would not understand that I would not spend 4 hours of my spare time, for free, fixing a bug that only he was experiencing - probably because he misconfigured something).
Any help should be acknowledged as such in the open-source community, because this is a free service anyone is giving, but this is certainly no excuse for being gross or aggressive (I don't remember ever seeing the word "gay" appear in a proper comment on the Dokeos forum :-), nor in many other projects I've joined for a while).

well, cake 1.2, 1.1, who the heck cares, the are doing updates on a table with joins, if u have model relationships, when there is only that table updated.. c'mon get real, take a shot at zf. cake is old and written for php4 no wonder the community lives in the stone ages, sad sad framework...

The problem that had been holding me for a while with the Zend Framework was its custom license, but I just checked yesterday and it seems that they changed to the new BSD license (apparently *NOT* the Free BSD License, which removes the advertising clause, but rather the original BSD License with some changes):

http://framework.zend.com/license
http://www.fsf.org/licensing/licenses/index_html#FreeBSD
http://www.fsf.org/licensing/licenses/index_html#OriginalBSD

That might allow our small team to use the Zend Framework to develop open-source software (depending on the license).

[***] (ndlr: I don't like) CakePHP. [***] that a very simple thing takes AGES to develop in there.

It's convention [***] (ndlr: not good).
[***] (ndlr: I don't like) convention-over-configuration. [***] (ndlr: I don't like) it's performance. Use plain structural PHP forever.

ndlr: we had to moderate this post a lot to avoid any non-technical, subjective and non-helpful comments, but we still wanted to let the people know that just one more person doesn't like it, for different reasons than the ones expressed above. Kenyo, please moderate your comments on this blog so that they are useful to all. Thanks

I'm in the CakePHP sucks camp. I just wasted a week of my life I'm not getting back.
I loved the premise... as much as I loved the analogy: baking a cake is simple. CakePHP is not simple. And at the end of it, when you finally figure it out (which is next to impossible), you get a not that great app. Their very weak examples had me thoroughly confused and thinking I could have done much better with pure PHP. I'm sure their platform is awesome... their documentation is horrible.

Ok, so 4 months have passed since the long letter "Cake PHP gets by but its community sucks".

In that time, here's what happened:

1. I learned CodeIgniter, wrote a couple simple apps on that. The whole learning process took about 2 weeks, and today I can cook up a simple CMS on C.I. in a week, and have the app released and upgraded quickly and without dropping any sweat.

2. In C.I.'s GREAT community, I learned about a C.I. fork called Kohana, which I learned in A WEEK (due to it's similarity do C.I.), I have already deployed one app on Kohana, and it is working fine (it has been for a month), the client loves its speed and stability, and I have not asked A SINGLE QUESTION on the Kohana irc channel, nor have I used the help forums for ANY REASON WHATSOEVER.

3. Due to a new client's monstruous demands, I am now learning Joomla Extension Development. I have written 3 components and numerous modules for existing components to suit it up to the client's needs. The Joomla's API lacks detailed documentation, but if you are familiar with the concept of Programming Frameworks, and don't have a problem looking at core code to figure some things up, it is DEFINETELY worth the time. Joomla has a very well organized structure, and it is very simple to develop inside of it, and I really, REALLY like it.

On my 'to do list' are Symphony and Zend FW, which are known to be advanced and flexible...

In the end, I don't see why anyone should ever have to deal with CakePHP. I haven't been into that irc channel for a while, and I hope those guys are doing better then they were half a year ago. I really do...

This here link (http://www.google.com/trends?q=cakephp,+codeigniter,+kohana&ctab=0&…) will probably show you that cakephp has reached stagnation... guess time ran out.

over and out.

I now and then get curious about cakephp (it seems to happen every 4-6 months!

After my last checkup on it (couple hours ago) I can tell you that not much has changed... Also, I was wrong about stagnation - that was a snapshot oppinion - cake is in steep decline.

I guess the rudeness of its community members has finally began to burden its user-base stability.

Here is the link again!

http://www.google.com/trends?q=cakephp,+codeigniter,+kohana&ctab=0&…

over and out.