Homepage
I, Me and Myself
Portfolio
Mindfolio
Blog
Guestbook

Navig: Blog > Mind Views

PHP frameworks are very hard for me

Posted on July 04, 10 @ 07:35 am under Mind Views.

I am not telling any one to stop using PHP frameworks. Using a framework actually adds lot of (usefull and useless) code, which is hard to remember for novice coders like me. People say it is good practice to use a framework and we can manage the code easily. But I face difficulty in using them.

I am one of those novice programmers placing the php code above the html of each page. I use conditional redirects to specific php pages. I use a library called Jasmine, which takes care of database connections and has commonly used functions across the applications. I pass values from URLs, ofcourse I do proper validation before accepting the values into the scripts.

I started observing that the code I was writing was perfectly alright, and the application is made secure by validating and other stuff. But the URLs seem ugly. As a programmer it is ok for me, but in the SEO point of view, it was ugly. because URL parameters were getting neglected. So I thought to use some URL rewriting techniques. Very soon I found that using a framework would be good.

I made my quest of which framework to use. Started with cakephp. It looked ok, but logically understanding the flow was difficult. Then switched to Kohana. It looked very much comfortable. I even rewrote my jasmine code as library for Kohana v2. One major drawback I observed is controllers within folders cannot exceed depth of 2, i.e I could not call the controller written in the second sub folder from URL. This made me go back to the market of frameworks. Came across Kohana v3, but it was appeared strange to me. Documentation was very poor to understand. I finally settled with Codeigniter. Excellent documentation and ease of coding. Bingo, I hit the bulls eye.

I confirmed myself to use codeigniter in one of my currently running projects. Logically, every thing is fantastic. Templating, seperation of controllers, models and views. Even the nested controller problem got disappeared. I was happy and felt my self royal by using a framework. I thought to write Codeigniter as my competancy in my resume.

Now starts the problem. I was going on adding features to the projects, and the file count increased. Even though I named the files briefly, it was hard to remember which file has which functionality. Sometimes I had to call the same model in multiple controllers and had to rewrite so mych of same code again and again. Then I thought to make the application compact and effective. So I merged some controllers and placed logically related code as functions. So it was easy to call just few files.

Most of the pages in my application were using a template. A place holder only got the data to be displayed. I had to write so many functions in models, so many functions in controller and so many views called from within the template.

This time, the problem is only with me. I have to go through so many lines of code to find the code to change. Even though it is possible to search by looking at URL. I really get scared by looking such a huge code. Plus, the index.php file in the root gets triggered on every request. This inturn invokes huge number of php scripts. Obviously occupying memory. I was surprised when I saw ~1MB memory usage for a page of just 2KB.

Sometimes I feel like.. hey.. i could have implemented this feature in a much simpler way.. why am i writing so much of code for this. Then i answer myself.. dude.. even if u write in a simpler way, framework will only understand the complex way. I cannot even call the individual script directly, because the framework has taken the complete control of the project. I feel disgusted. I have to manage the titles, meta data and other stuff again and again for every controller. I feel the work as very tedious.

In my 5 years of PHP code development, I developed a habit of writing PHP scripts the traditional way, i.e the script of the top of html. I feel comfortable with it, because I can implement the required functionality very fast. Handling scripts was very easy. Framework makes me write so much of code, so much of memory eating while executing.

Finally I have decided, not to use any frameworks in my future projects. For those ugly urls, i will use htaccess url rewrite techniques.

Comments

No comments.

•   Databases (7)
•   Diary (82)
•   HTML and Javascript (2)
•   For Your Information (15)
•   iSpecial Jokes (13)
•   Java related (1)
•   Javascript (1)
•   Jokes (42)
•   Mind Views (20)
•   My Observations (8)
•   Open Source Tech. (6)
•   PHP (6)
•   My Poetry (10)
•   Reviews (2)
•   Sing Along (15)
•   Sankaracharya Stotras (3)
•   My Talent (1)
•   Uncategorized (12)
•   Webservers (3)
•   Websites to see (19)
•   WML and WAP (3)

•   It is my personal site. Content included here is according to my wish. If you don't like my site, close it and go away.
•   'Mind Views' and 'My Observations' are purely opinions of mine and not others. If something in this site hurts you, control
     your mind and send me a mail. We will discuss. If you go to court of law, it's your wish. Every citizen has a right to express, so do I.
•   Some content in this site might not be appropriate for some audience, whose opinions differ with me. So don't try to argue with me.
•   Important: Don't try to judge me just by glancing this website. I am different outside.
•   This is a time-pass site. Reading it in a hurry will be useless.