How can I cope with a different coding style at work?

August 2, 2025 6 answers
Asked by ~TestTheBrakes
After 15 years of working with C++ where the curly braces are placed on separate lines, I recently started a new job that requires opening curly braces to be on the same line due to auto formatting with clang-format. Initially, I thought I could handle it, but I'm finding it incredibly challenging. The code feels like a dense wall of text without any paragraph breaks, and it's really messing with my reading flow. I'm looking for tips on how to manage this differenceโ€”ideally a way to format the code for easier reading that I can revert back after I'm done. Any suggestions would be greatly appreciated!

Answers

-around-the-block
I switch between styles too, and while I can't fully relate to your pain, have you considered trying out different themes? Custom themes with unique fonts can really change your perception. Sometimes a fresh look can make the code feel less daunting, making the structure more noticeable!
Reply to this answer
_sauce reduction
When I'm dealing with different formatting styles, I just type my code the way I want and then use a commit hook for my team's formatting rules. If the code looks annoying while reading, I just add some spaces and donโ€™t commit those changes. It helps maintain readability without affecting the team's workflow!
Reply to this answer
checker+piece
It might feel a bit clunky, but have you thought about using a different code editor like VS Code or Notepad++? You could copy the code into that, let it format the way you prefer, read it there, and then just delete it when you're done. That could help make it more readable without messing with the original code.
Reply to this answer
plain_yogurt
Have you tried running clang directly outside of your IDE? That way, you don't have to mess with your development environmentโ€”just format the code as you like it, read it, and move on!
Reply to this answer
citrus_grove
I totally relate to your struggle! When I transitioned from C++ to Java, I played around with various auto-formatting techniques to switch the code back to my preferred style, but that just created more issues with version control. After some time, I decided to embrace the new style. It took a few months, but I got used to reading and writing that way. It really helped my workflow, especially for pair programming. Think of it like learning to ride a bike with a crooked handlebarโ€” sticking to one style makes it less confusing in the long run!
Reply to this answer
!33 pages bound
With over 35 years in the field, I've faced countless coding styles. Honestly, adapting to the new format is the way to go. It takes time, but playing around with the format isn't really worth it. If the whole codebase is laid out this way, just acclimatize yourself to it. You might even find that after some time, you prefer it! Also, dabbling in Pythonโ€™s whitespace style can help you adjust better across different formatting rules.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions