• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Five questions of code?

 
Marshal
Posts: 70234
282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To continue from what Paul Nisset said here, did you develop these principles gradually or did they appear suddenly? What influences did you have from older refactoring techniques?
 
Author
Posts: 31
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Campbell,

Cool question. You may want to read what I replied to Paul in the other thread, because I guess I'll just pick up here, where I left off.

TL;DR: Like most things in computer science the rules came about through many iterations.

During a live coding session, with my best friend, I came up with the game in the book, and the five lines rule, I also came up with a few other rules. Unfortunately, neither of us wrote any of it down. On my way home I felt like I had stumbled on something interesting, and helpful, so when I came home I recreated some of it and tried to take some notes.

I have always loved writing stories, and I have started many books, none of which has come anything of. So my notes quickly took the form of a book. I mostly just thought it would be for me and my friends. While writing this I came up with a few different rules to make everything fit. After about a year of having it gathering e-dust in my dropbox, I opened it again and read through it. By this time I had gotten more experience in the industry, and decided to rewrite most of it, and change some of the rules.

Another year passed. The final phase of the rules has been in my collaboration with Manning, where I have actually added a few, and removed half of one -- it is mentioned but not as a formal rule. I've found that trying to write something in a formal format like a book forces me to think more critically, and the structure can reveal gaps. Mostly the early rules have stayed pretty much the same, but chapter 6 is nothing like the original.

For the second part of your question, I took a lot of inspiration. I often say, if you want to make something good, start by copying something good then make it your own. The game is inspired by many games of its kind, the rules are based on the most useful smells I have come across, many from Robert C. Martin's "Clean Code", the refactorings are often rooted in Martin Fowler's "Refactoring". The initial draft actually followed the structure of Fowler's book, but one of my talented editors helped make it more suitable to my message.

I did not come up with how good code should look. At every rule and refactoring, I have a subsection about what inspired it. Those are the giants on whose shoulders I stand. I only hope my contribution will be putting the knowledge in more people's hands.

Hope that answers your question.
 
Campbell Ritchie
Marshal
Posts: 70234
282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you. I ad already seen you answer to PN about your tech talks at University.
 
I was born with webbed fish toes. This tiny ad is my only friend:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic