Even bad code can function. But if code isnt clean, it can bring a development organization to its knees. Every year, countless hours and significant resources are lost because of poorly written code. But it doesnt have to be that way.Noted software expert Robert C. Martin, presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship. Martin, who has helped bring agile principles from a practitioners point of view to tens of thousands of programmers, has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code on the fly into a book that will instill within you the values of software craftsman, and make you a better programmerbut only if you work at it.What kind of work will you be doing? Youll be reading codelots of code. And you will be challenged to think about whats right about that code, and whats wrong with it. More importantly you will be challenged to reassess your professional values and your commitment to your craft. Clean Code is divided into three parts. The first describes the principles, patterns, and practices of writing clean code. The second part consists of several case studies of increasing complexity. Each case study is an exercise in cleaning up codeof transforming a code base that has some problems into one that is sound and efficient. The third part is the payoff: a single chapter containing a list of heuristics and smells gathered while creating the case studies. The result is a knowledge base that describes the way we think when we write, read, and clean code.Readers will come away from this book understandingHow to tell the difference between good and bad codeHow to write good code and how to transform bad code into good codeHow to create good names, good functions, good objects, and good classesHow to format code for maximum readability How to implement complete error handling without obscuring code logicHow to unit test and practice test-driven developmentWhat smells and heuristics can help you identify bad codeThis book is a must for any developer, software engineer, project manager, team lead, or systems analyst with an interest in producing better code.
Cited By
- Hong J and Ryu S (2024). Don’t Write, but Return: Replacing Output Parameters with Algebraic Data Types in C-to-Rust Translation, Proceedings of the ACM on Programming Languages, 8:PLDI, (716-740), Online publication date: 20-Jun-2024.
- Aman H, Amasaki S, Yokogawa T and Kawahara M A Quantitative Investigation of Trends in Confusing Variable Pairs Through Commits: Do Confusing Variable Pairs Survive? Proceedings of the 28th International Conference on Evaluation and Assessment in Software Engineering, (90-99)
- Romano S, Toriello G, Cassieri P, Francese R and Scanniello G A Folklore Confirmation on the Removal of Dead Code Proceedings of the 28th International Conference on Evaluation and Assessment in Software Engineering, (333-338)
- Sun W, Fang C, Chen Y, Zhang Q, Tao G, You Y, Han T, Ge Y, Hu Y, Luo B and Chen Z (2024). An Extractive-and-Abstractive Framework for Source Code Summarization, ACM Transactions on Software Engineering and Methodology, 33:3, (1-39), Online publication date: 31-Mar-2024.
- Toosi F (2023). Source Code Features and their Dependencies, Applied Computer Systems, 28:2, (221-231), Online publication date: 1-Dec-2023.
- Noei S, Li H, Georgiou S and Zou Y (2023). An Empirical Study of Refactoring Rhythms and Tactics in the Software Development Process, IEEE Transactions on Software Engineering, 49:12, (5103-5119), Online publication date: 1-Dec-2023.
- Tigina M, Birillo A, Golubev Y, Keuning H, Vyahhi N and Bryksin T Analyzing the Quality of Submissions in Online Programming Courses Proceedings of the 45th International Conference on Software Engineering: Software Engineering Education and Training, (271-282)
- Nurollahian S, Rafferty A and Wiese E Improving Assessment of Programming Pattern Knowledge through Code Editing and Revision Proceedings of the 45th International Conference on Software Engineering: Software Engineering Education and Training, (58-69)
- Reich P and Maalej W Testability Refactoring in Pull Requests: Patterns and Trends Proceedings of the 45th International Conference on Software Engineering, (1508-1519)
- Liang J, Arab M, Ko M, Ko A and LaToza T A Qualitative Study on the Implementation Design Decisions of Developers Proceedings of the 45th International Conference on Software Engineering, (435-447)
- Romano S, Zampetti F, Baldassarre M, Di Penta M and Scanniello G Do Static Analysis Tools Affect Software Quality when Using Test-driven Development? Proceedings of the 16th ACM / IEEE International Symposium on Empirical Software Engineering and Measurement, (80-91)
- Cassieri P, Romano S, Scanniello G, Tortora G and Caivano D Do Developers Modify Dead Methods during the Maintenance of Java Desktop Applications? Proceedings of the 26th International Conference on Evaluation and Assessment in Software Engineering, (120-129)
- Bhattacharjee A, Roy B and Schneider K Supporting program comprehension by generating abstract code summary tree Proceedings of the ACM/IEEE 44th International Conference on Software Engineering: New Ideas and Emerging Results, (81-85)
- Hernandez A, Nassif M and Robillard M DScribe Proceedings of the ACM/IEEE 44th International Conference on Software Engineering: Companion Proceedings, (56-60)
- Liu F, Li G, Fu Z, Lu S, Hao Y and Jin Z Learning to recommend method names with global context Proceedings of the 44th International Conference on Software Engineering, (1294-1306)
- Alsuhaibani R, Newman C, Decker M, Collard M and Maletic J An approach to automatically assess method names Proceedings of the 30th IEEE/ACM International Conference on Program Comprehension, (202-213)
- Digkas G, Chatzigeorgiou A, Ampatzoglou A and Avgeriou P (2022). Can Clean New Code Reduce Technical Debt Density?, IEEE Transactions on Software Engineering, 48:5, (1705-1721), Online publication date: 1-May-2022.
- Zabardast E, Ebo Bennin K and Gonzalez‐Huerta J (2022). Further investigation of the survivability of code technical debt items, Journal of Software: Evolution and Process, 34:2, Online publication date: 9-Feb-2022.
- Sundelin A, Gonzalez-huerta J, Wnuk K and Gorschek T (2021). Towards an Anatomy of Software Craftsmanship, ACM Transactions on Software Engineering and Methodology, 31:1, (1-49), Online publication date: 31-Jan-2022.
- Gresta R, Durelli V and Cirilo E Naming Practices in Java Projects: An Empirical Study Proceedings of the XX Brazilian Symposium on Software Quality, (1-10)
- Gomes P, Garcia R, Eler D, Correia R and Junior C Software Quality as a Subsidy for Teaching Programming 2021 IEEE Frontiers in Education Conference (FIE), (1-9)
- Caivano D, Cassieri P, Romano S and Scanniello G An Exploratory Study on Dead Methods in Open-source Java Desktop Applications Proceedings of the 15th ACM / IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM), (1-11)
- Soomlek C, van Rijn J and Bonsangue M Automatic Human-Like Detection of Code Smells Discovery Science, (19-28)
- Latifaj M, Ciccozzi F, Anwar M and Mohlin M Blended Graphical and Textual Modelling of UML-RT State-Machines: An Industrial Experience Software Architecture, (22-44)
- Preschern C A Pattern Story about C Programming Proceedings of the 26th European Conference on Pattern Languages of Programs, (1-9)
- Batdalov R and Nikiforova O Patterns for Assignment and Passing Objects Between Contexts in Programming Languages Proceedings of the 26th European Conference on Pattern Languages of Programs, (1-9)
- Buffardi K and Aguirre-Ayala J Unit Test Smells and Accuracy of Software Engineering Student Test Suites Proceedings of the 26th ACM Conference on Innovation and Technology in Computer Science Education V. 1, (234-240)
- Basile D and ter Beek M A Clean and Efficient Implementation of Choreography Synthesis for Behavioural Contracts Coordination Models and Languages, (225-238)
- Basile D, ter Beek M, Degano P, Legay A, Ferrari G, Gnesi S and Di Giandomenico F Supervisory Synthesis of Configurable Behavioural Contracts with Modalities Formal Techniques for Distributed Objects, Components, and Systems, (177-181)
- Alsuhaibani R, Newman C, Decker M, Collard M and Maletic J On the Naming of Methods Proceedings of the 43rd International Conference on Software Engineering, (587-599)
- Digkas G, Ampatzoglou A, Chatzigeorgiou A, Avgeriou P, Matei O and Heb R (2020). The Risk of Generating Technical Debt Interest: A Case Study, SN Computer Science, 2:1, Online publication date: 1-Feb-2021.
- Andrä L, Taufner B, Schefer-Wenzl S and Miladinovic I Maintainability Metrics for Android Applications in Kotlin Proceedings of the 2020 European Symposium on Software Engineering, (1-5)
- Nascimento M, Araújo E, Serey D and Figueiredo J The Role of Source Code Vocabulary in Programming Teaching and Learning 2020 IEEE Frontiers in Education Conference (FIE), (1-8)
- Kanade A, Maniatis P, Balakrishnan G and Shi K Learning and evaluating contextual embedding of source code Proceedings of the 37th International Conference on Machine Learning, (5110-5121)
- Preschern C Patterns for Organizing Files in Modular C Programs Proceedings of the European Conference on Pattern Languages of Programs 2020, (1-15)
- Spadini D, Schvarcbacher M, Oprescu A, Bruntink M and Bacchelli A Investigating Severity Thresholds for Test Smells Proceedings of the 17th International Conference on Mining Software Repositories, (311-321)
- Krueger R, Huang Y, Liu X, Santander T, Weimer W and Leach K Neurological divide Proceedings of the ACM/IEEE 42nd International Conference on Software Engineering, (678-690)
- Bessghaier N, Ouni A and Mkaouer M On the Diffusion and Impact of Code Smells in Web Applications Services Computing – SCC 2020, (67-84)
- Aman H, Amasaki S, Yokogawa T and Kawahara M (2019). Empirical study of abnormality in local variables and its application to fault‐prone Java method analysis†, Journal of Software: Evolution and Process, 32:4, Online publication date: 1-Apr-2020.
- Wan Y, Shu J, Sui Y, Xu G, Zhao Z, Wu J and Yu P Multi-modal attention network learning for semantic source code retrieval Proceedings of the 34th IEEE/ACM International Conference on Automated Software Engineering, (13-25)
- Krüger J Tackling knowledge needs during software evolution Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, (1244-1246)
- Preschern C Patterns to escape the #ifdef hell Proceedings of the 24th European Conference on Pattern Languages of Programs, (1-12)
- Euler S Automatic Evaluation of the Quality of Solutions for an Open Programming Task Proceedings of the 2019 ACM Conference on Innovation and Technology in Computer Science Education, (237-238)
- Nielebock S, Krolikowski D, Krüger J, Leich T and Ortmeier F (2019). Commenting source code, Empirical Software Engineering, 24:3, (1418-1457), Online publication date: 1-Jun-2019.
- Wiese E, Rafferty A and Fox A Linking code readability, structure, and comprehension among novices Proceedings of the 41st International Conference on Software Engineering: Software Engineering Education and Training, (84-94)
- Bafatakis N, Boecker N, Boon W, Salazar M, Krinke J, Oznacar G and White R Python coding style compliance on stack overflow Proceedings of the 16th International Conference on Mining Software Repositories, (210-214)
- Liu K, Kim D, Bissyandé T, Kim T, Kim K, Koyuncu A, Kim S and Traon Y Learning to spot and refactor inconsistent method names Proceedings of the 41st International Conference on Software Engineering, (1-12)
- Tanveer B, Vollmer A, Braun S and Ali N (2019). An evaluation of effort estimation supported by change impact analysis in agile software development, Journal of Software: Evolution and Process, 31:5, Online publication date: 20-May-2019.
- Rajlich V (2018). Five recommendations for software evolvability, Journal of Software: Evolution and Process, 30:9, Online publication date: 17-Sep-2018.
- Wan Y, Zhao Z, Yang M, Xu G, Ying H, Wu J and Yu P Improving automatic source code summarization via deep reinforcement learning Proceedings of the 33rd ACM/IEEE International Conference on Automated Software Engineering, (397-407)
- Aniche M, Bavota G, Treude C, Gerosa M and Deursen A (2018). Code smells for Model-View-Controller architectures, Empirical Software Engineering, 23:4, (2121-2157), Online publication date: 1-Aug-2018.
- Batdalov R and Nikiforova O Three Patterns of Data Type Composition in Programming Languages Proceedings of the 23rd European Conference on Pattern Languages of Programs, (1-8)
- Zarras A, Mamalis G, Papamichail A, Kollias P and Vassiliadis P And the Tool Created a GUI That was Impure and Without Form Proceedings of the 23rd European Conference on Pattern Languages of Programs, (1-8)
- Blasquez I and Leblanc H Experience in learning test-driven development: space invaders project-driven Proceedings of the 23rd Annual ACM Conference on Innovation and Technology in Computer Science Education, (111-116)
- Su F, Bell J, Kaiser G and Ray B Obfuscation resilient search through executable classification Proceedings of the 2nd ACM SIGPLAN International Workshop on Machine Learning and Programming Languages, (20-30)
- O'Neill B (2018). Curriculum changes to improve software development skills in undergraduates, Journal of Computing Sciences in Colleges, 33:6, (86-96), Online publication date: 1-Jun-2018.
- dos Santos R and Gerosa M Impacts of coding practices on readability Proceedings of the 26th Conference on Program Comprehension, (277-285)
- Schankin A, Berger A, Holt D, Hofmeister J, Riedel T and Beigl M Descriptive compound identifier names improve source code comprehension Proceedings of the 26th Conference on Program Comprehension, (31-40)
- Krüger J, Wiemann J, Fenske W, Saake G and Leich T Do you remember this source code? Proceedings of the 40th International Conference on Software Engineering, (764-775)
- Tanveer B, Vollmer A and Braun S A hybrid methodology for effort estimation in Agile development Proceedings of the 2018 International Conference on Software and System Process, (21-30)
- Kery M, Radensky M, Arya M, John B and Myers B The Story in the Notebook Proceedings of the 2018 CHI Conference on Human Factors in Computing Systems, (1-11)
- van Schelven K Clef Design Proceedings of the 11th European Lisp Symposium on European Lisp Symposium, (94-102)
- Mosqueira-Rey E, Alonso-Ríos D and Moret-Bonillo V A heuristic evaluation of the user and programming interfaces of a sleep medicine application Proceedings of the 33rd Annual ACM Symposium on Applied Computing, (648-655)
- Buchwald H Subject-Orientation and Agility Proceedings of the 10th International Conference on Subject-Oriented Business Process Management, (1-7)
- Gestwicki P Design and Evaluation of an Undergraduate Course on Software Development Practices Proceedings of the 49th ACM Technical Symposium on Computer Science Education, (221-226)
- Börstler J, Störrle H, Toll D, van Assema J, Duran R, Hooshangi S, Jeuring J, Keuning H, Kleiner C and MacKellar B "I know it when I see it" Perceptions of Code Quality Proceedings of the 2017 ITiCSE Conference on Working Group Reports, (70-85)
- Bach T, Andrzejak A, Pannemans R and Lo D The impact of coverage on bug density in a large industrial software project Proceedings of the 11th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement, (307-313)
- Green R (2017). Focus driven development, Journal of Computing Sciences in Colleges, 33:1, (72-76), Online publication date: 1-Oct-2017.
- Uhnák P and Pergl R Ad-hoc Runtime Object Structure Visualizations with MetaLinks Proceedings of the 12th edition of the International Workshop on Smalltalk Technologies, (1-10)
- Cheresharov S, Krushkov H, Stoyanov S and Popchev I (2017). Modules for Rapid Application Development of Web-Based Information Systems (RADWIS), Cybernetics and Information Technologies, 17:3, (109-127), Online publication date: 1-Sep-2017.
- Van Heesch U, Theunissen T, Zimmermann O and Zdun U Software Specification and Documentation in Continuous Software Development Proceedings of the 22nd European Conference on Pattern Languages of Programs, (1-13)
- Sauermann V and Frey F Architecture Management in Software Development Organizations Proceedings of the 22nd European Conference on Pattern Languages of Programs, (1-14)
- Avidan E and Feitelson D Effects of variable names on comprehension an empirical study Proceedings of the 25th International Conference on Program Comprehension, (55-65)
- Valdecantos H, Tarrit K, Mirakhorli M and Coplien J An empirical study on code comprehension Proceedings of the 25th International Conference on Program Comprehension, (275-285)
- Beniamini G, Gingichashvili S, Orbach A and Feitelson D Meaningful identifier names Proceedings of the 25th International Conference on Program Comprehension, (45-54)
- Wiese E, Yen M, Chen A, Santos L and Fox A Teaching Students to Recognize and Implement Good Coding Style Proceedings of the Fourth (2017) ACM Conference on Learning @ Scale, (41-50)
- Lindell R Design in Ecology of Other Artefacts Proceedings of the Audio Mostly 2016, (240-244)
- Ó Cinnéide M, Yamashita A and Counsell S Measuring refactoring benefits: a survey of the evidence Proceedings of the 1st International Workshop on Software Refactoring, (9-12)
- Lee J, Kim D, Kim S and Park S (2016). Decomposing class responsibilities using distance-based method similarity, Frontiers of Computer Science: Selected Publications from Chinese Universities, 10:4, (612-630), Online publication date: 1-Aug-2016.
- Bernstein M Storyspace 3 Proceedings of the 27th ACM Conference on Hypertext and Social Media, (201-206)
- Sharma T, Fragkoulis M and Spinellis D Does your configuration code smell? Proceedings of the 13th International Conference on Mining Software Repositories, (189-200)
- Politowski C, Fontoura L, Petrillo F and Guéhéneuc Y Are the old days gone? Proceedings of the 5th International Workshop on Games and Software Engineering, (22-28)
- Romano S, Scanniello G, Sartiani C and Risi M A graph-based approach to detect unreachable methods in Java software Proceedings of the 31st Annual ACM Symposium on Applied Computing, (1538-1541)
- Patrick M, Elderfield J, Stutt R, Rice A and Gilligan C Software testing in a scientific research group Proceedings of the 31st Annual ACM Symposium on Applied Computing, (1454-1459)
- Gestwicki P and McNely B (2016). Interdisciplinary Projects in the Academic Studio, ACM Transactions on Computing Education, 16:2, (1-24), Online publication date: 28-Mar-2016.
- Ott C, Robins A and Shephard K (2016). Translating Principles of Effective Feedback for Students into the CS1 Context, ACM Transactions on Computing Education, 16:1, (1-27), Online publication date: 26-Feb-2016.
- Costa B, Pires P, Delicato F and Merson P (2016). Evaluating REST architectures-Approach, tooling and guidelines, Journal of Systems and Software, 112:C, (156-180), Online publication date: 1-Feb-2016.
- Gestwicki P (2015). Teaching game programming with PlayN, Journal of Computing Sciences in Colleges, 31:1, (90-97), Online publication date: 1-Oct-2015.
- Mitrović D, Ivanović M and Budimac Z Test-driven development of web and enterprise agents Proceedings of the 7th Balkan Conference on Informatics Conference, (1-5)
- Allamanis M, Barr E, Bird C and Sutton C Suggesting accurate method and class names Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, (38-49)
- Preschern C Idioms for error handling in C Proceedings of the 20th European Conference on Pattern Languages of Programs, (1-10)
- Ouni A, Kessentini M, Bechikh S and Sahraoui H (2015). Prioritizing code-smells correction tasks using chemical reaction optimization, Software Quality Journal, 23:2, (323-361), Online publication date: 1-Jun-2015.
- Hill J and Feiock D (2014). Pin++: an object-oriented framework for writing pintools, ACM SIGPLAN Notices, 50:3, (133-141), Online publication date: 12-May-2015.
- Stegeman M, Barendsen E and Smetsers S Towards an empirically validated model for assessment of code quality Proceedings of the 14th Koli Calling International Conference on Computing Education Research, (99-108)
- Dibble C and Gestwicki P (2014). Refactoring code to increase readability and maintainability, Journal of Computing Sciences in Colleges, 30:1, (41-51), Online publication date: 1-Oct-2014.
- Hill J and Feiock D Pin++: an object-oriented framework for writing pintools Proceedings of the 2014 International Conference on Generative Programming: Concepts and Experiences, (133-141)
- Dillon S, Rastrick K, Stahl F and Vossen G (2014). Cases for the Web in Your Pocket WiPo, International Journal of Information Technology and Web Engineering, 9:3, (40-54), Online publication date: 1-Jul-2014.
- Steidl D and Eder S Prioritizing maintainability defects based on refactoring recommendations Proceedings of the 22nd International Conference on Program Comprehension, (168-176)
- Tian E Journey to agility for a large scale telecom system Proceedings of the 2014 International Conference on Software and System Process, (191-192)
- Heinonen K, Hirvikoski K, Luukkainen M and Vihavainen A Learning agile software engineering practices using coding dojo Proceedings of the 14th annual ACM SIGITE conference on Information technology education, (97-102)
- Greiler M, Zaidman A, Deursen A and Storey M Strategies for avoiding text fixture smells during software evolution Proceedings of the 10th Working Conference on Mining Software Repositories, (387-396)
- Schulze S, Richers O and Schaefer I Refactoring delta-oriented software product lines Proceedings of the 12th annual international conference on Aspect-oriented software development, (73-84)
- Gestwicki P and McNely B Empirical evaluation of periodic retrospective assessment Proceeding of the 44th ACM technical symposium on Computer science education, (699-704)
- Luukkainen M, Vihavainen A and Vikberg T Three years of design-based research to reform a software engineering curriculum Proceedings of the 13th annual conference on Information technology education, (209-214)
- McNely B, Gestwicki P, Burke A and Gelms B Articulating everyday actions Proceedings of the 30th ACM international conference on Design of communication, (95-104)
- Kruchten P, Nord R, Ozkaya I and Visser J (2012). Technical debt in software development, ACM SIGSOFT Software Engineering Notes, 37:5, (36-38), Online publication date: 7-Sep-2012.
- Luukkainen M, Vihavainen A and Vikberg T A software craftsman's approach to data structures Proceedings of the 43rd ACM technical symposium on Computer Science Education, (439-444)
- Cukier D and Yoder J The artist in the computer scientist Proceedings of the 10th SIGPLAN symposium on New ideas, new paradigms, and reflections on programming and software, (129-136)
- Kurhila J and Vihavainen A Management, structures and tools to scale up personal advising in large programming courses Proceedings of the 2011 conference on Information technology education, (3-8)
- Smith A and Kulkarni P Localizing globals and statics to make C programs thread-safe Proceedings of the 14th international conference on Compilers, architectures and synthesis for embedded systems, (205-214)
- Ozkaya I, Kruchten P, Nord R and Brown N (2011). Managing technical debt in software development, ACM SIGSOFT Software Engineering Notes, 36:5, (33-35), Online publication date: 30-Sep-2011.
- Vihavainen A, Paksula M, Luukkainen M and Kurhila J Extreme apprenticeship method Proceedings of the 16th annual joint conference on Innovation and technology in computer science education, (273-277)
- Ozkaya I, Kruchten P, Nord R and Brown N Second international workshop on managing technical debt (MTD 2011) Proceedings of the 33rd International Conference on Software Engineering, (1212-1213)
- Brown N, Cai Y, Guo Y, Kazman R, Kim M, Kruchten P, Lim E, MacCormack A, Nord R, Ozkaya I, Sangwan R, Seaman C, Sullivan K and Zazworka N Managing technical debt in software-reliant systems Proceedings of the FSE/SDP workshop on Future of software engineering research, (47-52)
- Do Vale Pereira D and Kulesza U Refactoring a web academic information system using design patterns Proceedings of the 8th Latin American Conference on Pattern Languages of Programs, (1-14)
- Kratzer K and Böttcher A Using an RTSJ-compatible MVC pattern as basis for configurable event-driven real-time software Proceedings of the 8th International Workshop on Java Technologies for Real-Time and Embedded Systems, (8-15)
- Nicolaysen T, Sassoon R, Line M and Jaatun M (2010). Agile Software Development, International Journal of Secure Software Engineering, 1:3, (71-85), Online publication date: 1-Jul-2010.
Index Terms
- Clean Code: A Handbook of Agile Software Craftsmanship