Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Tim Koschuetzki's Blog:
Composing Methods: Substitute Algorithmn
Aug 16, 2007 @ 13:26:00

Tim Koschuetzki has another in his "Composing Methods" series posted today - this one taking a look at something called the "substitute algorithm". It's a method of replacing content in a simpler way than using multiple ifs (as replaced by array functions).

Programming is such a dynamic action that you often find yourself having to replace an algorithmn all together. It will be much easier to do if the current algorithmn is an easy one already. [...] Make sure you decompose your algorithmns as much as you can and use many small methods for it.

His example replaces multiple if statements to search through an array with a simple in_array statement, returning the selected array index from there.

tagged: method compose substitute algorithm replace search method compose substitute algorithm replace search

Link:

Tim Koschuetzki's Blog:
Composing Methods: Substitute Algorithmn
Aug 16, 2007 @ 13:26:00

Tim Koschuetzki has another in his "Composing Methods" series posted today - this one taking a look at something called the "substitute algorithm". It's a method of replacing content in a simpler way than using multiple ifs (as replaced by array functions).

Programming is such a dynamic action that you often find yourself having to replace an algorithmn all together. It will be much easier to do if the current algorithmn is an easy one already. [...] Make sure you decompose your algorithmns as much as you can and use many small methods for it.

His example replaces multiple if statements to search through an array with a simple in_array statement, returning the selected array index from there.

tagged: method compose substitute algorithm replace search method compose substitute algorithm replace search

Link:


Trending Topics: