Entries
RSS 2.0

Comments
RSS 2.0

IronRuby and a Paradigm Shift at Microsoft

John Lam just announced that Microsoft will be accepting source code contributions for the IronRuby project! They’ve already impressed me by releasing the DLR, IronPython, and IronRuby under their Microsoft Permissive License, which is essentially just BSD with extra patent protections so no one sues them for a bajillion dollars. I have to admit, I didn’t think I’d see the day they’d accept community contributions to a project. More and more, it seems that Microsoft is starting to embrace open source. I don’t think they’re going to GPL the Windows source anytime soon, but opening the source of developer projects is a big step.

I can’t wait for the DLR… I’m hoping they can make IronPython and IronRuby first-class citizens in Visual Studio as well. I’m also interested in seeing what sort of fun DSL support the DLR can provide…

Inversion of Control and Generics

I stumbled across an interesting article today, in which the author describes an alternative take on inversion of control in .NET. I started to write a comment, but it got a little long-winded, so it became a blog post instead. :)

The author, Ralf, suggests that rather than injecting instances of dependencies, we should “inject” their type using a generic type argument. This means that instead of the standard dependency injection pattern:

   1: class MovieLister
   2: {
   3:   private IMovieFinder _finder;
   4:   public MovieLister(IMovieFinder finder)
   5:   {
   6:     _finder = finder;
   7:   }
   8: }

He suggests doing this:

   1: class MovieLister<TFinder>
   2:   where TFinder : IMovieFinder, new()
   3: {
   4:   private TFinder _finder;
   5:   public MovieLister()
   6:   {
   7:     _finder = new TFinder();
   8:   }
   9: }

This clearly has the advantage of not having to construct an IMovieFinder externally and then inject it into the MovieLister’s constructor. I have a few issues with this approach. First, by relying on the new() constraint, you’re only getting access to the parameterless constructor of the dependency. This means that if your dependency requires initialization logic, you’re out of luck. (And that rules out about 90% of dependencies.) Second, in order to create a MovieLister, you actually have to instantiate a MovieLister<MovieFinderImpl>. This means that any code that consumes your MovieLister must also know which implementation to inject to satisfy the IMovieFinder dependency. What happens if you want to change the implementation that you’re using for IMovieFinder? You have to find each place you’re creating a MovieLister and change the generic type argument.

This gets even scarier when you consider chained dependencies and the construction of an object graph. (This is where inversion of control containers shine, because they can automagically wire-up your objects for you without much coaxing.) What happens if your MovieFinder has a dependency, say on an IMovieRepository?

   1: class MovieLister<TFinder>
   2:   where TFinder : IMovieFinder, new()
   3: {
   4:   private TFinder _finder;
   5:   public MovieLister()
   6:   {
   7:     _finder = new TFinder();
   8:   }
   9: }
  10:  
  11: class MovieFinderImpl<TRepository> : IMovieFinder
  12:   where TRepository : IMovieRepository, new()
  13: {
  14:   private TRepository _repository;
  15:   public MovieFinderImpl()
  16:   {
  17:     _repository
 = new TRepository();
  18:   }
  19: }
  20:  
  21: class MovieRepositoryImpl : IMovieRepository
  22: { ... }

Not too bad… but wait, how do we create a MovieLister now? Now, instead of having to instantiate a MovieLister<MovieFinderImpl>, we have to create a MovieLister<MovieFinderImpl<MovieRepositoryImpl>>. By using this idea of “type injection”, you’ve actually made each “parent” type dependent on not only its dependencies, but also on all of the dependencies of its dependencies (and their dependencies, and so on). In a real-life application, this would quickly become unmanageable.

Still, it’s an interesting idea. It would probably work in very basic scenarios, but it might make your code more difficult to maintain. I do agree with Ralf that using a service locator isn’t the best way to implement IoC, though. Instead, check out Titan! :)

The Product is More than Just Software

I’m moving my blog back to Wordpress. I originally moved to Mephisto because I was impressed by its quality and ease of use. It has a good design, was well thought-out, and sat on the Rails stack, meaning it was easily extensible. Wordpress, by contrast, is implemented as a gigantic for loop, relying on “hooks” to support extension, and basically forcing users into implementing their work as bizarre mashes of code and layout, without the nice MVC separation that Rails provides.

So why am I back to Wordpress? Simple: Mephisto is dead. There hasn’t been any active development on the project since the end of 2006, and while that may not seem like a long span of time to its developers, six months of dead air on a beta-quality project is unacceptable. With its market share, Wordpress will always have the active support of a vibrant community and development team.

I understand that Mephisto’s developers have been working on something pretty cool, and that there’s probably more money in it than in a blogging platform, so I can’t blame them. The important lesson here, though, is that the end-result of software is more than the software itself. I need to remember that myself as I work on Titan… (beta 2 with a real-live manual is coming soon, I swear!)

Edit: By the way, articles were imported, but it nuked all of the comments. I’m way too lazy to try to recover them. Sorry to anyone who spoke wisdom therein. :)

Paul Graham is Braindead

Edit: After some thought, I was a little harsh on the title of the article. The play on his article’s headline was too much to resist. :) It obviously is not meant to be taken literally.

It’s very rare that I let something another blogger posts get under my skin, but Paul Graham’s article Microsoft is Dead made me bristle. A rant was necessary.

I’ve always thought of Paul as a smart guy, but his writings always drip of anti-Microsoft sentiment. Normally, that’s par for the course, and I let it slide — after all, if you don’t bash Microsoft at least three times a day you’re obviously a shill of the Man. Like I said, usually I let it slide, although I probably should expect slightly more from a respected blogger than I would of your average run-of-the-mill Slashdot troll. His latest article, though, is complete and total ivory tower bullshit.

Some of my favorite quotes from the article:

All the computer people use Macs or Linux now. Windows is for grandmas, like Macs used to be in the 90s.

What in the hell are you talking about? To be sure, lots of geeks use Macs and (particularly) Linux. That doesn’t mean that no one uses Windows anymore. Whether you particularly like the platform or not, if you’re a professional developer and you don’t know Windows, you’re definitely limiting your horizons. If you want to be ignorant of more than three-quarters of the business applications market, be my guest — it just makes it easier for me to find work.

The last nail in the coffin came, of all places, from Apple. Thanks to OS X, Apple has come back from the dead in a way that is extremely rare in technology. Their victory is so complete that I’m now surprised when I come across a computer running Windows.

Translation: “I don’t get out much. In my tunnel vision, I ignore 90% of the computing market. Microsoft who?”

And that was the second cause of Microsoft’s death: everyone can see the desktop is over.

If I had a dollar for every time I heard this since WEB 2.0 was coined, I could pay Bill Gates and Steve Jobs to fight to the death with rubber chickens in a no-holds-barred cage match. (And just try to come up with a better way to spend money than that!) This argument has been going on since Web 0.1alpha1. Whenever I hear anyone talk about this, I just laugh and recall fondly the NC and how Larry Ellison claimed it would be the FUTURE OF COMPUTING in the late 90’s. We still have applications running on mainframes, for God’s sake. What makes you think desktops are going anywhere? I’ll tell you what, Paul, you get one of your Y! Combinator startups to write the Quake engine using only HTML and Javascript, and we’ll talk — and remember, it’s 10 years old now.

Paul, what happened to you since your Great Hackers article? Are you that desperate for linkbait? Maybe it’s just that you’ve spent way too much time inside the Y! Combinator Anti-Reality Bubble. Your subsequent Cliffs Notes post trying to ease some of the backlash just served to make you look even more ridiculous — because you still stand by your insane claims.

I’m known to root for the underdogs too, but that doesn’t mean that I delude myself into thinking that when I speak, worlds are created before my feet.

Logitech = Honorable

A few weeks back, I bought a pair of wireless Bluetooth headphones from J&R because they were on an after-Christmas sale. I read the reviews on Newegg, which said that the plastic that the band was made from was flimsy and cracked in the back after light use. “Pshaw!” I thought. “It couldn’t be that bad!” Entranced by the clearance price, I convinced myself that the people who were complaining about the headphones breaking must have been playing rugby while wearing them, and happily submitted my order.

They were very nice headphones. Then about two weeks after I got them, a crack started to develop in the headband… precisely where the rugby players had said it would! A week or so after that and my gargantuan head won the war against the plastic and they snapped enough that the wire inside of the headband broke, rendering them useless. To add insult to injury, just after I bought the original pair, Logitech released a new model that were basically the same but had a headband made of spring steel.

I called Logitech to get an RMA, and asked for them to refund my money so I could put it towards the new model. I explained I didn’t want another pair of the old model, because I felt they were clearly defective. To my surprise, the customer support rep said that they were replacing the old model with the new model free of charge. I just received my new FreePulse headphones tonight, and they’re even better than the ones I had before. (And I paid much less for them!)

It’s never good when a company creates a defective product, but Logitech has accepted the fact and acted honorably towards their customers. In this day of minimal customer support, it was a pleasant surprise. Kudos to them.

Open Source, and Passionate Developers

Last night, I came across this article talking about the difference between an employee who is passionate about the company and an employee who is passionate about their work. Rarely does a blog entry come along that matches up so exactly with my own ideas.

The best nugget of wisdom comes in the form of the “four-question test” that identifies if an employee is passionate about their work:

  • keeps up with trade/professional journals
  • knows who the key people in the industry are
  • would spend his own money, if necessary, for better tools
  • if they were NOT doing this as their job, they would still do something related to it as a hobby

When applied to software developers in particular, I would add “participates in open-source software efforts” to the list as well. This relates closely with the 4th question (concerning hobbies), but goes deeper — it suggests that not only does the individual enjoy what they do, but they want to use their talents for “the greater good”. This also goes back to another test of a “passionate worker” in the original article:

Does not care about upward mobility in the company. Cares about doing fabulous work and possibly the recognition of his peers in the industry. May stive (sic) for professional recognition.

This is the main reason why I chafe so much under the the non-compete agreements and intellectual property constraints that permeate the software industry. All developers should have the right to “own” the software that they develop, as long as it’s done entirely on their own time with their own resources, and doesn’t represent a conflict of interest with their “day job”. Not only should developers be allowed to release their own personal creations as open source, but they should be permitted to sell them.

Before you tag me as some sort of commie, understand that I do think a company that employs software developers has every right to protect their intellectual property. Unfortunately, too many companies do so simply by saying their developers own nothing. Before I took my current job, I interviewed at a “big-name” consulting firm. Their contract agreement said something along the lines of:

The Employee hereby acknowledges that all Inventions are the property of (company), except those explicitly listed in Appendix A.

Translation:

You’re screwed. If you ever have a unique idea that ends up gaining any decent amount of buzz or generating any decent amount of money, you better damn well better be able to prove that you didn’t think it up before, during, or up to 12 months after your tenure with our company. Otherwise, we’ll sue the shit out of you and take not just your ideas, but your house, your car, and probably your dog.

Needless to say, I wasn’t interested in the job. (Particularly when they offered me a flat salary with no overtime and suggested that the average work week was 70-80 hours. Bear in mind, they would be billing my time to their client on an hourly basis.)

In my opinion, developers should legally own their work, as long as the following conditions are met:

  • Absolutely no code would be re-used from company projects.
  • Within reason, no concepts that were developed specifically for in-house projects would be re-implemented.
  • All of the work on the project occurs on the developer’s own time, outside of the office, and would not be developed using any company hardware or software.
  • The software would not be directly related to the company’s industry, and would not compete with any offerings of the company.

Developers who care about software write the best software. If they want to spend hours of their own time improving their skills, why get in their way?

MP3 + DRM = Ferrari + Square Wheels

Yahoo! announced the other day that they would offer MP3s unencumbered by DRM (digital rights management) technology.

Everyone together now: WHAT TOOK SO #@!$@ LONG?

Sure, they’re only offering one measly song, and it’s Jessica Simpson, no less. Not exactly my style of music, but hey, it’s a start. It’s been said many times that the entertainment industry will ultimately lose the war over digital copyright law because they “can’t compete with free”. The assertion is that if they can’t retain control of their intellectual property, nothing else matters.

What a load of crap.

Even today, years after its original inception, MP3 is one of the most powerful technologies on the Internet. Wrapping an MP3 in DRM is a lot like making a Ferrari capable of going 500 miles per hour and getting 100 miles per gallon, and then fitting it with square wheels made of concrete. Oh, and you can only drive it down certain roads. And on some models of the car, you have to keep paying a monthly fee, or the engine won’t start. And, if you get caught letting anyone else drive it, you could be fined up to $250,000. Oh, yeah, and if you get tired of the car, and you want to make a switch, don’t even try to sell it. It doesn’t really belong to you, see… Ferrari still owns it, even though you paid for it.

Ridiculous, right? Why doesn’t the recording industry see that even without the terrible press they’ve been getting for the past few years, they can’t possibly hope to compete with illegal MP3 downloads. How do they expect to compete with a product that is both more valuable (since it doesn’t have DRM restrictions) and costs less?

The answer: lawsuits. Lots, and lots, and lots of lawsuits. I’ll tell you what, RIAA. Let’s make a deal. You give me half the money you have earmarked for legal action against music fans, and I’ll come up with a solution for you. Better yet, give it to the artists that work for you, or use it to promote their music. Even better, use it to find bands that have real talent, that aren’t just marketable Ken and Barbie dolls, and turn us into their fans.

After all, isn’t that your job — promotion? Or is it just to bite the hand that feeds?

Top 10 Ways to De-Motivate Geeks

Everyone has a price. Sometimes, though, the cost isn’t measured in dollars and cents. I recently read the article Top Ten Ways to Motivate Geeks, and being a geek myself, I got thinking about the inverse argument: what can a manager do to piss off their technical underlings such that they are less productive? After talking with a few of my fellow geeks, I present, in no particular order, our humble list of ways to de-motivate the technophiles that work for you. Note that I use the word “geek” to represent anyone that works with technology on a day-to-day basis, but particularly people working in software development or IT.

Disclaimer: This is not directed at my current employer or its management, and is not intended to describe any single person or any single company. It was compiled from the opinions of several geeks working at several companies in multiple states. Please don’t fire me. :)

1. Insult their ability or intelligence
The best geeks are confident, almost to a fault (sometimes not almost). As it is with any creative person, they don’t do what they do just to pay the bills. They don’t just do what they do, they are what they do. If you directly insult their programming ability, you’re not just insulting their code, you’re insulting them as a person, and as an artist.

Sound too wishy-washy? Maybe so. The best have a thick skin, and can absorb criticism pretty readily. I’m not suggesting that you should avoid criticizing them entirely — knowledge is a combination of instruction, experience, and feedback. Without a critical review once in awhile, they’ll just start assuming that they’re the best of the best. (This is undoubtedly why peer code reviews are becoming popular in XP environments.) Instead, restrict your criticisms to the product of their ability, not their ability itself.

Another thing to remember: misusing terminology implicitly insults a geek’s intelligence. “Oh, that problem can be solved easily! Just re-instance the variable with a generic!” Huh? If you don’t know the answer to a problem, don’t offer your opinion — particularly if you’re not a geek yourself, or if you don’t have the domain knowledge required to contribute. Don’t believe that by clobbering together a bunch of language keywords that you’ll convince anyone (particularly someone who understands what all those words mean) that you know what you’re talking about.

2. Take credit for their work
This is directly related to #1. Remember, a good geek’s work is a labor of love. When you take credit for their work, you might as well make a pass at their significant other while you’re at it. If you’re going to take credit, limit it to credit for directing them only, and leave any technical work that you weren’t directly involved in out of it. In fact, for bonus points, mention the geeks’ contributions to your superiors. Good geeks are team players, but they’re also proud, and it bothers them to never get recognition except as “a member of (manager)’s team”.

This particularly holds true for creative decisions. If you allow your geeks creative latitude (and you should, see #5), reward them when they take advantage of it and come up with a great idea. They will remember it, and they’ll be more apt to come up with creative solutions the next time around. Likewise, if you take credit, they’ll remember it — but they’ll start asking themselves why they bother to come up with good ideas anyway.

3. Don’t communicate enough with them
Geeks are information junkies. This is what lets them constantly improve their skills and continue on the search for better ways to solve problems. This also means that they want to know what’s going on in the company around them, and particularly the projects they’re involved in themselves. Within reason, answer their questions to the best of your knowledge. This doesn’t mean you should divulge things that the geeks shouldn’t know (for example, it’s probably best you don’t get into financial specifics), but they should be made to feel like they’re “in the loop”.

The best geeks aren’t just geeks, they’re also strategists, and capable of understanding business. They want to know what the company’s primary goals are, so they can adequately improve their skills to follow suit, and align themselves with the right projects. This is more about self-preservation than anything else, but it also stems from a natural desire to be on the cutting edge of everything. The grand majority of geeks are very forward-thinking, and aren’t interested in using technology that’s stagnated. They’d much rather try out that new circular saw than be comfortable working with the same handsaw they’ve been using for years.

Although you should be sure to communicate with them, you should never, ever, ever lie to them. Geeks spend the grand majority of their time dealing with factual data that is constrained by logic. They are also likely to be able to follow logic through multiple complex stages. If you do decide to lie to a geek, don’t ever go back on your statements, and don’t try to layer more lies on top. Geeks will be able to reason their way through your nonsense, and being naturally cynical, they will start to disbelieve everything you say.

4. Communicate with them too much
While it’s true that geeks want to be in-the-know, they don’t want to know about certain things (even if they sometimes think they do). For example, unless they’re wearing a sales-engineer hat, they should be left pretty well out of the sales cycle. Their deterministic nature will make it more difficult for them to understand why a client doesn’t see that their software is fantastic, because the code is so clean and it uses this really cool idea for caching that they came up with in the shower one morning.

Likewise, the job of a salesperson is to promise everything under the sun to the client, and then produce just enough of what they promised so the client doesn’t get pissed off. Don’t tell the geeks what the sales staff is promising customers, or you’ll start to see bottles of Maalox show up on their desks.

5. Stifle them
Software development is a lot like art. When confronted with the task of drawing a likeness of a person, anyone can draw a stick figure. Likewise, anyone can learn VBA in a few weeks and jam together something to track their coffee expenses. This artistry is one of the reasons why software engineers and mathematicians are not interchangeable. Geeks might not readily compare themselves to artists, but they’re much more on that side of the spectrum than, say, statisticians.

The worst possible thing that you can do to a geek is say: “Here’s a fun and interesting problem, but because of (insert illogical reasons here), you have to solve it in this way only.” Even worse, keep them in the dark about the restrictions until after they’ve finished a creative and effective solution, and then give them some nonsensical reason why it can’t be used, like “Our customers know Java! We can’t possibly sell something that’s not written in Java!”

6. Give them impossible deadlines or ask them to work ridiculous hours
Nothing destroys morale (and by extension productivity) faster than hopelessness. Everyone wants to feel like their work is going to make a difference, so if your geeks believe that success is impossible no matter what they do, they’re not going to bother. Bad morale is viral, too, so it only takes one person on a team to become discouraged for the entire team to be in danger. Worse yet, once they’ve caught the hopelessness bug, ask your geeks to work 14 hour days to meet the impossible deadline. Likewise, if you don’t set reasonable deadlines and instead ask that everything be completed yesterday, don’t be surprised when your geek ignores new requests and continues to work on what they’re already working on. Remember, you said that task was absolutely vital two weeks ago. If every task ends up at #1 priority, it falls to the geek to prioritize them, and that gives them the opportunity to prioritize based on what they want to do on a given day rather than what’s best for the project.

That being said, crunch-time is a reality in almost all software development projects. It’s impossible to perfectly estimate the amount of time required. Dozens of books have been written on the topic and yet no one really has the magical formula. Sometimes the timeframe will be have to be compressed in order to get the contract, or the customer will change their requirements, or there’ll be a flaw in the design that makes you take a couple steps back, or whatever. Asking geeks to work lots and lots of overtime will not yield more work. In fact, there are some very good arguments that stretching the schedule past 40 hours actually results in lowered production, because fatigue creates “negative” work which has to be corrected later during more lucid periods.

7. Make them work on “soul-crushing” projects
Every geek has been involved in, or knows someone who has been involved in, a project that can only be described as “soul-crushing”. The first requirement for a project to be soul-crushing is that the people that work on it consider it to be boring. Geeks, being creative individuals, want to be intellectually stimulated by their work. If they wanted every day at work to be the same, they would get a job driving a truck, or digging ditches. (This is of course not meant to denigrate the truck drivers or ditch diggers of the world. It’s just not my thing.)

There is a difference, however, between projects that are simply routinely boring and projects that are soul-crushing. To rise to the next level of pain, a project must meet other criteria. Here are some examples:

  • It requires the creation of hundreds of similar components that are just different enough that they can’t be adequately abstracted.
  • Just the development will stretch on for years, with no end in sight. Then, the geeks get to support it for the rest of their natural lives.
  • It’s guaranteed to lose the company money. Everyone knows, and no one cares.
  • It’s built on a terrible foundation, or it tries to re-use or re-purpose code that should never have seen the light of day in the first place.

Projects don’t start out being soul-crushing. Some projects are horribly uninteresting, but any project can be exciting to the right people under the right conditions. The existence of soul-crushing projects in a company can be a sign that the company is in trouble.

8. Make them misrepresent their work
Salespeople are capable of walking into a company and telling boldfaced lies about the stability or the features of a product. That’s good, because that’s their job. It’s a little like dating… you lie to the other person until they love you for who you really are. Without salespeople, the money would run out before the product *is* stable enough to sell, and the geeks couldn’t cover the monthly bills on their MMORPG habit.

There’s a reason geeks aren’t good at sales. The best geeks are hopeless perfectionists that can never be fully convinced that “good enough” is good enough. When they look at their work, they see it “end-to-end”, through the sexy interface to the flaky API, through to the buggy back-end and the twisted database with 14 bolt-ons that one day, they really, really want to fix if they could just have a little more time before it ships.

This understanding of their software (which you might call “x-ray vision”) allows them to do their job, but at the same time, it makes them doubt the product. They know that there’s a kludge in that function around line 43. They know that the memory requirements are such that the software won’t scale past about 10 concurrent connections given the current hardware. Worst of all, they know that the software hasn’t been tested yet, or if it has been tested, it has dozens of outstanding issues in the bug tracker. None of these things are apparent when all you can see is the sexy interface, which is as far as the salespeople and the customers see.

Unless sales is part of their job description, don’t make geeks lie about their work, not to the customer, not even to their co-workers. Even worse, when they tell you the software’s not ready or that guy in marketing that promised that customer a holographic smell-o-vision interface is nuts, don’t…

9. Ignore them when they know what they’re talking about
Sometimes, there’s a fine line between confidence and egotism. Sometimes, there’s a fine line between giving an honest opinion and crying wolf. If a geek raises the red flag and starts waiving his/her arms at you, pay attention to them at least long enough for them to try to plead their case. If you don’t believe them, don’t just ignore them — reason with them why you disagree. Remember that geeks are, above all else, built on logic. If you think they’re being overly emotional, chances are there’s a reason for it, and you might want to pay it heed. If you don’t take them seriously, it raises the chance significantly that they won’t take you seriously next time.

10. Don’t adequately protect them from customers
First, it’s important that you remember that the customer is not always right. Sometimes customers make stupid requests because they don’t understand what they want, or they don’t understand what they’re asking for. Some customers think using the telephone, and ask for something that they feel will solve a problem before reasoning out the situation on their end. It’s important that you don’t make geeks field too many of these requests. Unless everyone is sitting around playing World of Warcraft because there’s no work to be done, one of your jobs as manager is to triage the resources that you have available.

Unless they’re paid to do so, geeks don’t want to have to figure out what clients want for themselves. They want you to translate the “client-speak” into objectives, which they will then translate into code. If the geeks are spending their time on the front lines, they’re not spending their time in the trenches, making the product better. If their business card doesn’t say “support tech”, don’t put them on tier 1, because this will only result in less code being generated, and one very pissed off developer.