Programming Methodology

As I design code for my ROV, I’m discovering something: my brain is
set in Object Oriented mode. The solutions I think of work well for OO
programming. But there are problems with this:

  • LabView is not especially good for OO programming. 1

  • Some of the hardware I’m working on doesn’t allow for it (or allows
    it in a very limited way).

  • I’m working at a low enough level that I should be thinking about
    things like the overhead that OO programming adds.

The take-away here, which is important, is that I’m trying to
architecture something such that it isn’t a complete mess (especially
for the next poor soul who has to deal with my code), and that each
component is testable on its own.

This turns out to be more difficult than I’d like it to be. There are
lots of little decisions I have to make about where to do X thing,
where the control loop for Y thing happens? How do I log all of these
things correctly while both running individual components and when
running the master program? How do I do it without copying code all
over the bloody place? How should I pass data around for logging, and
for all the other things I need to do?

I’m sure these are solved problems by people who are much smarter than I.

As an example: the data logging. I want data to be logged. I want to
do it when I’m running a module individually. I want to have the same
format when I run it from my master program. In the past, I’ve used
Log4j, or Log::Log4perl, or whatever tool is appropriate for the
[OO] language I’m using. These tools were built by people with much
more knowledge of the language than I and they work.

I have an idea of how they work. I could reproduce them in an OO
language, though limited in scope to the above packages. But for my
current application, these are difficult.2 I have various
requirements I must meet. I can meet them simply, but I also want to
do it such that my code is not a terrible mess and can be changed
without terrible repercussions on the entire structure.

I have a variety of little problems like this. I’m learning. I’m
improving. This is in addition to the various annoyances I have with
LabView, and I’m still learning LabView. But it’s something I didn’t
anticipate when I started. I’ve worked on procedural code before
(namely C).

Once again I step back and look at the over-arching code to decide the
best method of achieving my goals. I do it regularly. I hope to not go
too far down any of the rabbit holes I find.

Footnotes:

1 I think I’ve said enough about LV at this point so I’m not going
to belabour the point.)

2 I should note here that the purpose and needs of logging are
somewhat different in my current system. But that’s an aside to my
point here.

Leave a Reply