Archive for May, 2008

The Good Parts of The ASP.NET Framework and Visual Studio

May 31st, 2008

Douglas Crockford opens his latest book with these words:

Most programming languages contain good parts and bad parts. … [the language designers or architects] are usually powerless to do anything except heap more features on top of the existing pile of imperfections. And the new features do not always interact harmoniously, thus producing more bad parts. – JavaScript: The Good Parts by Douglas Crockford

His words can apply to all programming languages and frameworks. Like the Microsoft .NET Framework, Visual Studio, Java, and Eclipse.

Bad parts in the ASP.NET Framework and Visual Studio:

  • ASP.NET Themes and Skins
  • The ASP.NET AJAX Framework
  • ASP.NET / Visual Studio Inline Style Properties
  • Visual Studio Design View
  • ASP.NET and Visual Studio’s over dependency on XML configuration files

It would be great if someone wrote a book outlining the good parts of ASP.NET and Visual Studio. :)

Author: Adam Kahtava Categories: ASP.NET, JavaScript, Musings, Themes and Skins Tags:

Getting a Job at Google: A Web Developer Fizzbuzz

May 24th, 2008

Back when the web turned 2.0, AJAX was all the rage, and gas was cheap, a Google recruiter contacted me. We worked through a couple screening interviews – I explained how I was a .NET / ASP.NET / C# developer with some experience with Java and PHP, I described how C# was somewhat similar to Java. Things went great, I moved on to the next step of the process – writing code (a JavaScript widget for Gmail) with a 2 day (weekend) hard deadline. At the time I was wearing JavaScript diapers, but tried the exercise anyways – I'm still convinced the recruiter confused my Java / C# experience with JavaScript. Anyhow…

The Google Web Developer Exercise:

Web Developer Exercise

Attached are three states of a new contacts widget. This widget will be used across Google and may be anywhere on the page. Designers will also use this in mocks for usability tests. Create the HTML, CSS, and JavaScript for the widget as described in the image. Your solution must work in Firefox v1.5+ and IE v6+. Bonus points for a solution that degrades nicely on older browsers.

After my first attempt, I concluded that:

  1. My JavaScript knowledge was embarrassing
  2. Dynamic programming languages like JavaScript using prototypical inheritance were awesome – as a monocultured .NET developer I had sorely been missing out
  3. Framework Web Developers (ASP.NET, Ruby on Rails, and so on) aren't really Web Developers – we depend on a framework (an API) as a crutch, where the law of Leaky Abstractions is very real, and often when it rears it's head we use our golden hammer (our multipurpose language of choice), but there are better tools at hand
  4. Web Developers claiming n years of experience need to at least know JavaScript, CSS, HTML / XHTML, a server-side language, and some XML / XSL – NOT just a single multipurpose language or framework
  5. Innovation can only happen when you become one with the technologies surrounding your realm – for example: Jesse James Garrett probably would not have publicized AJAX had he been an exclusive ASP.NET developer. Diversity is essential for innovation

In retrospect this exercise is brilliant, it's a more complex derivation of a Fizzbuzz exercise, which effectively weeds out the knowledgeable candidates from the n00bs. JavaScript is notorious for being one of the world's most misunderstood language, many developer (and the ASP.NET Framework) still use JavaScript techniques from the old days of Netscape. For example: <a onclick=”return false;” …, or <a href=”Javascript: do something;” … are common DOM Level 0 inline techniques that should be avoided. These techniques have been replaced, but finding developer that use these JavaScript techniques can be hard.

By having a developer complete this exercise you effectively determine that the they understands these concepts:

  • Cross browser compatibilities and work arounds for both JavaScript and CSS – with a preference given to feature detection (object detection) vs browser detection, an understanding of the different event handling models between browsers
  • An understanding of the separation of concerns – JavaScript, markup, and CSS should be separate files, or at least separated within the document
  • Event registration and listening – DOM events, the different browser event models, no inline level 0 event declarations, no pseudo JavaScript protocol inline declarations within markup
  • An understanding of functional languagesclosures, namespaces, lambdas, recursion where necessary
  • Node manipulation – creating, swapping, removing elements
  • Knowledge of non-obtrusive JavaScript techniques
  • Importance of modular / compartmentalization of CSS and JavaScript – defensive programming techniques that minimize the risk of interfering with other scripts and elements within the page, part of the non-obtrusive techniques, how to avoid global variables
  • An understanding on how to debug JavaScript from both IE (link) and Firefox (link)
  • JavaScript code conventions – naming conventions, statement conventions
  • CSS naming conventions
  • General DHTML / AJAX techniques – showing and hiding elements
  • A gauge on their attention to details and UI design intuition – what their gut tells them to do when things aren't spelled out

My latest crack at the Google Web Developer Exercise:

You'll have to visit my site (view this blog post outside a RSS reader) to view the code in action.

The code: GoogleExercise.js, index.html, GoogleExercise.css

Today I'm wearing JavaScript training wheels – feel free to comment on the code, I'm always looking for improvements and suggestions. I did take a couple shortcuts on the CSS / UI side of things as I was focusing more on the functionality.

Using one of the AJAX Libraries (like jQuery) we could certainly do this exercise in significantly fewer lines of code.

Today I still think about Getting that job at Google, Yahoo!, Amazon, or Microsoft. How well do you know JavaScript?

Update: I redid the Google Exercise using jQuery and more semantics, you can find my latest version here: The Google Exercise Revisited: Semantic Markup with jQuery.

Actions Speak Louder Than Words: Goodbye ASP.NET AJAX

May 15th, 2008

An anticlimactic conclusion about the ASP.NET AJAX Framework – this framework’s niche seems to be the internal (intranet) business application realm that depend on ASP.NET Web-Forms. These applications have a handful of users, a couple developers, no performance or bandwidth requirements, little ambition for future growth, and the developers typically embrace dragging & dropping controls in Visual Studio. In this case the ASP.NET AJAX Framework provides some eye candy, and patches the broken Web-Form metaphor by cramming AJAX into the ASP.NET model, but then comes along the ASP.NET MVC Framework, Silverlight, WPF and … ??? Goodbye ASP.NET AJAX!

Interesting observations:

How many applications explicitly state that they use the ASP.NET AJAX Framework?

  • 25, this includes sites like DotNetNuke (with a reputation of being slow), view the list here.

How many of these applications are relatively high-traffic?

  • None. ZERO!

How many applications explicitly state that they use the YUI library?

How many of these applications are relatively high-traffic?

  • Quite a few. A couple notable sites: Flickr, Slashdot, Linkedin, Paypal, O’Reilly, My Opera.

How many applications explicitly state that they use the jQuery AJAX Library?

  • 516 and growing, view the list here.

How many of these applications are relatively high-traffic?

  • Many. A couple notable sites: Twitter, Digg, Dell, Slashdot, BBC, Netflix, Technorati, New York Post.

If no high-traffic application uses the ASP.NET AJAX Framework then why would you? Actions (or lack of action) often speak louder than words, and it appears that the ASP.NET AJAX Framework is not suitable for the real world.

Author: Adam Kahtava Categories: .NET, AJAX, ASP.NET, ASP.NET AJAX, JavaScript Tags:

Education is a Great Investment: In Honour of the Student Loan

May 10th, 2008

As a student I was a pathological penny pincher, but as much as I’ve complained about student loans, I’m also grateful for them. Sure, it would be great if Canada could adopt an approach like Finland and other European countries where education is free, but that’s not in our cards.

Why are student loans good?
I grew up in a small village in Northern Ontario, in a huge family – in total there are 11 of us. YES! I have 8 siblings and we all have the same parents. :) Most Canadians are familiar with the rural community setting (maybe not the huge family scene). A railway runs through town, the town has 2 gas stations, a single postal code is associated to the entire area (including all the outlying hamlets, and farms), the local high school is 30 minutes from home, the high school kids are bussed from a 100km radius (and there’s still only about 700 students in total). Most of your childhood is spent: crawling across beaver dams, building tree forts, playing Lego, banging away at BASIC on rainy days, swinging from ropes in barns, chasing sheep, skateboarding, and shooting guns. Most of the residents in these towns live modest lives, and have chosen the rural community because it’s cheaper than living in the neighbouring city, or they have just always lived there. The residents are employed in the dwindling lumber industry, the agricultural industry, the local businesses, they are seasonal workers, or unemployed.

In short, living in these remote communities can be economically challenging, supporting a massive family in these areas can be difficult, and receiving educational assistance from your family is even more difficult. So… If it wasn’t for government funded student loans I probably wouldn’t have gone to College/University, and if it wasn’t for an education I probably wouldn’t have been able to develop the skills necessary to be where I am today – yesterday I paid the last of my Student Loans. :)

Thank-you Government of Canada for the student loans!

For all the students out there, keep your chin up, keep your eyes on the goal, don’t let finances get you down, focus on your studies, and keep pushing forward. Education is a sound investment in your future – provided you’re not going to school for underwater basket weaving, or attending an atrociously expensive private college, and not going to school forever (everything in moderation, right?). As the old adage goes: “you’ve got to spend money to make money”, and education is a sound investment.

Author: Adam Kahtava Categories: Musings, Personal Tags:

Griping About Users: What’s Wrong With Forums?

May 10th, 2008

Forums or Newsgroups are a great way to expand your community, contribute to the greater development community, hone your communication skills, and stay grounded. However, forums can have a frustrating dark side. From what I can tell, the dark side of forums stem from the wide diversity of users.

On Forums we have:

As a forum contributor, I like to think that I’m giving something to the community, but some days I feel like I’m wasting my time and here’s why.

Frustrating forum threads:

When contributors pass your words off as their own:

Amanda from Microsoft offers this bit of advice on 08-28-2007:

Which seems vaguely similar to something I might have said back on 12-07-2006:

When users are belligerent:

“Adam has so little time he can’t even read your question …” – Brian

When users want a quick fix or want you to do their work:

“please verify and do for me some work.” – dagamishiva

It makes it all worth while when users are genuinely grateful for your advice and suggestions. In the end, forums (and helping people in general) is rewarding, and some forums that explicitly cover more advanced topics omit the frustrating chatter and facilitate professional level discussions.

Author: Adam Kahtava Categories: ASP.NET, Community, Musings Tags:

Necessary Skepticism: Skepticism is not Pessimism

May 4th, 2008

In the software realm our opinions are often polarized (perceived in extremes) with no middle ground – you’re a pragmatist or an idealist, you’re a Windows or *nix person, “you’re either with us or against us”. This train of thought is referred to as Black-and-White Thinking, or All or Nothing Thinking. This thought process continually manifests itself in the software realm for good reason – we’re under pressure to produce, but have limited time, and can’t exhaust all permutations or combinations of technological possibilities. So we develop coping skills, and make quick decisions (even if they are wrong). As IT professional we’re constantly in The Fight or Flight mentality:

All or Nothing thinking … is part of the most primitive of human responses: The Fight or Flight Response. When faced with a life-threatening situation, we must make a snap decision and act on it. There is no time for ‘maybe this’, or ‘maybe that’. -All or Nothing Thinking

Some Polarized Views

Views or labels that seem to be commonly applied to people, organizations, and people:

  • A Pessimist or an Optimist
  • A Cynic or an Proponent
  • A Skeptic or a Dreamer
  • A Pragmatist or an Idealist
  • A Tigger or an Eeyore

These labels are generally mutually exclusive – you’re usually labeled a Pessimist or an Optimist, but not both. Then there’s this general acceptance that Skeptics are Pessimists and these are Curmudgeons, and Eeyores (but everything in moderation). Switching between views is healthy and advisable (be a Skeptic and an Optimist), because inherently “[a]ll programmers are optimists” (1) and too much Enthusiasm, and Optimism often results in Hype, and “Hype is the plague on the house of software” (2).

Why not embrace all these views? Take on the role of a Skeptical Dreamer, then an Optimistic Cynic, or a Pragmatic Idealist. Let’s throw off these polarized thinking models and fill in the gray areas. As Fred Brooks once said: “Skepticism is not Pessimism”, and critical thinking is also not Skepticism.

(1) Fred Brooks, The Mythical Man-Month (2) Robert Glass, Facts and Fallacies of Software Engineering

Author: Adam Kahtava Categories: Musings, Software Tags: