Project: Framework or code from scratch?

A question about how to proceed with coding a project

  • (3 Pages)
  • +
  • 1
  • 2
  • 3

30 Replies - 12581 Views - Last Post: 22 March 2011 - 02:21 PM

#1 SirHenrik  Icon User is offline

  • New D.I.C Head

Reputation: 17
  • View blog
  • Posts: 31
  • Joined: 31-December 10

Project: Framework or code from scratch?

Post icon  Posted 31 December 2010 - 11:37 PM

*
POPULAR

Hello fellow PHP developers.

Mostly I have only worked on smaller projects that only served one small and sometime simplified purpose. But lately I have got the urge to begin on something bigger. Now I got the blueprints, and I have the idea. Even started with some code in the CodeIgniter framework, but my problem is this. Is this going to hurt in the long-run?

Specifically what I am wondering about is: When working on a bigger project with a large infrastructure and a lot of content, is it wise to use a framework, or should the code be written by scratch?

If you have any experience with this topic I've would love to hear about it.

Thank you.

Is This A Good Question/Topic? 6
  • +

Replies To: Project: Framework or code from scratch?

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10567
  • View blog
  • Posts: 39,121
  • Joined: 27-December 08

Re: Project: Framework or code from scratch?

Posted 31 December 2010 - 11:50 PM

Moved to PHP Programmers.

In the real world, you will often times be working on large projects where a lot of the code is already written and you will be maintaining or expanding upon it. Essentially, you will be working with other peoples' frameworks.

In regards to 3rd party APIs, there is a saying in the IT world about reinventing the wheel. Using 3rd party APIs can cut down on development time significantly and allow you to focus on the specifics for the project rather than a lot of the backend stuff.

So to answer your question, I think familiarizing yourself with some commonly used 3rd Party APIs is a good idea.
Was This Post Helpful? 0
  • +
  • -

#3 SirHenrik  Icon User is offline

  • New D.I.C Head

Reputation: 17
  • View blog
  • Posts: 31
  • Joined: 31-December 10

Re: Project: Framework or code from scratch?

Posted 31 December 2010 - 11:59 PM

First off I want to express my gratitude with moving my post to the PHP Programmers thread, thank you!

I guess it is true that you rarely are the first off to code on a large project. But when you are saying 3rd Party APIs, what exactly do you mean? Are you thinking of basic APIs like ones from Google Map? Or are you referring to more complex ones?

If I were to start a project in the PHP framework CodeIgniter, would that set any limitations on including 3rd party APIs?

Thank you for your answer.
Was This Post Helpful? 0
  • +
  • -

#4 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10567
  • View blog
  • Posts: 39,121
  • Joined: 27-December 08

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:03 AM

Yes- 3rd party APIs are those developed by organizations or individuals that aren't the company/organization/individual producing the given language.

I'm honestly not all that familiar with 3rd party PHP APIs, but I don't see a reason as to why using an API would limit your use of others. It really shouldn't, in theory.
Was This Post Helpful? 0
  • +
  • -

#5 SirHenrik  Icon User is offline

  • New D.I.C Head

Reputation: 17
  • View blog
  • Posts: 31
  • Joined: 31-December 10

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:14 AM

Ah, now I fully understand your statement.

Yes, 3rd party APIs can't really limit you in any way. But what I sometimes wonder is this: "Is it healthy to use a 3rd party application or framework?". It speeds up productivity and maybe even optimization by using methods that you were not even familiar with. But I just can't help feeling that in some way or another, it got to be bad practice.

Is there any advantages by writing your code from scratch, besides that you know your application inside out? Which you also can with a framework developed application by actually reading the pre-made functions and methods you use.

It's a project manager nightmare.
Was This Post Helpful? 0
  • +
  • -

#6 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10567
  • View blog
  • Posts: 39,121
  • Joined: 27-December 08

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:21 AM

It's more the design of the framework. Certain 3rd Party APIs are just poorly designed, buggy, or cumbersome. This makes them a pain to work with. Always a good idea to research the APIs before choosing them to make sure you are getting what you want.

As for writing everything from scratch, that just doesn't happen anymore. Even APIs like XML Parsing, database connections, etc., are all pre-written. At some level, you will be using someone else's code.
Was This Post Helpful? 0
  • +
  • -

#7 SirHenrik  Icon User is offline

  • New D.I.C Head

Reputation: 17
  • View blog
  • Posts: 31
  • Joined: 31-December 10

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:34 AM

I completely agree that the tools and APIs that you choose to work with are critically important. None of us would like to wake up one day and see that that API are no longer supported or updated, though this doesn't stop you from using it - but it makes it less attractive. At the same time when choosing a API it'll have to be thorough, we don't want to find our self re-writing your code because that originally chosen API didn't fit you needs suddenly.

But am I the only one that feels that instead of being raw developers, we are simplifying the job heavily that it makes us maybe - less of a developer?

Now it is my believe that if you can explain to your self and others what actually happens in that and that specific line of code, you are a raw programmer. Since you could just have written the original API code your self, because you understand it. Still, I don't find my self browsing trough my APIs and frameworks at first. Maybe I should.

Your thoughts on the matter is gratefully appriciated.

And thanks for posting this thread on the DIC twitter page, very kind of you.

This post has been edited by SirHenrik: 01 January 2011 - 12:35 AM

Was This Post Helpful? 0
  • +
  • -

#8 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 10567
  • View blog
  • Posts: 39,121
  • Joined: 27-December 08

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:41 AM

A lot of newbies have the same thoughts about reinventing the wheel. In the IT industry, there is another saying that goes something like: The novice programmer asks "how can I?", while the experienced developer asks "where has this been done before?".

In real world development, you don't have the luxury of time to reinvent the wheel always. And you/your team will probably be doing something of significance, not just pencil pushing or writing 10 lines of code. It will probably be an involved project. If you want to gain the experience of reinventing the wheel personally, go for it. It can be a good exercise. However, professionally, your boss(es) care about getting the project done on time and that it is functional. They don't care if you are a "raw" programmer or not if the project works as they want it to.
Was This Post Helpful? 0
  • +
  • -

#9 SirHenrik  Icon User is offline

  • New D.I.C Head

Reputation: 17
  • View blog
  • Posts: 31
  • Joined: 31-December 10

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:54 AM

I enjoyed your novice-expert saying. And I guess it is true as the clients wants their product as fast as possible, naturally. And if the result is the same, more or less, why not go with a framework and APIs that fits your needs.

One day I think I'll try and invent the wheel again, hopefully after that I would feel more comfortable working with the existing frameworks. I guess that the bottom line is that am afraid of writing something that couldn't be mine, and that I have a urge of understanding the skin and bones of my work. But I guess this varies heavily from developer to developer.

This post has been edited by SirHenrik: 01 January 2011 - 12:55 AM

Was This Post Helpful? 0
  • +
  • -

#10 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6063
  • View blog
  • Posts: 23,517
  • Joined: 23-August 08

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 08:55 AM

Quote

the experienced developer asks "where has this been done before?"


You've obviously never met my boss ;) Although I must admit he's getting better, but where PHP is sort of the bastard child of our huge project (the meat is in the servers which are running primarily C), the UI is somewhat...unwieldy :D
Was This Post Helpful? 0
  • +
  • -

#11 joezim007  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 11
  • View blog
  • Posts: 110
  • Joined: 13-September 08

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:18 PM

My opinion about frameworks is this: There are many facets to a large framework and each of those pieces have received a lot of attention over time by someone who is an expert, or at least very knowledgeable, on the piece s/he worked on. (at least this is the way it SHOULD be) If you go ahead and make your own framework, if you're not an expert in each area you will probably do something wrong or forget an important piece, which could end up compromising the security or the stability of your projects that use the framework. There is a reason that frameworks are updated often: they missed something. There are tons of updates to every framework that fix security holes because there are tons of ways that apps can be exploited, and if you don't have knowledge about each of those security risks then you could get yourself into a lot of trouble.
I know this post sounds a bit grim, but it's more true than it should be. I'm not saying that you can't make your own framework for your projects, but if it is public, I would put your trust in something that has been tried and tested.
Was This Post Helpful? 0
  • +
  • -

#12 CTphpnwb  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2992
  • Posts: 10,337
  • Joined: 08-August 08

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 12:42 PM

View Postjoezim007, on 01 January 2011 - 02:18 PM, said:

...if you're not an expert in each area you will probably do something wrong or forget an important piece, which could end up compromising the security or the stability of your projects that use the framework. There is a reason that frameworks are updated often: they missed something.

I'm not saying you're wrong, but something to keep in mind is that if you use a framework and they did miss something, your site becomes extremely vulnerable as soon as a hacker compromises another site that uses the same framework. If you wrote your own then your security flaws are yours and yours alone, assuming you've made decent effort at making your site secure. Hacking somebody else's site gives no advantage to the hacker attacking yours. There are pros and cons to everything!
Was This Post Helpful? 0
  • +
  • -

#13 Gamegoofs2  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 159
  • Joined: 15-April 09

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 04:34 PM

Sorry if I'm repeating something someone already said. I didn't take time to read all the posts.

I find coding from scratch in PHP better for me. I've learn tons and tons of things having to code the project from the ground up that I wouldn't have had to learn if I went with framework like CodeIgniter. Once you've learned the language sufficiently I'd suggest going with a framework.
Was This Post Helpful? 0
  • +
  • -

#14 cfoley  Icon User is offline

  • Cabbage
  • member icon

Reputation: 1999
  • View blog
  • Posts: 4,154
  • Joined: 11-December 07

Re: Project: Framework or code from scratch?

Posted 01 January 2011 - 05:03 PM

If you program in a high level language then you're already using someone else's code in your project. Take addslashes for example: You can either call the one included in PHP or write your own. It's the same for every method that the language provides.

Maybe you think that using a third party API diminishes the contribution you make to your own code. However, really it's just about how you spend your time. With a third party API you can code faster. This means you have spare time to add more features, test more thoroughly, complete more projects or just more time to spend with your girlfriend.
Was This Post Helpful? 2
  • +
  • -

#15 dawmail333  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 27
  • View blog
  • Posts: 174
  • Joined: 02-July 07

Re: Project: Framework or code from scratch?

Posted 02 January 2011 - 02:25 AM

View PostCTphpnwb, on 02 January 2011 - 04:42 AM, said:

View Postjoezim007, on 01 January 2011 - 02:18 PM, said:

...if you're not an expert in each area you will probably do something wrong or forget an important piece, which could end up compromising the security or the stability of your projects that use the framework. There is a reason that frameworks are updated often: they missed something.

I'm not saying you're wrong, but something to keep in mind is that if you use a framework and they did miss something, your site becomes extremely vulnerable as soon as a hacker compromises another site that uses the same framework. If you wrote your own then your security flaws are yours and yours alone, assuming you've made decent effort at making your site secure. Hacking somebody else's site gives no advantage to the hacker attacking yours. There are pros and cons to everything!


I would have to disagree. If you are building something on even a quarter of the scale of CodeIgniter, you introduce so many different possible security flaws, it's not funny.
Having a framework like that means a) so many security helpers are built in already (e.g. XSS cleaning by default in a few places!), and B) any flaws get fixed quickly, and c) so many people are working on the same project that flaws are mighty few in the first place.
You'd need to be a freakin' expert to avoid ALL of these flaws.

Reinventing the wheel, whilst good experience, needs you to avoid all of the flaws and pitfalls along the way. And in plus, there are very few possible attack vectors that CI sets: most of them, once again, come back to the framework-user's code, so in my not-so-humble opinion, using a framework is a fantastic idea, unless a) it's much bigger than your project needs to be, or B) it forces you to use an overkill design methodology, therefore adding a ton of work.

This post has been edited by dawmail333: 02 January 2011 - 02:26 AM

Was This Post Helpful? 1
  • +
  • -

  • (3 Pages)
  • +
  • 1
  • 2
  • 3