Learning Ruby via a text adventure game -retrospective

Narcis G. Chitescu
2Performant Tech
Published in
4 min readSep 4, 2018

--

Hello, friends! I’m Narcis, one of the four 2Performant’s ninja interns. We made a role-playing game of our own imagination, the hero has to reach the winning-room by moving around a map filled with obstacles, monsters, potions, shops, hospitals and other rooms. You can find more technical details about the game in our first blog post, read about the obstacles of our first app as interns and also, you can see our code evolution in the previous blog post. In this final part of our blogpost series I’ll talk about what we learned from this challenge, you’ll find out our impressions, our mistakes, and finally we’ll share with you good tips for writing the best code you can.

Our gains

While coding in ruby and reading about it, our understanding grew, the code reviews were on point and very enlightening, they grasped what we lacked and gave a good feedback. We understood the importance of a well structured code, and a well thought plan.

What we like

We like that we have access everywhere although we are interns. For example, we went into 2Performant meeting rooms where we discussed and decided the game structure. That was useful because afterwards we were able to implement the game using other’s classes and functions without knowing exactly their code. Another good thing that we’ve learnt at 2Performant is how to write useful tests which assure you that any code refactoring maintains the deserved functionality.

A brief conclusion

Overall, this project was a good learning opportunity, the way we did things thus far was very professional, here we understood that the target was to be a great developer, and not just a programmer.

We want to thank the awesome colleagues that made it easy for us to be part of the team, which meant much for us because we could focus on the task that we had. It’s nice to find a relaxing atmosphere and a happy vibe, it helps you to be who you want to be and strive to work together towards a common goal

Here are some tips, small and general things we learned, that might be useful for you as well, especially if you are new to Software Development, regardless of the language you are using:

You can call it beautiful code when the code also makes it look like the language was made for the problem” (Ward Cunningham, inventor of Wiki)

- Treat the coding language like a tool, get familiar with it so you can use it to its maximum potential. (We got through some Ruby tutorials before we started coding the game)

- Not having errors at first might be an error itself — don’t assume everything works fine just because nothing screams — unless you have well written tests.

- Take your time and analyze the problem, things that look complicated in the beginning can have simple solutions.(We’ve discussed the structure of the game, we’ve fixed all the implementation’s details and only after we started coding.)

- Focus on design patterns (at least the most common ones, for example Factory pattern helped us to create the rooms and Orchestrator pattern was an elegant way to manage the game flow).

- Learn how to write good code. (“Beatiful Code” — O’ Reilly is a good book which helped us a lot).

- Don’t limit your work, make it as reusable as possible.(You have to abstract the things, split the app in smaller pieces and design each of them independently, avoiding dependencies. For example, our game map is formed by multiple rooms. If we want to add even more types of rooms, we only have to create another one by reusing Room’s template.)

- Code that repeats is ugly. It actually is (KISS, YAGNI, DRY)

  • Read about TDD, BDD and red-green-refactor.(Our tests from the previous versions of game were reused in the last version, so we coded from scratch knowing exactly if the game functionality was maintained by running the tests.)
  • Be open to suggestions and feedback because this might be the easiest way to improve — others might see things from a different perspective that you haven’t even took into consideration. (We want to thank Sava and Irina for the feedback and advices that made us understanding programming from an experienced developer’s perspective).

If you want to try our game or just take a look at the code, you can find it here. Please leave a comment with your opinions and suggestions.

Well, that’s it! Good luck and have a nice day!

--

--