Page 1 of 2

Struggling with Frameworks

Posted: Thu Nov 06, 2008 1:34 pm
by Theory?
I'm not "new" to PHP by any stretch, but I'm at that very beginner stage where like...the logic is just starting to click with me. As in, I'm finally able to sit down and map out an application and figure out what kinds of functions and objects I'm going to need, etc. That sounds so amateur, but like...I don't know, programming is easy for me, application design is a whole other beasts that just took so much longer for me to understand.

EITHER WAY.

I always hear about these awesome "Frameworks" that everyone raves about. Sounds like a good idea, prerolled code. I just...I don't know. It doesn't click with me. I've looked at Zend and I bought a book on Symfony which I realize are two very different kinds of frameworks, but whether it's an RDF or just a practical API like Zend or PEAR etc. I just don't...get it. I can't explain it better than that. I have hard time understanding documentation and understanding how to work these elements into my code, etc.

So basically I have two questions. Should I be diving into frameworks just yet, or should I get better at writing my own code first? And secondly, what would you say is the best way to get into using frameworks and/or good books to learn the process or any other good resources for me to check out to help getting started using them.

Thanks so much, I'm sorry this is such a beginner question.

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 2:56 pm
by alex.barylski
That sounds so amateur, but like...I don't know, programming is easy for me, application design is a whole other beasts that just took so much longer for me to understand.
Programming is what comes first always...design takes years of experience and even then you'll never get it 100% right.

Design requires abstract thought, solving the big problem not the individual problem that implementation is all about. It's more about interface :)
I always hear about these awesome "Frameworks" that everyone raves about. Sounds like a good idea, prerolled code. I just...I don't know. It doesn't click with me. I've looked at Zend and I bought a book on Symfony which I realize are two very different kinds of frameworks, but whether it's an RDF or just a practical API like Zend or PEAR etc. I just don't...get it. I can't explain it better than that. I have hard time understanding documentation and understanding how to work these elements into my code, etc.
Think of your source code reflecting real world objects, entities, problems, etc...

When you build a house, usually you hire a team of people, contrators, designers, carpenters, etc...

Software should be no differet but because of the ease of enterance (and lack of standards support) it usually is. Software is developed ad hoc, one line at a time. When something breaks a fix is applied and usually introduces another bug.

This is because of the lack of design/structure/planning/design of an application.

If a house was built the same way it would blow over with the first gust of wind. People have been building homes a lot longer than software so we've learned from our mistakes. Software has a long way to go.

A framework is the foundation on which you build your software, like a prebuilt home, validated by certified contractors.

Some frameworks give you nothing but the frame, others give you drywall, and others still offer some basic wiring and plumbing.

How much the framework does will depend on your requirements. If you need full control over the system using a low level framework like Zend, would make most sense as you can build as you go. If you know you want easy DB access maybe using a framework with ActiveRecord support would be a better approach.

If you only wanted to hammer out modules using a framework like Joomla (where the wiring, plumbing, paint, etc is already supplied) would be better justified.

There is a difference between a framework and a code library, like PEAR. Zend could be considered both I suppose. Framework usually implies architecture, which in software development usually means MVC (Model-View-Controller).

A code library is more akin to the tools an indivudla might use within the codebase to speed up development, like encryption APIs and so on.

Cheers,
Alex

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 3:02 pm
by onion2k
There's a world of difference between a library and a framework. Frankly I think the scope for using a framework is incredibly limited - the app really needs to suit it perfectly before it's a good idea. When you're using a framework you have to bend your coding style to fit the framework rather than the other way around, which is the proper way of doing things. Libraries, on the other hand, are always a good idea. Especially if you're sensible enough to wrap them as per a strategy pattern.

(In other news, I'm completely drunk. :drunk: If this post doesn't make sense I apologise. I'll fix it tomorrow.)

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 3:16 pm
by alex.barylski
(In other news, I'm completely drunk. If this post doesn't make sense I apologise. I'll fix it tomorrow.)
Hahaha...I'm quoting your dirty laundry...no fixing allowed... :P

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 3:39 pm
by onion2k
PCSpectra wrote:
(In other news, I'm completely drunk. If this post doesn't make sense I apologise. I'll fix it tomorrow.)
Hahaha...I'm quoting your dirty laundry...no fixing allowed... :P
But sir, you forget my Jedi Mod powers. :twisted:

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 4:23 pm
by alex.barylski
Boo...abuse of power... :lol:

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 6:10 pm
by Theory?
PCSpectra wrote:
That sounds so amateur, but like...I don't know, programming is easy for me, application design is a whole other beasts that just took so much longer for me to understand.
Programming is what comes first always...design takes years of experience and even then you'll never get it 100% right.

Design requires abstract thought, solving the big problem not the individual problem that implementation is all about. It's more about interface :)
I always hear about these awesome "Frameworks" that everyone raves about. Sounds like a good idea, prerolled code. I just...I don't know. It doesn't click with me. I've looked at Zend and I bought a book on Symfony which I realize are two very different kinds of frameworks, but whether it's an RDF or just a practical API like Zend or PEAR etc. I just don't...get it. I can't explain it better than that. I have hard time understanding documentation and understanding how to work these elements into my code, etc.
Think of your source code reflecting real world objects, entities, problems, etc...

When you build a house, usually you hire a team of people, contrators, designers, carpenters, etc...

Software should be no differet but because of the ease of enterance (and lack of standards support) it usually is. Software is developed ad hoc, one line at a time. When something breaks a fix is applied and usually introduces another bug.

This is because of the lack of design/structure/planning/design of an application.

If a house was built the same way it would blow over with the first gust of wind. People have been building homes a lot longer than software so we've learned from our mistakes. Software has a long way to go.

A framework is the foundation on which you build your software, like a prebuilt home, validated by certified contractors.

Some frameworks give you nothing but the frame, others give you drywall, and others still offer some basic wiring and plumbing.

How much the framework does will depend on your requirements. If you need full control over the system using a low level framework like Zend, would make most sense as you can build as you go. If you know you want easy DB access maybe using a framework with ActiveRecord support would be a better approach.

If you only wanted to hammer out modules using a framework like Joomla (where the wiring, plumbing, paint, etc is already supplied) would be better justified.

There is a difference between a framework and a code library, like PEAR. Zend could be considered both I suppose. Framework usually implies architecture, which in software development usually means MVC (Model-View-Controller).

A code library is more akin to the tools an indivudla might use within the codebase to speed up development, like encryption APIs and so on.

Cheers,
Alex
That was excellent. I have a book about symfony and it seems like the framework is almost an application itself, and I have trouble telling if the learning curve is worth the convenience. I feel like becoming too dependent on an RDF will take away from good practice in general design and coding, but I can clearly see the benefit of using library code like certain parts of the Zend Framework and the PEAR repository.

Thus far, I've just been spinning my own little library of code. I plan to keep refactoring it into some sort of personal framework for my own convenience.

Is that too ambitious and unnecessary?

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 8:32 pm
by Christopher
Theory? wrote:So basically I have two questions. Should I be diving into frameworks just yet, or should I get better at writing my own code first? And secondly, what would you say is the best way to get into using frameworks and/or good books to learn the process or any other good resources for me to check out to help getting started using them.
The real answer to this question is that when you start solving all the common problems of web applications in the same general way that frameworks do -- then you will be ready to start using frameworks. I know it is not the answer you wanted, but it is the truth.

Programmers naturally just do not build applications using best practices because best practices are not very intuitive. If you can get 10 programmers to agree on how to implement something, then you probably are using a best practice. And you also implicitly have a framework.

Once you get to the point where you are building your applications using best practices then you will also be weary of maintaining your own "framework" (which once seemed exciting) and will be glad to have other programmers support and improve your code for you.

Re: Struggling with Frameworks

Posted: Thu Nov 06, 2008 9:33 pm
by Syntac
Before you even think of using a framework, make sure you have a solid foundation in writing your own code. Never, ever use something you don't understand.

Re: Struggling with Frameworks

Posted: Fri Nov 07, 2008 11:13 am
by Theory?
arborint wrote:
Theory? wrote:So basically I have two questions. Should I be diving into frameworks just yet, or should I get better at writing my own code first? And secondly, what would you say is the best way to get into using frameworks and/or good books to learn the process or any other good resources for me to check out to help getting started using them.
The real answer to this question is that when you start solving all the common problems of web applications in the same general way that frameworks do -- then you will be ready to start using frameworks. I know it is not the answer you wanted, but it is the truth.

Programmers naturally just do not build applications using best practices because best practices are not very intuitive. If you can get 10 programmers to agree on how to implement something, then you probably are using a best practice. And you also implicitly have a framework.

Once you get to the point where you are building your applications using best practices then you will also be weary of maintaining your own "framework" (which once seemed exciting) and will be glad to have other programmers support and improve your code for you.
That's kind of what I figured. I'm having lots of fun right now working on my own code. I spend all day with my little notebook scratching out drawing's I've made trying to find new ways to further modularize my code, etc. Don't know if that's how other programmers do it, but it's just how my mind works (I have a short attention span). So far I've got a nice little library of basic CRUD objects that are abstract enough to be very reusable. Don't know if they truly obey best practices, but I've managed to create a few Singletons for security and I find myself using strategy objects a lot to extract HTML templates entirely. I haven't even begun looking at templating systems though I am well aware of them and what they offer, but again, I figured like I did with frameworks that I should just get comfortable with my own code first.

Thanks so much for the insight guys, I feel a lot more comfortable now knowing I don't NEED to worry about this end of things just yet.

Re: Struggling with Frameworks

Posted: Fri Nov 07, 2008 2:30 pm
by alex.barylski
I spend all day with my little notebook scratching out drawing's I've made trying to find new ways to further modularize my code, etc. Don't know if that's how other programmers do it, but it's just how my mind works (I have a short attention span).
I do the same thing. I go through 2 or 3 of those 50 pages notebooks a month just scribbling ideas down...

Re: Struggling with Frameworks

Posted: Fri Nov 07, 2008 3:13 pm
by Christopher
Theory? wrote:That's kind of what I figured. I'm having lots of fun right now working on my own code. I spend all day with my little notebook scratching out drawing's I've made trying to find new ways to further modularize my code, etc. Don't know if that's how other programmers do it, but it's just how my mind works (I have a short attention span). So far I've got a nice little library of basic CRUD objects that are abstract enough to be very reusable. Don't know if they truly obey best practices, but I've managed to create a few Singletons for security and I find myself using strategy objects a lot to extract HTML templates entirely.
PCSpectra wrote:I do the same thing. I go through 2 or 3 of those 50 pages notebooks a month just scribbling ideas down...
Scratch and scribble all you want, but the sad truth is that you will not really start implementing best practices until you start collaborating with other programmers. Insular programmers may think they are having fun, but they are actually just spending a lot of time producing sub-standard code. Perhaps one of you is a genius, but in my experience there are between few and none of those around.

Re: Struggling with Frameworks

Posted: Fri Nov 07, 2008 3:37 pm
by Luke
Thus far, I've just been spinning my own little library of code. I plan to keep refactoring it into some sort of personal framework for my own convenience.

Is that too ambitious and unnecessary?
Actually, I'd say the BEST way to understand frameworks, and even a language in general, is to write a framework. Also, generally your own framework will be the one best suited to your work since, obviously, it will be catered exactly to your needs. I would say my own framework consists of about 1/3 Zend Framework components, 1/3 my own components, and 1/3 third-party components I have found and have liked. This is the method I recommend taking, as it allows you to rely on other people's (often unsatisfactory) code while slowly developing your own to replace it. :) Plus you learn so much its ridiculous.

I learned almost everything I know by attempting to develop my own components to replace Zend's, or provide functionality it doesn't provide. :wink:

Re: Struggling with Frameworks

Posted: Fri Nov 07, 2008 5:42 pm
by alex.barylski
Scratch and scribble all you want, but the sad truth is that you will not really start implementing best practices until you start collaborating with other programmers. Insular programmers may think they are having fun, but they are actually just spending a lot of time producing sub-standard code. Perhaps one of you is a genius, but in my experience there are between few and none of those around.
Far from genuis I'm afraid. On the contrary I believe I am probably much slower than most people but that serves me well in software, because I have a hard time comprehending complex functions/methods I am extremely pedantic about keeping things extremely simple.

Even I can comprehend simple things and simple things by nature break less often, perform better, easier to change, more secure, etc, etc...

Most frameworks are just to complex for me personally...I think simple and like simple. I deal far better with comprehending many small details than one single massive detail. In fact I would argue that is probably human nature and not only because I'm slow. :P

Nothing wrong with working as an "insular" programmer...I'm willing to bet most good ideas are born from a single developer working in his garage all alone, passionately trying to solve a problem...

Group projects tend to suffer from "too many chef's in the kitchen" syndrome where they lack clear direction and vision, especially in open source where if someone disagree's with an executive decision, a project fork occurs and yet another project starts.

Re: Struggling with Frameworks

Posted: Fri Nov 07, 2008 9:46 pm
by allspiritseve
arborint wrote:Scratch and scribble all you want, but the sad truth is that you will not really start implementing best practices until you start collaborating with other programmers. Insular programmers may think they are having fun, but they are actually just spending a lot of time producing sub-standard code. Perhaps one of you is a genius, but in my experience there are between few and none of those around.
I've never collaborated with other developers on a project, so I can't honestly refute this, but I feel like its not quite true. Sure, working with other developers will get you on the right track much quicker, but I'm a big fan of agile development and the "genius" of programming coming from building something simple that works and then refactoring it until it works well. The genius comes from the process though, and not from the developer... most of us won't have great revolutionary ideas off the top of our heads, but I think good ideas, best practices even, can evolve from a diligent agile development process. I may be wrong though.