Heap Heap Array! Rotating Header Image

The Language Wars Rage On

Should a VB6 shop start using VB.NET, or should they switch to C#?

In addition to my business, I work for a county-level government agency in Florida. Our legacy system is a 1.2-million-line steaming pile of VB6. While it works (for limited definitions of “works”), there’s no way we’re going to be able to maintain it forever, and we’re certainly not going to write new projects in VB6.

Since we’re a Microsoft shop, we’re going to the .NET platform. The choice, however, is whether to use the familiar syntax and stick with VB.NET, or to harness the additional power of C#. I favor the latter approach, and I’m pleased that the Powers That Be agree.

The world of .NET development is dramatically different from VB6. Techniques that work in VB6 no longer work in .NET; techniques that work in .NET fail miserably in VB6, and even some things that work in both environments are sufficiently different to be difficult to understand.

Using similar syntax to express dissimilar ideas is a recipe for confusion.

Respect the Pomodoro

I’ll be the first to admit that my greatest weakness is time management. I’m a procrastinator extraordinaire. (If you doubt me, simply check the time between posts on this very blog.)

I find it difficult to get started on a huge project if I know the project is going to be huge up front. It’s even harder at the tail end of a project, when all of the fun stuff is done and all that’s left is the annoying little tweaks and bug fixes needed to make a program ‘production ready’. Project Waldo1 is in that very phase right now. When the fun stuff is done, my velocity drops to near zero.

The biggest problem seems to be a lack of internal feedback on time use. If I spend seven hours coding and one hour conferring with colleagues, that’s a productive day. If I spend one hour coding and seven hours conferring with colleagues, that’s an unproductive day. If I spend eight hours reading programming books, that’s a supremely unproductive day (except for the professional development idea). But I tend to gravitate toward lack of productivity, because, frankly, it’s more fun than keeping my nose to the grindstone, and I tend not to notice that I’m not being productive.

That’s where the Pomodoro Technique comes in.

For those of you who haven’t heard of it: the Pomodoro Technique is a time management system, based around indivisible units of time (“pomodoro”2). A standard pomodoro is 25 minutes, followed by a 5 minute break.

The advantages are many. First, and foremost, there is immediate feedback if my work begins to slow down again. If the end of the day arrives and I’ve only completed three pomodoro, I know that either I’m spending too much time goofing off or I’m being far too often interrupted. Second, the system reminds me to take frequent breaks. When I do get in the zone, I tend to not leave my chair for hours at a stretch (no pun intended). The bell gets me out of the zone and onto my feet. Finally, the recording system doubles as a to-do list; as I think of things I need to do, I write them down, and I can go back and prioritize later. Without a system, everything tends to either be ‘priority 1′ or completely forgotten.

It also works because it appeals to my sense of completionism. If I see a goal on my list, I want to complete it. The Pomodoro Technique literature suggests tasks be broken down into approximately 3-hour increments (5 to 7 pomodoro). I can see my progress toward those goals; I can’t really see the progress toward the end. At any given time, I know what I’ve done and what is left to do.

I know that the Pomodoro Technique seems to have been further refined and polished among the developer community. I’m not really using those refinements yet; I’m “playing by the book”. The system as written works for me, and while I may be able to adjust it later to better fit my needs, I’ll try it as it is for a while.

FOOTNOTES
1. It’s a mapping application. I’m a GIS developer, even though it’s not really my passion. But I can still make corny puns. 
2. The plural of “pomodoro” is an open question. Proper Italian is either “pomidoro” (from “pomo d’oro”) or “pomodori”. “Pomodoroes” would probably fit in English, but doesn’t ring well. According to a colleague, the plural of “pomodoro” is “pomodoro” (or maybe it’s “sharpei”, I’m not sure). 

Project Euler Problem 14

For the last 36 hours, off and on, I’ve been working on solutions to Project Euler problems, just to learn some F#. I started at the beginning and have been working my way up, as the difficulty increases.

So far, I’ve solved problems 1-10, 14, 47, and 243. Problem 9 doesn’t really count as I basically borrowed the code verbatim from another site, and problem 5 almost doesn’t as I solved it with pencil and paper.

I may cover a few of the others later, but for now I’ll focus on 14.

Continue reading →

Rough Edges

My copy of Programming F# arrived a few days ago, and I’ve been reading it in my spare time. In doing so, I’ve noticed a few oddities in the language. That isn’t to say that it isn’t a great language; it’s just clear that the integration between ML and the .NET framework is not entirely seamless.

Continue reading →

Fledgling Forays in F#

So, to start learning F#, I searched for existing F# code. One of the first snippets I found was the sieve of Eratosthenes in many languages, including F#. Except the listed F# ‘sieve’ wasn’t; it did an exhaustive search from 2 to Math.Sqrt(int_of_float n) for every element n.

I thought, “Even as a beginner, I can do better than that.” Here’s my first attempt:

Continue reading →

Trying To Think Functionally

Lisp is worth learning for the profound enlightenment experience you will have when you finally get it; that experience will make you a better programmer for the rest of your days, even if you never actually use Lisp itself a lot. [Eric S. Raymond]

I, for one, know that I’m only partially enlightened.

When I was taking “Programming Languages” (COP 4020), one of the languages covered, intended to represent the entirety of functional programming, was Common Lisp. We studied it for about two weeks. On the exam, a 5-point question asked us to write a function to determine whether a list was palindromic. I set off writing tons of code (on paper, even), checking for the equality of the first and last elements, then stripping them off and recursing on the rest.

As I handed in my exam, I commented on the difficulty of that question compared to the low point value. The professor looked at my test, then at me, and then she wrote on a scrap of paper so that the other students couldn’t see (yet):

(defun is-a-palindrome (lst) (equal lst (reverse lst)))

That’s thinking functionally. I could hammer out the code, but I was writing C with a bunch of parentheses. I wasn’t really writing in Lisp.

When I started working here, I was writing a lot of Python. Python isn’t generally considered a functional language, but it has enough of the features (first class functions, lists, map/filter/reduce, etc) to give me a taste of power. Then I was forced into using VB.NET 2005, which felt like stepping back in time a decade. It had none of the Pythony goodness I was used to: no list comprehensions, no map/filter/reduce (with clunky forms added in VB 2008), and no lambda statements (halfassedly added in 2008 and properly added, supposedly, in 2010).

What skill I picked up from Python quickly began to fade.

My outlook was bleak, as well. I thought the .NET platform was headed for the same old languages and the same old paradigms, for the same old Blub coders. I was afraid that I’d end up a Blub coder… or worse, that I already was one.

Then I saw some of the nice features of C# in .NET 3.5 (and immediately started griping that VB didn’t have them), and what’s more, I found F#.

Let me say this up front: I like Lisp. Most of it makes very little sense to me, but I can feel the power behind it. Though I’ve wanted to learn a functional language for a while now, I know that my chances of ever getting a job writing it are slim, so I’ve focused on the standard OO and procedural languages. F# has the advantage of being backed by Microsoft; Visual Studio 2010 will have F# out of the box, and it’ll be right there on the desks of almost every .NET programmer, overcoming much of the inertia that leads people to use languages like VB.

So that’s why I’ve decided to throw myself into F#; it’s a paradigm I want to embrace, and a language that I may actually get paid to use someday. That’s worth reshaping my mind for.

And at the very least, I’ll end up writing better code in other languages.

Welcome, All

I’m a GIS (ew), VB.NET (double ew) and C# developer by trade, a general-purpose code monkey at heart, and always trying to learn new things. But I don’t want to learn on my own. So, I’m inviting everyone to join me as I try to teach myself what’s truly important in code.