Thursday, March 17, 2011

Why CakePHP

1.  Almost every experienced developer hates writing same code again and again because it’s really is nothing but wastage of time. For eg:- Creating same boring add/edit/delete functions for entities and all. Other problem faced by most of the developers is the organization of code. Most of them may not understand how actually to keep their code organized or if they really need it at starting phases. But when we reach at later stages, our code becomes messy and messier. CakePHP solves this problem by its MVC structure and its attractive features.

2.  MVC: I preferred it because of MVC. When I have to do something related to view, then I just go to the view folder, change it and don’t think about the rest of the coding. As well as for controller when I want to develop or change the business logic. When I have to work with db then I am working with model.

3. Good thing is that everything is separate portion. So when I am working with views, I don’t want to think about model’s coding.

4. Bad thing is the DB connection. I have some allergy about DB connection. If I wrote code in model, then with every refresh, a lot of query runs. It will be solved by writing the code in controller.

5. I prefer this because of the total control is in my hand. If I want then I can use the predefined coding structure or I can wrote it by myself using standard.

6. Component: Components are packages or group of logic that are shared and used between several controllers. If I want to copy and paste specific code between controllers then I might consider wrapping some functionality in a component and include this into the controller which is needed. I can use component in different reasons. Such as:
  • Security
  • Sessions
  • Access control lists
  • Emails
  • Cookies
  • Authentication
  • Request handling
  • Image resize
  • Paypal payment getway.
7. Behavior: Model behaviors are a way to organize some of the functionality defined in CakePHP models. They allow us to separate logic that may not be directly related to a model, but needs to be there. By providing a simple and powerful way to extend models, behaviors allow us to attach functionality to models by defining a simple class variable. That’s how behaviors allow models to get rid of all the extra weight that might not be part of the business contract they are modeling or that is also needed in different models and can then be extrapolated.

8. Helpers: Helpers are the component-like classes for the views in the application. It contains presentational logic that is shared between many views, elements, or layouts. Let any 3rd party editor such as fck editor, I can easily add this with any views.

9. PHP compatibilities: Compatible with PHP4 and PHP5. So I don’t think about the hosting.

10.CRUD: Integrated CRUD for database interaction so that we can easily control data transaction.

11.Scaffolding : Scaffolding is a meta-programming method of building database-backed software applications. It is a technique supported by some model-view-controller frameworks, in which the programmer may write a specification that describes how the application database may be used. The compiler uses this specification to generate code that the application can use to create, read, update and delete database entries, effectively treating the template as a “scaffold” on which to build a more powerful application.

12.Code generation: I can bake the cake and generate the code automatically. Though I hate it. I always want to know everything and write the whole code by my hand.

13.Route: there is a file named route.php. By this, I can easily control the URL and the access of the project.

14.Validation: I can use the built in validation in model as well as controller. I prefer the validation in controller.

15.No apache configuration needed.

16.Coding structure and standard: I have to maintain the coding structure and standard. So if another developer who is familiar with cake standard, he can easily start coding. If anyone don’t know the CakePHP, though he can easily integrate with the project.

17.  The framework also provides a basic organizational structure, from filenames to database table names, keeping your entire application consistent and logical. This concept is simple but powerful. Follow the conventions and you’ll always know exactly where things are and how they’re organized.

18.Execution time: CakePHP is much slower then coldignetor. Average execution time for cakephp is 0.31sec where coldignetor get only 0.19sec. Though the execution time can be reduced for cakephp but it will not be less then coldignetro.

19.  Timely Delivery and Deployment: There’s no doubt that CakePHP will accelerate the development process. Finishing it before deadline means more debugging period.

20.  Easily Upgradable Code: If we developing a structured application, then there is no issue while upgrading of an application because i already have a list of various Models in my system with their Controllers. I can easily plan the units to upgrade without going the whole PHP code again.

21.  Fully Functional Code: The way applications are developed using Cake offers us to perform various tests. Best of all, it allows us unit testing to the simplest entities and their functions. For eg: If I have built a online exam system with it, I know ‘exam’ is entity of my application and the functions like exam, resultCalculation, result, examSet etc. are more easily tested.

22.  Visual Tweaks after development/deployment: Since, Cake has MVC structure, all views inside Cake are always in a separate files (*.ctp) which are free of any complex PHP code. This not only makes the Visual stuff easier to implement but makes it easier to modify too.

23.  Easy understandable Code: All our entities (Models), functions to these entities (Controllers), User Interface (View) are in separate files, so I will not start studying a controller if I am looking to change the Caption of some input field or any other random task.

24.  SEO: In terms of SEO, I have complete freedom of my html through the layouts and views, and the routing system allows any self URLs I want, so no restrictions there and easy to SEO

2 comments:

  1. Nice work buddy..
    More you share.. more you gain...

    Keep up the good work :)

    ReplyDelete