1

I'm and entry-level developer straight out of college. I am the only developer at this company.

I feel the challenges I face are different to most people working with sub optimal or very poorly written code, because I am not only not part of a team, but also entry-level, and have no documentation, or tests.

I've been tasked with updating a piece of software' it's a Windows Forms Application. I was handed a flash drive with a folder of source code. I set up git and GitHub so that I have version control and cloud backup. It was coded in VB.NET (I was told that the code was in C# when I interviewed for the job and was hired) Fortunately I've learned VB.NET quite quickly. The code is not at all modular or well structured. The majority of the program is just one ENORMOUS class (well over 2,300 lines of code) with almost no comments.

There is also only one function. The majority of the code relies on sub procedures that rely on their side effects (i.e. they manipulate external variables) while members of the form's class, these are effectively global variables. It is not a logical "class" but instead an entire program dumped into a class.

the software is meant to interact with a datalogger called an 8832 which is produced by ESC. The software I work with also interfaces with a device that was not designed to work with any software other than the proprietary software that they manufacturer sells licenses for separately. Therefore I have no manual do easily decipher what the strings of characters it spits out mean. so far I have figured out that "@" followed by two digits and a minus sign followed by more digits is an error code, until you reach "$$"

I have a fair bit of freedom as to how I go about things as I am the only developer who can work on this type of software at this company. Understanding how things have been implemented is difficult due to the lack of comments and the way things are organized (all over the place)

I am starting to understand how certain things have been done, however, I feel that working on making changes will be difficult due to hard coding and bad organization. I could propose to re-write the software, but that would take a very long time. I think my best recourse is to deal with the bad code for now, while putting in time on the side (during work hours of course) to start slowly rebuilding the code.]

This program could be so simple, clean, and reliable, but the coding of the previous contract developer has left it difficult to work with, buggy, hard to develop and build on, and very hard to test. Its hard to debug due to the lack of functions that return values. having threaded code with many procedures manipulating shared variables is messy.

I was not provided with any tests, therefore I need to find out what output the datalogger gives, see what the original software produces, and then use that as tests for when I start making changes to the software.

Should I proceed as planned? I feel that this way, I get stuff done while also making future larger projects possible. (The current code would need to be altered beyond recognition for some of the longer term projects to be possible.

The other option is to say "let's waste no time on this version and re-write the code now" Then the company gets no updates of the software for months.

3
  • 2
    Btw, Today there are excellent free auto conversion tools from vb.net to c#
    – Doc Brown
    Commented Jun 13, 2023 at 5:57
  • 4
    What a classic... Welcome to this wonderful industry. Btw, if your were handled a driver and you set a repo, you are already more professional than you think...
    – Laiv
    Commented Jun 13, 2023 at 6:09
  • @DocBrown I just looked into this. I think I'll give it a shot.... btw I had a professor named Doc Brown. He was a good teacher for Software Engineering.
    – mpAppProg
    Commented Jun 13, 2023 at 16:05

1 Answer 1

6

I was not provided with any tests, therefore I need to find out what output the datalogger gives, see what the original software produces, and then use that as tests for when I start making changes to the software.

This is an excellent approach. Having tests of the original (possibly buggy, but that's for another day) code is also mentioned as an important technique in Working Effectively with Legacy Code, which I'd recommend for this job.

The other option is to say "let's waste no time on this version and re-write the code now" Then the company gets no updates of the software for months.

At best. Rewriting software when there's nobody around who understands how, and more importantly why, the software was built that way is a recipe for disaster. Typically there are lots of nonsensical-looking code which actually does useful stuff for business/engineering/legal reasons rather than programming reasons, and you can't really discover those without first being an expert in all the related fields.

2
  • 1
    Thanks I will look into that book. I am fortunate to have access to the users and "designers" who are technically not designers but rather my clients in a way. The quality of the information they feed me determines how well the software will work for them. If they omit requirements or don't explain business operations well, we all suffer.
    – mpAppProg
    Commented Jun 13, 2023 at 13:50
  • 3
    Along with this, the first thing I would do (and did when I was in a similar situation) is to decompose long functions into smaller ones. Typically you can find repeated segments of code (maybe with different variables) in such code and those can be safely refactored into 'pure' functions. This will be very tedious and slow at first. Think of this as like solving a jigsaw puzzle: it gets easier as you put more pieces in place.
    – JimmyJames
    Commented Jun 13, 2023 at 19:34

Not the answer you're looking for? Browse other questions tagged or ask your own question.