Posts Tagged: rant


7
Apr 10

sitting

meetings demotivational poster

In case you didn't read it: None of Us is as dumb as All of Us.

<rant>

There is a lie we like to tell ourselves that goes something like this, “I am in control of my life.” You are not, it’s a cultural lie though, one of those things that we’ve all agreed makes us feel better so we politely nod our heads and lie to each other and all get through the day a little easier. It’s similar to that radical 90′s style lie I grew up with during school that went something along the lines of, “Everyone is special and magical and made out of ponies.” Everyone gets a trophy, even if you didn’t win, because you are special just for trying. It’s a lie that everyone knows is a lie, but it makes people feel better, so what’s the harm.

Well over the last few months it’s become apparent to me that these things are lies, that I’m no more in control of what goes on in my life then my dog is of his own. At any moment someone could walk through the door and kill us all just for laughs, or someone could hand me a million dollars. The uncertainty of it all is unsettling and exciting. The one thing that has slowly crept into my life recently is the subject of my post, and that is the hallowed institute of meetings. Somehow I went from a code ninja hacking down mountains of whatever was thrown in front of me to a table jockey. I am now scheduled to attend no fewer than 8 meetings per work week.

That works out to 1.6 meetings/day, and rest assured there is at least 1 meeting everyday. I know people that do nothing all day but meetings, it boggles the mind. I would say that I “hate” meetings, but that really doesn’t convey the depth of my loathing for them. Meetings are the bane of my existence, I could stomach maybe 1 a week, a short sweet status meeting, but what I can’t handle is the bread and butter corporate meeting, and I’m going to detail why.

  1. Marketspeak: I don’t know what the fuck happens to people when they get in meetings but everything, everything gets some fancy new moniker. Sure I could say that I’m working on some stuff, but wouldn’t it be better to say that goal-forwarding has been achieved on several Tier-1 action items. There are no people anymore, just assets and resources, dehumanized by the cruel tongue of Marketspeak. Every concept, no matter how simple, is wrapped in shiny new clothes, as though you might confuse the dog turd covered in whipped cream as a delicious fudge sundae.
  2. Teleconferencing: There is always some person (sorry, meant to say “stakeholder touchpoint”) who thinks its appropriate to call into the meeting on a 1992 Nokia Celfone while in the middle of a monsoon while driving through a tunnel. Bonus points if this person has a thick accent that makes even high-fidelity communication less than understandable. The other issue is having 10 people on one side of the conference line and 10 on the other, and the fun of each side trying to figure out who is talking.
  3. Pointless Status: Managing people is difficult, so management is obsessed with the idea of status. The problem is that status is normally not quantitative but qualitative, too bad that doesn’t fit into the Holy Spreadsheet. People are forced to turn things into percentages, I’m 80% done reflanging the spline, even if that doesn’t make any sense. Status reports are a proxy for involvement, they are a way to feel connected to a process you don’t have any part in.
  4. Workturbation: Meetings are insidious, if you have 8 hours of meetings you will go home mentally exhausted, more than likely frustrated, and with a feeling that you’ve really put in a hard day’s work. The problem is that when you try to figure out what you’ve actually accomplished the list is either non-existent or incredibly paltry. Meetings feel like work but rarely accomplish anything of actual significance. Meetings also have the incredible ability of spawning meta-work just for the sake of the meeting itself. Before the meeting you have to prepare whatever pointless agenda you have for your meeting, secure a place to have the meeting, work around everyone’s schedules. Afterward someone prepares the minutes and it gets emailed to the companyname-all mailing list where inevitably the tiny list of things that were actually decided are rehashed again and again. Personal bikesheds are floated around, and more than likely all the chatter on the email list will require ANOTHER FUCKING MEETING to sort out.
  5. Punting: Punting is the amazing technique where something interferes with the meeting so it is moved down the road to another meeting. Punting is sometimes necessary when someone wants to discuss in detail some trivial point, but the best and most frequent kind of punting is the following. Design meeting is convened, difficult non-trivial thing is brought up that requires actual thinking and problem solving, meeting participants get frightened by the idea of actually having to dust off the critical thinking part of their brain instead of blithely parroting made up statuses of underlings, issue is tabled to be dealt with in the future, a piece of me dies inside. Keeping the meeting moving becomes MORE important than getting anything decided or accomplished.

The list is in no way exhaustive or universal. At the end of the day though, a meeting is taking up time you could be doing something, they should be looked at that way. All that time you are sitting in meetings talking about all the stuff that could be getting done if everyone wasn’t stuck in meetings all the time… my head hurts. What we need are people with their hands on the problem empowered to make decisions and move things forward. Then we can meet once a week to talk about how things are going, instead of sitting around all week wondering why nothing is getting done.

</rant>


12
Feb 10

arbitrary

Lion riding a horse

Fucking arbitrary decision, but a good one!

Rant time, oh it’s Friday rant time! You see we are making progress on our project at work up to the point that I will be traveling to beautiful Indiana next week to get some specialized training and toolkits. It’s a big deal for our project and we are all very happy, I’m glad to get to be an important part of all this and actually look forward to it. I will be heading out there with two other guys from the company and they will be leaving on Wednesday while I stay until Friday. Here comes the fun part, how to drive around after Wednesday?

Rent a car! I hear you shouting at your computer (don’t worry I can’t really hear you, you are just very predictable). Well it may shock you to find out that I’m only 24 years old and because of the actuary tables I am not allowed to rent a car. You see you have to be 25 years old to do certain things, like rent a car or hotel room or get a nice break on your car insurance. Less than 25 and you are a hellbent young rogue ready to destroy any car you get your hands on. It doesn’t matter that I’ve spent the last 6 years working hard studying at University to get 2 degrees or designing software for a Fortune 1000 company, no the table says 25 years old and by the hammer of Thor we are going by the table.

Now there is a monkey wrench, one I’m sure we’ll get settled and figured, but it’s not the first time arbitrary decisions have been made that have negatively impacted me, and it probably won’t be the last. On this current project we deal with messages and messages have many pieces parts, in the old system you could have thousands and thousands of different pieces parts. In this new system you are limited to about 1,000 unique parts, it has been a challenge trying to figure out how to get everything to work. Is there some reason for this, NO! its completely arbitrary, they just chose a large number, and in the next iteration of the product that limitation will be lifted.

I remember hearing a story from a fellow developer about how new software was installed that all webforms had to send their data to so that it could be sanitized (despite the fact that it was already being sanitized by our program). This new cog in the machine had a limit of 100 fields per form, now only in the dreams of a fevered madman would you need more than 100 fields. Well it did, it was a complicated form dealing with complicated government requirements and to make it easy for the user it was dynamic and beautiful and everyone loved it. Then they had to completely break it, make it work in chunks and find some clunky workaround so that it would never submit more than 100 fields, the users hated it, the developers hated it, everyone hated it. Some digging went forth and the 100 field limit was completely arbitrary and you know in the code somewhere was something like this.

  FormField fields[100]; //No one will ever need more than 100 fields

This arbitrary decision causes a world of hurt. Now we don’t want to go down the super configurable, just change this XML file which will regenerate this XML file which will be used to partially populate this .properties file which will be dynamically…. fuck you. Just that if you have limits there better be good fucking reasons, or else remove them.

If you are going to limit me to 140 characters there better be a good reason, oh because of the inherent limits imposed by SMS, fine Twitter I understand perfectly. You can’t open two spreadsheet with the same name even if they are different files, what are you doing Excel?!

The next time you are about to code something that will result in a clearly arbitrary error message down the road, you better have a good reason to. There better be some sort of machine limitation or design limitation or something, because its not the limit that pisses people off, its their arbitrary nature.


3
Feb 10

bureaucracy

pentagon bureaucracy cartoon

Wait until he meets the Undersecretary for Reduction Planning and Appropriation's new Assistant

Bureaucracy, long the scourge of people who want to git-r-dun. There are some people out there that hate bureaucracy with a passion I can only really muster up for the pending zombie apocalypse. Make no mistake about it, I dislike bureaucracy, I think it is a wasteful but sometimes necessary evil. I’ve found myself ensnared in a bureaucratic nightmare for the last few months so I thought I would jot down some observations on bureaucracy.

Zombie Bureaucracy

(Wow lots of zombies in this post so far) A Zombie Bureaucracy is a bureaucracy that had some reason (however flimsy) for existing in the past but no longer needs to exist. Not unlike a zombie this bureaucracy manages to live long past its usefulness shambling into the future pointless and frustrating. This is caused by the ease that more bureaucracy can be created, at the stroke of an email someone can dream up a committee or process, but the difficulty in disbanding bureaucracy. It is disproportionately difficult to reduce bureaucracy because it looks like work, and people don’t like having their work taken away, it reduces their sense of job security.

Dev: Why do I need 3 developers to sign off on every commit?
Mgr: Because 4 years ago two of the lead developers got into a pissing war over code formatting
Dev: Why didn’t they just work it out?
Mgr: Because they had huge egos and management was too scared to fire either one
Dev: Is this still going on?
Mgr: No, Frank left 3.5 years ago because he didn’t want to put up with Mark anymore
Dev: So why do I still need 3 developers to sign off on every commit?
Mgr: Because 4 years ago…. I guess it doesn’t make much sense anymore…. That’s the way it is!

Just like misery, bureaucracy love company

Bureaucracy is an attempt to control something, to take organic chaotic processes and make them orderly. The problem that often arises is that bureaucracy is its own organic chaotic system, that then requires more bureaucracy ad infinitum. If you’ve ever been in a meeting where all you decided was the schedule of meetings, congratulations, you are in the Matryoshka doll hell of bureaucracy.

Meetings

I loathe meetings, a bunch of people talking about the work they could be doing if they weren’t in meetings all the damn time. Meetings are seductive, they sound and feel and look like work, but they are occupational masturbation. No one has ever brought a product to market because they were able to make it to 10 meetings a day. Meetings have almost no value, sometimes they are necessary, but not nearly as common as corporate culture would have you believe.

And the rest…

hot tamales candy box

Forgot to file the A34C-Bh amendment releasing liability for tongue trauma

I could go on and on, but I will cut the rant short and get to the point. Bureaucracy at its core is about trust, or more importantly the lack thereof. I don’t have my girlfriend fill out the A34C-B form (Confirmation of Confection Purchase Agreement) before running to the store to ensure that she understands that I would like her to pick me up some Hot Tamales. I trust her at her word, there is no need for such ridiculous formalities.

When an organization has enshrined itself in a monument of bureaucracy what it is really saying is, “We’ve been burned before and now we don’t trust you.” We don’t trust you to deploy your code correctly, we don’t trust you to design things properly, we don’t trust you to do X, so let’s get a bunch of people together to review it. This is fine in small doses, frankly I want people to review my code and my designs, I make mistakes like everyone else. But when taken to the extreme it takes a toll on your motivation, on your creativity, and on any preconceptions that you knew what you were doing. Bureaucracy is the surest way to crush your workforce into a homogeneous mix, you will catch the awful at the expense of the great.


17
Dec 09

bing and what?

look a bird, now I'm deciding I guess

look a bird, now I'm deciding I guess

I keep seeing commercials on TV, I’m sure you have to, where there is one person and another person asks them a question, the commercial then goes something like this:

  • Normal Person: Hey want to get lunch
  • Freakazoid: Lunch from the latin luncha for eating during the daytime
  • Normal Person: Huh?
  • Freakazoid: Oklahoma abbreviation OK, OOOOOOklahoma where the wind goes…
  • Normal Person: I said “huh?” not “ok?” you stupid fuck

These terrible abortions have been shoved onto the world by Microsoft to promote bing. The idea here is that using Google / Yahoo / etc. causes such a delude of useless results that querying a normal search engine is like talking to the freak from our vignette. The alternative bing is a decision engine and by using that you can “stop searching, start deciding”.

First off for full disclosure, I’m not the biggest fan of Microsoft, I think they make expensive sub-par software. On the other hand though, I program in .Net and work in XP and Vista everyday, I also own a Mac and have ubuntu installed at home. I use Microsoft products, there are some that I even like, but their corporate culture and quality control bugs me. If you want to write a snarky comment about me being a linux-head or a mac-fanboy or a windoze-m$-hater, feel free to.

The whole “Decision Engine” thing is what pisses in my Corn Flakes, its such nothing market-speak. They synergized outside the box with a shifted paradigm to come up with Decision Engine. Here is the thing though, what the fuck does it mean? Does it mean that it will make decisions for me, is it a big step forward in finding stuff on the internet? So I decided to do a completely scientific comparison of bing and google.

The first step in this was searching the term “ok” as this is the most annoying example from the bing commercial. Here are my completely scientific results.

bing
bing search of ok

bing search of ok

google
google search of ok

google search of ok


Bing’s first result is for Oklahoma! Think about that for a second, and now here it is again because it bears repeating, BING’S FIRST FUCKING RESULT IS THAT OK IS AN ABBREVIATION FOR FUCKING OKLAHOMA! You’d think after the commercial they would have thrown something into their indexing algorithm. Google correctly points me to a wiki article about the term “okay” before suggesting Oklahoma. But let’s move past the obvious and focus on the fact that besides bing fulfilling their own prophecy, what about bing helps me decide? Nothing, they are the same page layout, they are the same thing, they do the same fucking thing.

But what is there to decide, maybe this is user error, maybe I should ask it something it could actually answer. I want chinese food for dinner, let’s see what happens when I search bing and google for “chinese food near me” (note: I made sure to sign out of each so that neither would have an advantage knowing my location from an account).

bing bing search for "chinese food near me"
google google search for "chinese food near me"

Here Google clearly wins, Bing thinks I want to know about chinese food in Maine (ME) and proceeds to tell me all about it. Google makes the same mistake but then also uses some google magic to determine that I live in Columbus, OH and provides some chinese food that is actually in this state.

I don’t want this to turn into a who’s better at this query or that query type thing. Let’s take a step back and look at the bigger picture, bing doesn’t help you decide, it is a search engine. And that’s the whole point of this post, fuck your market-speak Microsoft. Don’t obfuscate, innovate. If you want to take down Google go spend some of your money to design something that is actually better. Bing as it stands today is a moderately effective search engine with pretty pictures, nothing more.

There is plenty of room to innovate, there are things people could do to help me make decisions, but Bing doesn’t do any of this. Search engines could start leveraging social networking information to understand the person that I am and tailor my results, they could allow the end-user to vote results up and down for a query so that the group prunes the result set, they could do some research and development and come up with something that would blow my mind.

The problem with Bing isn’t that its not a good search engine, its that its not a good decision engine, its not any kind of decision engine, its a fucking search engine. Microsoft is famous for and probably makes a ton of money off of sprinkling marketing fairy dust on their shitty shitty products, so they won’t stop, it just pisses me the fuck off. Stop with your dumb commercials with annoying fucks rambling like idiots because you’ve completely revolutionized searching and you no longer present results in a big list sorted by your concept of relevance, until you actually revolutionize searching, like Google did with their pagerank algorithm.


10
Dec 09

weakness

..who drank a soup primarily made up of Zug the Viscous...

..who drank a soup primarily made up of Zug the Viscous...

As I promised yesterday, today’s post will be all about the question ‘What is Your Biggest Weakness?’ Jeremiah Peschka threw down the challenge at me, the challenge coming to him by way of Brent Ozar who himself was tagged by David Stein. This is starting to remind me a bit of the episode of Futurama where Fry becomes King by drinking the previous King, which has my all time favorite quote, “It’s just like the story of the grasshopper and the octopus. All year long the grasshopper kept burying acorns for winter while the octopus mooched off his girlfriend and watched TV. Then the winter came, and the grasshopper died, and the octopus ate all his acorns and also he got a race car. Is any of this getting through to you?”

The question being posed though is What is Your Biggest Weakness? now before I answer I would like to examine this question and its prominence in hiring people. Frankly this question is bullshit, you may as well ask someone any of the following because they are about the same.

  • How well can you lie to me?
  • Are you ready to debase yourself for the promise of money?
  • I think you are fucking stupid!*

*Not technically a question

The question is a social contract we have all entered to for reasons unknown, it is like the dance we do when someone sneezes.

  1. Sneezer: *sneezes*
  2. Sneezee: Bless you
  3. Sneezer: Thank you
  4. Sneezee: You’re welcome

Four steps to every sneeze, why, because we are afraid our souls are going to shoot out of our nose. No, now it has just become ingrained in the culture as the polite thing to do, even though the reason for its existence long ago stopped being relevant. I’m sure at some point in history the “What’s your Biggest Weakness?” question was original and clever and useful. There were people in the world who hadn’t heard it and prepared a canned answer. It was a probably a great way to see how someone thought on their feet and could wiggle out of a tough spot. That is no longer the case.

Sometimes when I fart it smells like cinnamon rolls, that can be distracting for others

Sometimes when I fart it smells like cinnamon rolls, that can be distracting for others

Now this question is an insult to both the person asking and the person being asked. The person being asked knows this question exists and if they have a snowball’s chance in hell of ever being employed they have an answer all cued up and ready to go. Some clever little spin on how they work too darn hard, are too much of a perfectionist, or are just too damn likeable for their own good. In that fake answer is the insult to the person asking the question, but really, they deserve it.

If you’ve ever answered that question with one of these fake answers, don’t bother, I have your greatest weakness, you are a whore for money. And guess what people, that’s my greatest weakness. When I was interviewing for my current job I recall clearly being asked that question and giving some cock-and-bull “I work too hard and am a perfectionist” line. The truth of the matter is that I’m a bit obsessive compulsive about my code, I am a bit of a perfectionist, but is that my greatest weakness, no. My greatest weakness was that I was too gutless to refuse to answer that stupid question, or too timid to respond with an actual weakness instead of some shrink-wrapped bullshit about working too hard. My greatest weakness that day was letting my fear of living on the streets eating catfood overcome the voice in my head calling out this faux question for what it is, a slap in the face to any prospective employee. I could have answered with any of a wide range of actual professional weaknesses that I have:

  • I get bored easily
  • I don’t test simple fixes as thoroughly as I should
  • I don’t work at consistent output, I have times when I’m incredibly productive and times when I just want to nap
  • I don’t agree with most corporate culture, telling me what to wear, when to show up, how to act, is understandable, but it shows a lack of respect that I find insulting, its a rigid structure in which I am less productive not more.
  • I value my free time more than I value money which makes me a less than ideal candidate when the idea is trading time for money.
  • I like people, sometimes I’m more interested in talking to someone about code (or monkey or robots or zombies) than writing code

Those would have all been great things to say, but I didn’t. I sat there with a phony smile and a phony answer, I lied and it worked. I’m hired, I’ve worked on several projects and they have all been successful, on-time and on-budget. I’m cognizant of these failings that I have and I think that that is my greatest strength.

If I had it to do over again I would have answered with my actual weaknesses, and then I could have spun it a bit. I know that these are the things that can derail me and potentially derail a project. I don’t overlook my failings anymore, I remain conscious of them and actively work to counteract my natural tendencies. I’m aware of the fact that I don’t test thoroughly the small stuff, so now when I’m pushing a small change that fact pops up and I have to ask myself, did I test this thoroughly or did I cut corners and just run it in the compiler in my brain (which is full of all kinds of bugs and edge cases). The first step to dealing with any weakness is admitting it and being aware of it, the second step is doing something about it.


I’m going to continue this game of blog tag by asking Mark Essel to respond to this question next.


3
Nov 09

i can’t stop you from being stupid

computer-stupid

I’ve been working on a skunkworks side project that is nearing release, I’m down to the last 5%, which is the most difficult part. Suffice it to say that this project is a library meant to be used by other developers (and myself) to develop neat and nifty things. One of the most complicated things is trying to define an API that makes doing the right thing easy and doing the wrong thing really hard or impossible. The problem is that the as I pressed on I realized that almost half my code was checking for some stupid thing and protecting against it, attempting to build up state machines and syntax trees in the hope of reporting to you that you had done something stupid, and then it dawned on me, I can’t stop you from being stupid.

The other thing that dawned on me is that I shouldn’t try to, there are already built in errors that will point out what you did wrong, I don’t need to add another layer on top. So I came up with some simple guidelines, applied it to my project, and watched unnecessary code melt away.

  • Pick sane defaults
  • Assume the developer knows what they are doing
  • Make it easy to do the right things
  • Make it hard to do the wrong things

The beautiful part of all of it is that my code became easier to read and understand, which means when there is a problem and you need to drop into my code (since it is open source), you will be able to understand what’s going on. Let’s take a look at what I mean with a contrived example, an HTML building library with 4 functions for clarity.

class HTML {
  static function open_html() {
    echo &quot;&lt;html&gt;&quot;;
  }

  static function open_body() {
    echo &quot;&lt;body&gt;&quot;;
  }

  static function close_body() {
    echo &quot;&lt;/body&gt;&quot;;
  }

  static function close_html() {
    echo &quot;&lt;/html&gt;&quot;;
  }
}

The way I was programming did a bunch of handholding and sanity checks, which were nice but unnecessary. The class became bloated with so much state and sanity checking that it was becoming unwieldy, let’s take a look at an overly protective incarnation of the above code.

class HTML {
  private static $html_open = false;
  private static $body_open = false;

  static function open_html() {
    if(self::$html_open) {
      self::handle_error(&quot;html is already open&quot;);
    }
    echo &quot;&lt;html&gt;&quot;;
    self::$html_open = true;
  }

  static function open_body() {
    if(self::$body_open) {
      self::handle_error(&quot;body is already open&quot;);
    } else if (!self::$html_open) {
      self::handle_error(&quot;body must be contained in html&quot;);
    }
    echo &quot;&lt;body&gt;&quot;;
    self::$body_open = true;
  }

  static function close_body() {
    if(!self::$body_open) {
      self::handle_error(&quot;cannot close unopened body&quot;);
    } else if(!self::$html_open) {
      self::handle_error(&quot;body must be contained in html&quot;);
    }
    echo &quot;&lt;/body&gt;&quot;;
    self::$body_open = false;
  }

  static function close_html() {
    if(self::$body_open) {
      self::handle_error(&quot;cannot close html, unclosed body exists&quot;);
    } else if(!self::$html_open) {
      self::handle_error(&quot;cannot close unopened html&quot;);
    }
    echo &quot;&lt;/html&gt;&quot;;
    self::$html_open = false;
  }

  static function handle_error($message) {
    //What is the correct behavior, should we attempt to fix the error, report it, who knows.
    //We'll just stop execution
    die($message);
  }
}

Those sure are some nice error messages and it keeps you from creating malformed html, but what’s the point of it all. The browser is more than happy to tell you that your markup is invalid, or run the output through a lint checker or W3C validator, why should this class have some buggy half-implemented validator inside of it. The answer is, it shouldn’t.

If you write stupid code you should get stupid results, Garbage In – Garbage Out. Library code shouldn’t hold your hand making absolutely sure that you never make a mistake, what’s the point of it. If you write the following code

HTML::open_body();
HTML::close_html();
HTML::open_html();

You are clearly missing something about how markup works, it’s not the library’s job to hold your hand and guide you through this crisis, the browser will slap you in the face and you will have to learn something. Now there is a caveat, here we are generating HTML, there are great utilities for finding errors in HTML, so we don’t need to reinvent the wheel. If you are writing a library or application code where if something goes wrong the error displayed is fine, don’t reinvent the wheel. If the error is unacceptable you may need to do some error reporting.

At the end of the day you can’t keep the user of your creation from being stupid, they are going to do stupid things and stub their toes and curse your name and you need to make sure that they had to go far off the beaten trail to do so, overlooking obvious better ways to do it, so that it’s their fault and not yours. Make it easy to do the right thing and hard to do the wrong thing, but if the user wants to open the body tag before the html tag, let them, they have to learn sooner or later.


7
Oct 09

just because its better doesn’t mean its good

I recently wrote a blog post called why no love for scripting languages lamenting the lack of open source scripting environments in Windows 7. I got some interesting feedback, most of which went along the lines of “POWERSHELL!!!1!!one!”

Being an interested fellow I took it upon myself to look up PowerShell, and it looks like a nice language, really good for administrative tasks. So I read some of the manual and it looked ok, and I started looking for some scripts that would compare old school .bat to the new PowerShell. I found what I was looking for here PowerShell Examples. We will be looking at an example that displays the current date.

@ECHO OFF
IF NOT &quot;%1&quot;==&quot;&quot; GOTO Syntax

:: Use BATCHMAN to retrieve day
BATCHMAN DAY
:: Errorlevel 0 means BATCHMAN was not found
IF NOT ERRORLEVEL 1 GOTO NotFound
FOR %%A IN   (1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL  %%A SET DD=0%%A
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 1%%A SET DD=1%%A
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 2%%A SET DD=2%%A
FOR %%A IN (0 1)                 DO IF ERRORLEVEL 3%%A SET DD=3%%A

:: Use BATCHMAN to retrieve month
BATCHMAN MONTH
FOR %%A IN (1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL  %%A SET MM=0%%A
FOR %%A IN (0 1 2)             DO IF ERRORLEVEL 1%%A SET MM=1%%A

:: Use BATCHMAN to retrieve year
BATCHMAN YEAR
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL  %%A SET YYYY=198%%A
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 1%%A SET YYYY=199%%A
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 2%%A SET YYYY=200%%A
FOR %%A IN (0 1 2 3 4 5 6 7 8 9) DO IF ERRORLEVEL 3%%A SET YYYY=201%%A

:: Store in variable and clean up temporary variables
SET SortDate=%YYYY%%MM%%DD%
SET YYYY=
SET MM=
SET DD=

:: Display the result
ECHO.
ECHO SortDate = %SortDate%
GOTO End

:Syntax
ECHO.
ECHO SortDate.bat,  Version 1.00 for MS-DOS
ECHO Display the current date in YYYYMMDD format
ECHO.
ECHO Usage:  SORTDATE
ECHO.
ECHO This batch file uses BATCHMAN, a utility by Michael Mefford
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com

:End

Rough, if you’ve ever had to write anything non-trivial in batch you will start to feel that pain at the back of your eyes right now, this is your brain trying to eat your memories. Batch is hideous, and difficult to write, and gross, and everyone hates it. Don’t believe me, well you don’t have to, Microsoft agreed with me and began development on Monad in 2003, this project would become PowerShell. Now let’s look at the PowerShell equivalent of this code

&quot;&quot;
&quot;Date / Format   YYYYMMDD        DD-MM-YYYY        MM/DD/YYYY&quot;
&quot;============================================================&quot;
&quot;Yesterday       &quot; + (get-date (get-date).AddDays(-1) -uformat %Y%m%d) + &quot;        &quot; + (get-date (get-date).AddDays(-1) -uformat %d-%m-%Y) + &quot;        &quot; + (get-date (get-date).AddDays(-1) -uformat %m/%d/%Y)
&quot;Today           &quot; + (get-date -uformat %Y%m%d)                        + &quot;        &quot; + (get-date (get-date)             -uformat %d-%m-%Y) + &quot;        &quot; + (get-date (get-date)             -uformat %m/%d/%Y)
&quot;Tomorrow        &quot; + (get-date (get-date).AddDays(1)  -uformat %Y%m%d) + &quot;        &quot; + (get-date (get-date).AddDays(1)  -uformat %d-%m-%Y) + &quot;        &quot; + (get-date (get-date).AddDays(1)  -uformat %m/%d/%Y)

That is much better. I see some stuff that looks like objects in there (I’m definitely seeing the dot operator). I’m a n00b to PowerShell and yet this code is easy to grok and all and all very pretty. Nicely done Microsoft, you get a cookie.

Well this would be a pretty boring post if I just went around patting Microsoft on the head for doing a good job. The interesting thing about PowerShell Examples is that they go on to provide the same example in other languages as well. Here is the same thing in perl.

#! perl

# SortDate.pl,  Version 1.00
# Display &quot;sorted&quot; date (YYYYMMDD)
# Written by Rob van der Woude
# http://www.robvanderwoude.com

# Parse time string
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);

# Add &quot;base year&quot;
$year = $year + 1900;

# Add 1, since moth seems to be zero based
$mon  = $mon  + 1;

# Add leading zeroes if necessary
if ($mon &lt; 10) {
 $mon = &quot;0&quot;.$mon
}
if ($mday &lt; 10) {
 $mday = &quot;0&quot;.$mday
}

# Concatenate substrings
$sortdate = $year.$mon.$mday;

# Display result
print &quot;\nSortDate = $sortdate\n&quot;;

Certainly could use a text formatter of some kind to get rid of the icky manual padding, but for someone who has never written a line of perl, this looks quite nice and readable (although I am quite aware that that is not always the case for perl). So what’s got a bee in my bonnet? Well I almost didn’t write this until my friend Jeremiah tweeted the following

Writing powershell. This is happily like writing perl. 7:31am Oct 6th

And a little bit later

ZOMG This is seriously just like writing perl… I <3 you #PowerShell 10:41am Oct 6th

Side note: Jeremiah is about the smartest man in the world when it comes to SQL follow him here and view his blog facility9.

Why go about reinventing the wheel, if you are going to make a language similar to perl, just host perl. What’s the harm? Its hard to call it harm, but its inefficient and tastes a little bit too much like embrace, extend, extinguish to me. PowerShell becomes the defacto scripting language in Windows enticing open source programmers because it is similar to their language of choice. So why fret, PowerShell, perl, batch, bashscript, who cares? Well there are legion reasons why software developers should care.

  1. CPAN, PEAR, GEMS, etc. – These are huge repositories of tested code that can be leveraged quickly and easily by open source developers. CPAN (Comprehensive Perl Archive Network) contains 16,600 modules. PEAR (PHP Extension and Application Repository) contains 536 different packages with 1,255,213 lines of code. RubyForge hosts 8406 different projects. These established languages have a gigantic ecosystem of usable code.
  2. Learning curve – Do you know the intricacies of your chosen language? Did you spend two hours debugging a wily error and because of it have forever learned some dark corner of your language? Can you tell me in your sleep the difference between $foo and $$foo in php? Well none of that will help you in the new PowerShell.
  3. Brain drain – Come up with a really clever way to solve a problem in PowerShell, great, keep it to yourself. Where is the community? There is powershellcommunity.org. But there is yet to be an established authority for the community

Now these problems I outline are true of any emerging language. They are normally offset by some inherent positives in the language. I haven’t examined PowerShell in-depth enough to find out its intrinsic value. On first blush and with my limited exposure, it seems to be a competent enough pseudo object oriented scripting language well suited for administrative tasks. Nothing ground breaking, nothing that knocked my socks off, in the words of Homer Simpson:

I saw you desperately trying to cram one more salty treat into America’s already bloated snack hole. So I did what I could. I did what any loving husband would do! I reached out to some violent mobsters.

PowerShell is just one more salty treat that Microsoft is cramming into America’s already bloated snack hole. It would be fine if they had a level playing field and allowed other scripting languages to be first class citizens, but they don’t. After the mind numbing pain of batch scripting, PowerShell seems great. It really starts to lose its shine when you view it against the cornucopia of free mature open source scripting languages.

I want to end with a real world example (anonymized). There was a system that managed blerns. Blerns could be collected in collections called Bars, Bars could be collected in collections called Foos. These things were numbered and a system was built to manage them in COBOL. Because COBOL likes to make pictures, the original architects thought to themselves, we will pack the information into an 8 digit number like so FFBBbbbb, so that 01010001 would be the first blern, in the first bar, in the first foo, 01010002 would be the next and so on.

This worked great, the company was selling blerns left and right, and pretty soon foo:01 had 98 bars. Then things started to break down, 3 more bars, and the whole house of cards would come crashing down. What to do, what to do?! The engineers were assembled and solutions were offered.

We only have 8 foos, just assign the overflow into foo:10.

Seemed reasonable enough, but that would have resulted in weird code springing up all over the place like this

if foo == 1 or foo == 10
  return &quot;foo the first&quot;
else
  ...
end

Surely there was a better solution, what could it be? Well, suffice it to say I wasn’t present for these meeting and I only saw the terror of the last solution being halfway implemented and this new solution coming in. The solution was a technical sounding concept called field widening. It amounted to storing the identifiers like so FFFBBBbbbb, 10 digits now capable of holding up to 1000 Foos, 1000 Bars per Foo, and 10000 Blerns per Bar. Surely this was better, but was it any good. I guess it might be, as long as we don’t live in an exponential world.

Oh…