Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/package.php on line 78

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Loader::package() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/packages.php on line 8

Strict Standards: Non-static method Object::camelcase() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/loader.php on line 264

Strict Standards: Non-static method Loader::package() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/packages.php on line 8

Strict Standards: Non-static method Object::camelcase() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/loader.php on line 264

Strict Standards: Non-static method Loader::package() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/packages.php on line 8

Strict Standards: Non-static method Object::camelcase() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/loader.php on line 264

Strict Standards: Non-static method Loader::package() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/packages.php on line 8

Strict Standards: Non-static method Object::camelcase() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/loader.php on line 264

Strict Standards: Non-static method User::checkUserForeverCookie() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/user.php on line 4

Strict Standards: Non-static method Loader::helper() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/autoload.php on line 4

Strict Standards: Non-static method Object::camelcase() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/loader.php on line 248

Strict Standards: Non-static method Loader::db() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/type.php on line 79

Strict Standards: Declaration of SelectAttributeTypeController::saveKey() should be compatible with AttributeTypeController::saveKey() in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/types/select/controller.php on line 429

Strict Standards: Declaration of SelectAttributeTypeController::duplicateKey() should be compatible with AttributeTypeController::duplicateKey() in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/types/select/controller.php on line 429

Strict Standards: Non-static method Config::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/maintenance_mode_check.php on line 5

Strict Standards: Non-static method PermissionsCache::exists() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/permissions.php on line 69

Strict Standards: Non-static method PermissionsCache::getIdentifier() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/permissions.php on line 15

Strict Standards: Non-static method Loader::helper() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/startup/process.php on line 29

Strict Standards: Non-static method Object::camelcase() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/loader.php on line 248

Strict Standards: Non-static method View::getInstance() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/dispatcher.php on line 245

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/collection_types.php on line 38

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Warning: Cannot modify header information - headers already sent by (output started at /home/colinlawrence/colinlawrence.net/concrete/models/package.php:78) in /home/colinlawrence/colinlawrence.net/concrete/libraries/view.php on line 764
Coding Guidelines
Home > Blog > Coding Guidelines

Coding Guidelines


Strict Standards: Non-static method Localization::getTranslate() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/localization.php on line 34
Posted by clawrence on February 16, 2011

Today I had a really good conversation with two of my co-workers about object oriented coding guidelines.  Two guidelines happened to really stick out in the conversation.

First and foremost, never return a null value from a method (or interface).  Returning null values seems to stem from the days when programmers dealt with C code.  This seems to have been the proper way to code back in the day because objects tended to be quite heavy when it came to memory and CPU utilization.  Returning null in object orientated languages causes mistrust in your code because any caller of your method must check for null values before using the returned value.  If the caller doesn't check for null values then an exception will be thrown which will cause a great deal of instability in your application.

Second, if it is possible, wrap primitives in objects.  The tendency that many people have when passing primitive values around in code is assuming something about the primitive in the boundary cases.  This can be thought of as metadata that should be attached along with the primitive value.  There is almost always some kind of metadata that should be attached to primitive values that will help improve your code.  This will help users of your interface (this term is used loosely here) use your value in the correct way.  For example, let's say you pass around a float value that is a lengh value.  Instead of just passing this float value around, wouldn't it be better to also pass along the units of measurement as well, such as metres or feet.


Strict Standards: Non-static method Loader::db() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/key.php on line 96

Strict Standards: Non-static method Loader::helper() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/key.php on line 103

Strict Standards: Non-static method Object::camelcase() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/loader.php on line 248

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/attribute/categories/collection.php on line 73

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Comments:


Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/block.php on line 57

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Non-static method Loader::db() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/blocks/guestbook/controller.php on line 454

Strict Standards: Non-static method Cache::get() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/models/block.php on line 57

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 111

Strict Standards: Non-static method Cache::getLibrary() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 115

Strict Standards: Non-static method Cache::key() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/cache.php on line 131

Strict Standards: Only variables should be passed by reference in /home/colinlawrence/colinlawrence.net/concrete/libraries/block_controller.php on line 141

Strict Standards: Non-static method Localization::getTranslate() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/localization.php on line 34
Leave a Reply



(
Strict Standards: Non-static method Localization::getTranslate() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/localization.php on line 34
Your email will not be publicly displayed.)



Strict Standards: Non-static method Localization::getTranslate() should not be called statically in /home/colinlawrence/colinlawrence.net/concrete/libraries/localization.php on line 34
Please type the letters and numbers shown in the image.Captcha Code