Archive for January 2010

Learning Delphi: A true story

It’s pretty common where I work to go out to lunch together with other coworkers. We’re located downtown, right across the street from a major shopping mall and with plenty of restaurants within walking distance. A few months ago I was out with a few of the other coders, and one of the guys, David, told the story of how he got into programming. It made quite an impression on me. You’ll see why. Unfortunately he’s no longer with the company, so I can’t get the exact story from him to retell here, but I’ll give the idea of it here.

Disclaimer: Even when I give the story from his perspective, they aren’t exact quotes by any means. My memory’s real good, but not that good! But this is the basic idea of what he said, with no ficionalizing.

He wasn’t originally a computer programmer. Hadn’t even really studied it in college. David’s degree was in accounting, and he was working as an accountant with an insurance company back in the 90s. He explained, “They had a tuition reimbursement program set up with the local college. You could take classes there, and as long as you got a B or better at the end of the semester, they’d pay you back for the courses. The tuition was several hundred dollars per course, so you had a pretty strong incentive to do well in them!

“Anyway, I was working with this insurance company, and my job was to take care of custom policies. They had this thing where they’d write out custom policies for all the small businesses in the area, which were all more or less from the same template but with a bunch of cudtomized details tailored to each one. And every month I’d get this big stack of a few hundred sheets of printer paper and have to crunch all the numbers. It was annoying, really tedious work.” We commiserated with him about how much that must have sucked, as we sat there waiting for our orders to arrive.

“After a while I got them to give me direct access to the database to read these values from, instead of giving me a printout from it, and that helped a bit, but there was still a lot of stuff I had to do by hand. I got to thinking that this was the sort of thing that could be simplified by writing a computer program, if only I knew how to. Well, they had a course at the college on database programming, and I signed up for it.”

He looked at us a bit wryly and said, “To this day I don’t know how I actually got into the class. I wasn’t paying enough attention when I registered for it. Turns out it was a graduate-level Computer Science course! I didn’t have any CS background, and after the first day in the class I was completely lost. The entire grade for the semester was based on a project. You needed to create a database program to solve a real-world problem. And it had to have a graphical user interface, it had to have reporting…” he listed off several requirements, and this was about where I saw where the story was headed. It was almost like he was reading off a lit of Delphi’s historical strong points.

“I was completely lost. I didn’t even know where to start! But I’d already paid the tuition and I couldn’t get it back without a B or better in the class. So I went to talk to a friend of mine who was a professor in the CS department. I explained the problem to him, and he listened, and when I was done he thought about it for a moment. ‘Well,’ he said, ‘you could try Visual Basic, but there’s this new thing that just came out that might work better for you. It’s called Delphi.’ He was able to get me set up with a copy, and I installed it on my computer at work.

“For the next few months, that’s pretty much what my life was about. I’d work on my job during the day, then stay after in the evening to figure out how to use Delphi and how to make it talk to a database. Needless to say, I didn’t get very much sleep! But when the end of the semester rolled around, I had a working program. And I ended up getting an A on the class.”

Ladies and gentlemen, that right there is a testament to the power of the Delphi language! From a cold start, no programming background at all, to writing an app good enough to ace a graduate-level CS course in a matter of months. Granted, David’s a very intelligent guy, and that certainly played a part in being able to pick it up so quickly, but even so, a lot of it’s the Delphi language itself. (You’d never see results like that in the C family!)

Delphi is an evolution of Pascal, which was originally created by Niklaus Wirth as a teaching language. Being easy to learn was an explicit design goal. That originally came with a few tradeoffs and drawbacks, but the Borland team managed to extend the language into a powerful general-purpose programming system while still holding to the Pascal philosophy of making the language’s syntax and semantics as intuitive and easy to understand as they could. That’s what made it possible for David to pick up so quickly, and that’s why even experienced programmers who have been coding for years love Delphi: the language just makes sense. It may not have <insert trendy feature from some other language here>, but language design makes the code, even code the dreaded “other people’s” variety, easier to read and comprehend, and that counts for a lot in modern team-based software development.

In Object Pascal, things make sense, and they tend to work right even if you don’t quite understand them. IMO this is the main reason why so many people who know Delphi actually find it enjoyable to work with, as opposed to just something they write code in because they need to get something written, and why they sometimes even go so far as to call it “the best programming language.”

Abusing extended RTTI for fun and profit

I’ll admit, I don’t like the default settings for Delphi 2010’s extended RTTI.  Making almost everything included by default ends up compiling a ton of junk into the EXE, most of which will never get used.  But every once in a while, you can find some sort of use for it.

Continue reading ‘Abusing extended RTTI for fun and profit’ »

Programming Ethics 101

A few days ago on StackOverflow, someone posted the question, How can I keep Task Manager from killing my program? The first comment asks a very good question:  “What legitimate reason do you have for doing this?”
It reminded me of the guy who wanted to know how to make a file that can’t be edited or deleted by any means. Both of these guys seemed to have honorable intentions, but just hadn’t thought the ramifications through all that well. Continue reading ‘Programming Ethics 101’ »