Question

I'm a developer by hobby, meaning that I do it on the side and I don't do it too often. I've been reading on and off regarding web application frameworks and looking in between at CakePHP and CodeIgniter. I finally decided to dive further into CakePHP as it seemed to be more up my alley.

Problem is, the more I dive into it the more I don't understand why I'm using the framework. So, hardcore developers out there, discuss with me, or help me understand the following:

I do understand in the long run application frameworks are there to help deploy code faster, or write code faster. Understandable, however, is a limitation of these frameworks the fact that you have to code to the standards of the framework? The more and more I try to use CakePHP, it's almost like I'm having to learn the framework language/standards on top of the actual programming language. For example, I'm having to learn CakePHP's standards and ways to implement "faster" deployment and interpretation but I'm also trying to code to PHP standards (which is somewhat built into CakePHP), but as a whole, this is what I'm seeing. To me it's a bit of overhead, but if you know CakePHP or your framework of choice, this is nothing, because you probably know how to code to your framework?

The other question or discussion is, as a developer on the side and a person that likes the MVC approach, but does not really know how to implement it with a framework, would the best approach to code the same way I am (through a function file), making my own functions, etc, but also put MVC techniques to use? What I mean by this is, instead of learning an application framework, should I separate the content styles from the functions, etc like MVC works, but use my own functions, or should I learn an application framework.

Note: I could be going about the application framework incorrectly, I'm not sure though. Additionally, this was meant to be a discussion and not a rant; I don't know what I don't know, so I'm actually reaching out for some clarification.

Thanks!

Was it helpful?

Solution

I think that there's something to remember here: to be productive at something through a tool, you need to learn how to use the tool first. You know how to walk, and you could get from point A to B in an hour. If you want to get there faster, you need to learn how to drive, and those days spent learning how to drive could have been used to walk. But once you know how to drive, you're dramatically more efficient.

It's like that with frameworks - the car is the framework.

With frameworks as a whole, they are used to ease and speed up the development process. To apply the DRY principle, to give you robust basic tools (text processing, input managing, form validation, email and session handling, etc.) so you can work on them right away, to stop you from reinventing the wheel. I was renuent of using a framework, but once I got the hang of it, it's something I can't let go, in my experience.

I don't think it's a limitation (since they are extensible), I think it's more of a "personal standard" - a way that those applications where meant to be written, just as you would have done when you create your own libraries. Once you know and love your framework, that overhead magically dissapears.

About the MVC, I wouldn't use the word "should", but it is definitively a good choice, no matter what you do - if you use a framework, great, and if you don't but you separate bussiness logic from the content, great! It's all about you feeling comfortable. The same thing happens with Grid Frameworks, CSS Resets, library using, and such things - it's a matter of choice. What's mine? Use those tools because they're there for you to use and make robust applications and websites. They have been tested over and over again, they work, and they help you not repeating yourself or reinventing the wheel (something that has been done a thousand times). MVC is also great for scalability and maintenance.

My reccomendation is learn the framework. There's a reason you chose Cake over Codeigniter (dunno why, though - Codeigniter user here!), so stick with it, and work with it for a while. They're all powerful, but the full potential is not totally visible from the beggining.

Also, one last thing: since all applications have punctual uses, you will always create your libraries, no matter what, and those frameworks make it really easy to create, use, and mantain them. So you can have a mixup of all of them, with all the backend power of a framework.

Keep trying - you won't regret it!

My two cents, though.

OTHER TIPS

The principles of MVC are usually applied using object oriented programming, but its completely possible for you to utilize the concepts using procedural programming. This is how the bulk of Drupal works.

I've used a few different frameworks and also written my own. I prefer to use my own for the complete control over the design and implementation. I also wrote it in a way that i can utilize the core code in numerous projects. I also need to for a current project for copyright ownership issues.

I group of developers where i work use CodeIgniter and swear buy it, i've only used it to fool around with and never made and sites with it. But i do prefer it over CakePHP. When learning to use CakePHP i went through a lot fo the core code to figure out how to do certain things and decided i didn't want all that overhead for even the simplest requests.

Doing it yourself is a great learning experience. Lots of people think it should just remain a learning experience and not used for the real world, but i disagree. General frameworks are great for quick prototyping but i personally prefer more control over the system. THere are other MVC frameworks out there, possibly also look at them.

I dont always agree with the discussions some frameworks designers make but you should at least learn why they did it that way as it will teach you stuff.

There nothing 'wrong' with doing it using functions, but as someone that just (this past year) made the switch PHP procedural programming to PHP OOP; OOP is the way to go. I guess i should mention i'm not new to OOP, just ding in in PHP. But it still was not hard to learn.

The amount of code that i reuse as well as how simple it is to create new pages was worth the time it took to get the new stuff up to par with my old methods.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top