Professional PHP Blog

PHP Programming, Web Development, PHP Advocacy and PHP Best Practices.

Keywords and Language Simplicity

October 11th, 2007

Well, I like programming language comparisons, so how could I resist this chart (via) promoting the simplicity of the io language by pointing out how few keywords it has. The interesting thing about this is that Java and PHP are tied on this measure of simplicity with 53 keywords. Perhaps that reflects Java’s heritage as a simplification of C++ (63 keywords) and PHP’s heritage as an amplification of C (37 keywords) toward a specific purpose? As usual, Perl is the poster child for language complexity. Ruby does well with 40 keywords. But, before the Ruby fans get too uppity about the simplicity of their language, they should contemplate the cat walked across the keyboard while I was holding down the shift key predefined variables that they inherited from Perl.

20 Comments »

Improved Error Messages in PHP 5

October 7th, 2007

Sometimes its the little things that make a difference. If you run the this test program in PHP 4 (tested on 4.4.7):

< ?php
function test($arg) { echo "talk like a pirate."; }
test();
?>

You get the following message:

Warning: Missing argument 1 for test() in /usr/bin/- on line 2

The error message here is reported at the position of the definition of the function, but really the error was in how the function was called. The required parameter to test was not passed. This error can be annoying, forcing you to consult a stack trace to find the actual error location. Something some beginners may not know how to do.

However, if you run the same message in PHP 5 (tested on 5.2.2):

Warning: Missing argument 1 for test(), called in /Users/jeff/- on line 3 and defined in /Users/jeff/- on line 2

Sweet improvement!

One more reason to ditch PHP 4 and go php 5.

43 Comments »

Michigan Taxes Graphic Design Services

October 1st, 2007

The state of Michigan, in a bid to become the most confusing state to operate a business in, has passed a sales tax on a bizarrely random selection of services. These services include such illustrious professions as astrology services, social escort services, and graphic design services.

The enumerated list of taxable services (sec 3d) (PDF) lists “Specialized design services, as described in NAICS industry group code 5414.” The 5414 designation includes “planning, designing, and managing the production of visual communication in order to convey specific messages or concepts, clarify complex information, or project visual identities. These services can include the design of printed materials, packaging, advertising, signage systems, and corporate identification (logos).”

Custom programming, web design and hosting services are not taxed (they have NCAIS codes outside of the enumerated ranges). However, a service such as logo design would be taxable.

To do the right thing, as I understand it, and I am SO NOT A LAWYER…

A Michigan business offering a mix of services must collect the tax on the graphic design component of their services.

A graphic designer in Michigan must have a sales tax license and collect the tax as appropriate.

A Michigan based consumer of out of state graphic design services must report their graphic design purchases and pay the tax.

Meanwhile, Michigan has the worst unemployment rate in the nation and is the worst state for creating new businesses.

I’m glad 541511: Custom Programming Services was spared from the tax.

1 Comment »

Ruby versus PHP or There and Back Again

September 23rd, 2007

Well, I imagine that this opinion piece by Derick Silvers will cause some conversations: 7 reasons I switched back to PHP after 2 years on Rails. The gist being that a big bang rewrite of an existing code base is always a risk and that Rails is optimized more for the greenfield case. [...]

18 Comments | Read the full post »

Mighty Mouse Kryptonite and Exceeding Expectations

September 18th, 2007

I’m a fan of Apple’s Bluetooth mighty mouse. I cart my laptop all over and I like the ability to have a full sized mouse with a scroll wheel and right click without the hassle of cable management on some narrow coffee shop table.
Imagine my horror when just such a table caused the chain [...]

6 Comments | Read the full post »

reCAPTCHA – Combining Distributed Problem Solving with a Web Service

May 30th, 2007

I ran into an interesting project this morning called reCAPTCHA. In the spirit of distributed computing solutions, such as folding@home, it tackles a difficult problem by splitting it up and farming the pieces out. What makes this interesting is that instead of having computers solve the problem, people do.
ReCAPTCHA actually tries to solve [...]

5 Comments | Read the full post »

php|tek Slides

May 19th, 2007

Well, php|tek is over. It was a great conference and I’m really glad I went. This was my first PHP conference.
One of my main goals was to meet some of the folks at php|architect. I’ve been writing the Test Pattern column for them for over a year now. I was finally [...]

4 Comments | Read the full post »

Let Your Properties be Properties

May 8th, 2007

There is a coding pattern that I see (and have used) in PHP code that defines generic methods on a class for setting and getting properties.
 
function set($name, $value);
function get($name);
 Google code search for examples
Some times there are some ancillary methods to deal with unsetting, checking for existence, setting via an array, or dealing with references in [...]

15 Comments | Read the full post »

Where do you get your Wi-Fi?

May 6th, 2007

Sometimes you just have to get out of the house or out of the office. And some of those times, you have to use the internet as well.
I’ve collected a (short) list of places around town that have Wi-Fi. I usually use the Wi-Fi at a small local coffee shop. They are [...]

5 Comments | Read the full post »

On the Perils of Inline API Documentation

April 13th, 2007

Travis Swicegood has a post questioning the value of the docblock. I have a deep sympathy with this sentiment.
Even on projects with extensive generated documentation, I find that kind of documentation to be of extremely low value. The problem with inline API documentation is that there is no sense of priority. Developers [...]

14 Comments | Read the full post »

« Previous Entries
Next Entries »
    Subscribe Feed
    Share Subscribe to this blog…
    Share Bookmark or share this page…
  • About

    My name is Jeff Moore. I'm a PHP programmer living in San Francico and working for a startup.

    More about me…

  • Categories

    • Agile Methods (14)
    • Mac (14)
    • Misc (17)
    • Open Source (14)
    • PHP (98)
    • Software Design (29)
    • Usability (14)
    • Web Design (20)
  • Recent Comments

    • Programming Language Trends via Google  19
      Craigslist pva, jessica, Scott [...]
    • Looking Towards the Cloud  35
      bentonville multiple listing, cosmetic dental, Sam Brodish [...]
    • PHP versus ASP  8
      Marhta Blight, Ravi, Ryan Brooks [...]
    • How to Transfer Mac OS X Application Data between Computers  59
      Website Migration, harry the computer support guy, Dotty Salvage [...]
    • Working with PHP 5 in Mac OS X 10.5 (Leopard)  157
      lehuuphuc, Robert Parthemer, Lingerie Intimate [...]
    • PHP Games  25
      jessica, Tennille Cranor at Chilli Plants, Lucas Ortell [...]
    • un-PEAR-ing  5
      jessica, Eugene Panin, Arnaud [...]
    • The Legality of Republishing RSS Feeds  23
      kevinxiao, Marissa Miscovich, Quick Student Loans [...]
    • Faster Page Loading  4
      jessica, angular cheilitis, Aaron Rosenfeld [...]
    • PDO versus MDB2  15
      jessica, kevinxiao, Gavin [...]
  • My Other Stuff

    • Lively Debate
      My blog on Politics and non-technical topics
    • Web Application Component Toolkit
      PHP MVC Framework
  • Other PHP Blogs

    • Dynamically Typed
    • Jason E. Sweat
    • John Lim
    • Marco Tabini
    • Marcus Baker
    • Norbert Mocsnik
    • PHP Patterns
  • Site

    • Archives
    • Log in
  • Search