Meeting your First Monolith
ACT I, Scene: The End of Code School
Rachael: My application has 5 models. WITH a many-through-one relationship. It’s so complex. I feel like [while making jazzhands] a star.
ACT II, Scene: Second day as a developer
Rachael opens up the application everybody lovingly calls Panda
Rachael: Panda’s are cute. Especially the baby ones. I bet we will get to …
…
…
Rachael somehow resists the urge to hide under her desk and never come out
Rachael somehow resists the urge to run to the restroom and never come out
Rachael looks at Chuck, the nice engineering manager man with the unicorn t-shirt
Chuck: Panda is a monolith. It’s about 7 years old. In an hour or so, we will have a walk through the code.
End Play
Lessons Learned: It takes EVERYBODY Time
It takes everybody time to get to know a code base, no matter their level of expertise. Know that people expect it to take time for you to become familiar with a monolith. Take a breath. Take many breaths, and often. Don’t let the ImpostorSyndromeMonster get you.
It will take time to know where things go, and what they do. You probably won’t know all of it. This is okay. Eventually, hopefully, you will focus on a specific area of the application. Knowing a specific bit and having some general knowledge will make you helpful to everyone. Being able to share knowledge with new hires, even if they are an intimidatingly knowledgeable engineer, makes you an asset (and a delight).
Lessons Learned: Start with the README
Start with the README. More importantly, CONTRIBUTE to the README when you come across gaps or things that don’t make sense. If you have to get help configuring or running something, improve the documentation with what you’ve learned. This helps everybody and makes you an asset (and a delight).
Lessons Learned: rake -T
Rake tasks are commands from the command line. Common tasks you need to accomplish by entering the console (ex. rails console) of the application on a repeated basis, make great rake tasks.
There are the standard rake tasks that come with Rails applications,
like $ rake db:migrate
, but you can add your own custom rake tasks by
adding to the rake directory. If you are working with a monolith,
chances are there are lots of custom rake tasks. To see what is
available to you, run $ rake -T
. Try it out! It’s fun!
It’s also helpful to see what all there is you can do. Like, flushing a cache for instance. Had I seen that there was a task to flush a cache, I might’ve thought about trying that one day. It would have saved me a few hours ;-)
Lessons Learned: The db/schema.rb is your friend
I studied theater in college. At somepoint we hit Russian theater literature. I could never keep the names straight all the time. I’d print a copy of the character list and keep it hand and accessible. The db/schema.rb is like a character list, but for an application.
Closing Thoughts
Hope your monolith has a fun name, like Panda. I leave it to you to imagine the gif, slack custom emoji, shenanigans that can be had. So that when you are having a bad-code-day you can share things like this:
Todays Status: