Riding with Training Wheels: a Good Learning Platform Let’s You Focus on the Important Stuff
As I worked through a course on learning object oriented programming, I sat through a fairly long walk through. The lesson showed how to write a game for Rock, Paper, Scissors in object oriented fashion. The program I’m taking (Launch School) had previously addressed writing a procedural version of the game, but this would be an oo version.
In the various phases of the course were side topics such as dealing with Rubocop style complaints and thinking through the code at design phase. I thought it’d be nice to actually put these things into use in designing my own program but worried I wouldn’t be able to implement it as well as the walk through had. OOP is a rather broad topic, and I was beginning to feel overwhelmed by the sheer scope of knowledge I’d have to internalize.
Bonus Features: The Training Wheels
Well, I got the opportunity to test out the recently introduced concepts without having to plot everything from scratch. The same strategy had been used when writing the procedural version of the code. With the more complex oo format would I get it? Why didn’t I trust the process previously so successful?
Using the same basic functioning program that had been laid out, the challenge was to add onto it with optimizations and changes. Were the optimizations better? Was any given ‘problem’ worth addressing?
As is becoming clear with object oriented programming, there are a series of trade-offs to consider, and it’s not always clear what is the ‘better’ approach. There was a particular added feature that really made me realize how well formatted the course structure is. Now maybe I can trust the process.
Dealing with Complaints
Rubocop is a tool used to test your Ruby code to see whether or not it passes certain style requirements. On a whim, knowing that I’d likely be required to test added features for style, I ran code through Rubocop after finishing the second feature of 6. As I suspected would be the problem, modifying the Rock, Paper, Scissors game to include Lizard, and Spock affected the complexity of the processes that decided which move was victorious.
I struggled with this problem for some time. I had one short session of attempting to refactor the solution and realized that I was entering ‘hack and slash’ mode. I was trying to fix the problem without stepping back and understanding it. There is also something called Einstellung affect where after trying an initial approach you get stuck trying the same improper solution over and over again. I was definitely experiencing it there. The answer to dealing with both problems would be stepping away.
In another session, I began with a new approach which seemed to solve the problem but proved even more fruitless. I decided not to get stuck trying the same ineffective thing over and over again but move on to the next feature implementation. The current one worked although stylistically it got some complaints. I intended to come back to it fresh later.
Thanx Training Wheels
Seeing the next feature, I instantly realized that its proper implementation would resolve the style problem I was grappling with from my previous challenge. The important thing to realize from a learner’s standpoint, however, is not only that the course guided me well but that I would not have seen the solution had I not previously grappled with the problem.
After stepping back and trying to understand the previous style problem, I realized that I’d have to change a fundamental underlying feature of the program to simplify its complexity. Problem was… I didn’t know how to do it.
I hoped to wrestle with the problem for a while and see if I could come up with something. I was not convinced that I would. BAM!! On reading the next feature description I knew that it would solve my problem.
Of course, dealing with the details of the new feature would engender its own hurdles (oh, so that’s why a global variable can be important, but Rubocop doesn’t like me using them [‘Oh boy’]), but I see now the value of grappling with problems in a piecemeal way. I’m glad for the the cumulative structure of the Launch School curriculum.