WordPress Plugin – an example of bad programming

When you have to break out a debugger to try and figure out why an obvious modification to a piece of third party code isn’t working it’s usually down to bad code. Here’s the problem:

I was trying to add a submenu page to an existing WordPress menu.

Unfortunately, the developer had decided to write a convenience wrapper around some of the existing WordPress Add Menu functionality. Whilst a neat idea (you simply used a render function to that would parse the page name to call the function that rendered the content), they had managed to shoot themselves in the foot by hard-coding the page names in this render function.  E.g. in this render function you had:

What it meant was you had to basically step through the code to find out why things weren’t working.

Open Source web frameworks for 2016, 2017, 2018 and beyond

As an Open Source developer specializing in PHP frameworks like WordPress, Drupal, CodeIgniter and Symfony I’m always keen to know where to focus my efforts on new technologies.

But how can you predict where a web technology is going?

This is where Google Trends comes to the rescue. Here are some graphs of interest (in terms of searches for the technology) of new and existing Open Source web frameworks.

One caveat – a search for a term covers a lot of potential use cases such as end users wanting to find out more or developers searching for more information. A higher search number does not mean higher pay rates but it does mean there is a global interest in the technology.

Firstly, some CMSs: Drupal, WordPress, Joomla, TYPO3

WordPress is clearly more popular (which is understandable given its dominance). However, interestingly, Drupal is clearly on a downward trend. Anyone care to explain why?

I did have a look at other CMS’s such as OctoberCMS and PageKit but these did not even feature on the graph hence the omission. If anyone wanted a graph of up-coming systems perhaps I could do a separate chart.

Then, some frameworks: Yii, Symfony, Laravel, Zend, CodeIgniter

Some key takeaways – Laravel is going through the roof!
And Zend, which hit a peak in 2009, is clearly dropping off the radar. CodeIgniter, which had a peak in 2013, still has a strong interest and is in second place.

It would be interesting to expand on these graphs. Any suggestions on other frameworks or time periods to focus on?

Law of Demeter

TL;DR

In OO software, do not assume knowledge of anything else.

Longer explanation

The Law of Demeter (LoD) is the principle of least knowledge for developing software.

Roughly speaking other ways of expressing this are:

  • software should be loosely coupled
  • principle of encapsulation
  • principle of “information hiding”

For modern OO languages, when using dot notation simply use 1 dot. i.e. something like this would be forbidden:

dog.legs.walk

as you’re assuming knowledge.

Much longer explanation here: http://en.wikipedia.org/wiki/Law_of_Demeter