Ask: What Goes on Behind the Scenes of a Web Framework?

User /u/Samhain13 on reddit asks a great question.

What are the essentials of a web framework? How do/should developers decide on which packages to include in their frameworks? And more importantly, how do they test their frameworks before releasing them out to the wild?

How Do Developers Test Their Frameworks Before Releasing Them?

Just a brief rundown, here is what some of the bigger frameworks use:

  • Laravel, Symfony, Zend Framework (PHP) - PHPUnit
  • Django (Python) - Looks like they roll their own: Django
  • Ruby on Rails (Ruby) - Use a home grown testing suite: Ruby on Rails

To be honest, even with testing suites bugs still find their way into production code. Most of the frameworks started with a single contributor, or were lucky enough to be released to the public by a company, large or small. It’s tricky, because you need to find a following for your framework to really get features expedited and the bugs and kinks worked out.

So to answer the question, it’s really a combination of testing suites, alpha/beta releases, and countless contributors and users that work together.

How do/should Developers Decide on Which Packages to Include in Their Frameworks?

This really depends on the focus of the project. You could consider a web framework to have at minimum:

  • Router to handle requests
  • Controller Layout
  • Model Layout
  • At least one templating system for views
  • Session management

Some additional pieces that could be included to create a more complete framework would be:

  • User management
  • ORM for database connections
  • Caching extensions
  • Plugin/middleware system
  • Internationalization

Other more complete frameworks may go above and beyond that, it all just depends on what the focus of the project is.

If you look at the Symfony Standard composer.json, you will see that it requires some 3rd party libraries. Twig was created by Sensio which created Symfony, but they are two respectively different projects.

Some developers won’t use a full framework anymore, they will instead roll their own which means they will find a router library, ORM library, sesion library, template library, etc. and set up their own custom framework. The benefits of this is they could develop it in such a way that if they need to replace a library they will be more comfortable with the process of decoupling libraries versus a framework where you use what is provided to you, and you have to import additional libraries if you want to not use the defaults.

Last Updated: 2015-01-07 09:42:42 +0000 UTC

What are your thoughts on this?


RSS feed

Follow Doug On Social