While I'm not exactly the first one to do so, I would like to throw my congratulations out there as well. I just listened to this interview about the creation of Delphi, and it definitely brought back memories.
At the time, I was working for Med Data Systems, Inc. out of San Diego in my first gig out of college. It was a great time of learning and finding out exactly what it meant to be a professional software developer. One of my tasks was to port our DOS codebase to a Windows application. Since we used Turbo Pascal for DOS since version 5.0, it seemed like a natural fit to stay with Borland. We looked at TPW and VB, but in the end, once we saw what Delphi was like, there was no need to look any further.
My boss, Steve Belkin, and myself ended up flying up to the launch event in San Francisco (try explaining to your girlfriend that you're heading up to San Francisco over Valentine's Day and see what kind of look you get ). It was every bit the event that you've heard it was. If anything, the reports don't do it justice. It was truly a once-in-a-lifetime experience to witness the event first-hand, from the initial technical session where we got free software, to watching the stampede of people on the floor clamoring for the trial copy. Not to mention, Borland throws the best parties in the industry, and this one was probably their finest ever. I do miss Cadillac Margaritas...
This is a quick followup on my post, HTTPSRVR with Apache. If you're using an older version of httpsrvr (e.g. from Delphi 6), then you need to add the following OnCreate/OnDestroy events for the main httpsrvr WebModule. The reason you need to do this is that each thread needs COM initialized, and Apache doesn't automatically do that initialization (whereas, IIS does).
procedure THTTPServer.WebModuleCreate(Sender: TObject);
begin
{ Each web module will be in a separate thread. We need to initialize
the COM subsystem for each thread }
if Assigned(ComObj.CoInitializeEx) then
ComObj.CoInitializeEx(nil, COINIT_MULTITHREADED)
else
CoInitialize(nil);
end;
procedure THTTPServer.WebModuleDestroy(Sender: TObject);
begin
CoUninitialize;
end;
I recently needed to get some simple XOR-type encryption. At first, I was led to TI2803 by Borland. However, that tech note has some problems with the strings having unprintable characters in it (specifically, #0 is troublesome when passing the string around).
I finally came across Peter Martin's solution, which solves all of my needs quite nicely.
Ages ago, back when httpsrvr first came out, I got it working with Apache for a client. Recently, I came across a post by Sydney Delieu in the borland.public.datasnap group outlining the steps needed to get this working today. It strikes me that things are quite a bit easier today than before to get this working, but I did test these directions, and they work well.
I use Apache 2.0.52 with httpsrvr.dll. To get it working:
1. Install Apache (I will assume default directory structure for 2.0.52). 2. Copy 'httpsrvr.dll' to your /apache2/cgi-bin directory. 3. In httpd.conf, change the 'Options None' (again assuming defaults for 2.0.52) in <Directory "C:\Program Files/Apache Group/Apache2/cgi-bin"> to 'Options ExecCGI'. 4. AddHandler isapi-isa .dll to your httpd.conf. 5. Restart Apache.
Surely, you've heard Larry Wall claim that the best traits a great programmer can possess are Laziness, Impatience, and Hubris. If not, stop right now, read the link, and come back here. I think it is brilliant analysis on Larry's part to tie all of that together, and I also believe it to be true.
In contrast, let me explain why the vice of arrogance can't actually be turned into a virtue for a programmer. I'll even argue that arrogance in a programmer is inversely proportional to their talent. Now, before the hate mail starts pouring in, I'm talking about extremes here. There is a fine line between self-confidence and arrogance. I think it is vital for a programmer to have an abundance of self-confidence. I'm sure there are some in my readership that would even claim I walk that fine line betweeen self-confidence and arrogance from time to time. Self-confidence is good. Programmers can, and do, help shape the world. They build systems that catch criminals, thwart terrorism, pilot airplanes and rockets, map DNA, analyze stock markets, and many other potentially world-changing things. It's only natural to look at what you've created out of thin air and be proud of it, and by extension, gain self-confidence.
However, with apologies to Wall Street, Arrogance, for the lack of a better word, is horrible. It's especially troubling for a programmer to be arrogant while coding. Let's look at some of the main reasons for this claim:
- Arrogance leads you to not question your code. The more talent and experience that I obtain as a programmer, the more I look at my code as the source of the problem first. Most of the time, the problem is in my code. The times that it's a bug elsewhere, I've taken all of the basic steps to gather a test case to prove that it's not my bug. From there, I can either write a work-around, and/or report the bug to the responsible party in a way that allows them to fix the problem easily.
- Arrogance leads you to rely solely on yourself. After all, if you truly are that good, why would you want to take advice from anyone? As a programmer, I relish the opportunity to learn. It doesn't matter where the knowledge comes from. I'm just thankful to gain it. Arrogance closes your options, since the Arrogant Programmer refuses to accept that there are others with an alternative approach.
- Arrogance leads you to write "tricky" code. This make perfect sense, since it clearly demonstrates the superior intellect and raw genius of the Arrogant Programmer. Documentation? Comments? Meaningful identifier names? Pshaw. They're for mere mortals. The Arrogrant Programmer knows the ins and outs of every system, subsystem, and method, and knows that a call could never fail because it has been given life by the Arrogant Programmer. And heaven help the next programmer who dares disturb us to ask why they did such things! Clearly, they are not worthy to breathe the air of the Arrogant Programmer.
- Arrogance is most likely rooted in a false confidence. The Arrogant Programmer may be afraid of not knowing everything, and even more afraid that others will find out that they don't know everything. As a result, the typical mindset is to tear code and people down, instead of building themselves up. You should love working in a team full of great coders. If you want to rise to the top of the top (in anything, IMO), you need to be pushed and challenged. If you find yourself in an environment where you have others keeping you on your toes, it spurs you on to be better than you were before.
So, let's all strive to live by this motto: Friends don't let friends program arrogantly.
Let the flamefest and slashdotting commence!
I recently went to the state GoldenTee championship. It was a lot of fun, and I look forward to next year to improve on my finishes (I took 2nd in doubles and 4th in the open singles bracket). You can find a pretty good summary of what happened here. If anyone wants to inquire about the 3rd/4th place match, I'd be happy to relive the horror story for you in person - over a beer.
We now return to your regulary scheduled blogging lineup.
I wanted a way to name threads to make it easier to debug, but since I'm still using Delphi 6 for the next month or so, I don't have access to the named thread object wizard in the Delphi IDE (as can be found in Delphi 2005). The code that is generated in Delphi 2005 when adding a named thread uses the technique found here:
MSDN article on naming threads
There are some other options, too. See this Google thread for a link to a CodeCentral entry and a technique for making setting the name more flexible.
I came across this post today, talking about names as viewed from an intercultural perspective. It was a good read, but it triggered something in me that I knew I had to blog about, namely a quote that bites me time and again: "Writing the code is easy. Naming it properly is hard.".
I'd say this problem is pervasive, based on my experience. How many times have you seen code that does "for i:=0 to Count-1 do"? OK, maybe that's a stretch. Counter variables don't exactly require great names. But still, the point remains. Badly named variables, methods, components, etc. are very common. I find that when this happens in my code, it's due to a failure in my understanding of exactly what the code is meant to do. In the old days, you just had to change things around until they make sense. Today, it's called Refactoring.
My advice is that when you find yourself starting to have to do mental gymnastics to keep track of what a variable/method/etc. is used for, it's time to immediately change either the purpose or name of the variable (or both). It may be a minor inconvenience now, but it will pay major dividends the next time that code is looked at.
|