Jump to content

php framework or code from scratch?


zander1983

Recommended Posts

Coding from scratch is better than twisting someone else's work to fit your needs.

Except when time is a factor. Or when you don't know what you're doing. Or when you're especially vulnerable to problems like feature creep.

 

There are an infinite number of frameworks out there. Try a few more, especially the well-known ones (because I, for one, have never heard of "Elgg") before giving up.

Link to comment
Share on other sites

Is coding from scratch really better though? We have 3 developers and the boss believes we should use a framework because:

1 nobody codes large online applications from scratch anymore (his words)

2 its more stable

3 it forces the different developers to code within certain parameters thereby having a more uniform code base

4 easier to continually add features to the site because of the framework

 

I have always been a code from scratch person. But the arguments for frameworks are growing, especially regarding stability

Link to comment
Share on other sites

Frameworks make it easier to can you and hire someone else while barely skipping a beat, which is why bosses like it.

 

It's all preference. Both have their advantages. Frameworks are quicker to develop, from-scratch has the potential to be more efficient.

Link to comment
Share on other sites

1 nobody codes large online applications from scratch anymore (his words)

Probably true. A large application is more than likely going to have a team of developers working on it over time. Developers will come and go. Using an established framework means that a new team member will not have to trawl through thousands of lines of bespoke code to understand what it is doing. Don't forget, an application still has to be built using a framework. I would refer to this as from-scratch also, it's just that you already have all the nitty gritty bits like database connectors, session management, etc there for you.

 

Nobody will ever write every line of code themselves in an application. Just think when you last made a website. Did you put a Google map, or adverts on it? Did you use a template engine? Did you add any JQuery? All these functions and libraries are or require frameworks. You include the JQuery framework in a scrip tag before you write any javascript. You include the Google maps API framework in a script tag before you add the javascript code to display a map. You include the Smarty template framework in your code before you can create template files for your website. People say they don't use frameworks when they do without realising it.

 

2 its more stable

No, a framework may add additional overhead if you are not using it all. If you only require a small amount of functionality that the framework can offer, there is going to be lots of redundant code included. Good frameworks are usually optimised so they only load the necessary objects when required, however like all code there can be bugs. If you use the framework's functionality in an unorthodox manor then it is also likely that the end result will be poor.

 

3 it forces the different developers to code within certain parameters thereby having a more uniform code base

True, however the client code using the framework should be inline with the coding standards. The team of developers must also use the same standards throughout. This should be a practice that is written down and given to all developers. Just because a framework might use the following standard:

 

class My_Framework_Class {

}

$variable_name = "";

function Fuction_name() { }

 

Does not mean that in my application I could write the following code:

 

class myExtendedClass extends My_Framework_Class {

}

$variableName = "";

function someOtherFunction() { }

 

4 easier to continually add features to the site because of the framework

No, it does not make it any easier. Frameworks save time, that's the main point because you have access to functions that do a certain job, meaning you would not have to write all the nitty gritty stuff yourself. If I want to add a new feature to a website, lets say a blog, how is a framework going to make it easier? I'm still going to have to write all the code to make it work, just less of it. If I wanted it easy, I would install a copy of Wordpress and link it into my site.

Using a framework will mean that your code is object based, so it does have advantages such as not affecting other parts of a program when integrating new features. Essentially, using a framework should indicate that your code will be well structured, easy to follow, meaning that new functionality can be added with a relatively small amount of hassle. Completely bespoke code, over time can become a spaghetti like mess if not well documented.

Link to comment
Share on other sites

@neil.johnson

 

Thanks for that, thats a pretty comprehensive answer. You seem to be more pro framework than against it. Are there any you recommend? We have being using Elgg. One problem I've noticed amongst our develoeprs (including myself) is when we have a problem, we investigate whether its been done before (amost always yes), and then adapt that solution to suit our problem. With Elgg (and Im assuming all frameworks), we have to adapt the soltiuon to fit our problem, then adapt this solution to fit into the framework. With Elgg, this can lead to hours fighting with vews and actions and registering actions etc. Is this an issue with other frameworks?

 

I have a website which i coded from scratch. Im considering that we use this code base rather than wrestling with Elgg. Heres the site if you're interested: http://www.cottageireland.ie

Link to comment
Share on other sites

With Elgg (and Im assuming all frameworks), we have to adapt the soltiuon to fit our problem, then adapt this solution to fit into the framework. With Elgg, this can lead to hours fighting with vews and actions and registering actions etc. Is this an issue with other frameworks?

Yes. And for a custom framework too, though likely to a lesser degree. You'll spend time writing an awesome framework and further down the road discover that some new functionality you need to add doesn't quite fit into its model. The difference is that with a custom framework you probably won't have to do as much work because it already agrees more closely with what you want to do.

Link to comment
Share on other sites

Thanks for that, thats a pretty comprehensive answer. You seem to be more pro framework than against it. Are there any you recommend?

No probs. Really i'm neither for or against using PHP frameworks. If it is a very large project then it would be a recommendation. If it is a small to medium sized project then I probably wouldn't. I use my own framework library that covers most of the groundwork for any website of this size.

 

I have only really worked with Zend and had a play with CodeIgnitor so I cannot say out of all of them which one is best. It's really a personal preference. What I would say is that if your project is going to have developers coming and going then I would go with a well known framework. I have never heard of Elgg.

Link to comment
Share on other sites

  • 3 weeks later...

Bro,

 

I use both, but spend most of my time using scriptcase (php code generator), i have tested a few and can tell you that this is the best one, it is not database driven it is realy application oriented. It have alot of tutorials, videos, free courses. Check it out.

 

The main reason for me to use frameworks is the development time, since i started using I develop things 4-5 times faster, it is very nice my business.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.