Reflections #Rails, Quality Code

Today we learnt about what constitutes Quality Code:

  • understandable
  • readable
  • tested
  • working
  • clear
  • changeable
  • discoverability
  • documented

We also learnt about rails model associations, how a join table helps join two tables/models’ data for a many-to-many relationship. In teams of two, we drew a diagram called an entity relationship diagram and also used Trello (an online kan ban board) to plot our user stories/app features. We will be working on a twitter app for the next 2-3 weeks.

One of our assignments was to do a kata at Code Wars – Sum with Highest and Lowest .

I tried it and although i passed the tests, i couldn’t pass the null/empty? test. I was annoyed because I just couldn’t figure out what was wrong when i clearly wrote it correctly (if .null? or .empty?) but then in a fit of what-the-heck, I took out the .empty? method, and rerun the tests again, and this time, the code passed. I guessed the question was worded wrongly, It should just be null, not empty, since null != empty.

So lesson here – just write enough to pass the test. And sometimes the questions are wrong. And i nearly gave up actually, I thought there’s no way to pass even if you got the code correct, but then yeah, I guess I got to keep trying.


One thought on “Reflections #Rails, Quality Code

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s