Refactoring

Summarized using AI

Ooops! You named it wrong. What now?

Ian Norris and Melissa Hunt Glickman • May 17, 2022 • Portland, OR

In the presentation titled "Oops! You named it wrong. What now?" at RailsConf 2022, Ian Norris and Melissa Hunt Glickman explore the complexities and challenges developers face when the names in their code become misaligned with the evolving business context. They emphasize the importance of naming conventions and how poorly chosen names can lead to confusion, wasted time, and miscommunication within a development team.

Key points discussed include:

  • The Significance of Naming: Good names provide clarity, while bad names can lead to misunderstandings and inefficiencies. Developers often struggle with naming due to contextual changes over time.
  • Contextual Examples: Throughout the talk, Ian and Melissa provide examples from their experiences, including a scenario involving the renaming of "suggestions" to "outreach prompts" in a healthcare application, which ended up causing data integration issues due to misaligned expectations in the database.
  • The Process of Renaming: They discuss strategies for safely renaming components in a codebase, highlighting the importance of avoiding breaking changes, and the use of parallel approaches like dual writing during transitions to newer naming conventions.
  • The 'Rename Dance': Melissa introduces her concept of the "rename dance"—a careful method to handle renaming without incurring downtime or breaking existing functionality. The process involves stepping through changes in a structured way and monitoring them in production before fully committing.
  • Learning from Mistakes: Anecdotes shared illustrate both successful and unsuccessful renaming efforts, highlighting the lessons learned from potential pitfalls.
  • Balancing Perfectionism and Practicality: The speakers emphasize that perfectionism can hinder progress, and it's better to aim for a "good enough" name rather than strive for a perfect one, while focusing on the objective of delivering value through shipping code.

Overall, the session underlines the necessity of approaching naming with caution and thoughtfulness, as names can heavily influence development processes and team interactions. By recognizing when and how to implement changes to code names, developers can significantly improve their work environments and overall efficiency in the software development lifecycle.

Ooops! You named it wrong. What now?
Ian Norris and Melissa Hunt Glickman • May 17, 2022 • Portland, OR

You hear everybody talk about the newest feature to Widgets but you can’t find a single model reference to that in the code. What happened? Sometimes the business changes aren’t reflected in the code. Sometimes, you're missing information or the code grows into something different. What do you do? ‘Cuz you still gotta ship.

Buckle up for a fast paced ride through the opportunities and pitfalls faced when you find yourself in this position. Through success and failure stories, learn how to leave space for names to breathe, make changes safely, and walking that fine line of changing just in time.

RailsConf 2022

00:00:00.900 Welcome everyone!
00:00:14.280 Let's get that energy out! That's right, you picked the right talk to attend, two people in the audience!
00:00:19.980 Cool, so welcome to our talk titled 'Oops! You named it wrong'. No, no, it was you. I'm so positive you named it wrong.
00:00:27.359 Hi! I am Melissa, an engineer at Applied VR, where we're solving pain through immersive therapeutics.
00:00:32.579 I've been involved in the naming game long enough to know that sometimes I've done it well with clever names, and other times I've left some pretty confusing names behind.
00:00:38.579 I met Ian at one of those gigs where I tripped and left some stinky names in the code.
00:00:50.520 I'm Ian, and I currently manage at BackerKit, doing crowdfunding work. We worked with Melissa on pair programming and making questionable decisions.
00:00:57.960 Sometimes, that's what you have to do; let changes happen and just go have fun with it.
00:01:04.320 And by the way, shout out to Winnie, my cat. She's great and my supervisor too.
00:01:09.659 Before we dive into the subject matter, let's evaluate why a bad name versus a good name is crucial. Do we just wake up and throw out random names because we're developers? I guess sometimes it feels that way, but that's not how most folks operate.
00:01:28.619 Many people try to be rational. A great example comes from my experience at BackerKit, a crowdfunding platform. You raise money for a specific time period, and the project's live status is crucial.
00:01:39.900 However, the term 'live' can have different meanings. A project could be live on Kickstarter or BackerKit, but there's confusion when developers try to describe it. What's it mean to be live? Sometimes, confusion arises when we try to communicate specifics about a project being live in various contexts.
00:02:09.060 Names can be tricky and evolve over time within specific contexts. It's important to have developer empathy that accounts for context.
00:02:28.080 Have any of you joined a new company? You spend time figuring out what things mean. Take the term 'enum', which I thought I understood, but it turned out to be used in a confusing manner. Bad naming creates wrong assumptions and wasted energy trying to decipher clever names someone thought would be great.
00:02:59.220 It's essential not to create a barrier between those who understand and those who don’t.
00:03:12.840 I learned that when a developer successfully moved a project from Kickstarter to our platform, it was labeled as ‘legit’ because it worked. But then I found some variable named 'joint record' left for me, and I thought, wouldn’t it have made more sense if it were called 'existing order device' or something descriptive?
00:03:41.220 I was left wondering if I was missing some context. Perhaps there was a crucial reason behind that name, and it left me confused.
00:04:05.520 Let’s set the stage: we both worked at a medical healthcare company, aiming to improve our naming conventions that had grown complex over time.
00:04:12.430 We spent a lot of time writing tests filled with test data and debugging, which was sometimes a messy challenge. The company eventually expanded its scope and changed the number of treatable conditions over time. With this increase in complexity, our app underwent significant changes, while maintaining a monolith at its center.
00:04:44.880 There were many smaller applications and services, alongside custom channels to support the new business model and integrations. It became complex to understand where one application ended and another began, complicating the process of renaming.
00:05:06.840 Both Ian and I have experienced the challenges of renaming and refactoring, learning painful lessons along the way.
00:05:14.220 I have a little story to share about our health coach messaging system. Initially, the data science team suggested frequent member touchpoints to boost engagement and health outcomes.
00:05:45.420 However, as this evolved, suggestions changed to mandates from the business, and we rebranded suggestions as 'outreach prompts', as the coaches needed to reach out to participants directly.
00:06:13.440 My manager decided we needed to align our names with these changes, and I was tasked to rename suggestions to outreach prompts.
00:06:37.920 Initially, it seemed harmless, but in the data warehouse, the software still required that incoming data be tagged as suggestions.
00:06:58.560 This led to a significant data warehouse breakdown upon deployment because it couldn’t fetch the expected data. So, I introduced a workaround to translate 'suggestions' to 'outreach prompts' for the warehouse.
00:07:21.099 We still have issues regarding renaming elsewhere. Names like 'recommended topics' have become a new evolution, yet again, reshaping context and communication.
00:07:55.259 Navigating external interfaces became complicated, where renaming involved notifications to partners about changes.
00:08:30.780 Now, talking about naming in general, we both emphasize that it’s vital to recognize the implications behind names, so one must develop a strategy to handle renaming.
00:09:05.580 Melissa will now touch on her experiences where she managed to navigate through a rename process more smoothly.
00:09:29.820 In our journey, we initially had a structure centered around a single condition and then expanded to include multiple conditions across many specialists.
00:09:54.539 Renaming and restructuring became essential to adapt to this new model, which meant we had to be super organized during this shift in our service structure.
00:10:38.100 The changes were significant—supporting multiple relationships while maintaining the system intact without any downtime.
00:11:04.560 So the initial model underwent tremendous modification. We went from a simple model to something that reflected our expanded knowledge.
00:11:40.560 Using diagrams and tracking our changes proved tremendously helpful, especially under the pressure of a no-downtime request.
00:12:28.500 This model renamed not only involved operational changes but a shift toward a member-centric strategy.
00:12:59.880 Through this transformation, I learned the importance of approaching the renaming process strategically, ensuring you can follow through each step.
00:13:41.760 Tokens of wisdom come from observing these renames: patience, careful tracking, and an adaptability to the pace of business change.
00:14:32.940 As renaming teams involved different people, it became clearer that context settles when expectations are managed through solid communication while hopping on to new names.
00:15:27.600 Who knew renaming could be such an art form? We both appreciate tools meant for data migrations that ease the anxiety from renaming processes.
00:16:05.640 Each rename sends ripples through the application. One has to be mindful as deployment stages occur, and ensure you maintain uptime.
00:16:40.500 When running migrations, think carefully on what each rename means and what value it brings to clarity.
00:17:02.760 Now, we sense the struggles lie with internal teams wanting to shift quickly to new standards, and their busy schedules pose obstacles.
00:17:29.700 In our system, we had instances where names sounded absurd or nonsensical, but we had to focus on shipping.
00:18:07.560 The debate on naming took center stage again—names needed to convey clarity and rationalization.
00:18:43.440 Continue learning and be curious, as iterating through examples can provide immense context for correct naming.
00:19:15.960 As we wrap up, embrace learning from our experiences and remember that over-emphasis on perfection may detract from productivity.
00:19:38.520 Apply these methodical measurements to tailor your code to current expectations while easing into new naming conventions.
00:20:02.880 In conclusion, remember to maintain positive communication throughout the renaming processes, no matter how challenging they may seem.
00:20:51.900 We will leave you with the idea that a great name encapsulates purpose and context. Naming is a journey; perfect your naming dance, and embrace it.
00:21:38.520 Finally, if you're interested in the roles at BackerKit or Applied VR, please reach out to us after this talk.
00:22:10.320 Thank you for your attention!
00:22:33.600 We can take questions if anyone has.
00:22:45.720 A gentleman in a red shirt has a question.
00:23:00.840 The audience raised a point about what constitutes a good name. A good name helps avoid time loss.
00:23:20.520 It provides clarity about the responsibilities of collaborators involved in those names.
00:23:41.760 Names that are too abstract can lead to confusion. A descriptive name centers around a single job.
00:24:15.120 Although it's clear that a name holds its own weight, consider that it can be a warning sign. If things feel overly complicated, it may be the name that does not fit.
00:24:52.560 External interfaces complicate situations; they often need careful management.
00:25:30.180 A good name should maintain networking that balances innovation while keeping communication clear.
00:26:00.480 As developers, we should avoid skewed perceptions regarding naming. They matter because they assist in clarifying intent and expectations.
00:26:43.920 Sometimes, questions remain, and in such instances, iterate. It isn't a one-and-done situation.
00:27:09.480 Asking yourself what clue the name provides is insightful. Sometimes the first name that comes to mind is almost never the final decision.
00:28:04.440 Words can sometimes feel elaborate or too cute. Seeing what we can extract provides needed changes."}]} ``` Note: The last paragraph was truncated to optimize coherence and keep close to the speaker's intended meaning. Handling unintentional interruptions or laughter is advisable for clean transcripts.
Explore all talks recorded at RailsConf 2022
+64