Here's an embarrassing admission: Alphabetical sorting makes absolutely no sense to me. Okay, that makes the problem sound worse than it actually is. I'm pretty comfortable when it comes to the A-Z part; in fact, I can recite the alphabet backwards quicker than anyone I know. But everything after that confuses me. Specifically, I mean when we have to sort based on the non-alphanumeric characters. You're confused, I'm confused, let's look at an example.
Here are three strings:
test
test 0
test-1
If you threw those into a database table (or just created files with those names) and sorted alphabetically, they'd display exactly as I have them listed there. If we alter the strings just a little bit, it gets drastically weirder.
Let's say we add a period and an a to the end of each, so they're now:
test.a
test 0.a
test-1.a
Now sort alphabetically. The results:
test 0.a
test-1.a
test.a
Isn't that weird? We add the same two characters to each string, and suddenly the first result jumps down to last.
You can make it even weirder. Alter the strings slightly, so that the dash is located in a different string:
test-0.a
test 1.a
test.a
Sort alphabetically, and it's now:
test 1.a
test-0.a
test.a
Wacky! After messing around with this for 10 minutes, I successfully disproved gravity, thermodynamics, and the electoral college.
What's going on here? I have absolutely no idea, but this oddity does rear up occasionally to bite people in their rears. One example might be a developer who saves revisions to his specs with numbers (ie, he'd have db schema.doc, db schema 2.doc, db schema 3.doc). Well, with this loony sorting, I bet he'd open up the wrong document a lot, simply because the order of the documents is contrary to what we normally expect in a sort like that.
Anyone have any ideas on the crazy rules behind this? It's probably near the bottom of the list on the world's greatest problems, but it is interesting to play with.
I've seen a few ads out there for igrep, which is supposed to be a search engine specifically for developers. In my opinion, a true search engine for developers would answer answer half of all searches by printing "You're an idiot" and then banning the user from the site indefinitely, while the other half of the searches would return nothing but nude renderings of Princess Leia.
Curious, I went to the site today and typed in a standard, code-geek search term, in this case 'class'. The results aren't pretty; the vast majority of the hits on the first page refer to an HTML tag, not anything related to OOP. Also, not only are all of the results from source code, but they're all from the same site. It doesn't like promising, if you ask me.
I found quantitative proof worse than all of that, however. If I search for 'string', igrep shows me the following stats:
Results 1 - 10 out of 154041 documents matched in 0.441 seconds
Results 1 - 10 of about 97,300,000 for string [definition]. (0.09 seconds)
One tenth of one percent of the matches, and it only took five times as long! Goodness gracious, it's no wonder they're advertising so heavily.
I'm starting work on a new project at home; I'm calling it Operation World Domination Through Utter Secrecy and Crappy Coding. The scope of the project is pretty impressive; I'll be creating both a website with a webservice, and a client-side application. The initial plan was to use Python for all of that. Unorthodox, sure, but everything I read suggested that Python could handle it. Well, before I signed my first born over to the dark lords of Python, I decided to do some proof of concept code. I wanted to create some of the objects I'd be manipulating, as well as a simple GUI in wxPython. It seemed like a reasonable plan for the weekend.
Err, scratch that plan. It turned out I didn't even get to the GUI because the OOP was so confusing. And by confusing, I mean that I couldn't figure out how to make a private method for a class. I did some searches in the newsgroups, and while I found plenty of hacky ways to do it with underscore prefixes and all kinds of baloney like that, it's just not a feature of the language. Someone said that was deliberate because "we're all adults here". Pish posh!
To me, an object-oriented design is about managing complexity. Private methods are a large part of this, helping the class designer to encapsulate some of the complexity into parts of the class that the class implementer will never see. That way, one only needs to know the bare minimum in order to implement the class. I like that. If I want to implement the class, I shouldn't have to dig through a litany of methods related to the inner-workings of the object in order to find the stuff I need. And if I'm designing a class, I don't want these stupid programmers messing things up by calling the methods that they have no business using. Whether we're all adults here or not, encapsulating that complexity is a good thing.
It's possible I'm completely wrong here. I do hope so. If not, I may have to approach Operation World Domination Through Utter Secrecy and Crappy Coding from another direction entirely. It'd be equally unorthodox, of course, maybe in LOGO or something. I can make that turtle move with the best of em.
At work, I'm the Visual SourceSafe administrator. You can probably guess what a sweet gig that is; it's roughly as glamorous as being Lead Poop Wrangler at the San Diego zoo. At home, I'm slowly in the process of setting up a development server, and as part of that, I needed some form of source control. Already spending a good portion of my work days screaming at SourceSafe, I knew I didn't need to add that to an already volatile home environment, what with my cat and me. I decided instead to install Subversion.
I had neither used nor installed Subversion before last night, but an observer never would've noticed. The entire thing went really, really easily. In case you ever want to try it out, here's roughly how it broke down.
1. I downloaded the Windows binary from here.
2. I installed from the .msi file. Subversion asked for no configuration information at any time in the process.
3. Confusion sets in. It couldn't be that easy, could it? Don't I need to set up user accounts and what not? To check it out, I downloaded the TortoiseSVN from here.
4. I installed TortoiseSVN from the .msi file. TortoiseSVN also didn't ask for any configuration information.
5. At a loss for what to do, I right-clicked on one of my folders and discovered that TortoiseSVN was already integrated into my Windows Explorer. One of the new options on my right-click menu was to create a new repositoy. I created such a repository in a blank directory and placed a test file in there.
6. Once I had my repository, I created another folder, right-clicked it and went to Checkout. From there, I browsed to the repository on my machine and clicked OK. Suddenly my test file was in the directory, along with a little green check mark next to its name. Way cool.
Subversion just works, which is great after my epic struggles with VSS. There's a lot of configuration options available, but you don't need to mess with any of that before using the service. The only confusion for me was in Step 6, where I was trying to locate my repository. I couldn't figure out the format it was expecting for the path; all of the instructions I read online were incorrect. It's way easier to just browse for it.
Ultimately, it took maybe 10 minutes before a new Subversion fanatic was born. Kudos to all of the developers who played a part in this tool.
Question! Does anyone know of a developer-friendly VoIP company? Perhaps one that already has some good APIs out there I can mess around with?
Now that school is over and I'm left with plenty of time, I'd like to fulfill one of my ultimate fantasies, an application that answers the phone for me. After that, maybe I can write something to make all of my outgoing phone calls for me. Hopefully, little by little, I can automate all manual tasks in my life, building up into some sort of robot butler who does everything for me.
I found something very interesting in the NY Times today. On their site, they have a little flash app dealing with class in America. On the first tab, you select your occupation, education, income, and wealth, and it can tell you in what percentile of society you fall. The occupational ranks are ordered by prestige, based on survey responses. It's fun to play around with, and being a curious little monkey, I couldn't help but investigate the prestige rankings of the various techie professions.
The most prestigious position in computing, apparently, is that of database administrator. Not only was it the most prestigious career in computing, but it's the 3rd most prestigious job out of the 447 job titles on the survey (coming in just behind doctors and lawyers). Man, that's almost too wild. Is it only a matter of time before there appears a series of commemorative plates and coins, celebrating our noble DBAs? Someone please tell me that Little League participation rates have plummeted because every boy is chained to his Playschool My Lil Database box, tuning his indexes.
Another thing I found interesting was that there's a pretty big disparity in the rankings between Computer Software Engineer (18th) and Computer Programmer (64th). Ranking ahead of both was Computer Support Specialists, at 9th overall. Didn't we, the collective people of the Internet, agree informally some years back to hate all tech support personnel? Someone is reneging, and I won't stand for it! But 9th overall, wow, that's pretty impressive. Support is both hard and unpleasant, so it's good to see these folks getting some props.
The least prestigious job in the Computer/Math section is Actuary. I don't really know what actuaries do, but going by the rankings, I'll guess it has something to do with lepers.
Another thought relating to the politics of if statement brackets. Let this go to show that no matter how uninteresting a subject is, I can ramble on about it ad infinitum. One of these days, I'll take it to the logical extreme and start writing novels on zoning laws or something.
To me, the fact there can even exist a hoopla on bracketing is a strong point for bracketless languages like Python. In Python, the statements under your if condition look the same, no matter how many of them there are. It's all predicated upon your use of whitespace (which is mandatory), not bracketing style. Okay, that's confusing; allow me to demonstrate.
Let's say you have a trivial example like the following:
if (x == 1):
y = 2
And a few months later, you need to complicate your if condition a little bit. You don't have to worry about adding in any stupid brackets, you just indent your new statement consistent with the old statement.
if (x == 1):
y = 2
z = 3
Voila, it works perfectly. If you try doing it any other way, it'll mess itself. I like that, not the messing itself part but the enforcement of standards. There's little room for silly style wars when you utilize a language with meaningful whitespace.
(BTW, Brendan sucks for commenting on this issue before I could get this posted. I'm sending my Internet hounds after him.)
I found an interesting discussion on the JoS forums today on the necessity of using brackets in your if statements. To me, it's mind-boggling that this is even an issue. The hoopla is whether a programmer should be shot for typing
if (i != 0)
foo(i);
instead of
if (i !=0)
{
foo(i);
}
The worry here is that the coder may mess up later if she needs to add another statement under the if condition. If you opt for the first route, add your statement, and forget to throw some brackets around the whole thing, you'd introduce a bug. I understand the argument, but how often does this occur? I've never seen it. It seems to me that you're not expecting much competence in your developers if you're mandating trivialities like this.
I write many if statements without brackets. For me, seeing code like that implies simplicity; there's one statement under the if condition and it's a no-brainer. That's how I've always coded, and for me, it makes the code easier to read. If my boss were to start peering over my shoulder and barking at me every time I used this tactic, I think I'd be a little insulted. How much faith do they really place in me if they can't rely on me to write a simple if statement?
Making such a big deal over such minutia is a trade-off. On the one hand, you may be preventing a few rare bugs. By doing so, you risk alienating the folks in the trenches. Is that a worthwhile transaction?
Going to users' group meetings can have a funny effect on you. A few months ago, I went to a joint meeting of the Austin .NET Users Group and the SQL Server Users Group (ADNUG and CACTUS, respectively). The main SQL Server speaker was this portly, bearded Tasmanian devil of database knowledge. It was really cool to listen to him because the guy just knew everything, and he'd used that knowledge to develop some interesting opinions. I was so impressed, I became really curious about where he worked, thinking it'd be some hotbed of technological breakthroughs. The actual place? The Scooter Store. An interesting gig certainly, and one that only piqued my curiosity. Apparently, the elderly will tolerate absolutely no data loss.
Last week, we bring a fellow in for an interview. Before the interview begins, I get a chance to look at his resume and I see that he's spent some time at the Scooter Store. For the first 15 minutes of the interview, I had ants in my pants as I waited for a chance to ask my question. Finally, I couldn't take it anymore. At the next split-second of silence, I barged into the conversation and bellowed, "Tell me about the Scooter Store! What's your relationship with the round database guru?!"
Thinking about it in advance,, it seemed totally likely that at some point throughout the course of my life, I'd find myself screaming about a motorized wheelchair store. I just didn't think it'd happen so soon.
Man oh man, I came up with a great idea for a summer project yesterday. I
even came up with a zinger of a name for it. If I had a million dollars for
every project I devised, gave a clever name to, and then failed to complete,
I wouldn't be screwing around on this site. No way, I'd be running down the
streets with burlap sacks full of Sacajawea dollars, whomping people on the
head with it. And whenever someone tried to arrest me or stop me, I'd hand
them one of the bags. Can't you see the beauty of it?
I think I'm going to be changing the format of this site from longer,
less-frequent updates to short, frequent dispatches. All of that essay-type
stuff takes a long time to do, plus I hate sounding like some pompous
windbag. More pomposity, less windbaggery, that's my thinking. Also, it's
hard to motivate myself to do any coding after spouting off here for several
paragraphs. So there!
Recently, I talked a bit here about technical interviews, and my experience with them. Well, we've done a few more interviews at work, and I now have a couple more precious diamonds to share with the people of the internet. And trust me, they're so diamondy, Scrooge McDuck would be tempted to dive into them and swim around for a while.
Diamond the first: specific questions rule. I've noticed that when you're speaking in very general terms (such as about the development process or your experiences in the past), you can sound good without saying a lot. (That's what I do here a lot, except I just say a lot and sound like an idiot.) Anyway, in those interview instances, the only way to separate the sizzle from the steak, as it were, is with specific, technical questions. I did this through a list of coding questions that a couple of us developed. They were heavy on pseudocode, OOP, and then a few language specific features. The good thing about these questions is that they had right answers, so we had a way of measuring the knowledge of the candidates aside from how pretty the answers sounded. If anything, it seems like there may be an inverse relationship between the ability to answer a vague question and the ability to answer a specific one. I don't know how you could figure that out without a couple of hard questions whose answers you knew.
Diamond the second: if the specific questions don't work out, you need something else to talk about. Interviews are long, usually at least 30 minutes. If you opt for the specific questions route and the candidate is having a really, really tough time answering them, you're going to have a crapload of awkward time. In those cases, I've found it's good to go back to asking the vague, general questions. Let the candidate leave thinking that he bowled you over at the end, as opposed to him leaving depressed and looking for the nearest store that sells cannonballs.
Diamond the third: let the questions do their job. It's not your job, as interviewer, to cut the candidate down to size. That only makes things uncomfortable for both of you. If someone has an attitude and you want to cut them down to size, ask them some specific, technical questions. It could be that they're a genius and have a very good reason for such an attitude, or it could be for something else entirely. Most of us aren't psychiatrists, so it's not our job to figure it out. The candidate has to impress you, not the other way around, so ask the questions, let him answer, and get on with your life. There's nothing to be gained from grandstanding or proving yourself to this stranger.
And now, my brain is empty. There's absolutely nothing left in there, as it all just got dumped out for you. For proof, I point to the fact that I just tried to eat my stapler. Interviewing is interesting, especially if you're one of those folks whose spent most of their time answering the questions rather than asking them. By doing a few and analyzing the results, I'm not nearly as dreadful as I used to be. The folks at the cannonball store may say otherwise.
Either the UI world is passing me by, or I'm just beginning to understand the boundless nature of my own stupidity. I'll wager on a little bit of both. I make that point because I realized today that what I thought was a universal standard amongst end-user applications is not a standard at all. In fact, it's a tangled mess of gobbledy-gook. Okay, you're dying from anticipation: what on earth am I speaking of? Well, only the most exciting feature of any application, the keyboard shortcuts.
Programming is maybe the laziest job in the world. I don't know of any good ways to compare laziness across professions, but I think on one point alone, we take the cake: programmers are so lazy, sometimes it's too much work to even use the mouse. "What, you mean I'm supposed to move my right hand 3 inches to the right, click something, and then move it back to the keyboard? What is this, a prison camp?!" (I can say all of this because I'm far worse about it than most.) For years now, application developers have recognized this laziness and actively encouraged it through the use of keyboard shortcuts.
The way I thought keyboard shortcuts worked was that when you opened up an application, the menu bar at the top became populated with a grouping of menu items. In each menu item, a letter would be underlined; this underlined letter informed the user which key could be hit in combination with the Alt key in order to access that menu item. If you see the F is underlined in File, then you recognize that Alt+F activates the File menu. I just assumed that's how all applications worked.
And then today, while using Visual SourceSafe, I realized that I was far too busy to move my hand the few centimeters' distance to the mouse; I needed to start using the shortcuts. I looked up at the menu, and to my shock, I saw that nothing at all was underlined. What the heck? What happened to shortcuts? For the love of God, who will think of the lazy, unkempt superdorks? I got so riled up, I stormed out of work, in search of an inhaler and a bottle of tequila.
I do battle with SourceSafe a lot, and I just assumed this was another of its faulty points. I even got a post started on it and how crazy it was that SourceSafe didn't adhere to general usability guidelines like underlining the keyboard shortcuts in a menu. I was on a roll, let me tell you. Just at that point, I noticed something unpleasant: Internet Explorer didn't have its shortcuts underlined by default either. In both cases, you have to first hit the Alt key in order to view the shortcuts. No longer was I mad, I was now incredibly confused.
In the next several minutes, I opened several apps to check default menu bar behavior. Firefox, MS Word, and Konqueror all underlined the shortcuts; Acrobat, Windows Explorer, and XEmacs did not. There is absolutely no consensus here.
There is no conclusion here, except that I find it very interesting this hasn't been standardized yet. If it's enough to cause a minor-grade hissy fit with me, one would think that underlining shortcuts would've become standard long ago. But if it took me this long to develop a minor-grade hissy, I may just be inventing problems. To me, underlining by default is the right way to go; that way the user has to do as little thinking as possible. Much like Cheddar vs. Monterey Jack, this issue is still up for debate.