• 757-551-6373

Wojciech Sznapka: Type Hinting is important

In his latest post Wojciech Sznapka reminds us that type hinting is important in your PHP applications and can help provide more structure and better overall code practices.

One of my favorite PHP interview questions, is: what is Type Hinting and why it’s important? Putting definition in one sentence, Type Hinting is a way to define type of parameter in function signature and it’s a sine qua non to leverage polymorphism. […] So given the fact, that Type Hinting is optional and we don’t need to specify types of parameters passed to the method – why bother? Answer is easy: well prepared method signatures defines your model and are part of the “contract” that your code reveals to its consumers. It also prevents many silly errors and keeps codebase clean and coherent.

He talks about the best practices on using type hinting including where to put them (in an interface or base class or child class?) and some of the pros and cons of each. He also points out that some practices around type hinting, like overriding the hint and calling the method with unexpected/variable input, should be avoided (see the L in SOLID).

Link: http://blog.sznapka.pl/type-hinting-is-important

Community News: Packagist Latest Releases for 06.12.2014

Recent releases from the Packagist:

SitePoint PHP Blog: How to Create a Laravel CSS-Minify Command

The SitePoint PHP blog has a new post today from Tounes Rafie showing you how, in a Laravel framework based application, to create a minify command with the framework’s “artisan” command.

In this article you’ll learn how to use Laravel’s Artisan command line tool, and how to create a customized command. Note that you need to be familiar with the Laravel framework to get the most of this article. In this tutorial we’re going to build a command to minify our css assets.

He starts with a (very) brief look at what Laravel commands are and the options this articular one will include. Next up is the code you’ll need to create the command, making use of Laravel’s integration of the Symfony Console component. He shows how to register the command with the rest of the application and how to work with the options/arguments for the input. From there he shows how to run the command and how to make some other improvements including colorized output and more information on execution.

Link: http://www.sitepoint.com/create-laravel-css-minify-command

Anna Filina: Brute-force countermeasures

In her latest post Anna Filina has made some recommendations of countermeasures you can use to help prevent abuse against brute force attacks in your applications. The recommendations aren’t PHP-specific, but they’re a good guide and a place to start.

Password brute-forcing refers to trying all password permutations until the attacker finds the right one. Here are some of the most common ways to mitigate that risk: increase the length of the password and increase the number of possible characters. […] The human factor should not be ignored here. People often use letters in the beginning and numbers at the end.

She recommends a few other tactics to helping prevent the brute forcing including locking an account after a number of unsuccessful login attempts and requiring a CAPTCHA after a number of unsuccessful logins. She recommends not relying on a single method to help prevent this kind of attack, however. Multiple layers can only help, but be careful not to introduce too much complexity.

Link: http://afilina.com/brute-force-countermesures

PHPClasses.org: 7 Reasons Why TDD Failed to become Mainstream

In the latest PHPClasses.org post Manuel Lemos suggests severn reasons why TDD failed to become mainstream in most development communities. This is related to comments from an leader in another community about his perspective on the “TDD movement”.

Recently the creator of Ruby On Rails declared that TDD (Test Driven Development) is dead. Despite he used to be a supporter of TDD as the right way to do software development, he finally decided to announce that he really does not agree that TDD is really the right way. Read this article to learn more about what happened and what does this mean for developers that support TDD or not.

He starts with a brief look at what TDD (test-driven development) is and a link to a ThoughtWorks video of DHH talking about his new stance. Among his reasons are things like:

  • TDD is Expensive
  • You Will Change Your Projects and Old Tests Become Waste
  • Extensive Testing is Boring
  • Many TDD Preachers Do Not Use it Most of the Time But Do Not Admit it

Manuel shares some of his own opinions on the matter, though, pointing out that he doesn’t think TDD is dead. He suggests that it helps to “make you rethink” when developing and that your (and your development group’s) practices shouldn’t be influenced by outside opinions – use what works.

Link: http://www.phpclasses.org/blog/post/237-7-Reasons-Why-TDD-Failed-to-become-Mainstream.html

Community News: Packagist Latest Releases for 06.11.2014

Recent releases from the Packagist:

[WSOOTD] Reputation Management Software Biz-In-Box Starting Your Own Business Has NEVER Been Easier

http://goo.gl/q9xyKt To get more ideas about starting your own home based business please visit here: http://goo.gl/q9xyKt Learn the Top 10 Ways to Make Money Online – In this video I break…

Need help? contact us today at 516-506-0988

Community News: Recent posts from PHP Quickfix

Recent posts from the PHP Quickfix site:

Creative Solutions for Extraordinary Clients