DEV Community

Discussion on: How do you orient to a "new to you" code base?

Collapse
 
miguelmj profile image
MiguelMJ

Know my garden and get to know my neighbours

Pretty much 😂

within this area you tend and toil, what are some patterns you're seeing?

I think this is somewhat broad, but I could say that the patterns I see are a product of the frameworks used. I've realized that they condition the code a lot more than I thought.

what code most recently surprised you, and why?

Negative surprise: to see how few regular expressions are used (in the code I see). I understand some people consider that they reduce legibility, which is reasonable. But, come on, I recently refactored 150 lines into 50 just by replacing nested if-elses comparing strings with a few short regexes.

Positive surprise: the bash script used to manage backend tasks. I didn't thought I'd get to see such a complete, flexible and organized alternative to third party tools. I definitely felt inspired when I saw it!

Thread Thread
 
jeremyf profile image
Jeremy Friesen

I love that you phrased this as "positive" and "negative" surprise. That's a very useful lens to bring to your job.

Regular expressions are a powerful and ancient magic. I always shudder when I see regular expressions that are not bombarded with unit tests. Because they can be challenging to write correctly; and once written challenging to explain as they are incantations of an alternate form.