First off, let me say this: There's no need for your bootstrap to be OO. Your Bootstrap class will become a utility class with no real purpose, which does everything. That is also known as a God Object .
From what I see, you're better off using the procedural one.
Review for OO:
- Naming convention: Setters should be prefixed with
set
:setDirectorySeparator
,setRootPath
, etc. It's not clear whatdirectorySeparator
does at a glance. - Don't use Globals: The entire point of moving an application to OOP is to better manage the dependencies and move away from global variables.
- Don't use Service Locators: Your
$config
variable is a service locator. You will inject it (or worse, global include it) everywhere, it contains all of the configurations and all you need is one or two entries. Don't do that. Give each function/method exactly what it needs. - Application bootstrapping should not be OO. See above explanation.
Review for Procedural
- Use a class for Autoloading: It makes things a whole lot simpler, and it looks nicer too. I see you're using PSR-0, there are easy and simple solutions out there available.
- Arbitrarily requiring files and adding ini entries is not safe: If you don't sanitize user input properly in any part of your application, this may cause you some severe breakage on the server. Beware!
Here's an example for a good bootstrap file for an MVC application: How should a Model be structured in MVC? How should a Model be structured in MVC?
First off, let me say this: There's no need for your bootstrap to be OO. Your Bootstrap class will become a utility class with no real purpose, which does everything. That is also known as a God Object .
From what I see, you're better off using the procedural one.
Review for OO:
- Naming convention: Setters should be prefixed with
set
:setDirectorySeparator
,setRootPath
, etc. It's not clear whatdirectorySeparator
does at a glance. - Don't use Globals: The entire point of moving an application to OOP is to better manage the dependencies and move away from global variables.
- Don't use Service Locators: Your
$config
variable is a service locator. You will inject it (or worse, global include it) everywhere, it contains all of the configurations and all you need is one or two entries. Don't do that. Give each function/method exactly what it needs. - Application bootstrapping should not be OO. See above explanation.
Review for Procedural
- Use a class for Autoloading: It makes things a whole lot simpler, and it looks nicer too. I see you're using PSR-0, there are easy and simple solutions out there available.
- Arbitrarily requiring files and adding ini entries is not safe: If you don't sanitize user input properly in any part of your application, this may cause you some severe breakage on the server. Beware!
Here's an example for a good bootstrap file for an MVC application: How should a Model be structured in MVC?
First off, let me say this: There's no need for your bootstrap to be OO. Your Bootstrap class will become a utility class with no real purpose, which does everything. That is also known as a God Object .
From what I see, you're better off using the procedural one.
Review for OO:
- Naming convention: Setters should be prefixed with
set
:setDirectorySeparator
,setRootPath
, etc. It's not clear whatdirectorySeparator
does at a glance. - Don't use Globals: The entire point of moving an application to OOP is to better manage the dependencies and move away from global variables.
- Don't use Service Locators: Your
$config
variable is a service locator. You will inject it (or worse, global include it) everywhere, it contains all of the configurations and all you need is one or two entries. Don't do that. Give each function/method exactly what it needs. - Application bootstrapping should not be OO. See above explanation.
Review for Procedural
- Use a class for Autoloading: It makes things a whole lot simpler, and it looks nicer too. I see you're using PSR-0, there are easy and simple solutions out there available.
- Arbitrarily requiring files and adding ini entries is not safe: If you don't sanitize user input properly in any part of your application, this may cause you some severe breakage on the server. Beware!
Here's an example for a good bootstrap file for an MVC application: How should a Model be structured in MVC?
First off, let me say this: There's no need for your bootstrap to be OO. Your Bootstrap class will become a utility class with no real purpose, which does everything. That is also known as a God Object .
From what I see, you're better off using the procedural one.
Review for OO:
- Naming convention: Setters should be prefixed with
set
:setDirectorySeparator
,setRootPath
, etc. It's not clear whatdirectorySeparator
does at a glance. - Don't use Globals: The entire point of moving an application to OOP is to better manage the dependencies and move away from global variables.
- Don't use Service Locators: Your
$config
variable is a service locator. You will inject it (or worse, global include it) everywhere, it contains all of the configurations and all you need is one or two entries. Don't do that. Give each function/method exactly what it needs. - Application bootstrapping should not be OO. See above explanation.
Review for Procedural
- Use a class for Autoloading: It makes things a whole lot simpler, and it looks nicer too. I see you're using PSR-0, there are easy and simple solutions out there available.
- Arbitrarily requiring files and adding ini entries is not safe: If you don't sanitize user input properly in any part of your application, this may cause you some severe breakage on the server. Beware!
Here's an example for a good bootstrap file for an MVC application: How should a Model be structured in MVC?