Dom’s Blog

Polysyllabic Pretension Pertaining Primarily to Programming

WordPress 3.0

WordPress 3.0 has been installed on this blog. Doesn’t mean I’ll begin to update or anything, but WP3 is a major leap forward, and I’ve been updating blogs left and right with it. In other news, I got the Viper detailed — pic below.

Deatiled Viper

 

Update and Recovery

It’s been a long couple of months.  After getting out of the hospital, many of my symptoms continued.  I’m not sure how things will finally shake out, but I’m living with daily pain.

Following that experience, I went to a cardiologist for chest pain, and was sent for an electrocardiogram, an echocardiogram, and blood labs.  They then scheduled a nuclear stress test, which revealed some ischemia (heart muscle damage) in my left anterior descending artery.  From there, I went under the knife for a cardiac catheterization, which is basically a tube inserted into your artery (radial, in my arm, for me), which is then fed up into your heart, where dye is released so that doctors can see what is going on.  The catheterization revealed that I had a myocardial bridge, which is a heart defect.

From there, I went to a surgical consult to discuss the prognosis and options for treatment.  The surgical solution is something called a myectomy, which is where they remove a portion of the heart.  Specifically, the arteries would be “deroofed” to increase blood flow.

The doctor and I decided to use a medication-based approach rather than a surgical approach.  We’re going to try beta blockers or a slow-release nitro.  All-in-all, we’re feeling like this will solve the symptoms and allow me to return to my normal exercise routine.  Overall, good news.

I’m resuming my normal work schedule (which is to say that I’ll be working most of the time I’m awake — LOL).  I’m going to concentrate on fewer clients and give each one more hours.  I will probably put the blog on hold for right now, and resume when I’m through everything that’s going on.

Until then! -Dom

 

Recovery Week

Starting last week, I experienced a severe allergic reaction to Bactrim followed by outrageous medical incompetence that hospitalized me with a 104 fever, 135 pulse, falling 94/44 blood pressure, renal difficulties, and subdermal hemorrhaging (yes, bleeding under my skin).

I’m recovering slowly but surely, and waiting to find out what future health problems I’ll have to endure as a result of this experience. It all stemmed from a doctor’s incompetence and it’s not something I ever want to repeat.

This week’s blog post will be held until next week.  I apologize for any inconvenience.

 

Apple iPhone 3.0 Beta

Today, I downloaded the Apple iPhone 3.0 Beta to my iPod Touch through the Apple Developer Program that a colleague and I collaborate on.  It was a great birthday present from Apple, and yes: it includes the cut and paste technology.  Despite nearly-nonsensical yammerings from Apple on the reason cut and paste took so long to roll out (and why it’ll cost iPod Touch users $9.95), I have to say that the tech itself works quite well, and is apparently predictable enough to use consistently.  It doesn’t seem likely that I’ll accidentally paste a steamy message to my wife onto my mother-in-law’s Facebook wall.

Another neat feature is the “shake to shuffle” technology that does exactly what it sounds like.  Typing messages in landscape mode is a hoot as well, and it really makes me wonder why these features weren’t in from the beginning.  Oh, right: it’s Apple.

The “spotlight” feature of Mac OSX has finally made it to the iPhone and iPod touch.  By flicking the device one screen “left” of the home page, you can convince your iPhone or iPod Touch to search through e-mails, applications, and whatever else to find the keyword you’re searching for.  No more fumbling (hopefully!) through page after page of application screens searching for that elusive add-on.

All-in-all, a lot of the “features” in the update ranks feel more like “things that should have come with my device when I bought it.”  When the bloom is off of the rose for this update, it will certainly be interesting to see how the fanboys react.

As long as we’re talking Apple, I should mention that I am looking at the Mac Pro as an exclusive development platform for all future projects.  The eight-core machine can be stacked with enough RAM to handle the forseeable future, and the ability to run OSX alongside Windows without resorting to Hackintosh methods is appealing.  Also, the iPhone development SDK only runs in OSX, but I try not to let that shade my decision.  Much.

Apple has a long history of making me feel worthless as a customer, so I’m going to sit on my decision for a little while to let things percolate.

 

IDEs and the Coders Who (Don’t) Love Them

Unless you live under a rock, you know that integrated development environments are for sissies, and Notepad is the “old school,” “hardcore,” or “l33t” platform for developing code.  I call bullshit.  A good IDE can reduce time to market, improve coding efficiency, and help you write tighter code.

Per Wikipedia, an integrated development environment is a “software application that provides comprehensive facilities to computer programmers for software development.  An IDE normally consists of: a source code editor, a compiler and/or interpreter, build automation tools, and a debugger.”  Stack these features up against Notepad, and you’ll find that it only (barely) provides the source code editor.  Wikipedia continues to say that “most modern IDEs also have a class browser, an object inspector, and a class hierarchy diagram, for use with object-oriented software development.”

Given the features Wikipedia has so generously laid out for our perusal, which editor would you rather use?  One that offers a single feature (the ability to input text), or one that simplifies workflow, helps you spot errors more quickly, and contains helpful expediters like class browsers?  I’m not looking down on people who are “old school” and using Notepad, I’m just pointing out that perhaps it’s become too fashionable to toss wear the “I’m so hardcore I code in Notepad” button.

I once wore that button proudly.  Roughly a year ago, a colleague recommended NuSphere’s IDE product, PhpEd.  I was very skeptical, and only because of my respect for this colleague did I even try the product.  At first, I certainly wasn’t hooked.  I had a lot more buttons, toolbars, and other confusing and strange interface elements on my screen than I was used to in Notepad, vi, or even Emacs.  However, as I kept using the IDE longer and longer, I found my development lead-times getting shorter and shorter.  I was becoming more efficient, spending less time (for example) hunting for method names inside of classes and more time actually writing code.  I was hooked.

If you’re a button-wearing Notepad stalwart, you owe it to yourself as a professional to at least give an integrated development environment a shot.

 

Some Thoughts on the Viper

It’s probably trite to make an April Fool’s post after only a handful of weeks blogging, so I’ll take a break from technology, coding, and other geeky topics this week to get covered in oil and dig into some of my thoughts on the Viper.

I may not be the biggest gearhead out there, but I have owned many cars throughout my lifetime, including many of the “high end” cars that cross the boundary between transportation and unadulterated fun.  This gives me some perspective on the various cars out there, perhaps moreso than your typical “fanboy.”

This Christmas, I bought my wife a Dodge Viper.  Viper Red, SRT-10 (the “big boy” version), every option, 6-speed manual.  The link is a picture of our actual car, not some random Viper on the web, so please excuse the fact that it needed a bath.  Driving this car has really given me a respect for the “raw power” the car puts down to the road.  The “base” version is 510 bhp, and ours is upgraded to approximately 600 bhp.  It apparently runs the 0-60 in 3.5 seconds, and the quarter mile in the low 11′s with a trap speed of 128 mph.  This is some serious motion, if you’re not familiar with how to decode those numbers.

I’ve owned a race-built “stage 2-3″ Chevrolet Camaro SS, a pretty tricked out Pontiac Firebird Trans Am, a bone-stock Porsche, a lightly modified BMW, and in addition to owning these vehicles, I have personally driven a number of other top cars.  There is nothing that comes close to touching the “in your face” feeling of the Viper.  Corvette owners have been pretty vocal about the Vette “beating” the Viper, but I believe that Edmund’s sums up the experience (when comparing the Viper to the Corvette) fairly well:

“First, the 2008 Dodge Viper SRT-10 Coupe: 8.4-liter V10, 600 horsepower, 560 pound-feet of torque and an as-tested weight of 3,437 pounds. Those numbers, friend, are ridiculous. And they make the Viper the highest-displacement, most powerful naturally aspirated car we’ve ever tested. Combined with its crushing road presence, they define it as America’s most soulful supercar.”

“Driving either is like combining that first date with a randy prom queen with the physics-defying performance of a 1,000cc sport bike. You can hardly wait to get to the action and then, when it starts, you’re so scared you want it to stop.”

“There are problems, however. Like the Vette’s complete lack of exclusivity. The Z06 is stonk fast but, to most, it looks like any other Vette. And, to be completely honest, when driven back to back against a new Viper, it feels utterly emasculated.”

“Meanwhile, nobody is going to mistake a Viper for anything other than, well, a Viper. Unlike the Z06, there’s no watered-down sissy version in the hands of every Newport Ned who likes its image. The Viper only comes in one flavor: Hardcore.”

“In the limitless world of instrumented testing, the Viper bettered the Corvette at every opportunity. Its 11.8-second quarter-mile time and 3.7-second 0-60-mph sprint are just plain ridiculous. And its 125 mph trap speed is the fastest we’ve ever recorded for any car in the quarter-mile.”

“Power-shifting through the gears of the Viper’s six-speed Tremec transmission is like driving a D9 Cat through a mobile home: There’s a lot going on, but hold the wheel straight and nothing matters except the thrill.”

“The Corvette is also very quick, but the experience doesn’t pack the same buzz as it does in the Viper. There’s less noise, less intensity and less risk of death. Although it crushed the 60 mph barrier in just 4.1 seconds and blasted through the quarter-mile in 12.0 seconds at 122 mph, the Vette finishes several car lengths behind the Dodge.”

“Drive the Viper hard in a series of corners and you won’t settle into a smooth rhythm like you might in a less powerful, lighter Porsche 911, Ferrari F430 or even a Z06 Corvette.”

“It might force its way down a twisty road like a parade of Nextel Cup cars, but manhandle it properly, and it does so faster than all of the above. Subtle? No. Effective? Yes.”

“At 70.8 mph through the slalom and 0.93g on the skid pad, the Z06 isn’t really in the same league as the Viper”

“Both cars also have exceptional brakes, but again the Viper’s are just a little bit better.”

“Cupholders? There are two. Which is two more than the Dodge has.”

“It’s not that the Corvette isn’t sharp. It’s just overshadowed heavily by the Viper any time raw performance is a factor.”

“The shifter for the Z06′s six-speed, for example, is fine on its own, but compare it to the Viper’s accurate shift linkage and it feels like it’s been smoothed over by a committee meeting.”

“We’re also fans of the Viper’s signature side exhaust. It’s part of what makes a Viper a Viper. It’s also the reason God invented long pants. Burning your calf on the sucker is not fun.”

“And that is why the Viper wins this test. Because it forces you to commit. Think of it like a bacon and egg breakfast. In a bacon and egg breakfast, the chicken is involved, but the pig is committed. Viper buyers take the plunge. They must commit. This car is just flat scary. Loud, rough, hot as hell and faster than a Z06, it wins this test because it deserves to – because it’s badass and it’s not afraid to admit it.”

 

Coding Sample

When giving out advice on code, I believe in the school of thought that says “put up or shut up.”  It’s difficult for me to respect the code of others when they won’t show their chops, so to speak.  Here is me putting up so you can see for yourself if I need to shut up, or if you can learn something of value here.  This code is a sample class to, of course, tell the world ‘Hello!’ with a little style.

<?php

/**
 * class Hello
 *
 * This class helps us display our feelings to the world.
 *
 * LICENSE: You are free to do absolutely anything with this
 *          file.
 *
 * @copyright  2009 Domenic R. Merenda
 * @license    Unrestricted, no specific license
 * @version    1.00
 * @link       http://www.edgeprod.com
 * @since      File available since Release 1.00
 * @todo       Take over the world with this file alone
 */

class Hello {

   public $returnText = 'Hello World!';  // Stores the string to return

   /**
    * public function getHelloText($moodId,$smileyId)
    *
    * @param   integer  $moodId     0 = happy, 1 = sad, 2 = silly
    * @param   integer  $smileyId   0 = :), 1 = :(, 2 = 8-)
    * @return  string   returns the switch()-determined value of $moodId
    *                   and $smileyId
    */

    public function getHelloText($moodId,$smileyId) {

        $returnText .= ' '; // Add a space for human readability

        // Add the next sentence based on our mood ($moodId parameter)

        switch($moodId) {

            case 0 : // Happy
               $returnText .= 'I am extremely happy!';
            break;

            case 1 : // Sad
               $returnText .= 'I am so sad!';
            break;

            case 2 : // Silly
               $returnText .= 'I stick cereal in my nose!';
            break;

            // If the parameter is incorrect, return an error

            default :
               return 'Parameter $moodId must be 0, 1, or 2!';
            break;
        }

        $returnText .= ' '; // Add another space for human readability

        // Add a smiley based on the $smileyId parameter

        switch($smileyId) {

            case 0 : // Smiley Face
               $returnText .= ':)';
            break;

            case 1 : // Frownie Face
               $returnText .= ':(';
            break;

            case 2 : // Silly Face
               $returnText .= '8-)';
            break;

            // If the parameter is incorrect, return an error

            default :
               return 'Parameter $smileyId must be 0, 1, or 2!';
            break;
        }

        return $returnText;
    }
}

?>
 

Parting Ways Gracefully: How to Leave Your Bridges Unburned

Juliet may have lead you to believe that “parting is such sweet sorrow,” but does it have to be that way for every Romeo?  Can something useful be salvaged from a business relationship coming to an end, thus avoiding the obvious oxymoron?  Since I have the microphone and my questions aren’t rhetorical, I’m going to lean into the mic and say “yes, my dear Montague, there just may be a Santa Claus.”  If you’re not thoroughly confused already, read on to find out how to pull a rabbit out of your hat, or points south of there.

While I’ve tried to provide my clients with an excellent value for their money, it’s inevitable that for one reason or another, some contracts just won’t be renewed.  When this is the case, it’s better to make lemonade from the lemons life handed you than to piss in a glass and call it the same.  Many employees and even some contractors feel the desire to “take it to the boards” and badmouth their former benefactors.  I can assure you that little good can come of this.  Aside from the short-term satisfaction, no one is likely to rush to your aid with anything more than words, and you may even turn off some future employers with your harsh criticisms and potential mishandling of company secrets.

Instead, it is often better to avoid breaking the fourth wall on the fantasy that you have done nothing wrong and are a superlative employee who rarely takes four-hour lunch breaks or pees in the office coffee pot.  The adult community is a very small one for those of us who write code for the industry.  Demerits get around much more quickly than accolades, but that doesn’t mean that people don’t make recommendations based on a positive experience.

On the way out the door, many people try to negotiate getting paid for unused vacation, a couple of extra weeks using the company car, or a few months of severance pay.  Instead, it may be much more profitable in the long run to make your focus leaving a good impression on those around you.  I can tell you from experience that it’s a great feeling when a prior employer tells you that not renewing your contract was one of the worst business decisions they’ve ever made.

If  a company is allowing my contract to lapse because of funding issues, I try to give them a couple of hours per week of what would otherwise be my leisure time to wrap up any loose ends or complete documentation.  This can go a long way in the eyes of someone who may be in a more stable financial position in the future.

On the topic of a change in your employment situation, make it a point to deliver and delete any outstanding work-product you have for your client, even if it’s only partly completed.  Never give in to the temptation to “re-use” code that has been created on a contract.  Not only is it not morally right, it can also land you in legal hot water.

By putting your best foot forward as you walk out the door, you just might be walking in the direction of your next juicy contract.

 

Proper Documentation: Avoiding Spaghetti Code

My wife is a nurse, and she lives by the adage “if you didn’t document it, you didn’t do it.”  Obviously, this is an understandable sentiment in the life-and-death world of the medical field.  Why is it, though, that programmers regularly appear to feel that documentation takes a back seat to just about everything else?  In an industry where employees seem to change jobs about as often as they change their shirt, too many coders leave their replacements banging their heads against the wall by providing minimal documentation, if any.

Producing quality documentation is a top-to-bottom methodology that begins with the proposal and continues through to delivery.  A professionally-developed proposal should include a detailed specification sheet (often called a “spec” or “spec sheet”) that outlines the exact requirements, milestones, and performance metrics for a given project.  Starting out with a well-produced document of this nature can serve the needs of the programmer as well as the client.  By providing a road map for development, any changes from the original design can easily be tracked and costs can be renegotiated as appropriate.

Documentation isn’t just a separate file to be turned in with the other deliverables.  It extends to the way code is shaped.  Not everyone agrees with the school of thought that recommends camelCaseNamingConventions, but whatever system is being used to create class, method, or property names, their respective functions should be apparent at a glance.  Too often, coders will use variable names that mean something only to them, or substitute names such as “foo” during prototyping, only to leave these stand-ins hanging around in the final product.  Code should maintain a consistent method of indentation as well as methodology.  If a specific method uses a while loop, for example, to complete a task, then a similar function should not use a for loop unless it’s strictly necessary.  Maintaining consistency helps future programmers read code more easily.

Speaking of classes, methods, and properties, object-oriented code tends to be easier to read than procedural code for most medium-to-large scale projects.  Programmers should consider using this broadly-adopted form of coding for nearly any project beyond the most simple of hacks.  Unless the client specifically requests that the coder avoid the practice, documentation should be added before each class or method to explain the general purpose of each.

At the close of a project, a functional document should be presented to the client that outlines each class and method.  This document can then be referred to at a later time by the original programmer or by his or her replacement.  If the coder has documented the code properly, the same text can often be used in the functional document, simplifying the process.

Writing clean and well-documented code is a great way to be recognized as a professional, as well as a good reason to be recommended to other clients.  The coding world is often bereft of programmers who not only talk the documentation talk, but walk the documentation walk.  Standing out from the pack in this way is never a bad thing.

SPECIAL BONUS THIS WEEK

I am providing two documents I have used with clients for your education and use.  Please refrain from copying these documents verbatim, but feel free to use them as you see fit otherwise.

The first document is a proposal for a network of interlinked sites that “funnel” traffic to a specific source.  I called it “owning the pipeline” because I thought at the time that would be a clever name.  Click the document’s name to open it (PDF format).

The second document is a spec sheet for an accounting system.  This was an actual project, but the names have been changed to protect the innocent.  Click on this very hyperlink to download the document.

 

How Far We’ve Come

Recently, I’ve been thinking about just how far we’ve come since I’ve been involved with computers and technology.  My first computer was a Tandy TRS-80 Model 100, which was the laptop of its day.  It came out in 1983, which really dates me as an individual.  It had 32K ROM and came with 8, 16, 24, or 32K of RAM.  It could display eight lines (yes, EIGHT!) of forty characters each.  The screen had 240 x 64 reserved for “graphics,” which is less than either of my phones.

My next computer was a Commodore 64, followed by the Commodore 128.  Although I knew some BASIC from the Tandy, I really learned the language inside and out on the Commodore.  I also got my first hard drive, a 20MB model, for this computer.  I had also used a modem on the Tandy, but the Commodore allowed me to utilize ANSI graphics and get onto bulletin board systems (BBS), which really piqued my interest about the ways in which computers connected.

From there, I moved to the IBM PC platform, and discovered the Internet.  My current computer is a quad-processor machine with 2TB (terabytes) of storage and 16GB (gigabytes) of RAM.  It runs four 24″ monitors on two high-end video cards.  Overall, it’s pretty ridiculous.

Realistically, I probably don’t need all of that horsepower to perform my daily tasks, but think about where I started.  From eight lines of text to 1920×1600 resolutions across four screens, blazingly fast Internet (comparatively, of course), color laser printers, IP telephony (notice the Vonage device on my desk), and the list goes on.

Vive la technology … may it not bite us too hard in the ass!