SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2008
    Location
    Auckland NZ
    Posts
    32
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    General Template Setup

    Hey,

    I was involved in a few discussions with Ask The Expert this morning and it got me thinking is there a general standard or what system do you use when developing a multipurpose website with PHP - like the use of MVC,Admin areas, _assets.

    J

  2. #2
    SitePoint Wizard wonshikee's Avatar
    Join Date
    Jan 2007
    Posts
    1,223
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    There is no general standard

    There's people who will swear by pretty much every idea out there, so who's right? Everyone or No one (depending on how you look at it).

    There's basically 3 routes.

    1) Raw PHP, quick to start, but can quickly become messy and unwieldy if the site is large. I usually go this route for microsites, as it's the fastest to throw together on simple projects.

    2) CMS platform (this is what I call them, they go by many names). Applications like Drupal, Joomla, Wordpress, oSCommerce, vBulletin fall into these. They are pretty much totally independant ecosystems with various support from their community. They are the least flexible to work with, but offer the greatest functionality for time spent (as long as you don't deviate too much from their intended function).

    3) A PHP Framework, there is a huge variety within this, but generally frameworks fall into two categories, Glue and Full Stack. Glue is less organized, closer to #1, while a Full Stack is closer to #2 in that it offers a much more robust feature list, but at the cost of flexibility/ease of use. For a wide variety of projects, this is generally the best option, as it's a good balance between flexibility and code reuse, but it's also more difficult to use than #2.

    So in summary, the easier it is to use, the less functionality it generally offers as well as easier to disorganize.

    It's simply a matter of personal preference as well as dependent on what sort of projects you do.

  3. #3
    Foozle Reducer ServerStorm's Avatar
    Join Date
    Feb 2005
    Location
    Burlington, Canada
    Posts
    2,699
    Mentioned
    89 Post(s)
    Tagged
    6 Thread(s)
    ERR... missed the point of your post @JZM, but the info below is at least a little useful regarding your question

    Quote Originally Posted by JZM View Post
    Hey,

    I was involved in a few discussions with Ask The Expert this morning and it got me thinking is there a general standard or what system do you use when developing a multipurpose website with PHP - like the use of MVC,Admin areas, _assets.

    J
    @JZM

    You ask a very general question, multipurpose could be heavily ajax driven with fancy front-end and not as heavy on the server side and still uses MVC and admin areas.

    Generally speaking, you want to first decide where your application is going to live? On Amazon, your local server(s)... Are you going to use separate servers for your asset serving and another for your Database server(s). You also want to know if you will be load balancing the application so that you can decide how you want to handle session data - say for authentication users jumping between servers.

    DNS (Domain Name Service) also plays into this equation. If our DNS is slow then the application will be slow, so we need to think about how our application will make use of DNS and plan accordingly.

    You need to understand what type of team will be working on the project? Are you going to use contract people for the SQL, front-end design, or any other aspect of the application. It may be that it is going to be a single entity project - you.

    Early in a project I focus on what content will be used by this application, this includes Database, JSON, XML as well as more front-end javascript, images, videos, pdf, documents, and CSS. The content should drive many of the architectural decisions you make; best to do this early.


    This leads to planning the kind of application layer. There are many choices so what do you need for your project; A simple MVC structure, Service-Oriented Architecture (SOA) (which often dresses up MVC in different terminology), or any of the other (many) architectures that are currently in favour? pick one that fits your content and the functionality of what you need to do with it.

    An application will take on an 'organic' good or bad architecture if you don't plan or make an active choice. I support the idea of choosing rather than letting it take its' own shape. This doesn't mean that I don't like iterative styles of development I just like to understand the architecture/engineering of the application I am building.

    Once you have an idea of what you are going to do from your architecture standpoint you need to decide how you are going to test the application. If using a test suite like PHPUnit or SimpleTest then you should setup the scaffolding for this. I like writing my tests before the code is written and write in small chunks. I prefer behaviour driven development(
    http://behaviour-driven.org/)

    Then you get to choose what type of Coding patterns you want to use in the development. Really once you gain experience you don't specifically think about 'what pattern' but you are basing a choice on an appropriate pattern that best suits and has the best trade-offs in your application.

    For customers I like to do iterative releases and publish the test website from day one, so they can visit, try and watch it grow. The also get the chance to flag problems - typically logical or conceptional - earlier when it is 'less costly' to change course. At first customers are not used to this idea and say 'Just show it to me when it is done' but I get them checking regularly early on, they get used to it and like it after a while.

    If a team then I often do more project management than code, managing risks, planning, preparing what developers and designers need, and working with the infrastructure people (where it will live). If I am doing something on my own then I generally start this part of the project by designing the database and also (for variety), I work to get the asset servers, load-balancers, and DNS working. I generally don't design the whole database I first look at the most complex relationships and figure out how to handle them, then I work on building just the parts of the database that I am currently working on. I build a 'Model' test first that will fail because there is not yet a table created for a sql query to succeed. To satisfy the test I create the table(s) and appropriate SQL. I keep this going until much of the model data is ready then I work on the controller level and finally the view.

    I first pull un-formatted assets into the view, and then start stylizing the assets using C.S.S.
    I use SimpleTest's web-tester and Selenium (http://seleniumhq.org/) for browser testing which includes Javascript.

    I know that this description has been fairly general, but also hope that it helps with your question.

    Regards,
    Steve

    ictus==""


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •