Sunday, March 8, 2009

70 New, Useful AJAX And JavaScript Techniques

In this article, we present 70 new and useful JavaScript and AJAX techniques, all of which are of the highest quality and are more or less easy to configure. You will also find some very useful but better known techniques to use on almost any project you work on.

read more | digg story

Wednesday, February 4, 2009

15 jQuery Plugins to Fix and Beautify Browser Issues

we wanted to highlight 15 jQuery solutions for the most common browser issues that you’ll encounter when building web applications among other plugins that will give you a nice browser effect.

read more | digg story

Monday, January 26, 2009

A Whole New Mind

I've recently had the pleasure of reading "A Whole New Mind" why Right-Brainers Will Rule The Future by Daniel H. Pink. In his book Dan argues that we are moving toward the Conceptual Age and that the future belongs to the Right-Brainers, the conceptual thinkers, designers, inventors, creative and emphatic people are going to take over the work force. Dan argues that if your current job can be broken down into x amount of steps than it is most likely that your job will either go to China or India were it will be done cheaper or it will be automated by a computer. By 2010 one in four IT jobs will be offshored, "48 percent of GE's software is developed in India". The MFA is the new MBA. As Dan put it anyone doing routine work is toast.

As much as I've enjoyed reading the book the statistics didn't scare me one bit. A good programmer will always find work here in North America especially if he/she is creative and works both sides of their brain. In a way, software engineering is like art, as you get better your code starts taking on a better form, your code gets shorter, simpler and cleaner. I decided to email Dan.

Here is part of my email to Dan and this is based on my work experience.

"Finding a good graphical designer is easy but finding a good software engineer is very hard, a lot more skills come into play. I've actually heard that a lot companies have very bad experience with outsourcing software engineering because unlike graphical design, software needs to be maintained, updated and it actually ends up costing some companies more. It's a lot more complicated than following a set of steps. Computer science is a young science and in today's information age more software engineers than ever are needed to keep companies up to speed with latest and the greatest."

Dan's response
-----------------Start of Dan's Email------------
"Hi. Thanks for the note. I'm grateful you picked up a copy of A WHOLE NEW MIND -- and I'm delighted you enjoyed it.


You make an excellent point, one I wish I'd made more forcefully in the book. Yes, certain kinds of graphic design can be picked off. (Indeed, it's already happening -- as you point out.)

As for software, I'm convinced that anybody doing routine work is toast. But plenty of software folks will survive and flourish if they do what you've apparently done and work both sides of their brains. That said, I probably could have drawn a finer distinction among the types of work in the IT field writ large.

Also, you might be interested to know that in my presentations, I often make this point with a quotation from David Gelertner (in his book, MACHINE BEAUTY.) I'll paste it below since you might find it interesting.

“A good programmer can be at least 100 times more productive than an average one. The gap has little to do with technical or mathematical or engineering training -- and much to do with taste, good judgment, and aesthetic gifts. . . . Good programmers know what’s beautiful and bad ones don’t.”

Hope that's useful. Thanks again for being in touch.
"
---------------------End of Dan's Email----------------------------

I really appreciate Dan's quick response back to me and I agree with the quote that Dan mentions in his email from Machine Beauty, I wish he include it in his book. That said, I do recommend this book for all you left-brain thinkers. The second part of the book stops picking on software engineers and starts introducing you to "The Six Senses" R-Directed aptitudes which will help you develop the whole new mind this new era demands.

Sunday, November 30, 2008

10 Dirty Little Web Development Tricks

We all have them - little coding tricks and snippets of knowledge that we’ve picked up over years of experimentation and evolution of our processes, that are now part of our regular routine and save us time, gnashing of teeth and allow us to work quickly and efficiently. Here’s some of mine - perhaps you know a few of these already - I’d be interes

read more | digg story

Thursday, November 20, 2008

Refactoring 101

I recently inherited a QA (Quality assurance) project from another developer and been assigned to build upon it. I found the project very complicated and not very maintainable. My first thought was to completely rewrite it but this option was out of the question since this project was on the high priority list and needed to be out the door.
So what do you do? Refactoring 101
Starting from the highest level I spent my first 2 days drawing out diagrams of the database and reverse engineering the code into UML diagrams to get a better understanding of this monster. After about 3 days I had a fairly good understanding of this tightly coupled code and was ready to dive in.

My first step was to separate the business logic from the client side. .NET allows us to do this by using the code behind model.

My next step was to clean up the client side javascript code by introducing jQuery. jQuery has a very rich event related function which allow you to bind events to elements in multiple ways. The big advantage here is that you bind the events at the top of your page and make it more readable.
For example:

//bind all your events on ready

  $(document).ready(function(){
$("#btnUpdateUser").click(function () {
//not implemented;

});
The code is now more readable, you don't have to jump all over the page just to see what btnUpdateUser does on a click. There is a lot more I did with jQuery but I'll leave that for another post.
The heavy use of AJAX made me introduce AJAXpro to this application. AJAXpro allows you to bring server side classes with public fields to the client, the class now becomes a javascript object with properties which you can set and pass the object back to the server. Using AJAXpro I was able to bring the "User" object to the client, populate the textfields, allow the user to change the fields, repopulate the "User" javascript object and finally pass the "User" object back to the server for a database update.
Some other fundamental refactoring methods included: renaming variables to more descriptive variable names,encapsulate fields and breaking up never ending functions. Making the code more readable by breaking statements such as this one:

try { } catch(Exception Exception){} finally{};

to
try
{

}
catch (Exception Ex)
{


}
finally
{

}
Maybe it's just me but I find it much easier and much easier to read code statements from top to bottom instead of left to right.

This post was in no way intended to criticize the style of coding or practices used by the previous developer. Developers often have time constraints that don't allow for the proper design up front and a hacky simple solution had to get it out the door by the end of the week.

Wednesday, November 5, 2008

Implicit typing

C#3 makes the compiler do more by implicity inferring the types of local variables. Note this is not breaking the nature of the type system, the type system is still static and type safe.

Example of inferring types:

var stringName = "hello";

//The type of stringName is System.String
//Therefore
stringName = 0; //Throws an exception.

Restrictions:

■ The variable being declared is a local variable.
■ The variable is initialized as part of the declaration.
■ The initialization expression isn’t a method group or anonymous function1
(without casting).
■ The initialization expression isn’t null.
■ Only one variable is declared in the statement.
■ The type you want the variable to have is the compile-time type of the initialization
expression.
Ref: C# IN DEPTH by Jon Skeet


Tuesday, November 4, 2008

MYTH #1: “REFERENCE TYPES LIVE ON THE HEAP, VALUE TYPES LIVE ON THE STACK”

I'm currently reading C# IN DEPTH by Jon Skeet great read for someone moving from C# 2 to C# 3. Jon Skeet does an excellent job using examples to take you through the evolution of C#. In his core foundations part Jon tackles some of these myths which are floating around the internet and explains the truth behind them.

MYTH #1: “REFERENCE TYPES LIVE ON THE HEAP, VALUE TYPES LIVE ON THE STACK”

Obviously not true, but some time ago during an interview I blurted out the exact same words, without thinking about it, just because it sticks in your head.

At least the the first part is true "Reference types live on the heap".
"A variable’s value lives wherever it’s declared—so if you have a class with an instance variable of type int, that variable’s value for any given object will always be where the rest of the data for the object is—on the heap. Only local variables (variables declared within methods) and method parameters live on the stack. " Ref: C# IN DEPTH by Jon Skeet