extensions development for Joomla!™

 

Avoid using the switch() loop

The switch() loop, evaluates an expression, matching the expression's value to a case label, and executes statements associated with that case. This method can be a source for tricky bugs that usually happen, especially with novice programmers. Also, it's more of a procedural programming type than an object oriented one. There are also performance benefits using the Object Oriented Programing (OOP) approach of the switch loop, which can be applied using the Command Design Pattern.

Here you'll find the two methods and basic code for testing and future usage, as well as notes explaining the risks of using the switch() loop and, the benefits of using the Command Pattern approach in your future development processes.

Read more...

The "not so logical" comparison of 0 to null

When evaluating code, it is important to know exactly with which types of data we are working with and also to which type of software is it related, because sometimes, things aren't that logical as we might think and the results might not be the expected or desired.

Let's perform a couple of tests, using JavaScript and PHP, and see the results on each of these scripting languages, while comparing zero to null. In each example, we'll compare 0 (zero) to null using different available methods:

Read more...

Subcategories

Shopping cart

The cart is empty
Extension added to cart! x
Back to Top