When I first started in IT in 1987 at Underwriters, Safety & Claims in Louisville, Kentucky the PCs were just getting interesting. I was the only one that worked the second shift. My job was backing up mini-computers for the most part. In those days this still was a chore. I made a whopping $7.50 per hour. What was best about this job is that I had a lot of free time to study, access to a wide variety of computers, and Don Gardener and Mike Groher let me write some code. See, the Databus machines running Sunbelt routinely ran out of hard disk space and we’d re-write the code during long running batches to send data to another drive or fix small bugs. (Those were the days.) That was fun. In actuality what got me hooked was Quattro Pro 1, 3D charts, and the new 386SX graphics chips we got for our PCs.
In those days I spent $200 a month of my own money—remember I only made $300 a week—on computer books, books that I read cover to cover. These days I read a lot, but it is the rare book I have time to read from cover to cover. The reason for this is that I spend a lot of my free time writing books, and the reading is done pretty quickly, usually to research new topics. When writing books one is usually writing about a topic that doesn’t exist in book form as widely, which means the research is white papers, blogs, and technical manuals. I still read a lot, but it is hard to find the time to read a 1,000 page book cover to cover. However, if you are just getting started in IT, reading is the best way to learn about programming and computers. Better in some ways than college courses, for the obvious reason that college curricula follow technology but seldom lead it. Balancing books with the rigor of a college education and the discipline that requires is a wonderful balance though.
We can’t quite write about VS2010 because it is still in beta and features are evolving and protected, but you can learn about VS2008. A cool feature of VS2008 is extended Intellisense and XML comments for JavaScript. If you put your JavaScript in separate .js files and add XML comments—inside of the functions—then VS2008 will show consumers of those functions extended comment information as they are using those .js files. The following simple hello world function shows you where to place the comment—see Listing 1—and the Figure 1 shows you how Intellisense displays that information when a user is picking through commented functions.
Listing 1: A JavaScript function with an XML comment.
function HelloWorld() {
/// <summary>XML Comments are supported in VS2008</summary>
alert("Hello World!");
}
Figure 1: You can see the extended Intellisense summary displayed as I scrolll through available functions.
To reference the external .js file add script reference with the src attribute set to the external script file as shown in Listing 2.
Listing 2: Link to the external script file with the src attribute of the script tag.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="HelloWorld.js" type="text/javascript"></script>
<script type="text/javascript">
HelloWorld();
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Perhaps an interesting development we at DevExpress have to figure out is how to incorporate that Intellisense capability into our Client-Side Events Editor (see Figure 2). That would be cool.
Figure 2: Our client-side script editor is an easy way to add client-side script to our ASPx controls.