Building cake application (Part I)

Monday (day 1)

In that post these posts I am going to describe my working process and problems which I’ve met during the development of small CakePHP application. I am not going to go in details neither I will post any code snippets. It will be something like diary of the working process. So, let’s start.

The scope
It’s an Experts database with 2 parts:

  • External part – where all users could register and fill their resumes and field of qualifications
  • Administration part – administrators could provide the search in the resumes and mainly in the field of knowledge.

The application is a kind of very specific Jobs site where people create and fill their CVs and the administrators could search for experts for projects which require specific field of knowledge.

The alternative
To tell you the truth I’ve thought to use for this project some “drag&drop” tool and indeed I tried with Community Builder (the Joomla Component). To be honest it wasn’t bad looking form which I build within a day. The problem that turn me to start it again with Cake, was that as every thing which trying to cover “all possible scenarios”, was quite extended, but very messy component which could give me more troubles than it could help. For example, if you want to use it from the Administrative part, you need to work with an advanced Query builder. Once you set an required list instead of seeing the results you need to go to External part of Joomla where the list can be viewed.

Well, the advanced users /with administrative rights/ are not so advanced enough to work with query builder. They are not IT experts. They want something simple which will serve their needs. The second reason is that the Component was difficult to be used even from myself. I find that there are errors, missing results etc. Which finally turn me to use Cake for this project. 🙂

Well, the first thing in every project /of course after understanding the business requirements/ is the Database schema. So:
1. I need to have a users interface /both for internal and external user’s roles/ and I decided to use one table for this. For convenience I created 2 views which will determine the admins from regular users.
2. I created a profile table which will store the main profile information. The relation with users is one to one. I know it’s possible to use the user’s table for this, but I decided to split it.
3. There are some usual key look ups tables like, Occupation, Title, Countries which are in one to many relation with the profile.
4. There are 2 many-to-many relations which are “known languages” and “fields of experience”. The tricky part is the Field of experience relation, because the functionality required grouping. For example you could have group “Database skills” and inside there are MySQL, Oracle, Sqlite etc. and another group “Programming languages” including PHP, .NET, C++ etc. /Hope you know what I mean/
5. Still haven’t decided yet shall I store the searches for further usage. Anyway it could be implemented easily I hope.

Reusing some of the components
The good thing when you work with some framework /like CakePHP/ is that you have some snippets, which could be reused in other projects. So, here was the same:
I had an User interface serving me well in another project, so I decided to reuse it.
I had an interface which manage tree category structure, so I decided to reuse it for “Fields of competences part”.

Few words about those components:
For user authentication I used build-in Cake Auth component, so the interface is only the user management in the administration part.
For the Category component – well, it require some changes, because the current logic need only 2 levels of nesting I strip down the functionality as well as I removed some unnecessary fields like slug and description. The good thing was that interface already had tree like structure and build-in ordering of the nodes.

Decision to use Security component
In that project I’ve decided to use the Security component in order to prevent hacks mentioned in Security Issue in CakePHP. So far so good – I had hash keys in my forms and everything was as expected, so far.

Building Key look up interface
This day I’ve build the small key look-up tables – titles, occupation, type etc. Using the bake script this task was ready within minutes.

The conclusion of the day
So far so good. I’ve prepared most of the things and saved some time while reusing come code here.

To be continued…

2 thoughts on “Building cake application (Part I)

  1. LukeNo Gravatar

    hiya, just to say I really enjoyed this post – very illuminating and good to read about my peer’s way of working! I will try and comment more later if I can make time.

Leave a Reply

Your email address will not be published. Required fields are marked *