PHP functionphobs and doccomment fans

So in PHP functions are basically used in two cases: If the programmer doesn’t yet use OOP or if the script isn’t worth using OOP for. The notion of “helper function” or something like that does not seem to exist…(Reminder: Using classes does not mean your code is object-oriented!)

So true! But what really got me on this article, was this part:

Another tangentially related “standard” practice I feel badly about is the excessive use of doccomments. In most cases phpdoc comments just comment the obvious – at the same increasing the code size by a factor of two or three. I have no problem with doccomments where necessary, but in most cases (at least with well designed code) the behavior should be obvious from the method and parameter names.

Coming from a Perl camp and being a fan of Ruby for few years (still using them here and there), I start catching myself thinking that the world’s been taken over by crazyCamelCaseJavaProgrammers. I do understand that complex projects with huge (no, “huuuuuuuuge!” would be more appropriate here) codebase need concrete descriptive variables, but what happened with readable code? The less readable it becomes the more comments it generates. Sometimes the only expression you get after reading a doc file on the class is “Thanks, Captain Obvious!”. Commenting return statement with “return” comment, or “note: division by zero” and here it comes – division by zero.

I guess that I’m too picky on this one, but by the end of the day remember what this oldie:

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. Code for readability.

Docker partners Microsoft

Today, we announced an exciting set of joint initiatives with Microsoft, including:

  • Extending Docker to Windows with Docker Engine for Windows Server
  • Microsoft’s support of Docker’s open orchestration APIs
  • Integration of Docker Hub with Microsoft Azure, and
  • Collaboration on the multi-Docker container model, including support for applications consisting of both Linux and Windows Docker containers

I’d like to provide some context for this announcement, and why we are so excited.
When Docker was launched as an open source project 18 months ago, we had a simple goal:
“To build the ‘button’ that enables any application to be built and deployed on any server, anywhere.”

Great news for Docker. The more the merrier

CakePHP 3.x: first impressions

cake-logo

Having a pint at Octoberfest with Leonid, we have an interesting discussion about recent CakeFest held in Madrid. Apart of crazy stories about haircuts, and alcohol consumption that hotel had to witness those days, CakePHP 3.x was shortly introduced between the pints.

Since, I’ve been heavily using this framework in the last 3-4 years, and some heavy projects are still running on it, I’ve decided to have a look, to get the notion of what to expect, once the 3.x branch get to stable mode.

First impression was merely same as flood victim: in less then a split of a second, you realise how much you’ll have to re-write to comply with 3.x structure. It’s a lot! Almost a full re-write. Damn!

tumblr_inline_nczuo9C9ov1raprkq

 

Major improvements and redesigns affected:

  • ORM of Cake
  • Namespaces (namespaces, namespaces, names…)
  • Request/Response are defacto standards
  • Core became smaller, moving towards plug-ins architecture.
  • Composer-friendly.

I guess it’s the time to plan an upgrade, as not much time left for the release of stable 3.0.0 version.

For those of you willing to participate, get your coding kung-fu on the issue tracker in GitHub repo.

You’re using an outdated browser, please use Chrome

Going through, stumbled upon this nice source code:

<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<![endif]-->

Just out of curiosity, what would people heavily using IE do, if they’re offered Chrome. Ignore, or upgrade their IE?

Quotes: Technical Dept

Great article on software development sins from Ionel Cristian and great quote on technical dept:

Management fear risks. Juniors fear getting in intractable situations or just don’t know how to solve it better. Seniors with cozy positions fear embarrassment – it’s already cozy enough and the golden shackles are so shiny. Why risk looking like a fool and give management reasons for downgrade or lose that minuscule 1% salary upgrade.

But you, yes you, you can take it in your own hands. Fight for change or you’ll remain miserable and deal with “legacy” code forever. How to convince management to change and fix the damn debt? Depends on the situation, but it’s mostly a matter of ruthless politics. Make campaigns, invent reasons, gather support.

WordPress 3.9.2: security patch

This release fixes a possible denial of service issue in PHP’s XML processing, reported by Nir Goldshlager of the Salesforce.com Product Security Team. It  was fixed by Michael Adams and Andrew Nacin of the WordPress security team and David Rothstein of the Drupal security team. This is the first time our two projects have coordinated joint security releases.

WHMCS API: heritage of whmcs-ruby gem

Joshua Priddle did a great job back in DotBlock accomplishing Ruby binding for WHMCS API.  Unfortunately, last signs of activity were 3 years ago. It’s a pity, as gem is great, and works like charm, but it became massively outdated, and piled with pull requests no one merged in the master branch for ages.

The code was published by MIT license on 2011, thus whmcs-api gem will be its descendant, which I’ll try to keep updated as much as possible.

For now it’s being tested on Ruby 2.x and WHMCS 5.3.x without any problems. The source code and any issues are better be reported on the Github repo.