Tuesday, December 19, 2006
Thank YOU
Time magazine selected "you" as person of the year with their definition of "you" encompassing people who posted user-generated content on the web. I wanted to pay tribute to all of the "you" out there who inform, motivate, and inspire me. My list is limited since I usually hit dozens of websites each week, but this is a list of the people who regularly reeled me in during the last year:
Raganwald - http://weblog.raganwald.com/
Thanks for the cut and dry honesty. Thanks for the delicious links.
Joel Spolsky - http://www.joelonsoftware.com/
I'm not a blue blooded programmer, educated at Yale, and you would be ashamed of how weak I am with C++ and pointers. But you give me an opportunity to learn and think about my craft. In the end I'm better for it.
Drew McLellan - http://allinthehead.com/
24 Ways. 'Nuff said.
Scott Hanselman - http://www.hanselman.com/blog/
You not only inform, you motivate. You're not arrogant. I can tell you're smart because you want to share the things you discover. You never make me feel like I went to the wrong school or that my pedigree is suspect, you focus on the technology. Your excitement is contagious.
Dare Obasanjo - http://www.25hoursaday.com/weblog/
You keep it real.
John Lam - http://iunknown.com/
You think different and still manage to be associated with Microsoft.
Eric Sink - http://software.ericsink.com/
Practical and smart. Open about what it's like to be an ISV.
Nate Koechley - http://nate.koechley.com/blog/
My inside track to Yahoo! and a good resource for general web developer issues.
Aaron Johnson - http://www.cephas.net/blog/
I can't believe that at one point you were my roommate and we never talked about programming. You're full of good stuff, I hope you never stop.
Ted Leung - http://www.sauria.com/blog
Another of the "programmer's programmer" people I latched onto a while back and keep visiting. I like the quality of your thoughts which refreshingly venture from programming from time to time.
Paul Graham - http://www.paulgraham.com
You're my idealist. I usually get a sense of excitement when you post a new essay and then print it out to read over lunch or at coffee.
Simon Willison - http://simonwillison.net/
Another connection to Yahoo! and a jedi at taking notes.
Steve Yegge - http://steve-yegge.blogspot.com
Keeping it as real as Dare, from Google. Saying what a lot of people think but are scared to admit. Another person who is down the path from me, whose footsteps I'd like to follow.
Larry O'Brien - http://www.knowing.net/
Educated gentleman who kept me awake for a while trying to prove to myself that I know my language (C#). I ported my Haar transform code to Java too. Also proof that you don't need to be in the throng of things because he's "holding it down" in Hawaii.
Mad Kristensen - http://www.madskristensen.dk/blog/
Another clever Dane, but very accessible to me. Every time I hit the site I learn something new that I can almost immediately use.
Aaron Swartz - http://www.aaronsw.com/weblog/
A smart kid. I can't concentrate through a lot of the stuff but every so often I find something darling. Maybe I should categorize this like a few I've mentioned above it as "good conversation" blogs or thoughts that inspire some thought.
Sam Gentile - http://codebetter.com/blogs/sam.gentile/default.aspx
A true blue Microsoftie. Staying on top of the blog keeps me on top, usually, of what I should be paying attention to from Microsoft: service packs, new releases, and so on.
Ian Griffiths - http://www.interact-sw.co.uk/iangblog/
Chris Sells's cohort in a recent WPF book and another good Microsoft-centric blog to keep a finger on the pulse.
Chris Sells - http://www.sellsbrothers.com/
Another clever jedi master who cares enough to share what he knows from time to time. Author (along with Ian, above) of some pretty good books that I own. One thing Chris said from a podcast with Scott Hanselman that stayed with me toward the end of the year was (I'm paraphrasing) that the information age will show a gap between people who can absorb a lot of information and those who can't.
Darren Niemke - http://markitup.com/
IM Conversation:
David - test
Darren - I read you.
David - got a sec for a question... ?
It's a bit strange that I can have someone like Darren on my IM list to bother from time to time. I usually get emails from published authors but having one who bothers to answer questions from some guy in South Dakota is quite a priviledge. Great ideas, great blog.
Mike Arace - http://mikeomatic.net/
Found as I searched for commentary on posts by Joel. After I'd put you in the aggregator I kept finding good stuff.
Jason Haley - http://jasonhaley.com/blog/default.aspx
You are the future of what the Time magazine selection means; you're a new type of curator, posting signs that people like me can follow.
Bart De Smet - http://blog.bartdesmet.net/blogs/bart/default.aspx
A programmer's paradox. How on earth do you stay productive enough to be as relevant (which you do) and maintain enough time to communicate it?
Reddit Kids - http://www.reddit.com/
Not only user-generated content, but relevant by democracy. I've especially enjoyed joel.reddit.com
Digg - http://www.digg.com/
Almost as good as Reddit.
Carl Franklin, Richard Campbell - http://www.dotnetrocks.com/
Love the podcast. I've got a love/hate thing going on with Carl's opinions, but I'm amazed that you keep it going and keep it as fresh as ever.
Josh McAdams - http://www.perlcast.com/
Love this podcast as well. You're pretty "aw shucks" about it but honestly you're the best interviewer of the technical podcasts I listen to regularly.
Markus Volter et. al. at Software Engineering Radio - http://www.se-radio.net/
Another great podcast from which to learn. It's intriguing to catch the Europeanisms as well and to hear something a bit more formal. Many of the podcasts I downloaded I had to listen to multiple times, not because of different accents, but because the content was that deep.
There are many other blogs, podcasts, and other online haunts that I gathered information (I'll pay tribute to the non-technical ones on my other blog) but every site listed above is a place I keep going back to and appreciating. I find it amazing that none of you have to do it and yet you keep on giving to your community. That's quite a gift.
Thanks!
}
Monday, December 18, 2006
Grab the Silver Keyboard!
Steve Yegge's last post couldn't have come at a better time for me; I've been having a lingering feeling that I'm stuck in the mud, working too hard and having bad ideas.
So how do you make yourself a superstar? Never stop learning. I've heard
people say they think this position is a crock, that it's ludicrous, that you
couldn't possibly spend your whole career learning new things.
But I think differently. I think every program you write should be the
hardest you've ever written. And that's what I blog about, mostly. Improving
yourself. Because most employers, the ones who matter in the long run, they'll
be able to see how great you've become, and they'll alter the very course of
their business plan, if necessary, to make the best use of you. Does that sound
incredible? Well, I've seen it play out both ways over my modest 20 years in our
industry, and that's how I see it.
I don't think it absolves me from having weak ideas or from lacking the most effecient approach to working outside of the office, but I know my direction is right. I need to work on my mechanics in future and make sure that while I strive to improve as a developer that I get better at picking what matters and solving problems that are this fine balance between learning something new and not being so challenging that they are unpractical.
I've been disheartened as well by the lack of community. People I know about online - my mentor list - make my life that much better but it seems rare that I meet people outside of conferences and the online world who have more desire for themselves other than getting a job done. In those dark moments I ask myself why I try and wonder whether it even will matter in the end.
But something in my intuition tells me I can't stop. That outside my "feelings" there are people like Steve who have walked a path I'm on.
This year I did become a better programmer. My skills as a designer improved. I created a bunch of tools that were useful not only to me but to others. My vindication came perhaps a month ago when I looked at a screenshot of a code repository program I'd written and forgotten about two years ago. I had rewritten a code repository program this year with tag support and as I compared the functionality and design I realized that I'd grown like a tree; the effect was visible over the long term but not on a daily basis.
}
Wednesday, December 13, 2006
foreach Considered Wack Quite Often
Don't get me wrong, it's not a jihad I have against the foreach in C#, it's just the fact that if I had a nickel (okay, a quarter to be realistic) for each time I changed a foreach to a normal for loop because I needed to track my position as I iterated through a collection and no underlying index was provided, I'd have enough money for coffee each week.
A simple example from the .NET world is the DataTable; when you iterate the Rows collection, the Rows don't expose an index. After seduction for the easy foreach, I end up with:
for(int i=0;i<myTable.Rows.Count;i++){}
There's only one time that a normal for loop got the better of me - I had to iterate and remove items from the collection. Modifying a collection that you're going through causes trouble but it's easily remedied - not with recursion as some would have it, but by simply going backward:
for(int i=myTable.Rows.Count -1;i>-1;i--){}
Besides its syntactic elegance, of what benefit is the foreach? By calling the underlying enumerator?
}
Tuesday, December 12, 2006
Epigrams on Programming
I am feeling my way around with CGI using perl so I took Alan Perlis's epigrams on programming and randomized them.
I think it will be my new homepage.
}
'Tis The Season
I'm quite fond of the different calendars with tutorials this season. From my first glances at this year's 24ways I should learn as much as I did last year. I also was delighted to discover the perl advent calendar. Any other decent holiday calendar/tutorials?
}
Thursday, December 07, 2006
Joel Rebuttal
Usually what Joel says is treated like gold by many developers, myself included. In a recent post he berated Om Malik for using a lego metaphor in describing how easy it was for startups to create software while paying homage to Fred Brooks's essay No Silver Bullet: Essence and Accidents of Software Engineering. Joel cleverly adds context to his comments by referencing a Business Week article from the early 1990s that uses the lego analogy with the idea of object oriented programming.
I've listened to Om Malik's podcast and can tell he is no programmer - in fact, I kind of laughed at a podcast on instant messaging where he called file sharing in instant messaging clients unnecessary (something nearly everyone I know from a working angle uses on a daily basis).
But what Om started was a good conversation which inspired Wesner Moise in his rebuttal to Joel asserting that Fred Brooks was as astute in his essay. Software development has advanced, Moise seems to be saying, well beyond what it was in the days of Brooks.
The desert for this travelling conversation was this story on programming Atari 2600 games. That sounds like tough work indeed.
Well, I'm off to play with regular bullets and legos.
Update: Some interesting comments from Phil Haack on the subject.
}
Sunday, December 03, 2006
What we wish we could say
Daring Fireball had me in stitches with the following paragraph on his colophon:
"If Daring Fireball looks like shit in your browser, you’re using a shitty
browser that doesn’t support web standards. Netscape 4 and Internet Explorer 5,
I’m looking in your direction. If you complain about this, I will laugh at you,
because I do not care. If, however, you are using a modern, standards-compliant
browser and have trouble viewing or reading Daring Fireball, please do let me
know. "
His most recent essay, Omnivapor, was referenced on Reddit but what got me going there was
his essay The Location Field is the New Command Line featured in Joel Spolsky's Best Software Writing I.
}
Friday, December 01, 2006
SearchDotNet
Dan Appleman, best known to me for his exhaustive book Dan Appleman's Visual Basic Programmer's Guide to the Wind32 API has had a sputtering blog over the last few years.
But recently it caught my eye because Appleman has created SearchDotNet which is a customized Google search engine for .NET sites.
It's nice to search for something like "Dictionary" or "Parallelism" and get relevant code despite the concept crossing language and platform barriers.
}
To Develop an Operating System
It's been around for a while but this powerpoint (linked directly as a *.ppt) is a presentation from Marc Lucovsky about the development process of the early iterations of Windows NT to Windows 2000.
Interesting things:
+ NT 3.1 was ~3 years late (I'm not feeling so bad about being behind on my current project)
+ The original team was only 6 people from DEC. That's astonishing. The eventual development team size was 200 with 140 people on the test team.
+ Quotes:
"To scale a development team, you need to establish a culture"
"Sloppiness is not tolerated"
+ By Windows 2000, the development team was 1400. I wonder what Vista's team size is?
+ The evolution of source control and branching at Microsoft.
}
Thursday, November 23, 2006
Tuesday, November 14, 2006
Language Design Books
Joel Spolsky is so popular that I'm sure upon his mention of "Compilers: Principles, Techniques, and Tools" - the so called "Dragon Book" - interest and sales must have shifted a little.
In this week's Software Development Times Larry O'Brien clarifies with a few resources including Modern Compiler Design, and Programming Language Pragmatics.
Because I'm not classically trained, I find myself with significant gaps in areas like this (compiler construction, algorithms, etc... ), so a reading list is a good thing to have. Of course, the list is the easy part and the finding of time to read and study is what is difficult.
}
Thursday, November 09, 2006
Falsification and Unit Testing
Did I ever post that unit testing is hard?
It's hard. I'd love to see it in action at other shops since we've got so much to learn. But let's tally the score of the moment:
It's about 10 minutes to midnight and I've been working my way through someone else's code. This code is a piece of a separate assembly that does validation of a whole bunch of business rules before a person can process a loan application. Each rule is fairly simple, along the lines of "if a person is not older than 18, they must have a cosigner" but there happen to be a lot of rules. I designed the rules to be in a separate assembly because the client changes these frequently, so it will be easy to update with a new DLL instead of reinstalling the application.
Our application is modeled as an object with a series of other objects and lists attached. An application has a borrower. A borrower has an employment history. And so it goes - which makes for a fluid, transactional save or validation by simply passing the application object around.
But I'm looking at a lot of validation at this late hour and finding a systemic issue. The person who wrote the code made an assumption with respect to Lists attached to objects that makes our validation code ineffectual. Here's a sample:
25 if (targetApplication.Coborrowers.Count > 0 && targetApplication.Coborrowers[0].Citizenship == String.Empty)
26 {
27 result.IsValid = false;
28 result.Message = "First Cosigner Citizenship is required for Approved Status.";
29 }
30 }
31 return result;
See the bug? If there are no coborrowers the rule (citizenship must be set) is never evaluated.
But even more so, here's the rub: I had the developer write unit tests for each and every validation rule they put out as a method. I thought a night like tonight: midnight, fatigue, and a crapload of code to fix for a promised build, would be avoided as a result.
The large picture here has to do with the way the unit test was designed to verify the functionality of the validation rule. Because the problem was approached as gingerly, I think the unit tests weren't liable to find a more subtle bug like this. Instead, the unit test probably attempted to validate a coborrower with a citizenship, asserting true, and a coborrower without citizenship, asserting false. No thought was given as to whether a coborrower may not exist.
Perhaps, in programming, we need to focus more on falsification in our unit tests - attempts to break the code or find ways it will assert what's expected under the wrong conditions. But that's all theory right now and I've got a decision to make: stay up late and try to keep my word or heading to bed and fixing the code under the right conditions... the purists will say that a rushed fix is bad, especially since I didn't write the first iteration and won't have time to update the unit tests (I know, I know: bad). But I have to live in a world of realisms where the pain of a broken promise is greater than the pain of a rushed, patchworked fix. Time to get the Mt. Dew out of the fridge...
}
Saturday, November 04, 2006
Configuration API Confession, Repentance
The beauty of blogs, in particular this one: I can flaunt my ignorance on any given area. A few nights ago I thought I'd update my current development project to have its connection string maintained in a config file so that it could be changed without a recompile in a single location.
I knew this was the approach we'd eventually take having used it like breathing on all of my previous .NET projects (which were ASP.NET). But Windows Forms applications are slightly different and I ran into the brick wall of not grokking the structure Microsoft uses for configuration.
The big problem in my understanding was that I wanted to have my configuration read in a separate library, thinking I'd reuse the pattern on any future project where I wanted to do something similar. So I created a library project and knowing a little but not enough created a config file manually to use. Knowing a little but not enough (or not updated?) I named my configuration file ConfigHelper.dll.config because this is a well known convention in .NET. I also manually copied this file to the \bin folder and even considered adding a "post build event" to the Visual Studio 2005 project to do this. And when it didn't work and my attempts to read the config file weren't successful, I became very frustrated and even took the time to write it up. Luckily no one besides A the jedi master reads this blog so my voice of ignorance got drown in the black hole that is blogger. No matter: this blog is for me, like a "captains log" to chart my experiences and thoughts.
I realized a while back that I knew just enough from the past few years programming ASP.NET to make ignorant mistakes and convoluted work-around solutions so I've been reading Brian Noyes's Data Binding with Windows Forms 2.0 on Safari trying to grok the whole picture as Microsoft intends it.
So here is the skinny, as embarrasing as it is for me to explain how wrong I had it:
1. In your project, create an App.config file. In Visual Studio 2005 this is the "Application Configuration File" option.
2. Make entries as you like in the configuration file.
3. Compiling your application will produce a MyAssembly.exe.config or MyLibrary.dll.config file in the \bin directory.
4. Libraries aren't meant to read from their own configuration files. Hence attempting to read an entry even if you've manually copied over your MyLibrary.dll.config file will result in an empty string once retrieved. BUT!
5. BUT! BUT! The library is designed to read values from the configuration file of the executable. So if you place the following line in your library:
string foo = ConfigurationManager.AppSettings["bar"];
Your library is looking for the "bar" value in the configuration file of your application.
To my own credit, a lot of the time when I find myself fighting with something I usually know deep down that it's a struggle to understand what the framework designer intended and not something that is "stupid." In this case, what the framework designers intended is quite elegant because when you have, like us, many different libraries that all need to pull something common (connection string is probably most obvious) it can be based on the configuration of the application and managed in a single location.
Okay, now that I got the memo, I can move on.
}
Thursday, November 02, 2006
Configuration API Convoluted?
I'm having an evening when I can't believe what is wrong with me because something that should be trivial is giving me hell.
Our application has had connection strings littered all over the place - okay, 8 to be exact and I know this because of my frequent usage of "replace in files" to toggle connection strings. But we're at a point when this needs to be centralized and mutable without doing a new build.
In my head this is simple: slap a config file into the project and off I go. Some kind of one liner along the lines of:
ConfLib.CONNECTION = ConfigurationSettings.AppSettings["Connect"];
Simple, right? I do it with web applications all the time.
The first issue is that ConfigurationSettings, which the old school .NET folks are used to, is deprecated. The message tells you to use ConfigurationManager but neglects to mention that a physical reference to System.Configuration.dll (in the GAC) is needed. This isn't a big issue and 2 minutes later I've referenced it, and rewritten my line of code as:
ConfLib.CONNECTION = ConfigurationManager.AppSettings["Connect"];
Not quite. I'm now in the habit of doing unit tests so I realize that Visual Studio 2005 copies your libraries to a new directory when it does unit tests. I look at the "post build event" options and wonder if it's worth the hassle. So instead I ditch the unit test and return to the main solution, manually copy the *.config file into my application's directory and try.
No dice.
Maybe ConfigurationManager is too nebulous? So I try the following:
Configuration conf = ConfigurationManager.OpenExeConfiguration("ConfigHelper.dll");
Which, when I run it in the debugger seems to pull my keys out of the config file but gives me an access violation when I try:
ConfLib.CONNECTION = conf.AppSettings["Connect"];
This is quite some time later and I'm pretty annoyed because I must have absolutely not gotten the memo or configuration is bloated. Almost to prove to myself how simple this should be, I create a file called Settings.xml and put in a couple of elements and write the following:
XmlDocument configDoc = new XmlDocument();
configDoc.Load(Path.Combine(Directory.GetCurrentDirectory(), "Settings.xml"));
ConfLib.CONNECTION = configDoc.SelectSingleNode("//Database/text()").Value;
ConfLib.VERSION = configDoc.SelectSingleNode("//Version/text()").Value;
That simple.
Granted I am WELL AWARE that the Configuration API has lots of goodies stuffed into it but should that make the process of pulling it out of a configuration file so convoluted? Things that are designed well work for the simple things as easily as they solve the complex.
My configuration files always have the same pattern: I create a class that is designed to read the xml file with static variables for each configuration value. I use a static initializer to read these from the file and have a single static variable I reference when the app is loaded. I've worked on a lot of stuff that benefits from this but almost always configuration stuff seems to boil down to a simple name/value pair you can leverage.
I could have made an indexer and had the pulling look like the AppSettings collection on the ConfigurationManager but I dislike the fact that the compiler doesn't catch errors related to misspelled key names.
Oh well, I'll leave it in its current state. Maybe I'll get the memo tomorrow but I doubt it.
}
Tuesday, October 31, 2006
Classpath struggle, even the Jedi
Larry O'Brien, well known Jedi Master of many things development posts:
"I have to wire up a ColdFusion to an Axis Web Service. I've spent the past 3
hours trying to figure out freaking classpath issues: something about a
ClassCastException from a org.apache.commons.logging.LogFactory. I'm giving up
for the day. Stupid freaking classpaths."
I can remember sitting in my one room apartment above a garage in Whittier fighting with classpaths, trying to wrangle them into my understanding of Java. It is not schadenfreude that makes me post this, it's more the comfort of knowing that I'm not the only one to have struggled with them.
}
Friday, October 27, 2006
Friction
Reading Joel Spolsky and others on the hring process is always interesting. One aspect of their writing that has always intrigued me has been the "quiz questions" used to get a feel for the interviewee's level of intelligence.
Lately I've been interviewing people regularly and am slowly coming up with a format that gets me closest to a person's technical level as it pertains to our company. I usually ask a person to rate themselves on a scale of one to ten in three areas:
1. Web Application Development (HTML / CSS / Javascript / ASP.NET (or any other web app framework or perl/scripting env)
2. "Fat" clients (Windows Forms .NET / COM )
3. Database programming and administration (SQL / Database Design)
I then follow up their ratings of themselves with some general questions in each area. For example, most people consider themselves knowledgable with web development because they know some basic html. Questions I like to pose here may be along the lines of asking what the difference is between DIV and SPAN elements, or what their understanding of why XHTML (versus HTML 4.0) came into existence, or whether they think designing with tables is a bad idea. On the programming side I like to ask a person about the postback cycle in ASP.NET, or if they come from a non-.NET environment, about something like state management (querystring, session, etc...) in web applications. Another favorite area of mine is javascript since many people think they know it but can't provide answers for even a simple question like how to register an event for an html element. When I ask questions the point is definitely not about trivia but more to gauge whether the candidate is about aptitude or whether they'd be capable of jumping right in the fray and making a contribution.
But beyond the technical questions, beyond the idea of "Smart, Gets Stuff Done" as goals in the ideal candidate, probably the most important thing about working the environments I've been exposed to is learning how they deal with "Friction." I was watching a panel show once on CSPAN where a wizened old military man said: "The difference between war plans and war is friction." As I understand it, friction has to do with all those little things (and big things) that go wrong. In our case, friction is almost always involved in trying to hit release dates. Friction is also a big player when it comes to team dynamics and how people treat each other.
For all the talk online about people who are exceptionally smart and productive, I'm surprised that the question of friction isn't more important when choosing programmers since friction is always a part of software development. Everyone's got a story about this, but here's mine: I worked with a guy who was exceptionally sharp, anal-retentive, and detail oriented. He'd forgotten more within his discipline than I probably will know. I would ask him from time to time for help on the little problems I was dealing with and his answers were always prompt and accurate. We worked together as peers and that's what made me capable of liking him however, for many people, he was nearly impossible to deal with because any change that required flexibility on his part was out of the question. If I'd been a team lead on a project, he'd be a difficult decision because of this attitude, and what would push me from the "maybe" into the "no" decision would not be my own ability to work with him, it would be his affect on the team as a whole and how he affected the team's group culture.
One thing to bear in mind is that I'm a consultant who writes business-ware which may mean that friction comes up for me a lot more than someone working at a shrinkwrap company, or a behemoth powerhouse with zillions of great hackers. But as my experience accumulates, I begin to see that a person who has the ability to calm a client down while being able to refocus and get a project out the door is more valuable than a person who is a brilliant programmer but unable to deal with the type of rapid change and improvisation necessary for our work.
}
Tuesday, October 24, 2006
Commands and Abstractions
I clash with people occasionally over my approach to SQL Server. My approach to SQL Server is quite simple: Transact SQL. Never one for layers of abstraction and always seduced by speed, I prefer to keep my management activity in Query Analyzer. SQL Management Studio seems a bit slower than its older cousin, so quite often I prefer Query Analyzer even with the brand new SQL Server 2005.
Often times for me preferences like this develop after bad experiences but today was a reminder of what kinds of things a layer of abstraction is capable of doing behind your back if you don't monitor it. We have a table with 82 columns and something like 50,000 rows. One of these columns needed to be extended from VARCHAR(10) to VARCHAR(50). I was walking through the steps as they may occur in Enterprise Manager so I opened the product (wait a few seconds), selected my database (wait a few seconds), opened the tables node (wait a few seconds), and then right clicked on my table to examine and manipulate the column (another few seconds, plus scrolling up and down to locate the column I wanted). I made my change and then proceeded to make a "change script" which, to my horror, creates a temp table, copies data and affects other tables referenced by the table whose column I was changing.
My usual approach to something like this is the following: Start->Run (Instantaneous). "isqlw" and hit enter (Instantaneous). In the query window I type the following:
1 USE MyTestDatabase
2 GO
3
4 ALTER TABLE Foo
5 ALTER COLUMN Bar VARCHAR(50)
6 GO
The point for me really veers from SQL Server at this point and gets into the question of the abstractions which I myself rely on unnecessarily - which prevent my thinking to get past a certain point. Although I have come to rely on the command line more and more over time, there are still things I learn: DOS things! that have really changed how I think about certain types of problems. A simple example of this is from a few months ago when I learned of the existence of pushd and popd, commands for storing and retrieving working directories on a stack. These relatively trivial techniques make it easy to do things that never really occured to me before. Like the fact that I could just use fc to check for differences in files. Or piping a request for help to a file so I could have documentation for a command. Here is an example that might be interesting: wsdl.exe /? >wsdlParameters.txt
One last point of clarification: I am not against abstractions. In many instances they work quite well. A while back I wrote a web based tool for viewing objects in SQL Server databases - basically outputting queries to the Information Schema views. Everything that tool does can be duplicated in query analyzer or in SQL Management Studio. But in terms of raw speed, flipping back and forth on table definitions in the web based tool beats clicking around in the GUI or retyping the same select statement with a different table name in the where clause. What I believe is that abstractions are used best when what they are hiding is understood fully. This is counter intuitive; most people think the abstractions - an easy GUI, a simple command, and so on - are there to make things simpler for people who want to keep details hidden. That is always dangerous, even when it's effective. I'd prefer to struggle with what's underneath and then live blissfully choosing the abstractions I find useful.
}
Monday, October 23, 2006
Serious Reading
Chris Sells answers a few questions in public but one comment got my attention:
Wow: three to five books in a week for "immersion." It's a stark reminder on a personal level of how much more aggressive I need to get with my own reading list (which, incidentally, includes Sells's Windows Forms Programming) but in a general sense it shows a hallmark of what the information age does to programmers - it might not be intelligence that separates us (though I think Sells is remarkably intelligent), it's the ability to absorb information quickly.How are you able to keep up with the changes? What books do you read?
[csells] I keep up with changes by a) a broad familiarity with as much technology as possible and then b) committing to using it because it feels like it’ll be the right thing and c) using fear to motivate me (recognize a pattern? : ). I read books on demand given the topic I’m into, and then it’s 3-5 books in a week for immersion. Frankly, after writing a few books, I’m a bit of a snob, so I don’t read a lot of technical books for fun the way I used to.
I don't read very quickly so it's a matter of discipline and will to work on absorbing what's relevant for the job and the future. But in a word where guys like Sells chew up and spit out technologies before most people are seriously working with them, a person needs a good reminder of staying focused.
It reminds me of the brief exchange I had with Hanselman. I'd ask a question, he'd casually suggest a book. It says, to me, that there's a bit of mysticism to how smart people like that stay on top of things but really that the information is out there and ready to be consumed if only one is disciplined enough to pursue it.
}
Tuesday, October 10, 2006
Windows Forms for Visual Basic 6 users
My current project at work is a Windows Forms application. Even though I've been programming .NET almost daily since it's introduction, just about all of what I've done is web based programming using ASP.NET. The non-web code I've written has been for the most part libraries (DLLs) to use in web apps.
Most of what I know about thick clients comes from doing work in Visual Basic 6 so while I usually know where I'd like to go with something, I find myself hitting a wall with how to do it in VS 2005.
An example of this would be this morning, trying to figure out whether the Locked property for controls is ported to .NET Windows Forms. Unfortunately it's not - the Locked property you find has to do with resizing and moving, not making controls editable.
Fortunately MSDN has a great resource here for people making the transition that lets you see Visual Basic 6.0 and Windows Forms compared directly.
}
Sunday, October 08, 2006
Rhino Book
I got David Flanagan's new Javascript Reference earlier this week. My fourth edition is nice and worn, but it will be nice to have the updated perspective since so much has happened in internet time since the fourth edition was published. It's the third edition of the book that I've owned and while buying the same book more than once has a big psychological drawback, I'm especially looking forward to reading the sections on the XmlHttp (AJAX) side of javascript.
}
Saturday, October 07, 2006
Firefox Hiding Namespaces! ARG.
For a while I've had people ask me how I did my photoblog and because I wrote it from scratch it's not really useful (and it's definitely "Me-ware": unusable to just about anyone but me). I always direct people towards Flickr but it doesn't have the photoblog experience quite like mine and other photoblogs.
This weekend I've been writing a tool called Flickr-Fu that grabs the RSS feed from Flickr and attempts to simulate the photoblog experience allowing a user to navigate forward and backward one photograph at a time. The RSS xml structure is extended by Yahoo with it's own namespace: http://search.yahoo.com/mrss - all such tags are given a "media" prefix to distinguish them from the structure of RSS 2.0. Using XPaths with .NET is pretty straight forward until you run into the namespace issue, at which point there is a class XmlNamespaceManager that you will need to tame in order to get the job done.
But before this point I was hitting my head against a wall: I could see the media:content tag that I needed to get the image URL but I could see no namespace associated with it! It doesn't follow as well-formed XML to have namespaces without some namespace URI but sure enough, Firefox was hiding the namespace URI. I pasted to IE and was able to get a proper reference to use with the XmlNamespaceManager. What a strange thing to display XML in a stylesheet but leave off the namespace references in the root element! Just to prove I'm not hallucinating, here's a screen cap:
Once the namespace issue was cleared up for me, the code was quite simple:
21 XmlNamespaceManager spaceManager = new XmlNamespaceManager(doc.NameTable);
22 spaceManager.AddNamespace("media", "http://search.yahoo.com/mrss");
23 linkToBig = xnItem.SelectSingleNode("media:content/@url", spaceManager).InnerText;
Flickr-Fu is a work in progress but you can have a look here.
}
Friday, October 06, 2006
Raganwald Responds
I had posted about Yegge's Agile/agile essay, trying to follow some of the interesting comments that ensued on the web. I made the following comment about Raganwald's response:
"Raganwald has the most interesting response
I've seen so far: that it all comes down to people over process and a good team
will succeed despite methodological strategy. "
He has since posted an elaboration in response on his blog - I was a little off in my reading:
"No. I'm saying that a "good" methodology cannot save a bad team. That does not
mean that a good team can survive a bad methodology. There are four
critical parts of a successful software project, and in my experience you
cannot succeed if any of them are missing. People are the first of those,
management the last. Methodology is a part of management in my view. In some
situations, strong management can impose an informal rather than a formal
methodology. But it would be stretching a point to claim that such situations
lacked process or had a bad process."
}
NULLs in subqueries
Here was an interesting issue we ran into this week. I haven't run into this before and thought I should share - a friend was using a subquery to filter and because of NULL results in the field his result was an empty set.
My approach to things like this is usually to use a join rather than a subquery and ultimately that's how we saw how Microsoft SQL Server was processing things. But this behavior is quite subtle so I'm posting since a person running into the same issue may Google there way to this entry:
1 CREATE TABLE #TRAN(
2 TRANID INT,
3 TRANNAME VARCHAR(50)
4 )
5 GO
6
7 CREATE TABLE #ACH(
8 ACHID INT IDENTITY(1,1),
9 ACHNAME VARCHAR(50),
10 TRANID INT NULL
11 )
12 GO
13
14 INSERT INTO #TRAN VALUES(1,'TRANSACTION A')
15 INSERT INTO #TRAN VALUES(2,'TRANSACTION B')
16 INSERT INTO #TRAN VALUES(3,'TRANSACTION C')
17 INSERT INTO #TRAN VALUES(4,'TRANSACTION D')
18 INSERT INTO #TRAN VALUES(5,'TRANSACTION E')
19
20
21 INSERT INTO #ACH VALUES('ACH 1A', 1)
22 INSERT INTO #ACH VALUES('ACH 2A', 2)
23 INSERT INTO #ACH VALUES('ACH 3A', 3)
24 INSERT INTO #ACH VALUES('ACH 1B', 1)
25 INSERT INTO #ACH VALUES('ACH 1C', 1)
26 INSERT INTO #ACH VALUES('ACH 3B', 3)
27 INSERT INTO #ACH VALUES('TEST',NULL)
28
29 -- RETURNS NOTHING
30 SELECT * FROM #TRAN
31 WHERE
32 TRANID NOT IN
33 (SELECT TRANID FROM #ACH)
34
35 -- RETURNS TRANID 4,5
36 SELECT * FROM #TRAN
37 WHERE
38 TRANID NOT IN
39 (SELECT TRANID FROM #ACH WHERE TRANID IS NOT NULL)
}
Saturday, September 30, 2006
People, Process
Steve Yegge has a post about the agile software development process. Gifted in wit and sarcasm, Yegge doesn't spare many punches in basically saying that "Agile" as is known as a process is basically about marketing and making money for consultants. He contrasts this with a lower cased "agile" which is what he believes Google (his employer) practices and others should.
A lot of comments seem to be coming back - resistance to Yegge's comments over at The Mindset because (and I agree with this) some of the things that are true for Google (working without deadlines) just can't be true for the rest of us. The Mindset also doesn't believe that the glossy, non-substantive Agile flies with most businesses. I'm not as optimistic as The Mindset since I have seen many an organization fleeced, but I do agree that most people aren't fools. Especially developers, the majority of which I've worked with are big skeptics.
Raganwald has the most interesting response I've seen so far: that it all comes down to people over process and a good team will succeed despite methodological strategy. Interesting because especially when it comes to Google, it seems like they take the cream of the crop so it would follow that they can be so lax with all the rock stars they have working there. Raganwald seems to fit into Spolsky's camp (maybe it was Raganwald's camp to begin with) where the equation is: Good programmers + working conditions == Great Software
Dare Obasanjo is pretty straight forward with how he sees Google:
"'smart people dicking around' type projects" versus "shipping code."
It doesn't get more plain than that now, does it?
Quite interesting especially since it wasn't long ago that I listened to Jutta Eckstein talking about Agility on Software Engineering Radio. The first thing out of her mouth was:
"People over process."
I think there's a lot of frustration in the marketing and money making of Agile but the finer details seem to have a lot of things that are great tactics in software development. "People over process" is a great way for the Agile methodology to begin itself since it allows for the Raganwald/Spolsky perspective but many of the communication things are good as well. What Yegge points out as "agile" in the sense of big rewards and incentives seem to have to do with compensation, not necessarily development methodology. Pair programming, as far as I know isn't a part of Agile but this is something I've never really seen as a full time approach. One thing I've been struggling with in my current project is the weight given to doing frequent releases in Agile. Because we started from scratch it doesn't make much sense and in this case we are departing from conventional Agile. However as the framework for the software begins to take form I'll push the team for more frequent builds that the client can look at. For now, scaffolding and putting things together for others takes far too much time and all the client would see is unfinished stuff that we are well aware is unfinished. Doing "SCRUM" meetings is another departure for us - we meet when necessary but there's enough on various plates to make meeting and percentages too much overhead.
In the end I find myself seeing truth in each person's perspective: Yegge is right about some of the dogma (whether it was intended or not is another question) some apply to Agile programming. The Mindset is right that those of us who don't work at Google don't have the luxury of working without a deadline. Raganwald is absolutely right on the importance of hiring. I did two interviews this week and that was... interesting. People, especially the caliber of whom work at Google, just aren't a reality for where I work. I include myself in that category since I'm not certain I'd fare too well in their hiring process.
}
Wednesday, September 27, 2006
Do you test your work?
Most places I've been people would nod and look at you with disdain. But I can't think of a person I've met that is as rigorous as this. (Courtesy of CodingHorror)
Testing seems to have less to do with technical proficiency (what gets you the initial result) and more to do with tenacity. I'm hoping it's like a muscle too - the more it is exercised, the more anal retentive I'll become about the lengths I go to check my work.
}
Monday, September 25, 2006
Eric Sink: Code Cover, Unit Tests
A good essay I finally got to last weekend is Eric Sink advocating code coverage. Code coverage is simply understanding how much of your code is executed within your application. For people like me who start off by sketching, revising, and honing their work, I'm sure an analysis of parts of dead code would be quite revealing.
But there were two other peripheral things about this essay that were very interesting to me. The first was a side comment Eric makes about how many lines of code he's written in the project:
"This library consists of 12,341 lines of algorithms, plus 5,819 lines of unit tests."What's interesting about this to me is that Eric, who is a developer I completely respect, is writing about a line of code in unit tests for every couple of lines he is writing as actual project. Ever since I became the resident nag of unit tests, trying to lead by example, I have come to realize just how much discipline it takes to have serious test coverage. As time has passed I've been happy with our choice since it's been helping us release much steadier versions of our software. I've also learned a lot about how to test our code, which I'll hopefully find time to share on this blog later.
The second thing that is interesting to me is that Eric always seems to have a side project of some kind. As a CEO of what seems to be a successful ISV this is impressive since many people I know in positions like that tend to lose their technical skills as they accumulate the managerial/strategic ones.
}
Saturday, September 23, 2006
Visual Studio Environment Settings
First it was Scott talking about his Visual Studio environment and then it was Jeff posting some of his own settings and a website to download customized VS.NET Environment settings.
I'm usually a bit boring when it comes to things like this - I used to like the courier font at 10 or 8pt since I'm used to laptops with next to nothing in coding real estate. Otherwise everything was default.
But I've taken to Jeff's ZenBurn settings quite a bit.
I hope the IDE Hot or Not site takes off; it would be interesting to see what some other people's settings look like. Who knew Visual Studio could have a Toyota Scion style effect and bring out a person's personality?
}
Tuesday, September 12, 2006
Unit Testing
I've worked on lots of projects but never been in a position to push everyone to have a unit test for all the important pieces of the application.
Pushing for unit tests makes me feel like the resident nag, especially when it goes beyond making the proclaimation that we'll approach the project in this way and leads into my sitting down with people pointing out code that seems to work but isn't covered by any unit tests. I'd be inclined to follow up everyone's code with unit tests they could have written myself, but it's too much work for a single person.
Another difficulty is that while I get the concepts behind unit testing, writing a good unit test is proving more thought provoking and difficult than just the idea of having a test that covers a method call. Most of the articles about unit testing talk about it in terms of methods that don't seem to have as much complexity or methods that don't leverage external resources. It's easy, with articles like that to have an example of a method that adds two numbers and then has a test that asserts that two values added have a correct result.
In our case, we've got a somewhat large database that we are utilizing in most methods making how/what we test for much more tricky. For example, if we have a method:
public LoanApplication GetApplicationById(int appId){ ... }
What's the best way to test it? Thus far we've got the following things:
1. Make sure the result is not null.
2. Compare properties against database query (with a tested database library).
Our test for that method may look like the following:
[TestMethod]
public void TestGetApplicationById(){
AppService appService = new AppService();
Assert.IsNotNull(appService.GetApplicationById(1));
LoanApplication testLoanApp = appService.GetApplicationById(1);
DataTable testTable = db.GetDataTable("select * from App where AppId=1");
Assert.AreEqual(testTable.Rows[0]["AppId"], testLoanApp.AppId);
// other fields test
}
How does one get tests like this right?
}
Monday, September 11, 2006
Testing Frameworks: NUnit up one
After spending a long time without having the ability to impose "testing" in the projects I was working on, I'm now in the position as lead developer to make testing a part of our development process.
Last week I went back and forth with either using NUnit, which I'd be more inclined to do on my own versus Visual Studio Team's built in testing capability. I chose Visual Studio just because it would be easier for team members to get to; I can't look over everyone's shoulder and force them to write tests but I can make it as easy as possible to encourage the behavior.
Before doing so I did a search to try to see if there were major differences between NUnit and Visual Studio's testing - I don't remember anything notable but today, just my luck since we've gone full force in the Visual Studio direction, I find a post complaining of lack of functionality in Visual Studio's test framework vs NUnit.
}
Wednesday, September 06, 2006
Monday, September 04, 2006
REST for the wife
When I was teaching I'd love to ask a person to give me an explanation of a technical concept as though I was a 13 year old. It's easy to memorize the acronyms but it's much harder to unpack them, especially with enough understanding to simplify them for people that have no assumptions with respect to the concept.
Ryan Tomayko, in this case, has done an amazing thing: read along as he explains REST to his wife (who we may assume as an intelligent but non-technical person).
}
Rumble in the Jungle
There is a saying among Africans: "When two elephants fight, it's the grass the suffers most."
But fortunately this doesn't apply to the web; when two giants go at it, we get to tune in and watch the blow for blow, entertained.
On Friday Joel Spolsky published The Language Wars, in which he discussed an approach to picking a language/platform for application development. I believe his point had more to do with picking a well trodden path for a development project, as well as having an architect with lots of experience with your chosen platform/language. Along the way, however, he said:
... and a handful of platforms where The Jury Is Not In, So Why Take The Risk When Your Job Is On The Line? (Ruby on Rails). Before you flame me, Ruby is a beautiful language and I'm sure you can have a lot of fun developing apps it in, and in fact if you want to do something non-mission-critical, I'm sure you'll have a lot of fun, but for Serious Business Stuff you really must recognize...
The rest you can read in the post but these comments sparked a fire from Ruby on Rail's inventor, David Heinemeier Hansson who retorted quickly on his blog that Joel was full of FUD. It's an interesting exchange but Hansson points out that Joel's final thrust is about a language called Wasabi that is used at Fogbugz and completely outside the "well trodden path" or "proven platform" category he seems to espouse at the outset of the article.
Soon after the rebuttle was posted there seemed to be a lot of people who thought Wasabi was a joke that Joel was using to wink at his like-minded classicists with while stoking the fire of the Ruby hipsters - so much so that many posted that they "got the joke" maybe in part to feel like they were the clever Ivy League programmers they assumed Joel left the easter egg for.
But they were wrong, and Joel followed up with a post in which he confirmed the existence of Wasabi, while backing away a bit from controversy by not rebutting the rebuttle.
All in all, it was an interesting friday evening following this story around. I never assumed Wasabi was an inside joke; Joel's mentioned many times that Fog Creek had a compiler they used to generate Fogbugz code in PHP and VBScript amongst other languages. I didn't understand the big fuss on the part of Heinemeier Hansson either and others - the concept of a domain specific language written in something doesn't pull away its platform underpinnings. If anything the platform is a safety net of sorts. But beyond this, the most important piece of the puzzle is Joel's second point: an architect is absolutely necessary for big, enterprise software (in order to do a good job).
On the other hand I find Joel's skepticism toward Ruby on Rails as premature as the blind enthusiasm of many. There is a lot of room between "Serious Business Applications" and college projects. Many business applications are not mission critical banking - I just participated in a rewrite of a sales project management platform that could have been Ruby on Rails fodder. If anything there's going to be better, smarter business development tools as a result of the good ideas that Rails has fostered.
Time to stay tuned to the aftermath in the blog/web world.
}
Tuesday, August 22, 2006
David doesn't get it
David Pogue, tech writer for the New York Times claims (follow up here) that perhaps the reason that there are so many Wintel vs Mac computers in corporate America are because IT folks just want to keep their jobs and the viruses, spyware, and a defective Microsoft operating system help them. A corporate environment with Macs and fewer issues would, according to his logic, result in less work, a smaller budget, and a smaller IT staff.
But Pogue is missing a big aspect of the corporate world: what Visual Basic was historically, and what the .NET Framework is today. Corporate environments are filled with throwaway programs that are very specialized towards people's business needs. Without an environment like that (with serious investment) on Macs, that sort of shift is not possible. It harks back to Balmer's "Developers, Developers, Developers!"
Web applications are removing this disparity between operating systems, but I wonder if Apple sees developers as tightly bound in their corporate strategy as Microsoft does. Because they don't, and don't understand corporate software, it lends itself to the chasm between Apple computer and the business user.
ps. I'm aware of Filemaker and Xcode, I just don't think they are as good. As a thought experiment, compare how much Apple bets on these with how much Microsoft bets on Visual Studio and .NET.
}
Saturday, August 19, 2006
Ruby $LOAD_PATH Watir
On and off I've been messing around trying to get Watir to work on my machine. The gem installed properly based on the instructions given to simple go to the command line and use the following:
gem install watir
But when I tried to execute a simple test I got the following:
uninitialized constant Watir
./watir.rb:6
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
C:/CODE06/RubyStart/WatirTest.rb:7
./watir.rb:6: uninitialized constant Watir (NameError)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
from C:/CODE06/RubyStart/WatirTest.rb:7
It seemed like an environment variable was not properly referencing the library but when I hunted for it I saw no environment variables. I ran the unit tests for Watir and it seemed to have installed correctly but I noticed the following at the beginning of each:
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..') if $0 == __FILE__
Smells like a path the the library so I investigated with:
puts $LOAD_PATH
which shows me the following:
c:/ruby/lib/ruby/site_ruby/1.8
c:/ruby/lib/ruby/site_ruby/1.8/i386-msvcrt
c:/ruby/lib/ruby/site_ruby
c:/ruby/lib/ruby/1.8
c:/ruby/lib/ruby/1.8/i386-mswin32
In order to get the script working I just hacked the $LOAD_PATH to include a hardcoded reference to my Watir libraries:
$LOAD_PATH.unshift 'c:/ruby/lib/ruby/gems/1.8/gems/watir-1.4.1'
From there I was set with the following simple script:
require 'watir'
include Watir
ie = Watir::IE.new
ie.goto("http://www.t3rse.com")
I'll dig into this - I haven't had the patience to sit down with a Ruby book just yet (anyone have ideas?) but if anyone has a similar problem running Watir, here is a hack to get you started if this is a hit on your Google search.
}
Friday, August 18, 2006
Podcasts to invoke musing, mulling
I love a good podcast. I started as a very regular listener on IT Conversations and have since drifted around looking for quality material. IT Conversations started with a lot of good content but it seems as though of late its drifted into MBA type material which is a bit vague for me; I prefer good technical podcasts.
Some places I've found myself consistently happy:
1. Hanselminutes - great coverage of the .NET universe along with other technical topics such as Syndication, SCRUM, and the like.
2. Software Engineering Radio - I am working at restraining myself of cultural stereotypes but the SE Radio crew are very, very concise. They have a much better depth of coverage than other technical podcasts
3. .NET Rocks - good show with an excellent track record. Sometimes just a touch too long, but I've always liked DNR.
I've listened to a few podcasts from WebDevRadio. Much of what I heard was good, and I like how it takes me out of the exclusively .NET universe a bit.
From IT Conversations, my favorites up to this point included Steve McConnel, Joel Spolsky, Philip Greenspun, Will Wright, and Paul Graham.
Although Venture Voice isn't really that interesting to me, Jason Freid and Joel Spolsky have some good interviews there as well.
In the "lost podcast" genre - David Heinemeier Hansson of 37 Signals had a great talk at Carson Workshops where he talks about the basic philosophy of Ruby on Rails. I don't see a link to it but if you find it, it's good. Simon Incutio took some great notes that will give you a good idea of what was said.
Well, there are a lot of podcasts out there; too many for me to get to. These are most of the ones I keep going back to and finding gems.
Peter Seale has a much more comprehensive listing here. I'm looking forward to going through his list, it would be nice to make a website that kept a nice listing of such podcasts. Not necessarily aggregated, but something maintained by a more trusted curator.
}
Thursday, August 17, 2006
Kiko Lessons
I posted yesterday about the speculation going on about their folding. Here it is from the proverbial horse's mouth.
}
Wednesday, August 16, 2006
Small Teams, Better Software
Via Raganwald, there is a small post on how smaller teams make better software. There is a nice balance between the need for methodology and the idea that people matter most. Agile thinking indeed.
}
Kiko, Down For the Count But...
... will they get up? Buzz is all around since the Y-Combinated Kiko is folding and being auctioned off. I was interested in what looked like a blog post retrospective of the whole thing until I realized it was just someone speculating, not the kids from Kiko writing about what happened.
Truth be told even though web calendars are interesting software, I really don't use them. I used Kiko a few times just to see how it worked and was impressed with what it seemed to take programmatically. And that's how I judge the whole thing - as a technical achievement, not as a sales person's way of making a lot of money even though they may have hoped for that side effect.
Now if I had $50,000 and a lot of motivation I'd get that source code and make a calendar component for .NET - the last one I worked with was no fun at all. And of course I know nothing about being profitable; it would be an interesting project is all.
}
Saturday, August 12, 2006
Yegge's Kingdom of Nouns
I'm late to the party once again; I discovered Steve Yegge just recently and ran across his essay "Execution in the Kingdom of Noungs." Yegge is a great writer and I can see why the essay recieved a lot of attention. Yegge basically asserts that Java is a kingdom of nouns; a language which focuses on things (objects) which he parallels as "nouns" over actions which he parallels as "verbs." This leads to a lot of verbose monstrositities in code and is, in his opinion, a bad thing compared to languages where verbs are parallel or even more first class than nouns - from which we get references to functional languages and the nirvana of LISP.
I remember learning java many years ago coming from the black sheep of all programming languages, Visual Basic. When I got to programming user interfaces with AWT and SWING, I remember being mesmerized by the sheer weight of it. In Visual Basic, one would double click on a button and the tool would create an event procedure that looked like this:
Sub MyButton_Click()
'code here
End Sub
I made the assumption that the tool was abstracting details away for me, but it was simple, intuitive, and effective.
In Java, I learned that to write an event handler I needed to implement an interface with a different class or override a method from an anonymous instance of a class that implemented the event handling interface. At first it seemed cool to throw all the terms around: "listener interface, anonymous instance... " but I had trouble stitching it all together cohesively by hand. It's been a while but I remember liking the idea of keeping a separate class to do my event handling rather than using an anonymous one but running into the trickiness of making references to data in the UI class where the event was being triggered.
I thought this was just a matter of tools; if I got the right IDE I would be able to nail the issue. But the IDEs I used tended to do things differently; I'm digging into memory here but I remember liking Borland's JBuilder for development and disliking how it used Borland helper classes for event handling to try to clean things up.
I think Yegge could have driven his point home about nouns if he'd focused entirely on event handling. To handle an event you need to know about two nouns: the listener interface and the class that implements that interface for you wherein you are given an opportunity to write your code.
I remember getting finally to go to training in Java (after I'd taught myself most of what I'd eventually know) and asking about that. People looked at me with the condescending "complexity is cool" look that usually sends Visual Basic programmers back to their environments to be productive.
And I can see some niceties of the extra nouns in Java. Building even more layers of abstraction is easier (e.g. handling many events with the same class implementing the listener interface) -
It's been a long time but I may be returning to the Java world; I made need to get Java certification for academic reasons. It will be interesting to study the language again with these thoughts in mind.
}
Monday, August 07, 2006
Joel, MapReduce, Javascript Closures, Flanagan
Older news is that Joel posted an excellent essay called Can Your Language Do This? where he walks through some of the basics of passing function references around in Javascript. I'll beat my old drum and say that Javascript is an intricate, powerful language.
The timing for the article is great because I'd just recently used function references as an approach to handling some client side script that needed to be synchronous. In the application we use a popup window that is launched in javascript and then based on some input from the user we pass back information to the page so that it can know how to proceed. The problem with this approach, however, is that a popup window is a disjointed entity from the page it popped up from and the thread that invokes the popup will not wait for the user to close the window before continuing with the rest of the javascript. My solution was simple: pass a callback function to the popup and use that to make sure the user interaction was finished before proceeding with the parent page's code.
Another essay I managed to finish over the weekend that runs along the javascript and functions as datatypes is Javascript Closures For Dummies by Morris Johns. Concise with beautiful typography.
One final thing: David Flanagan has a 5th edition of his Javascript book coming out from O'Reilly this month. I'm excited to see what his treatment of the latest developments such as Ajax will be. It will be painful to be buying that book for the third time, but if I get even a piece of the mileage I got out of the 4th edition, it will be well worth it.
}
Scott Gives Open Source, Step by Step
I've been wanting over the last few days to post Scott Hanselman's step by step tutorial on how to contribute to the DasBlog open source project. This weekend I had a chance to go over it, albeit without duplicating the steps - I'll do that soon enough.
It's always seemed a little sad to me that those of us working primarily with Microsoft development tools aren't as given to collaborating on anything that is either outside the scope of normal work or commercial effort. It's been a goal of mine to contribute to an open source project for a while and it's nice to get this little push in getting that done.
I did download DasBlog around TechEd time to study the structure of the application. It didn't quite install as easily as the *.vbs the readme file discusses but it was a simple permissions issue that I resolved by resetting server extensions on the virtual directory. At the time the NUnit 1.x binary was also unavailable so I had to remove the test projects in order to get it to compile.
Before I start writing patches, however, it will be important for me to have a proper understanding of the application's purpose, design, and implementation. I'm hopeful that my contributions while "dogfooding" will be more meaningful.
}
Wednesday, August 02, 2006
Google Code vs SourceForge
Comparison is made here. The use of Subversion on Google Code makes it appealing to me since I was planning to use Subversion for my home brewed projects anyway.
}
Linus on Visual Basic, Norvig on Javascript, Heinemeier Hansson on taste
Courtesy of John Lam - some of the greater fish in the sea of programming answered some questions on Sztywny Blog:
Sometimes you don't know whether a compliment is a compliment. Linus Torvalds says Visual Basic did more for programming than object orientation.
For example, I personally believe that "Visual Basic" did more for programming than "Object-Oriented Languages" did. Yet people laugh at VB and say it’s a bad language, and they’ve been talking about OO languages for decades.Peter Norvig, yes that Peter Norvig at Google thinks he needs to keep improving his Javascript. It always annoys me when people think they know javascript - not that it's unknowable, but knowing how to do alerts and toggle DIV visibility is for kids.
And no, Visual Basic wasn’t a great language, but I think the easy DB interfaces in VB were fundmantally more important than object orientation is, for example.
David Heinemeier Hansson gives the answers I would expect from him, especially espousing "values" as standing between good and mediocre programmers. For a long time I've been wanting to blog about his talk at Carson Workshops concerning "beautiful code."
The whole round table interview is interesting.
}
Monday, July 31, 2006
Thursday, July 27, 2006
Google Code
Wow, this is an interesting development: Google Code is an online project hosting/collaboration site. I'm sure they wouldn't describe it as an "answer" to Microsoft's own new project hosting/collaboration site, Codeplex, but the timing is interesting. The question that begs itself is "whatever was wrong with our old friend, Sourceforge?"
}
Wednesday, July 26, 2006
Generics + Bad Idea Jeans
I can't get the Bad Idea Jeans SNL sketch out of my head, but I'm not sure I trust myself. At the request of a coworker, I wrote the following to show how a generic Dictionary could be returned from a method with underlying types for key/value stated ahead of time:
public static Dictionary<X, G> BuildDictionary<X, G>(string cmd, string keyColumn, string valColumn) {
Dictionary<X, G> myDictionary = new Dictionary<X, G>();
SqlDataReader rd = new SqlCommand(cmd, GetConnection()).ExecuteReader();
while (rd.Read()) {
myDictionary.Add((X)rd[keyColumn], (G)rd[valColumn]); // ? good idea?
}
rd.Close();
return myDictionary;
}
It leverages generics to define the returned dictionary so that a call could be made like this:
Dictionary<int, int> data = DBDictionary.BuildDictionary<int, int>("myproc", "key", "val");
Perhaps I'm paranoid, or I've been burned too much, or I'm not scared of a little type dynamism, but this seems like a Bad Idea. The big reason, of course, is the casting that goes on in the method:
myDictionary.Add((X)reader["someField"], (G)reader["someField"]);
Reasons for my anxiety?
1. What if the underlying field has a change of type? You won't know until runtime when things blow up.
2. Maintenance if underlying field type does, in fact, change. If being type specific is avoided, you can gracefully accept these changes without a recompile. Even if your lookup (what's in the dictionary) is used, if it's passed to a SqlCommand as a parameter (which is the way I normally do it), the reference it expects is to an object type as in:
SqlParameter para = new SqlParameter("@Foo", objectRef);
3. I'm not afraid of strings. Over time I've been more reluctant to convert things, especially numbers. For example, if a numeric value is passed in the querystring, like:
http://myserv/Page.aspx?custId=101
Why should we convert custId to a numer if it's going to be passed to a parameter (see code above)? Another scenario is when some underlying value is going to end up in a textbox. I do not fear the string, just the Convert.ToXXYYZZ code I'd have to type out if I did want to be "type safe."
But some may feel differently, especially the ones who think that if something in the database changes you may want to intentionally have your code break so that you're aware of it. That's the only idea besides premature optimization that I can use to justify this approach...
}
Powershell Password Gen vs Hobbitwerk:::pwd
Scott Hanselman just posted an example of a password generator in powershell. Very cool, and reminding me of Hobbitwerk:::pwd. His script, however, is 7 lines of clean code.
Speaking of Hobbitwerk:::pwd, I'm surprised by how useful it's become not only for myself but for a lot of the people I showed it to. It's nice when a guy who's used to writing Me-ware makes something that other people leverage too.
}
Tuesday, July 25, 2006
Reddit Expansion
I'm cheering for Paul Graham's Reddit minions. The Reddit concept is brilliant, and now it's spawning into some really interesting variations (have I got them all?):
All of which are now subscribed now on my aggregator. It would be interesting to see the original Reddit code, which was written in LISP.
}