-1

First of all, I know that reinvent the wheel is, usually, a bad idea, but I want to write a PHP framework to learn OOP in PHP and to understand MVC in my free time.

Said that, I have to do two webs with few and simple database interactions, the basic funcionality of the webs is to show information.

I want to use my own framework in those webs, but I don't know where or when to start. Should I start doing the framework first and then the webs? or should I start doing one web, then the framework and then the other web?

closed as too broad by gnat, Bart van Ingen Schenau, GlenH7, user40980, Martijn Pieters Feb 25 '14 at 1:11

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

2

Why not Both?

Do the webapps, but keep a very strong separation of what code belongs to the the app and what belongs to the framework.

  • +1 for simultaneous development. There's no substitute for experiencing using it as you're building it. – Andy Hunt Feb 24 '14 at 11:57
3

Developing your own site/app framework in PHP is quite a learning experience. Over time, i have built 3 from the ground up. I strongly advise to pursue it.. but set yourself a (measurable!) shortterm goal, as for features. You'll want to throw it aside soon to start over! :)

My way..

  • Number one was to learn and keep it simple to me.
  • Number two was to learn and make it hard for me.
  • Number three was to deliver fast. (I couldn't find a off-the-shelve ones that didnt over-complicate, so i built a custom KISS one-trick-pony.)

In hindsight i do not regret starting any of these, i learned a lot. My next framework will be Symphony2, i appreciate the "over-complicated" parts of more since building my last framework.

1

nobody can answer that for you.
As to making a framework, first spend a lot of time thinking and writing about your design goals, what it should do and how it should do it at a conceptual level.
Just starting to type code and hoping you're going to end up with something even remotely coherent is only going to lead to disaster.

  • I have thought about the design, the structure, the goals, etc. But I want some guideline to know if I should start coding that design, first in a web and extract the framework, or first in a clean framework and then do the web. – ilazgo Feb 24 '14 at 11:13
1

Writing a framework for educational purposes is perfectly fine. However, you would be best also doing further research into existing frameworks, in order to learn what functionality they provide and how those frameworks implemented that functionality.

For serious web development, you are likely to be better off using an existing framework, as you will probably want to focus your energy on the development of websites and not frameworks, especially as there are plenty of good frameworks available freely.

1

Typically a framework is released by a team experienced in building a type of application to give other less experienced developers a head start. If you are less experienced, then building a framework is probably not the best place to start.

For instance, A team that builds web applications might release their codebase as a framework (krakenjs, rails, django, etc..). A team that designs web sites might release their sass/less base as a framework (bootstrap, foundation). Building a framework without first building real applications is just putting the cart before the horse IMO.

"David Heinemeier Hansson extracted Ruby on Rails from his work on Basecamp, a project management tool by 37signals (now a web application company)." - http://en.wikipedia.org/wiki/Ruby_on_rails#History

"Django grew organically from real-world applications written by a Web development team in > Lawrence, Kansas, USA" - http://www.djangobook.com/en/2.0/chapter01.html#django-s-history

It would be more beneficial to build real applications, possibly using existing frameworks, then if you are successful, release the base of those projects as a new framework, or an extension to an existing one.

In contrast to frameworks, OOP is a more general programming approach that is used across many application types. You could have an OOP business module, an OOP GUI, etc...

For some references, see a list of books here: http://www.island-data.com/bookreviews/oobooks.html Then try to model small applications, for example if you are into animals, you could start with the classic Animal/Dog/Cat (http://www.inf.ed.ac.uk/teaching/courses/inf1/op/Lectures/pub/07-poly.handout-2x2.pdf), building your way to the PetStore. Choose whatever type of application keeps your interest and start building.

Just keep in mind that the web application, and your application, are probably separate concerns, and sometimes frameworks will actually sacrifice OOP design to get a web application up quickly, so be careful commingling the two.

Not the answer you're looking for? Browse other questions tagged or ask your own question.