Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Teaching my dad SP/OOP

Name: Anonymous 2008-02-15 2:01

My dad learned programming a very long time ago, and he just started to program again to write configuration utilities for his employer. I've looked at some of his code with horror, because it's completely brute-forced.

The latest program he wrote was a demo program to mimic the functionality of a larger, real program. (The demo is meant to be used to show customers how the program, or, rather, a specific function of the program, works.) In this demo program, he reads an INI file for configuration, but, rather than using a library to read it, he just loops through the strings testing for the one he wants.

Here's a small sample of what I mean, slightly edited.


Do While (Not str Is Nothing)
  If (Strings.Left(str, 10) = "[Blarg]") Then
    str = reader.ReadLine
    Do While Not ((Strings.Left(str, 1) = "[") Or (str Is Nothing))
      If (Strings.Left(str, 9) = "Honk") Then
        Me.InputPath = Strings.Trim(Strings.Split(str, "=", -1, CompareMethod.Binary)(1))
      End If
    str = reader.ReadLine
    Loop
  ' ...
  End if
Loop


I've tried explaining OOP to him, and have told him that there's a very good .NET INI library (Nini), but he just shrugs it off.

So, /prog/, any suggestions for helping my dad learn the benefits of not writing unneeded, hackish code, and using OOP. (Please no OOP/FP debates; he's using VB.NET, and I think that F# is WAY too over his head right now.)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List