ADO.NET: Not Impressed

31 August 2006, 14:21 — Software Development

I was playing around the other day with .NET’s data capabilities, mostly the DataGridView component and its family of data access components, i.e. the DataAdapter, DbCommand, DbConnection and so on; and what strikes me is how difficult it is to built any kind of data solution in .NET; and how complex the API is.

To add further damage to it, the whole thing is rather poorly documented; so in order to understand it completely, you have to look at publicly available examples and read books to figure it out. And in doing so you keep running into problems: For instance, creating a small program that simply opens a database connection and displays a table for editing, seems impossibly difficult to make. It doesn’t seem like such a simple idea has struck the .NET community just yet.

To begin with, you need an SqlConnection; so instantiate one of those. Then put a DataAdapter on the form and let it generate different SQL statements that it needs to update the database with. Also let it create a DataSet, and fill this one with the data fields and types from the table. Next, place a DataViewGrid on the form, and tie it to the data using a BindingSource component. Then add code to open the Connection, and make the DataAdapter fill the DataSet with data. By now you should have a program that, when run, displays a grid of data which you can edit.

Except, of course, that the data isn’t saved. The data can be edited alright, but to write the changes back to the table, you need to place an Update() call to the DataAdapter (or DataSet?). When to do this, we might ask? Well, it doesn’t seem like the DataGridView is even remotely capable of doing so itself. It needs to be done for it. And all the examples on the Internet suggest that there should be a “Save” button on the form whereby changes, when pressed, can be written back into the table. I found one example where someone had figured out a way – through serious hacking – how to get it to write changes back to the database, as soon as you select a new row (gasp!).

This is absolutely stunning, since Delphi has been doing this very thing since, oh, version 1.x or something. Natively. You don’t even have to ask it. You slap a TDatabase component on the form; then slap an additional TTable on it, tie them together with a Grid through a simple, barebones TDataSource, set the Active property to true and it immediately works, right out of the box. No source code required. Really. In fact, you don’t even have to compile the program; the data is displayed right there in the Delphi dialog editor.

After some personal pondering, it seems to me that the .NET model is fundamentally flawed. Delphi’s VCL library aims to be transparent; that is, it provides a lot of functionality but doesn’t try to be all-inclusive. If any problems should arise, you simply peek behind the scenes to the Win32 API and do what you want (which actually rarely happens – if ever). In stark contrast, .NET goes the other way: It aims to be all-inclusive. The difference is, when .NET no longer can do what you want, there is no behind-the-scenes area that you can affect. It’s all or nothing. You’re Locked In.

And that means Problems, with a big P: I am gradually coming to the conclusion that .NET, for all its classes and namespaces, is an immature API – not surprisingly, though, given it’s 2.0 release status – and that it needs a host of specialized solutions on top of it, like open-source components, libraries and similar add-ons, that for years and years have been available for Delphi in abundance. .NET, in my view, is simply not much more than an additional API – a lot better than the old Win32, admittingly – but still far too complex and advanced for true Rapid Application Development.

It seems like Microsoft, for all their ambitions and efforts, still haven’t had the light bulb come on.

P.S. With my present luck, Microsoft will probably change everything in ADO.NET 3.0 so everyone will need to rewrite their applications. It’s only happened, oh, maybe three or four times in the past.

So You Wanna Be A Software Developer?

28 August 2006, 20:18 — Software Development

So you want to be a software developer? Well, take heed. There’s more to it than you think.

For instance, building computer software is…

  • New. Most other sciences have had hundreds of years of development. Construction, for instance, has been going on since the early days of the Romans, when they built acqueducts, colosseums, roads and palaces. To contrast with, the very first computer was built in the 1940’s, and has since then multiplied exponentially in processing power. We’re continually building bigger and faster computer systems, and no one has ever done this before. We’re all trying to invent better ways of doing it. Sometimes we fail.
  • A science. There are definite ways of doing this. All computers build on logic; and logic is a form of math. Math needs to be taught, learned, worked with and expanded. “Best practices” are formed; patterns of reusable ideas and materials have been compiled. There are many ditches along the road in which your code can be destroyed.
  • An art. Some parts of software development can not be taught. A person intent on doing everything by the book will miss his goal: It will either be too complex, too rigid, too weak, too expensive… The art of computer software is finding that Zen-like balance of perfection, where costs are balanced against structure, functionality against complexity. Someone said about project management in software: “Good, fast, cheap – pick two.” Somewhere in there is that elusive goal where you actually can pick three … but it takes skill, intuition, experience, and a sense of artistic balance which no science in the world can teach you.
  • Changing. Someone said, “Building a program is like building a bridge.” The reply is, “Building software is only like building a bridge, if you’re building it on Jupiter, using new and unresearched tools, and with materials that didn’t exist five years ago.” The computer world is constantly changing: New ideas come forth, new metholodogies are designed. New platforms to build software on appear, the tools are changing, old technologies fade away and new show up. Moving too fast, or too slow, can get you into problems. Maybe you take a path no one else took. Maybe you moved too slowly and now your platform is no longer available. To build software, you need to move ahead, in the right direction, and possess sufficient adaptability to embrace new technologies as they become reliable.
  • Complex. Because, probably, you’re not the only guy working on it. Chances are, you’re a team of people each building his own part. This means that you need management; you need to communicate your ideas; decide on important principles; not run into each other or building the same thing twice. You need to keep track of how things are going. You need to coordinate so the software can be observed and tested along the way, so you can see how it develops and functions. It’s an iterative, distributed process; and as any such process, it’s hard, because human beings don’t naturally communicate and coordinate. It’s an attitude that needs to be fostered into culture over a long amount of time. And sometimes you fail, and that means your project can fail.
  • Dangerous. A lot of projects fail. By failing we mean, it goes over budget, it takes longer than it should, or sometimes it never even completes but bogs down in a morass of unfinished parts. Some projects even drive businesses into bankruptcy. And that means you can lose your job – even if it’s not your fault, but someone elses.
  • Gut-wrenching. Most software performs an important activity in the Real World. Maybe the software runs hotel booking systems, or telephone switches, or ATM machines. Whatever it does, if it doesn’t work correctly – or, worst of all, crashes suddenly – you are going to know it. And you have to fix it – fast! It’s a special feeling to see the code you built suddenly handle hundreds of thousands of transactions per day. And if you made an error somewhere, people are going to get annoyed, angry, or furious. In some cases, such as if you’re building mission-critical systems – people may die.
  • Difficult. Some times, you have to be out on new ground and do things you never did before. That happens a lot of the time if you’re building new stuff. You’re deciding between different solutions, different tools; whether to go this way or that way. And both of them cost money, and you need to make the right decision because eight months down the line, you may not be able to go back and change it. This means you need to read books, study technologies, learn new subjects, catch up on your database skills, investigate new fields, and read complicated, technical manuals. Most of this you’ll have to do in your spare time.
  • Boring. Because there’s a lot of mind-numbing activities you need to do, too. Like writing documentation, thus making sure that other people will understand what you’ve done; or translating between different languages, because suddenly you’ve got customers in Japan, or Finland, or Mexico – and they need to understand you. Merging branches, estimating development time, implementing dull features in difficult programs are all things you need to do but rather wouldn’t. But all of those beat the most boring activity: Sitting down at the end of the month and trying to figure out what you’ve done, so you can fill out the time sheet. Or you won’t get paid.
  • Stressful. There’s no such thing as a lot of time on a project. Most projects in the business world need to be done yesterday. Sometimes projects take longer than expected, and this means new projects may start up before the old ones are done. Sometimes customers interrupt, sometimes your boss interrupts, sometimes things go drastically wrong when they shouldn’t; and sometimes, for no apparent reason at all, your tools give up and die. You need to be able to speed things up in a hurry, work evenings and weekends, and code fast, should that be required of you.
  • Incredibly fun. The joy of sitting down and building a new component with tools you like, perfecting a solution, designing a new system that you just know will work beautifully, can not be underestimated. For software developers, the tangible rewards in the form of money, luxury or similar is usually not the motivating factor. The reward is more in the form of being able to sit back, look at your Michaelangelo of art that you just built, and be immensely proud of that little labor of love.

Such is the life of a software developer.

I Hate Visual Basic

28 August 2006, 11:17 — Software Development

I hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate, hate Visual Basic!

Panzergeneral Heinz Guderian

26 August 2006, 23:44 — Military

guderian.jpgI have just finished reading “Panzer Leader: The memoirs of Panzergeneral Heinz Guderian“, a fascinating book about the man behind the Blitzkrieg tactics that revolutionized modern warfare.

The general himself describes the events during the 1930’s, in building up Germany’s armored force, the invasion of Poland in 1939, France in 1940, and the disastrous events on the Eastern front during 1941-1945. He was relieved of his duties twice because of lengthy and heated arguments with the OKH/OKW and with Hitler himself. Guderian was an outspoken man, who was not a member of the Nazi party and who disagreed with the Nazi ideals, but still fought as a soldier and officer during the wars started by the Nazis.

The book offers an insightful view into the German army, the Wehrmacht, and the military and political leadership during these years. Not everyone comes out looking good in the progress; least of all the clique around Hitler himself: Göring, Goebbels, Bormann, Himmler, Keitel and Jodl.

I met my friend Johan the other day over a plate of sushi, and we talked about Guderian and how it all seemed to go downhill after the fateful decision of diverting the 2nd Panzer Armee down towards Kiev instead of Moscow. But in the end, Johan suggested it was all for the better; had Guderian been given free hands, the Germans might actually have defeated the Russians and won the war.

Natural Keyboard Hacks

21 August 2006, 13:11 — Cool links

I recently got the new Microsoft Natural Keyboard 4000 here at work. It’s an absolutely great keyboard; every key is right where it’s supposed to be, it’s ergonomic, really quiet and has a limited but useful set of extra keys.

But one strange feature is the “zoom” key. It is located in the middle of the keyboard, extremely useful were it not for the fact that it zooms; it doesn’t scroll. And there is no way of changing it. It just zooms. So with this incredibly potentially useful feature, I can change the size of my Firefox browser text, which is something I typically do once in the lifetime of a Windows installation.

Fortunately, I found a way to hack the default behavior using this nifty web page. You simply edit the Program Files\Microsoft Intellitype Pro\commands.xml file, and look for instances of ZoomIn/ZoomOut, and change these to ScrollUp/ScrollDown. Typically, these rows start with C319 and C320, and should look like this now (brackets not included because WordPress won’t let me type them in):

C319 Type=”6″ Activator=”ScrollUp”
C320 Type=”6″ Activator=”ScrollDown”

Then you restart the Type32.exe process (or restart the computer), and you’ve got scroll instead of zoom.

Back in the old days, you’d have to edit registry values or patch the binaries. Nice of Microsoft to include an xml file this time. Kudos to MS!

Google Talk

18 August 2006, 15:42 — Reflections

I downloaded Google Talk a few days ago. It seems that is the only IM client that can penetrate these dark and ominous firewalls here at my company.

It works great, so far. It doesn’t, of course, integrate with any other protocol, so you’re sort of limited to the gmail user base; but it’s neat and simple and does what it’s supposed to do.

One feature that strikes me as odd: You can decide to let Google Talk set your “away” message to the mp3 song you’re currently playing. I wonder who thought that feature up.

The Fairy in the West

16 August 2006, 21:46 — Poetry

THE FAIRY IN THE WEST came walking by the shore
A robe of woven moonlight strains she wore
She quietly walked in mists of dawn
With gentle steps like woodlands’ fawn
Singing seafarer’s songs of ancient lore.

THE FAIRY IN THE WEST caught my silent gaze
And heard the songs and trumps of my hearts’ praise
Smiling, she beckoned me nearby
“Come with me”, she said; I could not defy
Her melodious voice, and eyes for me ablaze.

THE FAIRY IN THE WEST walked side by side with me
Over cliffs and streams and meadows by the sea
But through the veil of loving theme
She slowly faded in my dream
And I awoke and knew, it cannot be.

I keep her in my heart’s locked treasure chest
Where from her blushing smiles my soul is blessed
Whom once held dear, now forever more
By fading picture I adore
My fairest lady, my fairy in the west.

Why I Love McDonalds

13 August 2006, 18:18 — McDonalds, Reflections

McDonalds logoI like McDonalds.

Whenever I say that, people look at me funny. Both in Sweden and the United States. For Swedes, McDonalds represents the arch-enemy (pun intended) of Swedish culture; invading our poor nation with globalistic, imperialist capitalism; fattening our children; destroying household dinners; and carpeting the country with cheap and unhealthy fast food. To Americans, McDonalds represents the lowest common denominator of fast food, neither upscale nor fancy; the place you go where there’s nowhere else to go.

So why do I like it? Is it because I know the manager of the two Mc restaurants in town? Because many of my friends have at one point or other worked there? Because I’ve been there so often (purchasing coffee!) that the staff almost knows me by name now?

I fell in love with McDonalds way back in 1994, during a trip down to Roumania with the bible school I attended back then. We were just passing through Hungary, and stopped at the familiar golden arches just past the border checkpoint. A bit of familiarity on the road; and then we drove on down to Budapest. And it was there that we discovered that one of the ladies with us had forgotten her purse, complete with visas, passport, money and everything. Without this purse it would be impossible to get into Roumania. And with everything we suspected about this former East Bloc nation, the purse would be gone since long by now. Catastrophic failure loomed on the horizon, not to mention endless agony and waiting at the Swedish embassy.

Out of desperation, we stopped at a McDonalds in Budapest. It turned out it was managed by an American who had moved there, who sympathised with us and our missions trip, and not only did we get to spend time there, eating good food, using the facilities to wash up and look nice again; but the manager also called up to the restaurant in North Hungary. They had found the purse, with everything intact in it! So at McDonalds expense, they put it in a taxi and drove over 300 kilometers down to Budapest and handed it off to us. Then smiled, waved us off and wished us good luck.

It’s things like that, that imprints into your soul. Ever since then, McDonalds represents a welcome sign on the road, a bit of home. A Big Mac is a Big Mac, wherever in the world you go. And to me, it feels like wherever I go, there’s always a friendly smile behind the counter, waiting for me.

You can’t beat that.

Home from Minneapolis

13 August 2006, 1:19 — Cool links

MinneapolisJust writing to mention that I’m home from Minneapolis, and be sure to check out the picture gallery from my trip! Available either by clicking here or on the “Minneapolis 2006″ link in the list on the right.

Gotta love America.

Urbanization in America: When Wal-Mart Takes Over

9 August 2006, 17:51 — Reflections

America is growing. By 2000, it had a population of over 280 million people, and it is still growing ever larger. For instance, according to npg.org, the projected size of the U.S. population forty years from now will be well over 400 million. And you don’t have to look far either to see that the population has effectively doubled since 1950.

Wikipedia: Traffic CongestionWith such a massive population growth, it’s interesting to note the effects of it. Traffic, for instance, is growing every year. According to RAND Florida, the size of the Miami population has in 20 years increased from 3.3 million to 5.1 million, and at the same time the freeways and arterial highways traffic has doubled; but the average hours spent by motorists in traffic delays has exploded from 5 to 29.

While down in Mankato, MN yesterday, checking out the Vikings Training Camp, I headed downtown for a coffee during exercise sessions and got to talking to a gentleman running a book exchange store on one of the downtown main streets. We talked a bit about our common ancestry (his grandparents were either Swedish or Norwegian, I think), and then came upon the subject of urbanization and society growth. And it’s easy to see how stores like his would be threatened by America’s growth. Minneapolis keeps growing, larger chainstores move in, and soon you have a Wal-Mart in town that kills all the little Mom-and-Pop stores. While Mankato has yet to feel the brunt of this unquenchable capitalist force, it is only a matter of time; a while ago I read that Wal-Mart feels it is possible to double, or even triple, its current presence in the United States.

Every generation in this world has been different from the last. Our elderly sit on benches and complain about how much better life was in the fifties (or at least, how different it was). I bet the elderly back in the 1860’s sat on the benches and complained about how all these civil wars swept the world these days, all the youngsters that get killed, and how all of these Mom-and-Pop specialty stores threaten the traditional farming structure of the society. Interestingly enough, Henry David Thoreau would carry out his experiment in simple living (Walden) already in 1845.

I suppose we’re still trying to find our place in this world; still trying to define our society, using blunt and sometimes inaccurate tools of either releasing or restraining capitalistic forces. Zoning commissions, city councils and legislative boards all do their part, but the actual shaping of the land is much up to business. Shopping malls, of which the Mall of America is a good example, tend to localize and congregate smaller stores into retail centers. Stores grow larger, so does parking, freeways, and all the other accomodations necessary to house these gigantic warehouses of commerce. For sure, Mom-and-Pop stores may not be the Ultimate Way to do things, and probably neither are the shopping malls of the 20th century; although maybe malls are better way than the last one. And what if our population grew a hundredfold? What would a society of 20 billion look like?

Clearly, some remedies against overcrowding are clearly available, although they may in different places be severely underutilized. For instance, subways and light-rail transportation networks become ever more necessary the larger the population grows, and is a marvelous tool against urban sprawl; and as a European it is strange to look at the Minneapolis/St. Paul metropolitan area of about three million people, which just recently opened its first Light Rail line (for a comparison, see the overview of the Stockholm, Sweden metropolitan subway/light rail network; Stockholm is about half the population size of the Twin Cities).

Trying to foresee the future is always difficult. The world is in a state of explosive growth in many places. The structures by which our society expresses itself keep changing all the time. Is it a bad thing that small stores go out of business, to be replaced with shopping malls and superstores? For sure, it’s different. But maybe the Wal-Marts, Targets, Sears and Home Depots of today are just another milestone in the development of our society. While we may not grieve the loss of them, someday I have a feeling that they will be replaced with something even more humongous, and that day our kids will sit around and gripe about all the freedom we had when we still could drive our own cars.

Older Posts »