I was talking to a coworker about the trouble I’ve been having with coding the network engine for QubeKwest and his comment at the end was simply “The struggle is real.” While the response was intended to be a joke, it turned out to be accurate too. I’ve previously written about networking and how I’d utterly blown up what I’d written. While that is true, there is actually a little more to the story and it took a very long time before I got back to trying again.
I have a deep and passionate dislike for Windows 8 (any of the various flavors) and I had a laptop that I was coding on that came with Windows 8. The result of this was that I wanted almost nothing more than to have any other operating system on it. When Microsoft presented the opportunity to preview Windows 10, I jumped at the chance the very day they allowed it and had it installed on that laptop that very evening. Within fairly short order after that I’d gotten all my various development tools set up again and was ready to go.
The first project was coding a chat server and client that was written using the synchronous java.net package with Swing as the UI toolkit. It actually worked quite well after about 2 days and never made it anywhere near source control before a Windows 10 preview release caused me to lose it just a couple of days later. I wasn’t willing to let that be the end of the story, so once things were up and running again, I started over, this time using the asynchronous java.nio package with JavaFX as the UI toolkit. It was like stepping into the future. A vastly different and obscenely confusing future, but the future none-the-less.
To get this version of a chat server and client working took closer to 2 weeks and at the end it was only sort of working. I was proud of what I had managed to pull off, and once again it never made it anywhere near source control. Those of you out there that are picking up on a pattern here are highly accurate in your observation, but at the time I wasn’t really thinking about source control for a simple proof of concept side project. Well, this version was also lost. As it turns out, this time the Windows 10 preview patch actually bricked my laptop. After 3 days of nearly constant attempts to boot the laptop at all, I finally managed to unbrick it and in the process was forced to fully wipe the drive. Yep, lost that version too.
Then, with the hope of stopping this hideous pattern, I decided my next attempt would be directly inside the QubeKwest code base and would be checked in to source control over and over as I developed it. This is the version that the other blog post referred to when I said “I managed to substantially break it.” In the end, that version was turned into a single massive code comment just so I could get it to compile at all. That was the final fate of the third version of the network code. It lived on as a giant comment for a long time, and was eventually removed entirely from the code to make room for the fourth attempt.
The fourth version was started from scratch and has been through a real struggle of what I call refactoring and unrefactoring. Yes, I’ve decided unrefactoring is an actual word. I’m defining it as the action required to undo the effects of having refactored things. In this case, several parts of the server and client code were refactored to share a common base class. As it turns out, they aren’t quite as similar as I first imagined when I went down the refactoring path and I ended up fighting the results of that refactor almost constantly. Thus, I unrefactored the code and eliminated the base class putting the necessary bits back into the server and client code where they probably belonged anyway.
After all the work involved in the unrefactoring, I am back to where I can try to continue the process of coding the network engine. Fear not, the code is solidly and repeatedly checked in to source control so it’s not going anywhere. I have quite a ways to go to get the networking code to work the way I need it to, but I’m working on it and making good progress. The struggle is real.