Jump to content

Known methods to application bootstrapping?


ignace

Recommended Posts

Hi,

 

How do you generally bootstrap your application or which other methods do you know besides:

 

#1: Switch (Not really the best approach)

switch ($page) {
    case 'home':
        include('home.php');
        break;
    ..
}

 

#2: Using routing (most used)

$defaultRoute = array('default', 'route', 'parts');
$errorRoute = array('error', 'route', 'parts');

$route = uri2route();

dispatch($route);

 

#3: 'RESTful' based

This is something I have been playing with. A browser is just another device like CLI to access your 'website' (or the data at that resource identifier) through the Accept header can the application identify what it should return.

 

What are your thoughts, suggestions?

Routing is just a collective term for mapping a request to some sort of resource in your business logic. In fact, it means what you call "bootstrapping" here. Specifically how you do it is not so important (to some extent). You will obviously want some sort of way that has some degree of modularity. E.g., having to alter a switch all the time would be cumbersome, and it would eventually result in a rather large switch; you would want something dynamically defined.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.