Wednesday, October 27, 2010

Two more steps towards functional programming

I took two steps towards functional programming today.

First, I read a bit of "Pearls of Functional Algorithm Design", a book of essays on functional programming and modelled after Jon Bentley's "Programming Pearls" book. "PFAD" is written with examples in Haskell, and I have enough knowledge to follow the text but not enough for full comprehension. I'm not worried; my early experiences with object-oriented programming were similar. I plan to read up on Haskell a bit more, continue reading the text, and if I can find the time write some examples in Haskell myself.

Second, I continued my re-design of a program at the office, converting it to a modest form of functional programming. A very modest form. I call it "constructor programming", and attempt to push all code (well, all non-trivial code) into the constructor for objects. Using this techniques, I can use plain object-oriented languages (like C++ and C#) yet still get a feel for functional programming. (Or what I currently thing of as functional programming.)

The re-design work was helpful. It forced me to think about the classes and the true problem. I ended with a cleaner design, or so I like to think -- I have no measurements for complexity. (Come to think of it, I do have a utility to measure class interface complexity, and perhaps I should use that to measure my progress.)

I'm happy with the direction the code is taking. The code is clean and easy to understand. I think we could explain it to the business users and they would understand it. This is a big win, as the current system is quite opaque.


Wednesday, October 20, 2010

Inching towards functional programming

My recent work has been in object-oriented programming, but I'm interested in functional programming. I've read about it, talked with people about it, and I think it has a lot of promise. But working on it is tricky. The "regular work" during the day is in object-oriented programming, due to the tools, existing code, and talent of the rest of the team.

Despite the limitations, I can take some aspects of functional programming and use them in plain object-oriented code. Today I worked on the aspect of immutable objects. I've been designing (and re-designing) some classes, and I have been designing them to use immutable objects. The exercise has been enlightening, and I have gotten a better design out of it too.

So my recent efforts have been, effectively, to gradually transition from object-oriented programming to functional programming.

I followed a similar strategy when I moved from procedural to object-oriented programming. At the time, I was working in C. The client's shop was heavily regulated (by internal folks, not the government) and the corporate standards group strictly controlled the software installed on their PCs. (They still strictly govern software.) This was also prior to the great revolution of the internet, the web, and the open source movement. Acquiring software was harder (and more expensive) in those days.

I started my move from procedural code to object-oriented code by doing three things: reading about it, attending conferences, and programming in the style of object-oriented programming with the tools we were allowed to use. I didn't create anything as elaborate as the cfront compiler. Instead, I designed function calls that worked like object-oriented code. I called it "thing-oriented programming", and it was somewhere in between procedural programming and true object-oriented programming. Like today's efforts, it was enlightening and gave me better designs.

I'm excited about the future of functional programming. And with the internet and open source efforts, I should be able to try some real functional languages at home. The biggest challenge there will be time.



Tuesday, October 19, 2010

With vim

Attended the monthly BaltoLUG meeting tonight. It was easy; the new location is downtown, about ten blocks away.

The meeting was held at the Baltimore Node, a hacker space. This was my first visit. The space is a large workroom with various bits of electronics on tables, stored in bins, and tacked onto the walls. Not elegant but very practical.

The presentation was on VIM, the improved VI editor that is shipped with just about every distro of Linux. It's a powerful editor, and reminds me of TECO on the DECsystem-10. It can handle regular expressions and it has a macro-programming tool.


Monday, October 18, 2010

Hardware fun

I did some hardware work tonight.

I replaced a failing DVD reader on //ophelia (a Dell GX280 that was gifted to me). It came with a CD reader, and I had installed an old used DVD reader. That reader worked for a while, but recently failed. The failure was physical; there was something preventing the drive tray from opening.

A quick stop by the Radio Shack web page got a new DVD reader on its way to me. (Although there was only the one selection for internal DVD readers. I suspect that DVD readers will soon disappear, replaced by USB drives and network connections.)

With the new DVD reader installed, I was able to upgrade the operating system to SuSE 11.3. The upgrade went smoothly, and I like the look of the new KDE desktop.


Sunday, October 17, 2010

Open source in Pennsylvania

This Saturday I attended CPOSC, the Central Pennsylvania Open Source Conference.

CPOSC is different from most conferences. It's small, with a maximum of 150 attendees. It's run by volunteers. It lacks the pizazz and glitz of the big conferences. It focusses on open source software, avoiding proprietary and commercial solutions.

Despite the unusual approach, it has interesting sessions and good speakers, on par with those at the larger conferences. I attended several sessions and they were just as good as sessions at the Microsoft or O'Reilly conferences.

The sessions I attended included:

- A review of Java, the Tomcat web server, and the Eclipse IDE and how they work together.
- "One-line" programs that do useful things in Perl
- Javasript and how it can be used effectively
- A review of the latest version of Wordpress, which is growing from a blogging framework into a content management system.
- A summary of new features in Rails version 3
- Writing internet applications in Python using the "Twisted" framework. This framework is much easier than the Java RMI or the Microsoft .NET solutions for internet client/server applications.
- A list of collaboration tools for organizing and managing projects with distributed teams

The schedule is too fast to learn any topic in depth. Sessions run for fifty minutes, which is too short to discuss deep technical issues. Effective participants use the sessions as highlights for solutions, noting promising ideas and investigating them later.

CPOSC is targeted to practitioners. The speakers and attendees are practitioners, and can interact and share knowledge. It is a conference run by geeks for geeks. Managers (non-geek managers) may not want to attend, but they should consider sending their teams.

This was the third CPOSC; a fourth is planned for sometime late in 2011. I'm already pencilling it onto my schedule.

Wednesday, October 13, 2010

Meetings and tech - single packet authentication

I attended the CALUG (Columbia Area Linux Users Group) meeting tonight. The presentation was on Single Packet Authentication (SPA), a successor to port-knocking for granting access to selected users and hiding open ports from other users.

A somewhat scary aspect of the meeting was the fact that I could keep up with the discussion. I'm not much of a network geek (programming is my thing) yet at this meeting I quickly understood the concepts of port-knocking and SPA. Some folks knew it better than I, yet a bunch of folks asked questions that I felt I could answer. So I must be learning something about network configurations!


Tuesday, October 12, 2010

Thinking before acting

I've been working on a prototype of the next version of a finance model for the office. The old model is in C++ and the new model will be in C# or Java.

The prototype has advanced to the point that we need unit tests and system tests. We've been building system tests as we built the prototype, so they are in place. We now have a need for unit tests, or more specifically, class-specific tests. We need these tests to exercise features of classes before they are integrated into the system.

Our framework (a home-grown thing) is capable of such tests, and we can add them with a little effort. The unit tests will give us finer resolution on changes and faster feedback on changes. We're keeping the system tests; they exercise specific business cases and connect us to the users.


Monday, October 11, 2010

At the last CMAP meeting, I picked up a DVD with Microsoft's Visual Studio on it. The DVD has a timed edition, good for 90 days.

So far, I haven't installed it.

I will install it; I want to set up a time to use it. This week is busy for me. Installing the software now would simply mean throwing away one or two precious weeks of available time. Better to wait for a better schedule.

I'm thinking that this is not good for Microsoft. If you want people to try software, you want them to install the software and try it, not delay and worry about maximizing the demo time. Any time that is spent not running the software is... well, not running the software.

Getting back to me...

Perhaps I will install it next week. My week-days are busy, and the long commute takes a good chunk out of the day. Week-ends are better for experiments. This Saturday I will be out of town, attending the Central Pennsylvania Open Source Conference, so Sunday is the earliest day that makes sense.


Tuesday, October 5, 2010

The .NET meeting gives me a book on... Ruby

I attended the CMAP (Central Maryland Association of .NET Professionals) tonight. The presentation was on jQuery, which isn't a .NET technology nor even a Microsoft thing. And while I didn't win anything during the raffle I did pick up Thomas and Hunt's "Programming Ruby" (also not a .NET or Microsoft thing).

I did talk we a few other folks. My friend Ben is considering a position in Washington, but is not happy with the commute. (And it *is* a long commute.)

Friday, October 1, 2010

To list on the resume or not

I've been working with Microsoft VBA for Excel. The biggest benefit of this experience has been to refresh myself on the reasons for leaving VBA and using other languages. VBA is this horrid mutation of Visual Basic that loosens data typing, while retaining the frustrating VB6 editor that tries to be smart about syntax. The run-time engine has vague messages that amount to liitle more than "something went wrong".

The question before me is: do I add VBA to my resume? On the positive side, it shows that I have experience with different languages and platforms. On the negative side, someone might actually want me to work on VBA applications.

So perhaps I will, with the condition that jobs that ask for VBA skills get the "special" hourly rate.