Why do I need to use a popular framework? - php

I've been a PHP developer for many years now, with many tools under my belt; tools that I've either developed myself, or free-to-use solutions that I have learned to trust.
I looked into CodeIgniter recently, and discovered that they have many classes and helper routines to aid with development, yet saw nothing in the examples that I couldn't do just as easily with my own tools. Simple things like DB abstractions, Email helpers, etc. There was some interesting code relating to routes - mapping urls to the right controllers; but even that's not particularly difficult to code yourself if you've ever written an MVC style web app with pretty urls.
Even after looking through some of the other popular frameworks, I still see nothing that would be that much of a time-saver. Even looking at the forums, I see people struggling to get the tools to work for them. I do understand how they would be more useful for junior developers, since full system design skills take a while to understand and appreciate fully.
Yet, I'm often told that I should use an off-the-shelf framework to produce my solutions, but I still remain unconvinced. What's the real benefit to someone like myself? Am I just being elitist, or is this a common opinion?
Edit: Looking at some of the answers here, should I perhaps consider packaging up my toolset as its very own framework, writing some documentation and posting tutorials? If I'm hesitant to take on other's frameworks, would opening it up and getting more eyes on it help to improve my own skills/tools?

Frameworks have several advantages:
You don't have to write everything. In your case, this is less of a help because you have your own framework which you have accumulated over the years.
Frameworks provide standardized and tested ways of doing things. The more users there are of a given framework, the more edge cases that have been encountered and coded for. Your own code may, or may not, be battle hardened in the same way.
Others can be recruited onto a project with a standard framework and have access to the documentation, examples and experience with that framework. Your own snippets may or may not be fully documented or have examples of use... but isn't much chance that others are comfortable with them initially.
EDIT:
With regards to your idea of packaging up your own framework, the benefit of cleaning it up for public consumption can be larger than the benefit of getting others to use it.
The reason is simple: you will have to re-evaluate your assumptions about each component, how they fit together and how clear each piece is to understand. Once you publish your framework, your success will be strongly dependent on how easy it is to get up and running with.
Big wins with little effort are essential for adoption (those wins will encourage people to delve further into the framework). Ruby on Rails in an example of a framework that gives such big wins with little effort, and then has hidden layers of features that would have overwhelmed someone just getting started. (The question of the quality of RoR apps is not the point, the point is about adoption speed).
After people adopt a framework, it is about the ease of continued use. Little details like consistent parameter use patterns make all the difference here. If one class has many parameters on every method, while another has setters that are expected to be called before invoking methods, you will lose users because they can't get a "feel" for what is expected in a given case without resorting to the documents.
If both ease-of-adoption and ease-of-living-with issues are addressed properly, you only have to get lucky for people to adopt your framework. If those issues are not addressed properly, even an initial interest in the framework will wane quickly. The reason is that there are many frameworks: you will need to stand out to gain the advantages of having others using your kit (as they rightfully are as wary of your framework as you are of others).

Here's another reason not to create your own framework. Linus' Law - "Given enough eyeballs, all bugs are shallow". In other words, the more people who use a given framework, the more solid and bug-free it is likely to be.
Have you seen how many web frameworks there are for Java? Back in the day, it was fashionable for any half-decent developer/architect to write their own custom web framework. And at the end of the day, 95% of them looked like a custom implementation of Struts (the most popular Java web framework at the time). So they basically created a Struts clone that was: 1) proprietary; and 2) not as well documented and tested.
Let's face it - writing our own customer framework is fun, but what happens next? It becomes a maintenance burden to keep up with the framework yourself (or the poor soul who replaces you). And maintaining software is much, much more costly, especially when it comes to custom frameworks. Is the company in business to solve domain problems or in the business of maintaining frameworks?
I forget who said it, but I once heard a great quote - "The first rule to creating your own framework is: don't". Somebody else has probably gone through the effort of doing so and probably done the same work you would have done. Save yourself the time, effort, and testing.

There's many comments here as to the advantages of using a framework, and certainly I think in a good many cases they are perfectly correct.
HOWEVER
All frameworks come with the downside that they have a domain of problems that can be fitted into them. If your problem is well inside the scope of the domain then using a framework isn't an issue, and most of the time it's readily apparent if your problem is well outside the domain so you don't give it a thought. Issues arise when you try to force a problem into a framework that it just doesn't quite fit into or has some unusual non-standard feature - in which case you complete 90% of the code really fast then spend all the time you've saved figuring out how to bend or extend the framework so it can accomplish some obscure requirement. Because in these case your solution/extension has to plug into the framework it can often be more difficult to code than if you'd come to it independently.
In the wrong circumstances this can actually be disastrous. For example if a client asks for a project that you believe will fit into a framework solution and you quote accordingly, then after completing 90% you find the gotcha then you can be really up the creek, especially if it's some feature that the client is insistent upon (and it always is). These issues tend to arise because it is not always apparent from the word go where the gotchas might lie, particularly if you're using a framework you are less familiar with (and you have to from time to time).
This is really the same problem as arises with deploying any third party software in a project. Myself from experience I have no qualms about using frameworks or similar, but given the choice I will always go for the lightest, thinnest, wrapper I can find that will do what I need. That way I gain the advantages, whilst knowing that if issues do arise (and they are generally less likely to with a thinner wrapper) then figuring out how to work around them is likely to be simpler than learning an extensive code-base to the point where I can safely modify it.

The framework code is likely to be well-tested and relatively free of bugs. By using it you save yourself time testing/maintaining your own code to do the same thing.
And any time saved is good. Laziness pays off in programming.

One thing that you will be missing out on is all of the Validation that goes into a popular framework.
Your routines simply don't have the same exposure that the popular libraries have.

You may have a point.... however I wouldn't underestimate the power of many, as an example phpBB is as far as i'm concerned the bb solution to use. Why? Because there are many, many thousands of posts on their support boards and many people using it who are knowledgeable and can help people solve problems.
Therefore the only reason in your case to use a popular framework is the many others that use it, report bugs against it, fix it and support it. It'll be tricky to get the same coverage on your own libraries.

I would go against the grain here, and say, you should use your own custom framework, If the software you are building is the core of your business. As Joel would say, "Find the dependencies - and eliminate them". If you are just putting up a little website for your company, and you business isn't maintaining websites, then go ahead and use a framework. But when that website is your business, then you shouldn't depend on a framework from somebody else to let you get the job done.

I think the main reason is that when you use a common framework, there are a lot of people who are instantly familiar with your product.
Apart from that I think it's most important that whatever tools you use actually get the job done. If it happens to be familiar to other people, then that's a bonus.

I agree you should use your own custom framework. Not only is it easier for you to understand, but it provides the ultimate in job security!

Three reasons I can think of immediately:
A well-known framework will be familiar to other developers who may have to work on your project
A well-known framework will have resources like books, discussion boards, and other experts that can be used for finding out more information
Managers will often have a "don't reinvent the wheel" philosophy. In fact, existing solutions have probably solved the same problems that you'd discover if you create your own solution.
All of that said, there may still be a place for your own solutions. We wouldn't have so many frameworks (or scripting languages) to choose from if no one started something new.

Any experienced developer can build a framework -- the challenging part is convincing others that it's worth using. You'll need to create documentation and tutorials for it for those who plan to use or maintain it. You'll probably need to create a demo site to prove that its useful and actually works like it's supposed to.
That alone can be a considerable investment, not including bugs that could pop up in between. When its all said it done, it could be worth spending time learning another framework instead of making your own.
You mentioned CodeIgniter -- I personally feel like that's a pretty framework -- it doesn't get much more barebones than that.

What you essentially have is your own framework. So, it isn't a time-saver FOR YOU, because you have already spent the time to develop the framework. If you didn't have that to build from, it would certainly be easier and faster to use an existing framework than to roll your own.
What you need to look at is whether or not your framework is better than other options out there, and whether your familiarity with your own code outweighs having other eyes looking at it, and other people using it in enough different ways that the likelihood of any problems being found and corrected is much higher.
Also, if your framework is so much better than everyone elses', you might consider opening yours up to the community ;)

As you probably know: "time is money". So by using a popular framework with a lot of helpers, a lot of code examples on web and a big community you do more in less time.
Sometimes it if ok to use frameworks because you become more productive, but in some advanced and difficult projects it may happen so that the framework stays in your way and you have to find workarounds.
I think there is no definitive answer. You should put in balance the pros and cons and take the right decision for your project.
Usually I adopt popular frameworks very fast but not in critical parts of the projects and in time I extend their usage.

I think that if you don't see a need to use a framework then don't.
The reason I use a framework for example Django for python or Rails for Ruby or Webforms and MVC for ASP.net is because they make it easier and faster to write applications for them. In the case of Ruby and Python not using a framework for me would make me go crazy.
If you have something that works and don't see a need to use a framework I would say stick with what you feel is best. But, I would still keep up to date with frameworks.

I think they are more useful if you are starting from scratch and don't have the time to write your own. If you already have a codebase you developed over the years, they may be much less useful, but it may still be useful to take a look and see what they did.
For example, I am sure major game development shops are not using third-party tools, engines and frameworks, not because they are not sufficient, but they already have built their own since the 80's or whatever.
Plus, if you are using an off-the-shelf component, there is no way to exceed it in its particular area. If you need to be a market leader in a particular dimension, you should be building your own solution in that dimension, so you can lead. If you don't need this capability, using a third-party component that is just as good as yours may be a good solution as long as it is an easy transition. Time to train in the new tool and living with its idiosyncrasies may or may not be worth it though.
The other thing to consider is that if you can build something, you truly understand it. Otherwise, you don't. Now, you don't need to fully understand stuff to use them, so long as they "just work", but we all know how that goes... :)

Can you solve the problems you are given have with your code faster and more reliably than public frameworks?
If yes, then keep using your own.
If no, then find the framework that does a better job and run with it for that project.
It all comes down to which codebase gets the job done better(for the value of better given by the client. ;) )

Disadvantages.
Most frame works are not object orientated. (code igniter does show some promiss)
Most of the code is done via includes. trying to track down the problem is like pulling on a thread on a sweater, and having to unravel the entire garment to fully understand the creation.
Most frame works have poorly written documentation.
Most frame works try to do many many many things.
I find from my experience developing with frame works that it takes a good 3-6 months to get on top of the code base. And its only after that period of time that you will find out weather you are trying to fit a square peg into a round hole. Given that most php projects want to be finished before that period has elapsed, it will cost employers more to get any project using a big "frame work" to fruition.
Many of the php Frame works were written for php 4, and were written in a different enviroment. They have been extended greatly, but are showing their origins. The use of global constraints is particularly prevalent. I am hoping that php 6 puts most of them to death. Code igniter escapes most of this, but it is new, and has object orientated parts.
Some frame works have written code that is not needed, and causes problems.. eg: CAKE has a most excellent model view controller, but its session handling is a disaster. Unfortunately frame works are not written in a modular way. Often its an all or nothing option.
MOst programers "hack" the frame work to get it to do what they want. This leaves future programers sractching their heads. It also makes "upgrading" the frame work a impossibility.
I have yet to see a frame work that implements unit testing. (how do you know that you have not broken it).
give me a well written object any time. At least them you know the scope right off the bat.

Advantages are that it's already written and tested by multiple people therefore less likely to be bug prone.
Disadvantages are that it's not built specifically for your application and therefore will most likely perform worse.
All in all, I can't really see much reason to use one considering you already have your own...although it may be worth releasing that open source so others are able to bug check and recommend improvements.

Related

Benefits of creating a custom mvc framework

Would creating a custom php mvc framework from scratch be completely pointless for a small digital agency?
I have heard recently from a friend that His colleges are infact spending time on such a project within their agency. Their argument against using another such as cake or zend being that they come with so many unused features and therefore lots of unnecessary code.
I would have thought that such an endevour is completely pointless and indeed a waste of time and money. Surely it would make more sense to pick a framework that matches your needs as close as possible and then customise/extend it. On such frameworks as zend the code is surely going to be of a much better/tested level than that of 1 or 2 programmers could create in a few months.
It just doesn't make sense to me - can anyone pursuade me otherwise?
Using your own framework has one big advantage over other solutions. It means you have total i mean TOTAL! controll over it. No matter what happens to other frameworks, because one day you have open source software and another day it could be abbandoned or stopped project. And your framework will still be developed. Even if it means you will need to constantly add some features to it, with time it will pay off. Besides, PHP is like one huge framework after all, and it's evolving. Writing your own framework will keep you up to date with this technology :) Of course keeping with other frameworks or CMSes is also good idea, because maybe your clients will want to use them, and you can also learn from them and move some solutions to your software :D
No, I think you will find most here would agree with you - I certainly feel it is a complete waste of time. Especially given that they are a small agency, their limited resources could be better spent elsewhere.
Since they are concerned about a bloated framework, I suggest that instead they investigate using a lightweight PHP framework such as CodeIgniter and Kohana.
I see it pointless. But it's a curse of PHP programmers who tend to invent wheel again and again. I know what I'm talking about. I tried it too.
The best approach seems to be to learn a framework and if it doesn't suit you ask friends who knows other frameworks to learn how is the particular problem solved in other frameworks and if none of them seems good then MAYBE it's time to start work on a new framework.
The point with lots of unused code is not completely valid. Zend contains classes that can be stripped off as far as I know.
EDIT: Performance of PHP can be enhanced via eAccelerator for example. I find it easier than building a brand new framework.
MVC FW is less than 5% of average project code base, so I strongly recommend building MVC for every project and adapt it to the project specifications.
If someone has enough knowledge about MVC pattern and some experience in using and building MVC frameworks, it can be built in some days.
General arguments are speed and performance given by the custom FW.
Sometimes when people are afraid of changes and learning new things, they come up with all kinds of silly reasons why somethings is bad and should not be used.
I once worked in company that was determined to write their own web framework instead of using Django. One of the developers that was working on "admin" part of framework said i wanted him to lose his job cos Django has auto generated admin.
Unless is it very specific framework and you have very good reasons and enough fundings for project it is never a good idea to reinvent the wheel specially if you can't make it the same or better quality then what is already out there.
It depends on what kind of projects they do, and what are their needs. Never forget that in software, the 'best' always depends on what you are doing. There is no 'one golden solution' for everything. This includes mvcs.
There are various reasons to code your own mvc :
You can tailor it to your exact specific needs
You can keep it closed source, reducing exposure, increasing security due to obscurity
You can continue developing it, and then release it to the world when it is mature and fulfills a major purpose - a lot of current mvcs came to being in that way anyway.
You can continue developing it, keep it closed source code, and build massive SaaS services and applications on it, to which you will retain full rights. Can be done with apache license too though.
You can fulfill a purpose that is not fulfilled by any other mvc. Despite every mvc has its zealots who believe that they have the one and all solution, every mvc has its downsides. And believing that 'everything that can be done, has been done' because there are 15-20 mvcs out, is as stupid as saying 'all that can be discovered has been discovered'. And there were people saying the latter at the start of 20th century.
Not to mention that with an external mvc you are using, you are obliged to that mvc's project team for many things. They may already have or may introduce things that you dont like, or even hamper your specific applications.
Not to mention they may just get abandoned. Can happen to the biggest. Codeigniter was all the rage. What happened ? Ellis is dumping it basically. Development slowed down to a halt. Probably soon totally halting. Being open sourced does not guarantee a project either - there have been many open source projects which went similar ways.
What's going to happen to people who had coded major applications with Codeigniter ? Are they going to undertake the security of the Codeigniter installations they have themselves ? Therefore de facto becoming maintainers of their own mvc ? Or are they going to hire external parties to maintain the mvc for them ?
Not a good future investment.
My preference for coding my own mvc is mainly to have a mvc that fits my own style of coding. My criteria for a mvc :
Fast development
Fast modification
Low maintenance
Speed
Security
Extreme simplicity
Reliability in regard to future development
I have coded a major mvc for myself before. and i am still successfully running it on one of my hobby websites which handles ~600,000-1,200,000 unique visitors per month. At a given moment, 250+ visitors (google analytics - it doesnt include any bots) can be present on the site, hammering page after page. And it does not even blink. I like that. Despite it has various shortcomings that i dont like, it works spectacularly.
In the current mvc im doing, im using the lessons i learned from the previous one, as they apply to my specific purposes.
Not to mention it is a great way to hone and develop new skills.
But one thing is a must: plan it very well, and keep building on it, changing and improving it.
For any framework
Pros
get exact functionality you want
control over small details important to your project
familiarity with code
Cons
everything that breaks you must fix yourself
don't get to learn from the mistakes of the past
won't get as many bugs noticed due to smaller audience
Personally I recommend exploring existing frameworks before even considering writing your own. Just remember that it's okay if you don't understand it all in a day!
It's a waste of time. Unless they are building a site with the traffic of Facebook, the performance hits they will get using something like Yii vs. their own should matter very little
It's not necessarily a waste of time but I agree with you, I tried it myself too. I've been using Zend, Code Igniter and Fuel depending on what project that I'm working on.
The consequence that I had in creating my own framework is the deadline. If you're working on a project with a very tight deadline then creating your own framework would be a bad idea.

php frameworks - build your own vs pre-made

I am building an application currently in PHP and I am trying to decide on whether to use a pre-existing framework like codeigniter or build my own framework. The application needs to be really scalable and I want to be completely in control of it which makes me think I should build my own but at the same time I dont want to reinvent the wheel if I dont have to.
Any advice greatly appreciated.
Thanks
Use an existing framework.
First of all creating a framework from scratch represents a massive investment in time and effort. The process involves a lot of trial and error, because you're designing something that needs to be both simple and powerful. For every design decision you'll have to ask yourself how it will affect every single future project that will be built on your framework.
You'd think that you could take each design decision and weigh it against the requirements like you would do for any other software project, but the thing is you don't know your requirements. You can't know them, because a framework is supposed to be able to do almost anything (or have the ability to be extended to do almost anything) within its domain. Future project a will need to be able to do x. Can your framework allow that without turning it into spaghetti code? And what if project b needs to do y? What if project c needs to do z?
Have you predicted everything?
Now the normal response to this is that if something doesn't work, you'll just change it in the future. It's software after all. A framework however isn't like a simple application. It's supposed to have an interface and once you expose that to the software that will be using it, you can't change it. You can extend it, but not change it. So now you have to think about deprecating methods, api versions and version compatibility. It's a whole new set of problems to deal with along with normal framework maintenance and new application writing.
Then there's documentation. You need an API, tutorials, example code. Once you build your own framework you have to deal with this as well. You could ignore it, but I assure you that eventually you yourself will need to find out what that method you wrote 6 months ago does. What does it return? What if special case x happens? Have you written all that down, or do you need to step through the code again? And I wont even mention how easy it will be for a new team member to get started on a custom framework whose documentation lies completely or at least mostly in your head.
You also have to acknowledge that unless you're working with the very best and brightest (and have a budget to match) you'll never have the extensive set of libraries that existing frameworks boast. Can you analyze, design, code, test and debug faster than an open-source community?
Finally you should ask yourself if you are proficient enough to be writing a framework. Have you dived deep into the code of a modern OO PHP5 framework to find out what makes it tick? And most importantly do you know why it does things that particular way? Keep in mind that any mistake you make in your design can blow up in your face months from now and you can end up paying for them over and over again.
To sum things up I'd advice you to go with an existing framework; it doesn't mean however that you have to pick one and like it. Take the time you'd otherwise devote to developing a new framework and devote it to learning an existing one. Then you can extend it to fit your needs. Also remember that there could be things you wont be able to do. But I assure you there would be things you wouldn't be able to do with your own framework either, so it doesn't matter all that much. A framework imposes a few limitations. It's the price you pay for being able to develop applications faster.
Make a list of requirements for your framework (ORM, PHP 5.3, PDO, etc). Then iterate over the existing frameworks and narrow them down to find the ones matching with your requirements. Then look at the codebase, documentation, community, project activity – does it feel something you would like to work with? Also be realistic about the time needed to to implement all your requirements by yourself – do you want to focus to building an application or a framework?
I'm building my own and I'm very glad I did in terms of learning, which is important to me. Also I LOVE to be in total control of my code. It comes with lots of negatives though, the big one being I'm the only one that knows how to use it. Also, a lot of development time is spent on improving my framework rather than delivering products to my clients. But I can't stress enough that I really, really enjoy building and using it.
If you want to learn (A LOT) build your own. If you just want to get work done use an existing one. (Before starting my own I almost went with CodeIgniter)
While I've build my own CMS framework in the past, and used custom (in-house) general php frameworks, I'd find an active framework that fits your development style, and use it.
Unless your main product/application is the framework. But it doesn't seem that way.
Your concerns about control and scalability should be applied to the host of frameworks out there - giving you a short list of options that fit your requirements.
Certainly, it's not a question of 'in-house' vrs 'public', then once you've made that call just pick any old framework.
To answer the question behind the question, for a framework that gives you complete control and should be able to scale reasonable well (I'm not sure how you need the framework to scale), I would suggest the Zend Framework. You can use single parts of it, rewrite what you want, and it's far more than just a MVC implementation.
Update: A quick example of customization with Zend. If you don't want to use their MVC stack, but need something to route requests, you can just use Zend's router library. If you like the MVC stack, but hate the way the router works, you can just implement the interface and write your own router.
This applies outside the MVC stack as well. Zend has a ton of libraries for mail, rss feeds, caching, auth, db, etc. Use what you want, and ignore the rest. Extend what you want, most of the framework is tiered with interfaces/abstract/generalized classes that you can build on if the standard functionality doesn't suite your needs.
The decision is very plain and simple.
If you want to learn and have full control - go for your own
If you want just to make money fast - go for ready made one.
I work in a company that initially wrote its own framework, built by a guy that worked here. It was only used on one project. The reason for this is that we soon realized that although it was clever and very good, there was no documentation for it. So if we employ another developer or a freelance guy, they'd have to learn it.
We run with CakePHP for a while, which is popular, but it does seem a mess. We eventually settled on KohanaPHP. Easy to extend, some good documentation (probably not up there with some others though), nicely formatted code (meaning if you can't find documentation you can quickly work out whats going on). The way the framework is written makes it pretty easy for a developer to pick up and follow what is going on. Whereas we always had trouble doing this with CakePHP.
I think the only argument for rolling your own framework is that you may want some highly customised stuff. But Kohana is so easy to extend, you can just throw it in there. You don't have to use their packed libraries if you really don't want to.
That said, some project I don't bother with a framework at all, just some sort of routing solution, like GluePHP. Since it would be overkill to use a full stack framework.
If you were just trying to practice, I'd suggest writing your own. Otherwise, though, definitely go with using an existing one. Symfony ftw.
The short answer is symfony2 IHMO.
The reasons are:
do not reinvent the wheel
a good wheel is better than yours (others are professional wheel makers,
since a lot of time)
an OSS framework can be expanded or modified, even only inspected
first or later you will not have time to maintain your own wheel
a number of eyes and hands do it better than 2!
Of course the previous points are valid for a very small set of professionally made frameworks! My favorite is symfony2, but there are a number of good alternatives.

How to know when it is time to use a framework to develop a website?

I have been developing websites in an n-tier structure and so far my requirements are fulfilled. But as powerful frameworks like Zend Framework, Symfony are getting popular, I wonder how to know if it is time to shift to a framework?
Am I in a kind of dilemma? What is the right option?
If you satisfied with your own way - never.
Frameworks being written not by gods but by people. Some of them may know less than you. Or have different point of view.
Also, it is more a paradigm dictated to you, than toolbox. A religion.
If you have your own way and it suits you, better develop your own framework. Not as universal as famous ones, but not as fat and sluggish as them too.
Yes.
It not only speeds up development time (once you know your way around the framework), it enables other developers to have a better understanding of how the site works.
Using a framework has of course its advantages because you can write your code faster, you have not worry about a lot of functionalities that are always required in a web application so you can think more about your application-specific implementation and you have just to upgrade the other functionalities.
Using a framework gives you of course advantages in terms of collaboration because obviously if you use a well-known framework there are a lot of people that know it without spending time to train them.
But, when you use a framework, you must respect its structure, its coding style and its design. That's usually not a problem because if you choose wisely a framework, you won't feel the need to go off the rails.
The best thing to do is really just have a go! I switched from my own coding style into CakePHP about a year ago and haven't looked back since. Makes it much easier for me to work on other framework-based code by other people, too, and it's overall reduced the wtfs of looking at my own code six months later because now the code follows a much stricter format and is more predictable.
If you're asking that question, then the time to try it is probably now since you've clearly had your interest piqued. If it turns out you don't like working with them then you can always go back to your usual way (or even write your own like Col. Shrapnel says).
The 4 reasons we chose to go with a framework (Zend) at my company:
1 - Common syntax: the framework has it's own syntax that all our coders must work to (to some degree). Makes it easier to use external developers, or handle staff turnover
2 - Scale: the site in question was of a scale that demanded MVC architecture
3 - Tested Components: The framework has most of the components pre-built, leaving you to focus on the Model
4 - Brand credibility: There's a certain value in using a high profile framework brand from a client perspective. It implies a standard solution, and "decouples" the client from your custom framework
Whenever you're not quite sure what the end result of the software is going to be. Ready made libraries are usually made to handle almost anything so you can easily extend your site on them. And if there's going to be new people working on it at some point in the future, they can hop in easily, without having to learn your way of doing things.
But other than that, i think that Col. Shrapnel is spot on.
As long as you can't answer this question yourself, I'd say: Always use a framework.
I know a lot of developers who think that using a framework makes them less off a "real programmer" which is just plain stupid. This wrong kind of pride should not stand in the way of creating well structured and maintainable code.
Using a good Framework saves you a lot of the small annoying problems so you can concentrate on your actual project. Of course there are no things that you can't do without a framework but with one you'll be able to do them much faster and with les headache.
Maybe experience will then show you cases where you don't need a framework or are in fact better of without one but these are quite rare.

Why use a web framework (like rails) over php?

This isn't a question about what framework to use. I've learned both Rails and Django, and I write all of my webapps in PHP. My question is why bother with the frameworks? It's always taken me longer to use a framework than to reuse old MySQL code and build "models" with phpMyAdmin. I also like writing everything myself, because I know what's going on. I can still reuse functions, etc. and do things how I want, and this freedom seems to be missing from most frameworks.
I'm not saying that my way is right; in fact, I'm trying to figure out where my logic fails. The hype can't be just thin air. What am I missing?
The basic idea of a framework is to allow you to work at a higher level of abstruction and write only the code you have to write to implement your specific requirements. All the other repetitive stuff is handled for you by the framework, and probably with far fewer bugs and security holes than if you did it yourself.
It may feel like it takes longer to learn a framework than to just do it yourself using basic language features and standard APIs, but it's simply not true - not if the framework is good and the app is non-trivial, and especially not once you have learned the framework (using a different one for each new project would of course be idiotic) and factor in the time it would take to find and eliminate all the bugs and correct all the design mistakes that have long since been found, eliminated and corrected in the framework by its developer community.
Almost every developer has cowboy coder instincts that tell him "Doing things yourself is much more fun than using code others have written, and I'm sure I'm good enough to get it right the first time, so it will even be faster and better!". These instincts are almost always wrong.
Frameworks allow you to concentrate on the application itself rather than worrying about the boilerplate code that you'd otherwise have to write for every application. They allow you to structure you site in a much more logical (mostly object-oriented) way, using tried and tested design patters such as model-view-controller. The code in framework is generally more mature and of a higher standard than code you would write yourself for one-off projects as framework have a large community of developers perfecting the code perfecting the code over year. This means that framework-driven sites often perform better and are much more secure.
You also mentioned you like writing things yourself - I know where you're coming from. My solution to this was to write my own framework - I get to reuse and improve my code with every project I do and I know the entire codebase inside out.
Writing it your self may make it easier for you to understand things your self but unfortunately it can make it much harder for other developers to understand what is happening. Frameworks will often be better documented and have a larger community that can support a new developer that is working on the app that you wrote.
I think a big part of it is what you focus on. Frameworks standardize the parts that you shouldn't have to keep revisiting, which helps you focus on the application as a whole. If you reuse your own code all the time you're already using your own makeshift framework.
Your comparing a framework (Rails) to a language (PHP). A framework is going to give you pre-built components so you can spend time on what makes your project unique.
You may already have a code base that helps do this for you. Check out some of the PHP frameworks since that's where you are more comfortable. Take a look at CakePHP, CodeIgnitor and/or Zend Framework.
If you are building many small apps/sites, using a framework may make your life easier.
I think a good step for you is to create your own framework with the code you've programmed so far. ;)
Try to make your code parametrizeable, in other words: create components which you can reuse in different parts of a website (for instance: styled containers), or in different websites (form generators/validators).
You can even go further and create base-classes from which you extend new classes to build your websites. (for instance: data objects with generic select/insert/update/delete methods).
I bet this gives you the best view on why frameworks are so damn handy ;)
It'll take you longer to initially use a framework for the same reasons a PHP developer would take longer to initially use Ruby - you're not familiar with it.
Once you're familiar with them, frameworks can offer the ability to skip the mundane and focus on actually writing the important parts of the app.
You should also just use a PHP based framework like Symfony or CakePHP using them should reduce your production time considerably.
One reason to use a frame work is code separation. Take symfony for example. The model is all done with propel or doctrine libraries. Very little SQL needed. You instantiate a new object and user getters and setters, to store your data, and instead of writing SQL in your page code you create functions in the objects related to the query. When you need to access the same kind of data on different pages you are asking the model for it, keeping the business logic with the model where it should be, so there's never any difference. All the work is done in the "action controller function". You get all the data you need, and then put as little php in the display, basically just echoing the variables you got in the action controller, (with the exception of some for loops and if statements for conditionals. I have found this a more efficient way to code, and on my 2nd project saw the production time cut in half.
You don't need to learn a new language python/ruby just to use a great framework, just have to fin one that works for you.
First, PHP has frameworks too, so the question as stated misses the point.
Yes, you can write your own framework, and as Kris said, there's no shame in that. However, part of the leverage of code reuse is the collective value of the efforts of many. It's not just about reusing your own code. Frameworks encapsulate the common tasks and patterns we all share and provide well tested solutions with many iterations of improvements from the community. No individual effort is going to measure up to that, no matter who you are.
If you roll your own, it will only become world class due to the collective effort of world class people, and that will only happen if your idea merits the attention. The top frameworks out there are already proven on those criteria.
DHH is a smart guy, but the Rails we have today never could have been realized by him alone. Not even close.
If you like "writing everything yourself" as you say, then choose a framework with a core philosophy that matches yours, and start making core contributions in the areas where you can see room for improvement.
Depending on the functions of your Web Application, it can be faster to develop without a framework. For example when the Webapp is just some kind of data viewer.
But as soon as you begin to implement more advanced functions, you are much more efficient with a framework.
Try do do this from scratch:
- proper Form validation
- Handling of multiple Language and Date/Time formatting
- Authentication
See a framework as free tools and stable implemented function for you to use.
Sounds to me like you have already written your own framework in php, since you do mention code reuse.
I can imagine it being easier to use your own set of wheels instead of adapting to someone else's. No shame in that.
Frameworks are there mainly to help people who are semi-new to PHP (or the specific language it is built on) to be able to build a website to an extent that it is secure and easy enough to add on extra parts to the site without having to know a lot about the specifics like security, MySQL (or other database types). In my opinion it is a fairly good way to help break coders into a language, allowing for the fact that the framework isn't too complex of course.
EDIT The reason behind me saying they are for beginners is because myself, as a beginner has used frameworks to break myself into languages a lot better.

Why a very good PHP framework - Qcodo (or Qcubed - its branch) - is so unpopular? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I am wondering why this framework (QCodo) is almost forgotten and totally unpopular.
I've started using it a few years ago and it is the only thing that keeps me with PHP. Yeah ... its development is stuck (that's why there is now more active branch Qcubed) but it is still very good piece of software.
Its main advantages:
Event driven (something like asp.net) no spaghetti code
Powerful code generation
good ORM
follows DRY
very simple AJAX support
is fun to write
Since then I wanted to be trendy and checked Django but I cannot write normal request-based web application (it just doesn't feel right).
Don't believe? chess.com is written with it and surely there are plenty others.
My 2 questions are:
Have you heard of it (PHP people)?
If you are using it what is your opinion about it (show us examples of your work)
Thanks
I've used PHP a lot for many years and never heard of it.
The creator(s) of Qcodo never really promoted the framework, and thus, didn't generate a large following. I believe they created it mostly for their own use, but also offered it up to others. It is awesome if you are looking for a code-generating framework. It does have a learning curve. So to get the most use of it, it's best to spend time studying the examples.
Qcodo has really had no active development for well over a year and there doesn't appear to be much chance that development will continue on Qcodo anytime soon. Qcodo appears to be dying a slow death.
Qcubed, a branch of Qcodo, is under active development and has been since Nov 2008. It was created by users of Qcodo who got frustrated with the lack of Qcodo progress. If you are just getting started, start here and not with Qcodo. But use Qcodo forums to search for problems/questions you may have.
Qcodo and Qcubed are fantastic frameworks. Don't discount or underestimate them just because you've not heard of them.
Emulating ASP.NET or Wicket in PHP is not a good thing to do. Moreover, the code style does not look good to me.
$this->btnSavePage = new QButton($this);
$this->btnSavePage->Text = "Save";
$this->btnSavePage->Visible = false;
$this->btnCancelEdit = new QButton($this);
$this->btnCancelEdit->Text = "Cancel";
$this->btnCancelEdit->Visible = false;
Hungarian notation? OMG. I need to create a big object to create a button? Heavy weight to me.
Yes, we do use it at Chess.com and overall have been very happy with it. It can get problematic trying to figure out how/where to store all those QFormStates when you're getting well over a million pageviews a day. Every page view is its own QFormState! We solved this by putting all of them into memcache! It does have a bit of a learning curve, but once you know it, you never really need documentation any more. I actually have moved away from using QQ entirely, and use all custom sql in our ORM files. QQ is just not powerful enough to do heavily optimized queries and highly tuned queries is more important than database abstraction. After all, the site needs to function and be fast. Here is one example ORM static method in our User class to load a random user from the database (we used to use this to show a random "user spotlight" on our members page). Notice how it uses the slave database, not our master (custom built function). It also uses memcache so that the randomized user only changes every 10 minutes (600s).
public static function LoadRandom($blnAvatarRequired = true, $blnForce = false) {
$strCacheKey = MyMemcache::QueryToKey("User->LoadRandom()");
if($blnForce || false === ($objUser = MyMemcache::G()->GetQuery($strCacheKey))) {
$objDatabase = QApplication::GetSlaveDbConnection();
$DaysAgo = new QDateTime(QDateTime::Now);
$DaysAgo->AddDays(-10); //make sure this is an active member
// Setup the SQL Query
$strAvatarReq = $blnAvatarRequired ? ' and u.has_avatar':'';
$strQuery = "
select
u.*
from
user u
where
u.is_enabled=1 and
u.create_date > '$DaysAgo'
$strAvatarReq
order by
rand()
limit
1
";
// Perform the Query and Instantiate the Result
$objDbResult = $objDatabase->Query($strQuery);
$objUser = User::InstantiateDbRow($objDbResult->GetNextRow());
MyMemcache::G()->SetQuery($strCacheKey, $objUser, null, 600);
}
return $objUser;
}
Qcubed and Qcodo are used by us in 3 projects and these ones are the cleanest and easiest to maintain projects we ever had! This is great stuff and easy to understand.
Just go into the code you won't need much manuals.
Qcubed community is much stronger at the moment so you might want to check in Qcodo forum for your answers on basic problems, but post on the Qcubed forum.
We will continue to stay with this fantastic product and community!
Regards,
tronics
http://www.twitter.com/qcodo
No, I'd never heard of it.
The main ones I've heard of are Zend, CakePHP, Symfony, Code Igniter, and one or two other ones I can't recall the names of right off the bat.
I've been doing PHP work on and off for about 3 years and have never heard of it. Ask anyone to name a PHP frameworks and you're gonna get the usual suspects: Code Igniter, Cake, Zend, etc.
Guess QCodo devs need to work on their marketing a bit!
I've been using QCodo for 2 years and now I'm with QCubed.
This is the nice way to develop and maintain web applications, as well as, the easiest way to deploy code and test it. Remember that QCubed is now growing in acceptance and it's good for all QCodo's Community.
I think that frameworks can save a lot of development time but it many cases it's not recommended for all yours web developments.
I started to use it two years ago. The pro:
code generation from the database
ORM object oriented
simple use of ajax
Cons:
qcubed community is not so skilled to carry on a project with new good ideas
the new code is not at the level of Mike Ho.
bugs in the state of qforms, the forms of qcodo/qcubed.
is not popular.
they do not want to go ahead and use DDD and forward engineering.
the forms only works with js enabled.
is written in PHP.
new plugin system poorly designed.
At the moment, Grails seems to be the best framework, very DDD oriented, with the possibility to use any existing Java code, good template library, possibility to use different js frameworks, built on Hibernate and Spring. With Grails is possible to write simple web app or financial application.
I hope not to use PHP in the future, but since I know Qcubed/Qcodo I will use it if it will be necessary. For newbies, I reccomend Symfony, bigger community, mre plugins, feature rich, it has a more secure future.
Updates:
No database migrations, no way to track database schema changes
No schema reflecting which tables are generated
It is not designed to real TDD, it is not easy to test models, controllers and views. They just added a testing framework to an unfriendly testing web framework
QForms still bugged and can loose status when using several controls and trigger Ajax error and blocking the application.
The ORM is very boring to use in the long term (lots of chatty/redundant code) and cannot be tested with a tool like Rails console, in the end it takes less time to use pure SQL and test it with phpMyAdmin.
Bugs in the ORM too, sometimes I get a string when I declared the field as integer (code-generated queries).
There is not a front controller and a routing system and the framework is inside the public path! The plug-ins are installed in the public path too!
Strange directory structure not similar to other MVC frameworks and they thing that the M stands for ORM only instead of model.
not link_to tag like Rails or Symfony and many other tags.
Over complex metacontrols that are useful to waste time only.
Framework focused in scaffolding when in Rails it is not used a lot since most of the developers use a user centric design instead of data centric one.
The views are full of object->render and JS and custom controls are a pain to be customized, and instead of staying inside a template are inside a class with logic session .. everything.
It does not work with PHP 5.3 (not tested but should be resolved) and on Quercus.
Rails/Grails has ton of plugin doing everything.
I could continue but I think you get the idea. Just learn Rails or Grails for few months then let me know what you think.
I am moving my Qcodo project to Rails and I have a wonderful environment, nice community and most of the innovation in the web is around Ruby and Rails. Rails has been voted several times as best web development tool and is the only one that can substitute Java or .net
While I have heard of it (Qcodo... not this fork) I never looked into using it. There are tons of frameworks and only so much need. PR and mindshare are hugely important in such a situation and Qcodo never really had either. Now that I am settled on a handful I have no time, nor inclination, to start learning a new framework.
This Swim Log uses it mySwimLog
I've been using QCodo since beta 2, and am now a core contributer of QCubed, so yes, I've heard of it.
What initially drew me to the framework was the code generation. I came from asp.net, and codesmith, and was very pleased to find a framework that gave me both the event-driven approach of asp.net and the code generation of codesmith.
I also love that it's all pure OO PHP, which means I don't have to learn a new language to develop my PHP app, and customizing any aspect of the framework that doesn't behave like I want is simple.
All of this has resulted in us being able to produce an easy to maintain and robust Learning Management System that we have sold to and host for numerous Fortune 500 companies.
There are some downsides, such as the runtime overhead of an ORM approach, but the readability and clean layout of the code results in the ability to more easily streamline other aspects of the application, and significantly reduces both development time, and the number of bugs produced.
Since QCubed is a community driven project, anyone is able to submit tickets, suggest improvements or discuss changes, it's very clear where the project is going, and very open to constructive feedback.
In defense of some of the negative things said here, I will simply point out that tickets for most of the supposed "problems" simply have never been created. And I would encourage anyone that does encounter any of them to please create a ticket for us to look at at http://qcu.be.
OK, Here is something I want to tell about this Qcodo / Qcubed thing:
Its brilliant. I just have no words about how great it is. You say CodeIgniter? Symfony? I say Qcubed.
It was when I wanted to start off the project I am working on and I looked into all those and through a Wikipedia article, landed on Qcodo site, and then on Qcubed...and I was surprised.
The features I loved the most:
No SQL queries needed. Of course, it can be done but most things are taken care of!
Speration of Templates from the core functionality.
Creating custom controls is a piece of CAKE (and its not CAKEPHP).
Totally Even driven. Saving states is like..."where does that happen?"
NO LEARNING CURVE. Just look at Yii or Symfony exmaples and then go for Qcubed examples. Its much simpler compared to others.
Full AJAX support. I love this.
No JavaScripting. Ask it to do something as a 'javascript' action, it is done by javascript. Change one word to 'QAjaxAction' and it goes to ajax. Change again, page reloads. What more do you want?
Autocomplete, typecasting (both automated and manual control) and what not!
Inline editing of almost anything!
yeah, there are a few cherries on the ice cream when it comes to Yii. But I think Qcodo has more inside.
You say Authentication support? Well, I created one to integrate with Qcubed in 1 day. It saved a week of lerning headaches with other frameworks. Qcubed rocks.
yes, I hate its slow development. But I think its near to complete! (may be I know too few things but anything I am capable of imagining seems to get solved through Qcubed).
I wish it was more popular...I would have saved me a week of search before landing on their pages.
I have used QCodo/QCubed for 1.5 years now. Started with my own framework, which at some point seemed messy. That's when I started looking for a more mature framework. Luckily I found QCodo. Since then I have never even considered looking for something else. The framework is so flexible and powerful, that you can do everything you want with it.
I had almost no experience with event-driven architecture. So, the beginning was somewhat hard, cause there was few documentation available. But community itself is very active and you probably get answer to your newbie questions in 1-2 days (sometimes even in hours). But currently the documentation level is way better and community is even more active :)
Nothing I can complain about. And if I have some problems/suggestions, I will try to discuss those with core developers. Whining about stuff without constructive discussion is lame imho.
I have used QCodo/QCubed for 3-4 successful projects now. The more I use it, the more I like it :) And also, I'm trying to help developing even better framework whenever I have spare time. And I can say, that I have had more than 10 people, who I have convinced to start using QC now ;) And I hope there will be many more.
QCubed totally rocks!
Never heard of it.
Been doing PHP on and off 4+ years
http://www.piranhamethod.com/2009/04/09/qcodoqcubed/
I have heard of it and I love it.
I also came from a dotNet / Codesmith environment. When I picked up a project that wanted to translate a dotNet site to PHP I looked for a framework that could best emulate the way the original application's logic was set up. What I found was either bloated frameworks or frameworks that did not completely fulfill the projects requirements.
I accidentally found QCodo while researching using the MyGeneration tool for PHP code generation. I have not looked back since. The ease of use, ability to quickly build complex applications and the true OO approach QCodo now QCubed uses makes it the best framework for my purposes.
I've been using QCodo, ZCodo and now QCubed for quite a while now.
I actually picked it as a replacement for CakePHP, which at the time of my need, wasn't mature enough to do the things I wanted.
I'm super happy with it as a framework; it abstracts things just enough, but not too much that you lose sight of the programming.
I plan on using it for any development project I'm responsible for in the future, and I'm looking forward to QCubed being the best community maintained framework for PHP5 out there.
The quick reason is that popularity and success do not generally go with what's technically best. I'm sure any techie can come up with numerous examples. There are numerous things that can promote mediocre solutions, like marketing, first-mover advantage, being a touch better in some area that catches people's attention, being used in some high-profile application, or just plain luck.
The other reason is that what appears technically best to you may not appear so to somebody who's doing something different.
I think that QCubed is great and mainly because of the way you can use Ajax (you dont have to write Jscript and you dont have to use jQuery).
One very useful document: http://www.qcodo.com/demos/QcodoClassLibrary.pdf
I chose QCodo 4 years ago to develop our product. I've never regretted - now we're 3 developpers on the thing, and any non-OOP solution wouldn't work. We have installed almost 50 customers with it - on Apache, IIS, my SQL and SQLServer platforms, Linux or W2003.
F
The design is brilliant, code-generation is great, and it's really easy to develop, extend, and maintain. I can't read any other code now...
Yes, marketing is quite poor, and the project used to depend just on the creator (Mike Ho). All of it moved to Git recently, and marketing should be better soon. And, now Mike Ho is back !!!
I have used it in few projects involving Flash remoting but I only use the ORM in the framework as I don't really like EDP stuffs like .NET. The flow doesn't seems right at all for stateless web. It's great if the ORM can be released as a separate component.
I never heard about it.
I didn't used it.
qcubed community is not so skilled to carry on a project with new good ideas
Nonsense
the new code is not at the level of Mike Ho.
Nonsense
bugs in the state of qforms, the forms of qcodo/qcubed.
??
is not popular.
So what
they do not want to go ahead and use DSL and forward engineering.
Your point? Every framework that doesn't want to go your route is wrong? I for one would not want the suggestions you have made
the forms only works with js enabled.
You have to be kidding right? If users don't have JS enabled, then they're in the stone age...
is written in PHP.
No comment
new plugin system poorly designed.
Based on what do you say that? I would say nonsense to this as well
Clearly there is some hidden agenda with this poster...I've also had a close look at Symphony - and I would go with QCubed over Symphony every single time. For big apps or small

Categories