• Solutions
    • I Can Help
      • Define
      • Educate
      • Integrate
      • Advise
    • Consultation
      • Assessments
      • Design Reviews
      • Code Inspections
      • Ongoing Support
    • Training Classes
      • Training Schedule
      • On-Site Classes
      • Online Training
      • Customized Coaching and Mob Facilitation
    • Learning Roadmap
      • Developer Essentials Training
        • Agile Analysis and Design Patterns
        • Hands-On: Extreme Programming Practices
      • Scrum Framework Developer Essentials
      • Design Pattern Developer Essentials
      • Object-Oriented Analysis and Design Patterns
      • Scrum Software Developer Essentials
      • Agile Software Developer Essentials
      • Agile Software Developer Intensives
    • Speaking
      • Beyond the Legacy Code Crisis
      • Five Developer Practices for Agile Software
      • Writing High Quality, CLEAN Code
      • Essential Scrum Developer Practices
      • Improving Your Scrum Process
      • The Agile Development Advantage
    • Testimonials
    • Clients
  • Resources
    • Blog
    • My Book: Beyond Legacy Code
    • Bibliography
    • Referral Program
    • Associates
  • Contact
    • Contact Me
    • Schedule A Call
    • About
  • Schedule A Call

Read, Write, and Refactor

  1. Home
  2. Blog
  3. Read, Write, and Refactor

2025 Public Training Schedule

June 23 26, 2025 – Agile Analysis and Design Patterns – Half-Day Sessions Online

July 22 – 25, 2025 – Agile Analysis and Design Patterns – Half-Day Sessions Online

Register Now
Or schedule a private class
Course Descriptions
  • Developer Essentials Training
    • Agile Analysis and Design Patterns
    • Hands-On: Extreme Programming Practices
  • Object-Oriented Analysis and Design Patterns
  • Scrum Software Developer Essentials
  • Agile Software Developer Essentials
  • Agile Software Developer Intensives
Follow me on Twitter:

Follow @ToBeAgile

Blog Post Categories
  • Announcements {19}
  • Articles {2}
  • Bits and Pieces {74}
  • Blogosphere {1}
  • Bonuses {2}
  • Build in Small Batches {27}
  • Collaborate {38}
  • Create CLEAN Code {34}
  • Implement the Design Last {11}
  • Integrate Continuously {30}
  • Off-Topic but Interesting {3}
  • Rants {82}
  • Refactor Legacy Code {24}
  • Say What, Why, and for Whom Before How {22}
  • Seven Strategies {38}
  • Specify Behaviors with Tests {17}
  • Write the Test First {27}
Archives
  • 2023
  • November 2023
  • October 2023
  • September 2023
  • August 2023
  • July 2023
  • June 2023
  • May 2023
  • April 2023
  • March 2023
  • February 2023
  • January 2023
  • 2022
  • December 2022
  • November 2022
  • October 2022
  • September 2022
  • August 2022
  • July 2022
  • June 2022
  • May 2022
  • April 2022
  • March 2022
  • February 2022
  • January 2022
  • 2021
  • December 2021
  • November 2021
  • October 2021
  • September 2021
  • August 2021
  • July 2021
  • June 2021
  • May 2021
  • April 2021
  • March 2021
  • February 2021
  • January 2021
  • 2020
  • December 2020
  • November 2020
  • October 2020
  • September 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • 2019
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • February 2019
  • January 2019
  • 2018
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • 2017
  • December 2017
  • November 2017
  • October 2017
  • September 2017
  • August 2017
  • July 2017
  • June 2017
  • May 2017
  • April 2017
  • March 2017
  • February 2017
  • January 2017
  • 2016
  • December 2016
  • November 2016
  • October 2016
  • September 2016
  • August 2016
  • July 2016
  • June 2016
  • May 2016
  • April 2016
  • March 2016
  • February 2016
  • January 2016
  • 2015
  • December 2015
  • November 2015
  • October 2015
  • September 2015
  • August 2015
  • July 2015
  • June 2015
  • May 2015
  • April 2015
  • March 2015
  • February 2015
  • January 2015
  • 2014
  • December 2014
  • November 2014
  • October 2014
  • September 2014
  • August 2014
  • July 2014
  • June 2014
  • May 2014
  • April 2014
  • March 2014
  • February 2014
  • January 2014
  • 2013
  • December 2013
  • November 2013
  • October 2013
  • September 2013
  • August 2013
  • July 2013
  • June 2013
  • May 2013
  • April 2013
  • March 2013
  • February 2013
  • January 2013
  • 2012
  • December 2012
  • Privacy Policy

    (c) 2025 To Be Agile

    • September 5, 2018 ( 5 comments )
    • Refactor Legacy Code

    A couple of years ago I got to realize a lifelong dream when I became a published author. I was surprised to learn that many of the skills that I gained in becoming a good software developer were actually useful to me in becoming a good writer. Like code, prose should be well-encapsulated and cohesive, assertive and non-redundant, and all the other qualities that are virtuous in software apply equally well to prose.

    I learned how to keep my writing and my speaking focused and engaging. I learned that when I deal with things on the same level of abstraction that it’s easier to understand and communicate. I learned that very often a central image or metaphor around an important concept really helps us understand at a much deeper level.

    What I wasn’t expecting and turned out to be quite a pleasant surprise was that as I gained more skill as a writer, some of that knowledge could be transferred to writing good code. I want my code to be engaging and clear just like my writing. I find that even the basics of story structure can be used to help make the narrative of a piece of software more descriptive and interesting.

    The stories that we use in Agile speaks of what, why and for whom a feature is being built. This is used to drive our acceptance criteria. At a lower level, we describe the behaviors that we want to create using a “given-when-then” format which says,

    “Given some precondition, when a trigger happens, then some post-condition will occur.”

    These statements can be translated directly into unit test code so they can be very useful. Our goal is to break down features into smaller steps that produce some measurable result so that we can write a test around it.

    I’ve read many books on writing and still one of my very favorite books is Stephen King’s On Writing. One of the things that he says is that in order to be a good writer you have to do two things above all else. First, you have to read a lot of other people’s work because that’s how you expand your knowledge on how to turn a phrase and improve as a writer. Read from all genres and all styles. Read to study structure as well as execution.

    The other piece of advice that Stephen King gives in his book On Writing is that in order to be a writer you also must write a lot. This is one characteristic that all great writers have in common—they spend a lot of their day writing. Not all of it is good, of course. But when the mood is right they are able to capture a lot because they’re butt was in the seat.

    So, read a lot and write a lot. That’s the advice that Stephen King has for aspiring writers. For aspiring software developers, I would give some very similar advice with some caveats.

    One thing the developers don’t do nearly as often as they should at all levels of experience is to read other people’s code. One of the big problems around this is that most people write really crappy code. Also, many developers may write good code but just simply choose to approach problems in a different way than we would. However, this is good because it teaches us different perspectives and ways of thinking.

    Unfortunately, there are no libraries packed with best practices for coding in a variety of different environments. There is a lot of code out there if you know where to look for it. There are open source projects and tons of projects on GitHub and other repositories. But reading through this kind of code is not like reading the classics. Still, every once in a while I find some really interesting tidbits in code that make it worthwhile.

    The second piece of advice, write a lot, I think is easier for most of us. As professional software developers, a good part of our job is writing code. The challenge is to continue to improve our skills as we continue to write code.

    But there’s another aspect to software development that doesn’t have a strong correlation in literature but is very important for us developers to practice. We’re just beginning to realize the importance of refactoring code and how software is part of a lifecycle. We can use refactoring to safely and effectively transform even the most intractable legacy code into something better.

    Knowing how to look at its design and discover patterns that we can easily refactor means that we can constantly improve the design of software and treat it like an asset that can be maintained and improved.

    {5 Comments }

    • Brian Button says:
      September 6, 2018 at 12:21 pm

      Hi, David. I really like this article. It does touch on a conversation topic I was chatting about with a few friends yesterday, about trying to find examples of good code to read. It is a shame, that after all these years, there aren’t more open source projects where the code is written in XP-style.

      Maybe we should write “something magnificent” 🙂

      — bab

      Reply
      • David Bernstein says:
        September 7, 2018 at 7:34 pm

        Hi Brian,

        I’m glad you like the article. I also have been having a hard time finding well-written, XP-developed source code that’s publically available to review in open source or elsewhere. I’m sure there must be some projects out there.

        If anyone else knows of any publically available source code written using test-first development and other XP practices then please list them in a comment here or email me directly and I’ll post it.

        That’s one cool thing about having a blog, I can ask for help.

        Thank you,
        David.

        Reply
    • Marc Roussy says:
      September 20, 2018 at 1:19 am

      I enjoyed Stephen King’s book on writing as well, but I got more out of William Zinsser’s On Writing Well. Lots of great advice that made me re-think how I write my blog posts. I’d be interested to hear any other recommendations you might have.

      Reply
      • David Bernstein says:
        September 20, 2018 at 5:51 pm

        Hi Marc,

        Thank you for your comment. I haven’t read On Writing Well yet, but I own it and I’ll check it out. Other books on writing that I like include Writing Down the Bones by Natalie Goldberg and Keys to Great Writing by Stephen Wilbers. My wife has a ton of books on screenwriting and story structure that I’ve also learned a lot from.

        There are a lot more books on how to write well than how to code well. My book, Beyond Legacy Code, is one of the few books I know that goes beyond the basics on what good code is and why it’s important.

        David.

        Reply
      • David Bernstein says:
        September 25, 2018 at 8:00 pm

        Hi Marc,

        I started reading Zinsser’s On Writing Well and I love it. His words flow so well. Thank you for the recommendation.

        David.

        Reply

    Previous Post: « My Second Favorite Refactoring

    Next Post: The Stigma Around Refactoring »

    Leave a Reply Cancel reply

    Your email address will not be published. Required fields are marked *

    Solutions

    I Can Help
    • Define
    • Educate
    • Integrate
    • Advise

    Consultation
    • Assessments
    • Design Reviews
    • Code Inspections
    • Ongoing Support

    Testimonials Clients

    Resources

    • Blog
    • My Book: Beyond Legacy Code
    • Referral Program
    • Associates


    Read my book!
    Schedule a Call

    Training

    • Training Schedule
    • Learning Roadmap
    • On-Site Classes
    • Online Training
    • Customized Coaching and Mob Facilitation

    Course Descriptions
    • Developer Essentials Training
      • Agile Analysis and Design Patterns
      • Hands-On: Extreme Programming Practices
    • Object-Oriented Analysis and Design Patterns
    • Scrum Software Developer Essentials
    • Agile Software Developer Essentials
    • Agile Software Developer Intensives

    Copyright 2025 © To Be Agile. All rights reserved. Privacy Policy.

    This website uses cookies to improve your experience. I'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
    Privacy & Cookies Policy

    Privacy Overview

    This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
    Necessary
    Always Enabled
    Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
    SAVE & ACCEPT