TWC 124: Literalism and existence proofs in the service of stress reduction

Again another week where I solve one answer and punt on another.

TWC Task #1, Happy Women Day

jaredor submission for Task #1

Well, "solve" may be a strong word for what I did with this problem, at least for my programming conscience. The problem statement was simple, but had no requirements for an acceptable solution other than what you could infer from the example solution in the problem statement. However I did give not one, but two solutions, so that's not totally lazy, even if each, on its own, is lazy, right?

--lazy solution

What?! A cut-and-paste of the example itself as a solution? Yes. It literally satisfies the brief. When I was starting out as a programmer, I thought my programs had to do something, like, use a loop. These days, I'm thinking that the best program is the one you don't write, so this comes close to the sweet spot. I recommend this philosophy, partly in the name of efficiency, but there is also the benefit that, once my days are done, I will exit as the best programmer ;-)

--superlazy solution

Unicode has the Venus symbol: ♀


Who am I kidding? I feel guilt.

Okay, so maybe I will not go gentle into the programming night. I do feel there should be some residual thoughts cranking away when I shove a program into the world. The problem with under-specified problems is that then I have to come up requirements just to know where I'm heading and to know when I've gotten there. Ugh.

So, if I were to spend more time on this, what would I do? Well ... I just deleted a lot of words describing what I would do and I wasn't even halfway done. Suffice it to say that I can overthink a lot of things. Notionally, it would be just a circle atop a cross, but then I would have wanted some logic to account for scaling based on the radius. (I should never have read that article on designing true-type fonts--it ruined me ;-)

But given that I don't start writing until after my Sunday afternoon nap, I am forcing myself to live with being technically correct, which as we all know, is the best kind of correct.

Literalism stalks the world, slaying the unwary! Well, not literally...

Whenever I am feeling Quixotic, I don my rusty armor of experience, grab my dusty banner of software engineering and sally forth with my trusty lance of logic to tilt at the windmills of bargain basement software code. I also have a grudge against TDD fanatics, who think tests substitute for thought ("who test tests substitue for testing").

Only, I'm no hero, just a coder. A lot of the time I have to deal with code that is too lazy, but some of the time, I should ponder more if lazy is good enough. :-)

TWC Task #2, Tug of War

This is a version of the Partition Problem and based on that, I would probably have tried to code the Largest Differencing Mechanism with Balanced Two-Way Partitioning. Well, not actually that algorithm, to find the absolute minimum I would feel that I need to code the complete Karmarkar–Karp algorithm (CKK).

But the meta-problem I have is that this problem is already known and we have a solution that is as good as we (think) we can hope until someone proves P = NP. I just don't have the psychological fortitude to code a "best effort" that will most assuredly fall short. While I try not to engange in negative self-talk, I will assign my efforts for my leisure time assuming that I am not likely to be the next George Dantzig.

Leave a comment

About Jared Martin

user-pic I blog about Perl.