profile

juliette_chevalier

Legacy code, binary search, and naming conventions

Published over 2 years ago • 2 min read

Hi nerds -

I salute you from sunny Madrid, where everyone keeps talking about their upcoming vacation plans.

Today I'll do things a lil bit different and share with you some of my insights combining coding and mindfulness. Let me know what you think. 👩🏻‍💻

Calle de Fuencarral, Madrid

3 brain farts

👵🏻 Legacy code: Legacy code is old code that contains no tests and quickly grows impossible to understand. It's a disease to a large codebase because it compounds in complexity and makes the entire application harder to maintain and scale.

If left unsupervised, it grows so large, organizations crash because the cost of rebuilding the software is too big and the speed to produce new features becomes too slow.

Our personal legacy code are those assumptions and building blocks we live by, which we don't test and no longer understand. It's the lil rules we follow and take for granted; the habits that no longer serve our path; the "emotional baggage" we carry everyday.

If left unsupervised, it piles up, increasing the cost of self-awareness and building an identity that is harder to maintain and scale.

Working that legacy code

🔎 Binary Search: Our brains don’t have a storage problem, they have a retrieval problem. Everything we’ve ever experienced, thought, or said exists somewhere within our mind, but finding it is often the harder part.

A similar thing happens in Computer Science, where databases grow so large, finding relevant information efficiently becomes complex and time-consuming.

One of the most performant algorithms we have to find information is binary search. It works as follows:

  1. The data pool must be sorted using some sort of logic. For ex, you can arrange your experiences by date, by feeling (happiest to saddest), alphabetically, etc.
  2. Once you have the information sorted, you split the list in two and ask yourself: “on which half would the information I’m looking for be?” If you’re looking for Bob’s number, for example, you’ll know it’ll be on the first half of the alphabet-sorted list because it starts with a “B”.
  3. Then, repeat this process splitting your data in half until you find the information you’re looking for.

This is super powerful because it means we’re cutting our possibilities by half as we traverse through the list, rather than exponentially increasing the number of operations we have to run.

-- For your reference, binary search is O(log n). O(i), meaning constant time, is the best, while Big O notation is the worst.

Algorithmic performance graph

💙 Naming conventions: When naming variables or functions, developers may feel tempted to use short names like “a” or “x”.

In theory, the code will work the same, but next time we want to build a new feature on top of it, developers will have a harder time understanding what the code is meant to do, ergo a harder time providing a good solution.

A similar thing happens with our emotions. When describing thoughts and feelings, we often use words like “happy” or “angry”. However, we can usually do better.

Naming feelings is key to emotional intelligence and self-awareness because we handle situations better when we understand exactly what they are. Here’s a cool cheat sheet on naming emotions.

--- 👀 If you want to learn more about writing clean code, I wrote an article about the topic here.

2 intellectual goodies

"There are two methods in software design:

1) One is to make the program so simple, there are obviously no errors.

2) The other is to make it so complicated, there are no obvious errors."

~ Tony Hoare

Computer errors

"It's hardware that makes a machine fast. It's software that makes a fast machine slow."

~ Craig Bruce

1 funky audio

This song is for the saxophone lovers. You know who you are. 🎷


Thanks for reading.

As always, feel free to connect by hitting reply and sharing a juicy thought 💡.

We all help the curious community grow.

Best,

Jules 🤸🏻‍♂️

juliette_chevalier

Learning to code is 21st century super-power. I work as a Software Engineer and teacher around the world. My purpose is to empower others by showing them what we can do with our brain, a computer and wifi.

Read more from juliette_chevalier

Hi nerds - I salute you from Berlin, a city that strangely feels like a home away from home. This week, I spoke at DappCon, a conference for developers building crypto infrastructure. In a classic Berlin style, they had deep house playing in the yard, vegan food, green juices, and a wellness conference running on parallel at the top floor. Needless to say, one of my favorite crypto conferences so far. 3_brain_farts 💪🏽 Impact-effort matrix: The impact-effort matrix is a prioritization mental...

over 1 year ago • 2 min read

Hi nerds - I salute you from ETHCC in Paris, where I just presented a keynote about the smart contracts behind DAOs. We’ve been working hard at Aragon to launch our new product - a permission management system - and today was the first time we were sharing it so widely! Exciting time to be building in the open 🚀. 3_brain_farts 💖 How to find the one: Image you’re an employer looking to hire a Secretary and you need to hire him/her right after the interview. How do you know when to stop...

over 1 year ago • 1 min read

Hi nerds - I salute you from the Panama City airport, about to hop on a flight to Athens, Greece. Something interesting about bear markets is that they have been breeding ground for some of the most renown names in technology today: Square, Stripe, and Uber in 2009, Airbnb and Groupon in 2008, Facebook in 2004, Adobe in ‘82 and Microsoft in ‘75. But to build successful solutions teams need to run research - so that’s what we’re doing at Surge! If you have 1-2 minutes, please fill out this...

over 1 year ago • 1 min read
Share this post