开发者

Web-apps : to framework or not to framework?

开发者 https://www.devze.com 2023-01-02 01:02 出处:网络
I know PHP and am just beginning with MySql (but plan to use ODBC). I don\'t need any books explaining that.

I know PHP and am just beginning with MySql (but plan to use ODBC). I don't need any books explaining that.

I am probably qualified to develop a simple web site, but aim at taking on quite ambitious apps. I imagine that almost all web apps have some commonality like security, scalability, etc (I have absolutely no idea how to distribute a data base or an app over server servers, for instance).

Since I can't foresee the exact nature of the applications which I might develop (other than that PHP & ODBC will be involved), is there any point in getting married to a framework, or should I just reinvent the w开发者_如何学编程heel and personalize it to make it my own framework.

If an existing framework, then which one? The only help I can give is that I am not likely to do websites, portals, shoppings sites, etc, probably leaning more to asset tracking and data mining.


Using a framework saves you a ton of time and helps you to organise your app mroe logically.

If the app is small then frameworks like CodeIgniter or Kohana are ideal.

If you are building a bigger app that needs to scale the Symfony or possiby Zend are the ones to look at.

If you were to start your app in Symfony you would instanly get:

  • url rewriting using routes
  • a form framework for handling everything to do with your web forms
  • internationalisation and localisation
  • emailing
  • caching
  • admin area generator, to help you add data quickly
  • unit testing framework

Plus the whole framework is extendable and custmisable to suit your needs.

Starting without a framework you'd have to write all of this yourself. Or integrate several disparate open source modules.

Hope this helps.


Good frameworks give you a ready solution to common problems. Reinventing solutions for yourself probably will be excessive work. As a learning exercise coming up with stuff for yourslef has some value. To get a real job done efficiently use a framework.

This does assume that good frameworks exist in your world ...


I currently am developing in the PHP framework Kohana (version 3). There is also a way to make models (for the (H)MVC pattern) very quickly using ORM. For more information look at this: http://kohanaframework.org/guide/tutorials.orm and take a look at http://kohanaframework.org/guide/api and http://kohanaframework.org/download


Frameworks are great for making sure you code to a regimented fashion and that your code is readable. They also offer lots of code library's that will be able to save you alot of time in developing web apps.

Zend framework has a huge amount of code library's that you can include into your app to extend it easily, and for data mining having access to these library's would be very beneficial as I'm sure there are many data mining library's already made for Zend.

Symfony framework great for developing websites quickly and is very strict using innodb for its database tables which insures database integrity and is useful if you intend to develop a strict relational database. The admin generator is also amazingly quick for developing content management systems for websites you design.

If you are going to take on a framework I would look at this tutorial http://anantgarg.com/2009/03/13/write-your-own-php-mvc-framework-part-1/ which walks you through your first MVC(model view controler) framework and is far more simple than jumping straight into a full framework like Zend. I would just follow this tutorial until you have a decent grasp coding in an mvc style, its not really worth re-inventing the wheel due to the amount of time involved and the quality of existing frameworks.

Hope this helps

Luke


There are already some good answers to "which framework" question for PHP on StackOverflow, so I won't go into those.

However, as far as libraries go I would recommend using the ADODB library (easier proper sanitisation of input, supports multiple DB's, better API than PHP's native DB specific classes) and writing a few classes of your own.

A good example of a "lite" framework that provides templating (and that is also a good example of a well written framework) is Smarty (which is used by the W3C on their website - not a bad endorsement). To some it seems redundant to have a templating language in PHP, but it does help enforce a notable degree of separation of presentation logic vs application logic.

I think it's best steer clear of frameworks on PHP until you see something that really meets a need you can't solve easily without it.

My take on it is that you are happy writing your own classes and small site specific frameworks you'll be better able to evaluate other frameworks more easily (I regard this as a unique challenge with PHP as there is a bit of over supply of crummy frameworks that gets in the way of finding the good ones).


I`ve used Yii for a few projects. Need to say its extensions (backvendor http://www.yiiframework.com/extension/backvendor/ and bootstrap http://www.yiiframework.com/extension/bootstrap/) really save time on the first stages of development

0

精彩评论

暂无评论...
验证码 换一张
取 消