This document provides an outline for a course on clean code. It covers principles of clean code like high signal-to-noise ratio, self-documenting code, and the right tool for the job. It also discusses techniques for writing clean code, such as naming conventions, writing high-quality functions and classes, using conditionals effectively, and using comments judiciously. The document is presented over several pages with headings and subheadings to structure the content.
All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation. This first session creates the foundation for the 2nd and 3rd Clean Code presentation on Dependency Injection, as it explains expected base knowledge. Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs.
Writing clean code can significantly lower these costs. However, writing clean code also makes you more efficient during the initial development time and results in more stable code. You will be presented design patterns and best practices which will make you write better and more easily maintainable code, seeing code in a holistic way.
You will learn how to apply them by using an existing implementation as the starting point of the presentation. Finally, patterns & practices benefits are explained. This presentation is based on C# and Visual Studio 2012. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-10-03 Silicon Valley Code Camp, San Jose, CA
2015-06-27 SoCal Code Camp - San Diego, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-18 Desert Code Camp - Chandler, AZ
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
This document provides a summary of a presentation on object-oriented programming (OOP) and clean code given at IPB Computer Science on March 28, 2017. It introduces the speaker, Ifnu Bima, and his background working at Deutsche Bank and blibli.com. The presentation covers topics like code quality metrics, meaningful naming conventions, high-quality functions, comments, and unit testing. It emphasizes writing code that is easy to maintain and modify over time to prevent issues like bugs and technical debt.
Presentation I held before my colleagues about the book Clean Code (http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882).
It contains the highlights of several chapters and hint/guidelines a developer should know.
clean code book summary - uncle bob - English versionsaber tabatabaee
The document provides guidance on writing clean code based on the book "Clean Code" by Robert Cecil Martin. Some of the key points discussed include:
- Functions should do one thing and do it well, with a single level of abstraction and no side effects. They should fit on a screen.
- Names should be meaningful, avoid abbreviations, and use consistent vocabulary. Class names should be nouns and method names should be verbs.
- Code formatting is important for readability. Classes should not exceed 200 lines, functions a single screen. Variables should be declared near use.
- Comments should only explain why unusual decisions were made, not what the code does. Avoid commented out code or redundant comments
The document discusses principles and best practices for writing clean code, including using meaningful names, separating commands and queries, avoiding repetition, using exceptions instead of return codes, and following object-oriented principles like polymorphism instead of switch statements on objects. It provides examples of good and bad code for concepts like single responsibility, primitive obsession, and refused bequest. The overall goal is to write code that is readable, maintainable, and extendable.
Presentación para la charla sobre el libro de Robert C. Martin, Clean Code.
Esta presentación la impartí en CyLicon Valley, aquí tenéis el video con el audio de la charla => https://www.youtube.com/watch?v=1Fss1jBfc3g
The document discusses the principles of clean code as outlined in the book "Clean Code" by Robert C. Martin. It covers topics like meaningful names, comments, functions, objects and data structures, error handling, and unit tests. The goal of clean code is to produce readable, maintainable code through practices like breaking code into small, single-purpose functions and hiding implementation details in objects.
All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation. This first session creates the foundation for the 2nd and 3rd Clean Code presentation on Dependency Injection, as it explains expected base knowledge. Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs.
Writing clean code can significantly lower these costs. However, writing clean code also makes you more efficient during the initial development time and results in more stable code. You will be presented design patterns and best practices which will make you write better and more easily maintainable code, seeing code in a holistic way.
You will learn how to apply them by using an existing implementation as the starting point of the presentation. Finally, patterns & practices benefits are explained. This presentation is based on C# and Visual Studio 2012. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-10-03 Silicon Valley Code Camp, San Jose, CA
2015-06-27 SoCal Code Camp - San Diego, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-18 Desert Code Camp - Chandler, AZ
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
This document provides a summary of a presentation on object-oriented programming (OOP) and clean code given at IPB Computer Science on March 28, 2017. It introduces the speaker, Ifnu Bima, and his background working at Deutsche Bank and blibli.com. The presentation covers topics like code quality metrics, meaningful naming conventions, high-quality functions, comments, and unit testing. It emphasizes writing code that is easy to maintain and modify over time to prevent issues like bugs and technical debt.
Presentation I held before my colleagues about the book Clean Code (http://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882).
It contains the highlights of several chapters and hint/guidelines a developer should know.
clean code book summary - uncle bob - English versionsaber tabatabaee
The document provides guidance on writing clean code based on the book "Clean Code" by Robert Cecil Martin. Some of the key points discussed include:
- Functions should do one thing and do it well, with a single level of abstraction and no side effects. They should fit on a screen.
- Names should be meaningful, avoid abbreviations, and use consistent vocabulary. Class names should be nouns and method names should be verbs.
- Code formatting is important for readability. Classes should not exceed 200 lines, functions a single screen. Variables should be declared near use.
- Comments should only explain why unusual decisions were made, not what the code does. Avoid commented out code or redundant comments
The document discusses principles and best practices for writing clean code, including using meaningful names, separating commands and queries, avoiding repetition, using exceptions instead of return codes, and following object-oriented principles like polymorphism instead of switch statements on objects. It provides examples of good and bad code for concepts like single responsibility, primitive obsession, and refused bequest. The overall goal is to write code that is readable, maintainable, and extendable.
Presentación para la charla sobre el libro de Robert C. Martin, Clean Code.
Esta presentación la impartí en CyLicon Valley, aquí tenéis el video con el audio de la charla => https://www.youtube.com/watch?v=1Fss1jBfc3g
The document discusses the principles of clean code as outlined in the book "Clean Code" by Robert C. Martin. It covers topics like meaningful names, comments, functions, objects and data structures, error handling, and unit tests. The goal of clean code is to produce readable, maintainable code through practices like breaking code into small, single-purpose functions and hiding implementation details in objects.
The document discusses principles of clean code, beginning with definitions of clean code from various authors. It outlines key principles like the single responsibility principle and open/closed principle. It then covers sections on meaningful naming, functions, and classes. For functions, it recommends they be small, do one thing, avoid flag arguments, and have no side effects. For classes, it advocates for small size, encapsulation, high cohesion and low coupling following the single responsibility principle.
The document discusses clean coding practices for Java developers. It covers topics such as choosing meaningful names for variables, methods, and classes; writing code that is easy for others to understand; breaking methods down into single logical steps; and using fluent APIs to make code more readable. The presentation provides examples of clean code and ways to refactor code to follow best practices.
The document discusses principles and practices for writing clean code, including:
- Clean code is code that is readable, writable, and maintainable. It focuses on the needs of human readers over the computer.
- Broken windows theory states that one piece of low-quality code leads to more as developers get used to a lower standard. This can lead to software rot and eventual system rewrites.
- Characteristics of rotting software include rigidity, fragility, immobility, and viscosity.
- Following principles like SOLID, DRY, Law of Demeter, and object calisthenics can help avoid rot and keep code clean.
- Practices like using self-document
Petra Novandi discusses how to write clean code in JavaScript. She covers meaningful naming conventions, writing small functions that do one thing, using proper formatting and spacing, adding helpful comments, thorough testing, avoiding callbacks for concurrency, and leveraging new ES features. Clean code results in code that is elegant, simple, efficient and readable, improving productivity and maintainability. While JavaScript is flexible, efforts have been made to strengthen it with newer ES versions and tools to help enforce best practices and write code that is easily understood.
Clan code is extremely essential to build scalable application which can be maintained quite easily and improved further
Slide was prepared with contribution to my colleague
and i thank them for the help!
We know that Code Reviews are a Good Thing. We probably have our own personal lists of things we look for in the code we review, while also fearing what others might say about our code. How to we ensure that code reviews are actually benefiting the team, and the application? How do we decide who does the reviews? What does "done" look like?
In this talk, Trisha will identify some best practices to follow. She'll talk about what's really important in a code review, and set out some guidelines to follow in order to maximise the value of the code review and minimise the pain.
This document discusses principles of clean code based on the book "Clean Code" by Robert C. Martin. It provides examples of good and bad practices for naming variables and functions, structuring functions, using comments, and other topics. Key points include using meaningful names, keeping functions small and focused on a single task, avoiding deeply nested code and long argument lists, commenting to explain intent rather than state the obvious, and other guidelines for writing clean, readable code.
This document discusses principles and best practices for writing clean code. It defines clean code as code that works, is easy to read, understand and extend. It emphasizes writing code for other developers who will maintain it. Some key points include writing small, focused methods with meaningful names; avoiding duplicated code; using exceptions appropriately; formatting code consistently; and writing thorough automated tests. The overall goal is to communicate intent in the code as clearly as possible through these practices.
How should a professional software developer behave in code? What guidelines should one follow? How should we name our constructs? What about OOP principles? What's their real use?
This classic training module in my training curricula is the cornerstone of my professionalism. These are my conduit guidelines at work. I've held this training > 10 times, including at Voxxed Days Bucharest 2016 and at a Bucharest Java User Group meetup.
The document discusses clean code versus bad code. Clean code is easy to understand, maintain, and extend, while bad code is mysterious, fragile, and dangerous. The author provides tips for writing clean code such as using meaningful names, consistent formatting, small and focused functions, and comments that explain intent rather than state the obvious. The goal is to write code that is readable and maintainable over time.
Rule 1: Follow a consistent coding standard
Rule 2: Name things properly, long variable and function names are allowed
Rule 3: Be expressive, write code as you speak and be optimally verbose
Rule 4: Max indent per method should be 2, in case of exceptions 3
Rule 5: Avoid creating god object and long methods
Rule 6: Keep the method in one place, inject the class and call it, DRY
Rule 7: Avoid in-line comments (comment with code), put comments in the method doc
Planejamento de testes em um mundo ágilAriane Izac
Planejamento de Testes em um mundo ágil resume o seguinte:
1) No contexto ágil, os testadores deixam de ser os únicos responsáveis por garantir a qualidade e toda a equipe passa a assumir essa responsabilidade.
2) É importante planejar os testes considerando o contexto do projeto, priorizando riscos e automatizando casos que serão executados frequentemente.
3) A automação deve levar em conta fatores como maior risco, frequência de execução e linguagem para trazer mais valor ao longo do tempo.
This document provides an overview of writing clean code, focusing on readability, code style, naming conventions, code comments, control structures, functions/methods, classes, and modules. Key points include formatting code for readability, using explicit and descriptive naming, minimizing comments by ensuring code is self-explanatory, limiting nested control structures and side effects, following single responsibility and encapsulation principles, and leveraging software patterns.
Clean code is code that is elegant, efficient, focused, and readable. It should do one thing well. Bad code lacks these traits. Some heuristics for writing clean code include using descriptive naming, short methods that do one thing, avoiding comments when possible, consistent formatting, following object-oriented design principles like the Law of Demeter, and properly handling errors through exceptions.
Writing code is easy but writing maintainable code is almost impossible. During this talk I will discuss some of the principles of coding that relates to WordPress but goes beyond that.
This document provides an overview of test-driven development (TDD). It defines TDD as a technique for building software where tests are written before code to guide development. The key aspects of TDD covered are:
- Writing tests first before code, which helps improve design and ensures tests are written.
- The TDD mantra of Red-Green-Refactor, where tests initially fail (Red), code is written to pass tests (Green), then code is refactored to improve design.
- An example case study of a large Java project developed using TDD that has over 20,000 lines of unit tests providing over 90% test coverage.
YAGNI = You Ain’t Gonna Need It
Emerged as one of the key principles of Extreme Programming
and says that you should do the simplest thing that could Possibly work!
This document provides guidelines for writing clean code at Raya Software. It discusses topics like meaningful names, small methods that do one thing, avoiding switch statements, using exceptions over return codes, and not returning or passing null values. The guidelines are presented through examples to enhance readability and reduce errors. Overall, the document aims to help programmers at Raya Software write high-quality code through established best practices.
The document discusses principles of clean code, beginning with definitions of clean code from various authors. It outlines key principles like the single responsibility principle and open/closed principle. It then covers sections on meaningful naming, functions, and classes. For functions, it recommends they be small, do one thing, avoid flag arguments, and have no side effects. For classes, it advocates for small size, encapsulation, high cohesion and low coupling following the single responsibility principle.
The document discusses clean coding practices for Java developers. It covers topics such as choosing meaningful names for variables, methods, and classes; writing code that is easy for others to understand; breaking methods down into single logical steps; and using fluent APIs to make code more readable. The presentation provides examples of clean code and ways to refactor code to follow best practices.
The document discusses principles and practices for writing clean code, including:
- Clean code is code that is readable, writable, and maintainable. It focuses on the needs of human readers over the computer.
- Broken windows theory states that one piece of low-quality code leads to more as developers get used to a lower standard. This can lead to software rot and eventual system rewrites.
- Characteristics of rotting software include rigidity, fragility, immobility, and viscosity.
- Following principles like SOLID, DRY, Law of Demeter, and object calisthenics can help avoid rot and keep code clean.
- Practices like using self-document
Petra Novandi discusses how to write clean code in JavaScript. She covers meaningful naming conventions, writing small functions that do one thing, using proper formatting and spacing, adding helpful comments, thorough testing, avoiding callbacks for concurrency, and leveraging new ES features. Clean code results in code that is elegant, simple, efficient and readable, improving productivity and maintainability. While JavaScript is flexible, efforts have been made to strengthen it with newer ES versions and tools to help enforce best practices and write code that is easily understood.
Clan code is extremely essential to build scalable application which can be maintained quite easily and improved further
Slide was prepared with contribution to my colleague
and i thank them for the help!
We know that Code Reviews are a Good Thing. We probably have our own personal lists of things we look for in the code we review, while also fearing what others might say about our code. How to we ensure that code reviews are actually benefiting the team, and the application? How do we decide who does the reviews? What does "done" look like?
In this talk, Trisha will identify some best practices to follow. She'll talk about what's really important in a code review, and set out some guidelines to follow in order to maximise the value of the code review and minimise the pain.
This document discusses principles of clean code based on the book "Clean Code" by Robert C. Martin. It provides examples of good and bad practices for naming variables and functions, structuring functions, using comments, and other topics. Key points include using meaningful names, keeping functions small and focused on a single task, avoiding deeply nested code and long argument lists, commenting to explain intent rather than state the obvious, and other guidelines for writing clean, readable code.
This document discusses principles and best practices for writing clean code. It defines clean code as code that works, is easy to read, understand and extend. It emphasizes writing code for other developers who will maintain it. Some key points include writing small, focused methods with meaningful names; avoiding duplicated code; using exceptions appropriately; formatting code consistently; and writing thorough automated tests. The overall goal is to communicate intent in the code as clearly as possible through these practices.
How should a professional software developer behave in code? What guidelines should one follow? How should we name our constructs? What about OOP principles? What's their real use?
This classic training module in my training curricula is the cornerstone of my professionalism. These are my conduit guidelines at work. I've held this training > 10 times, including at Voxxed Days Bucharest 2016 and at a Bucharest Java User Group meetup.
The document discusses clean code versus bad code. Clean code is easy to understand, maintain, and extend, while bad code is mysterious, fragile, and dangerous. The author provides tips for writing clean code such as using meaningful names, consistent formatting, small and focused functions, and comments that explain intent rather than state the obvious. The goal is to write code that is readable and maintainable over time.
Rule 1: Follow a consistent coding standard
Rule 2: Name things properly, long variable and function names are allowed
Rule 3: Be expressive, write code as you speak and be optimally verbose
Rule 4: Max indent per method should be 2, in case of exceptions 3
Rule 5: Avoid creating god object and long methods
Rule 6: Keep the method in one place, inject the class and call it, DRY
Rule 7: Avoid in-line comments (comment with code), put comments in the method doc
Planejamento de testes em um mundo ágilAriane Izac
Planejamento de Testes em um mundo ágil resume o seguinte:
1) No contexto ágil, os testadores deixam de ser os únicos responsáveis por garantir a qualidade e toda a equipe passa a assumir essa responsabilidade.
2) É importante planejar os testes considerando o contexto do projeto, priorizando riscos e automatizando casos que serão executados frequentemente.
3) A automação deve levar em conta fatores como maior risco, frequência de execução e linguagem para trazer mais valor ao longo do tempo.
This document provides an overview of writing clean code, focusing on readability, code style, naming conventions, code comments, control structures, functions/methods, classes, and modules. Key points include formatting code for readability, using explicit and descriptive naming, minimizing comments by ensuring code is self-explanatory, limiting nested control structures and side effects, following single responsibility and encapsulation principles, and leveraging software patterns.
Clean code is code that is elegant, efficient, focused, and readable. It should do one thing well. Bad code lacks these traits. Some heuristics for writing clean code include using descriptive naming, short methods that do one thing, avoiding comments when possible, consistent formatting, following object-oriented design principles like the Law of Demeter, and properly handling errors through exceptions.
Writing code is easy but writing maintainable code is almost impossible. During this talk I will discuss some of the principles of coding that relates to WordPress but goes beyond that.
This document provides an overview of test-driven development (TDD). It defines TDD as a technique for building software where tests are written before code to guide development. The key aspects of TDD covered are:
- Writing tests first before code, which helps improve design and ensures tests are written.
- The TDD mantra of Red-Green-Refactor, where tests initially fail (Red), code is written to pass tests (Green), then code is refactored to improve design.
- An example case study of a large Java project developed using TDD that has over 20,000 lines of unit tests providing over 90% test coverage.
YAGNI = You Ain’t Gonna Need It
Emerged as one of the key principles of Extreme Programming
and says that you should do the simplest thing that could Possibly work!
This document provides guidelines for writing clean code at Raya Software. It discusses topics like meaningful names, small methods that do one thing, avoiding switch statements, using exceptions over return codes, and not returning or passing null values. The guidelines are presented through examples to enhance readability and reduce errors. Overall, the document aims to help programmers at Raya Software write high-quality code through established best practices.
This ppt is based on the book "Clean Code" written by Robert C Martin. It's a wonderful book and cover all the mistakes that we do while writing bad code. I am sharing few good practices shared in the book, hope you will like it
The document discusses essential skills that programmers need versus accidental skills. Essential skills are hard to acquire but long-lasting, including things like managing complexity, writing readable code, and limiting bugs. These skills separate good programmers from bad. Accidental skills like knowledge of a specific programming language are easier to obtain but have shorter usefulness. The document advocates spending time on design, planning, unit testing, discussing solutions with others, and considering alternative solutions rather than just focusing on writing code. Developing essential skills through these practices can help programmers continuously learn and improve over the course of their careers.
Clean code is subjective and every developer has a personal take on it. There are some ideas that are considered best practice and what constitutes clean code within the industry and community, but there is no definitive distinction.
How Functional Programming Made Me A Better DeveloperCameron Presley
The document discusses how learning functional programming improved the author's skills as a developer. It describes their journey learning F# by porting projects like a screenshot tool and card games. This helped them think more about pure functions, immutable data, and leveraging LINQ. It influenced how they write more testable code through interfaces and by avoiding null values. The author now considers types of components like boundaries, business rules, and workflows when building software. Overall, learning functional programming was challenging but improved their ability to design maintainable and testable systems.
The document discusses principles for writing clean code, including:
- Functions should do one thing and be small, with descriptive names.
- Code should be organized in a way that reads like well-written prose from top-level functions down.
- Comments are usually a code smell and cleaning up code is preferable to adding comments.
- Overall the goal is for code to be easy to read and understand at a glance.
This document discusses the principles of clean code based on Robert C. Martin's book "Clean Code". It covers topics like why clean code is important, guidelines for writing clean code like keeping methods small and using descriptive names, design principles like DRY and YAGNI, and code smells to avoid like long methods and duplicated code. The overall goal is to create code that is easy to read, understand and maintain over time.
This document provides summaries of what several experts consider "clean code". It discusses how clean code is readable, focused on doing one thing well, has minimal dependencies, is well-tested, has meaningful names, and shows that the author cares about quality. Overall, clean code is well-crafted, maintains professional standards, and can be easily understood and maintained by other programmers.
Chia sẻ về Clean Code tại XPDay Vietnam 2016.
Clean Code là gì?
Tại sao phải Clean Code?
Clean Code có khó không?
Một số ví dụ thực tế về áp dụng Clean Code.
It is time to fight the black holes in your software. Don't let legacy code dictate your work. Start learning and practicing dependency injection and refactoring. Become more agile.
1. The document provides programming style guidelines for writing clear, readable, and maintainable code. It discusses topics like naming conventions, file organization, writing statements, and documentation.
2. Specific guidelines include using lowercase names for variables and functions, uppercase names for constants, and prefix conventions. It also recommends organizing code into modular files with meaningful input/output, writing comments to explain the code, and using consistent indentation and formatting.
3. The document stresses the importance of writing code that is easy to understand even after some time has passed, and providing documentation on what the code is intended to do and how it works through header comments and external documentation files.
The document discusses clean code practices including meaningful names. It recommends following the "Boy Scout Rule" of leaving the code cleaner than when you found it. Examples of bad code include code that is confusing or does too many things due to rushing or pending requirements. Clean code is readable by others and has straightforward logic with minimal dependencies. When naming variables, classes and methods, use intention-revealing names that are clear and avoid mental mapping.
This document discusses guidelines for writing high quality code, including definitions of code quality, examples of good and bad practices for variables and statements, and recommendations on code construction. It focuses on concepts from the book "Code Complete" such as self-documenting code, managing complexity, information hiding, and creating high-level abstractions through classes and routines. The presentation provides many examples and recommendations for writing understandable, maintainable and flexible code.
Can we write successful enterprise software without challenging assumptions? Agile doesn't happen in a vacuum. Here's what I discovered using EventStorming as a blade to cut through business, software and organisation dysfunctions. From XP2017 Cologne.
The document discusses concepts and best practices for writing clean code, including:
- The importance of clean code for productivity and maintainability.
- Philosophies like SOLID principles and test-driven development.
- Guidelines for naming variables and functions clearly and meaningfully.
- Rules for writing small, focused functions that do one thing well.
- When comments are acceptable to provide necessary information versus when they indicate the need to improve code clarity.
This document discusses test-driven development (TDD), including what it is, why it is used, and how to implement it. TDD is a development approach where small test cases are written before code to validate requirements, with code written only to pass failing tests. It is a philosophy of workflow and design that helps clarify expectations, validate system state through assertions, break problems into smaller pieces, and protect against regressions. The process involves writing a single small test, writing just enough code to make it pass, thinking of other inputs and edge cases, and using mocks to stand in for external resources when testing relationships between code units.
The document discusses the importance of coding standards and unit tests. It notes that coding standards help make code easier to understand, maintain and scale. Unit tests are important to improve software design, make code easier to understand, reduce debugging time and catch errors. The document then provides examples of good coding practices like using meaningful names, small and focused functions, and minimizing comments. It also covers different types of tests like unit, integration and acceptance tests. Finally it gives an overview of JUnit and components like assert methods.
It has been said that one should code as if the person maintaining the code is a violent psychopath who knows where you live. But why do we work with psychopaths? That question unfortunately cannot be answered in this presentation. However, we can shed some light on how to code for readability hopefully avoiding the problem altogether.
Readable code is about a lot more than producing beautiful code. In fact, it has nothing really to do with the beauty of the code and everything to do with the ability to quickly understand what the code does.
In this presentation we will discuss why readable code is so important. We will cover six commonly reoccurring patterns that made code hard to read, why they occur, and how they can easily be avoided:
* Deep Nesting
* Unnecessary Generalization
* Ambiguous Naming
* Hard to Follow Flow of Execution
* Code Style vs. Individualism
* Code Comments
These concepts may be applied to any programming language.
2018 01-29 - brewbox - refactoring. sempre, senza pietàRoberto Albertini
La qualità del codice che maneggiamo tutti i giorni è molto importante ma difficile da ottenere. Non si tratta di un traguardo da raggiungere ma di un processo di continuo miglioramento.
Nel talk vedremo quali sono le più comuni debolezze del codice, vedremo come sia possibile manipolarlo senza paura e come approfittare di ogni occasione per migliorarlo seguendo alcuni principi di design.
https://brewbox.community/
https://www.facebook.com/events/1673978505997779
https://www.youtube.com/watch?v=aQQWrQZYliU
Similar to Clean Code - Writing code for human (20)
How to Implement a Strategy: Transform Your Strategy with BSC Designer's Comp...Aleksey Savkin
The Strategy Implementation System offers a structured approach to translating stakeholder needs into actionable strategies using high-level and low-level scorecards. It involves stakeholder analysis, strategy decomposition, adoption of strategic frameworks like Balanced Scorecard or OKR, and alignment of goals, initiatives, and KPIs.
Key Components:
- Stakeholder Analysis
- Strategy Decomposition
- Adoption of Business Frameworks
- Goal Setting
- Initiatives and Action Plans
- KPIs and Performance Metrics
- Learning and Adaptation
- Alignment and Cascading of Scorecards
Benefits:
- Systematic strategy formulation and execution.
- Framework flexibility and automation.
- Enhanced alignment and strategic focus across the organization.
Top mailing list providers in the USA.pptxJeremyPeirce1
Discover the top mailing list providers in the USA, offering targeted lists, segmentation, and analytics to optimize your marketing campaigns and drive engagement.
Understanding User Needs and Satisfying ThemAggregage
https://www.productmanagementtoday.com/frs/26903918/understanding-user-needs-and-satisfying-them
We know we want to create products which our customers find to be valuable. Whether we label it as customer-centric or product-led depends on how long we've been doing product management. There are three challenges we face when doing this. The obvious challenge is figuring out what our users need; the non-obvious challenges are in creating a shared understanding of those needs and in sensing if what we're doing is meeting those needs.
In this webinar, we won't focus on the research methods for discovering user-needs. We will focus on synthesis of the needs we discover, communication and alignment tools, and how we operationalize addressing those needs.
Industry expert Scott Sehlhorst will:
• Introduce a taxonomy for user goals with real world examples
• Present the Onion Diagram, a tool for contextualizing task-level goals
• Illustrate how customer journey maps capture activity-level and task-level goals
• Demonstrate the best approach to selection and prioritization of user-goals to address
• Highlight the crucial benchmarks, observable changes, in ensuring fulfillment of customer needs
Unveiling the Dynamic Personalities, Key Dates, and Horoscope Insights: Gemin...my Pandit
Explore the fascinating world of the Gemini Zodiac Sign. Discover the unique personality traits, key dates, and horoscope insights of Gemini individuals. Learn how their sociable, communicative nature and boundless curiosity make them the dynamic explorers of the zodiac. Dive into the duality of the Gemini sign and understand their intellectual and adventurous spirit.
Company Valuation webinar series - Tuesday, 4 June 2024FelixPerez547899
This session provided an update as to the latest valuation data in the UK and then delved into a discussion on the upcoming election and the impacts on valuation. We finished, as always with a Q&A
IMPACT Silver is a pure silver zinc producer with over $260 million in revenue since 2008 and a large 100% owned 210km Mexico land package - 2024 catalysts includes new 14% grade zinc Plomosas mine and 20,000m of fully funded exploration drilling.
Storytelling is an incredibly valuable tool to share data and information. To get the most impact from stories there are a number of key ingredients. These are based on science and human nature. Using these elements in a story you can deliver information impactfully, ensure action and drive change.
Digital Marketing with a Focus on Sustainabilitysssourabhsharma
Digital Marketing best practices including influencer marketing, content creators, and omnichannel marketing for Sustainable Brands at the Sustainable Cosmetics Summit 2024 in New York
Navigating the world of forex trading can be challenging, especially for beginners. To help you make an informed decision, we have comprehensively compared the best forex brokers in India for 2024. This article, reviewed by Top Forex Brokers Review, will cover featured award winners, the best forex brokers, featured offers, the best copy trading platforms, the best forex brokers for beginners, the best MetaTrader brokers, and recently updated reviews. We will focus on FP Markets, Black Bull, EightCap, IC Markets, and Octa.
The APCO Geopolitical Radar - Q3 2024 The Global Operating Environment for Bu...APCO
The Radar reflects input from APCO’s teams located around the world. It distils a host of interconnected events and trends into insights to inform operational and strategic decisions. Issues covered in this edition include:
SATTA MATKA SATTA FAST RESULT KALYAN TOP MATKA RESULT KALYAN SATTA MATKA FAST RESULT MILAN RATAN RAJDHANI MAIN BAZAR MATKA FAST TIPS RESULT MATKA CHART JODI CHART PANEL CHART FREE FIX GAME SATTAMATKA ! MATKA MOBI SATTA 143 spboss.in TOP NO1 RESULT FULL RATE MATKA ONLINE GAME PLAY BY APP SPBOSS
At Techbox Square, in Singapore, we're not just creative web designers and developers, we're the driving force behind your brand identity. Contact us today.
3 Simple Steps To Buy Verified Payoneer Account In 2024SEOSMMEARTH
Buy Verified Payoneer Account: Quick and Secure Way to Receive Payments
Buy Verified Payoneer Account With 100% secure documents, [ USA, UK, CA ]. Are you looking for a reliable and safe way to receive payments online? Then you need buy verified Payoneer account ! Payoneer is a global payment platform that allows businesses and individuals to send and receive money in over 200 countries.
If You Want To More Information just Contact Now:
Skype: SEOSMMEARTH
Telegram: @seosmmearth
Gmail: seosmmearth@gmail.com
Building Your Employer Brand with Social MediaLuanWise
Presented at The Global HR Summit, 6th June 2024
In this keynote, Luan Wise will provide invaluable insights to elevate your employer brand on social media platforms including LinkedIn, Facebook, Instagram, X (formerly Twitter) and TikTok. You'll learn how compelling content can authentically showcase your company culture, values, and employee experiences to support your talent acquisition and retention objectives. Additionally, you'll understand the power of employee advocacy to amplify reach and engagement – helping to position your organization as an employer of choice in today's competitive talent landscape.
Anny Serafina Love - Letter of Recommendation by Kellen Harkins, MS.AnnySerafinaLove
This letter, written by Kellen Harkins, Course Director at Full Sail University, commends Anny Love's exemplary performance in the Video Sharing Platforms class. It highlights her dedication, willingness to challenge herself, and exceptional skills in production, editing, and marketing across various video platforms like YouTube, TikTok, and Instagram.
4. Introduction
PAGE 4
Coding is for humans
Why is clean code matter?
Clean code is the Foundation
Resources
We will cover
5. Coding is for humans
“Programing is the art of telling another human what one wants the computer to do.”
Donald Knuth
Author of “The art of computer programing”
“Any fool can write code that a computer can understand. Good programmers write
code that humans can understand.”
Martin Fowler
Chief Scientist @ Through Work
PAGE 5
6. Why is clean code matters?
Reading is harder than writing
Technical debt is depressing
You’re lazy
No time to sloppy
Don’t be a verb
PAGE 6
7. Clean code is the Foundation
Clean Code
SOLID Code
Refactoring
DDD TDD
Automated Testing
Design Pattern
PAGE 7
12. The right tool for the right job
Creative using wrong tool is not something brag you
Watch for boundaries
PAGE 12
13. The right tool for the right job
Stay Native – Advantages
PAGE 13
Cached
Avoid string
parsing
Can minify
& obfuscate
Code
colored
Syntax
checked
Separation
of concerns
Reusable
14. The right tool for the right job
Avoid using one language to write another language/format via strings.
Leverage libraries
One language per file.
PAGE 14
15. High signal to noise ratio
Signal
Terse (Short)
Expressive
Do one thing.
Noise
High cyclomatic complexity
Excessive indentation
Zombie code
Unnecessary comments
Poorly named structures
Huge class
Long methods
Repetition
No whitespace
Overly verbose
PAGE 15
16. High signal to noise ratio
1. Our brain is the compiler
The “Rule of 7” effects:
Number of parameters per method
Number of methods in a class
Number of variables currently in scope
2. The mess builds quietly
PAGE 16
17. Don’t Repeat Yourself – DRY Principle
Duplication Issues
1. Decreases signal to noise ratio.
2. Increases the number of lines of code.
3. Create a maintenance problem.
PAGE 17
18. Self-document code
“Understand the original programmer’s intent is the most difficult problem.”
Fjelstad & Hamlen 1979
Clear intent
Layers of abstractions
Format for readability
Favor code over comments.
PAGE 18
19. Naming
PAGE 19
Why is naming critical?
Names to avoid
Avoiding side-effects
Selecting good variable names
We will cover
23. The Method Name Says It All
Go
Complete
Get
Process
DoIt
Start
On_Init, Page_Load, etc
PAGE 23
GetRegisteredUsers
IsValidSubmission
ImportDocument
SendEmail
Write a good method name, the reader doesn’t
need to read the body of the method to know
what it does.
24. Rubber Ducking
Verbalizing aids creativity
Stuck? Verbalize!
Ask: Am I describing one thing?
Read more: https://seal.deha.vn/?p=2402
PAGE 24
25. Avoid side effects
CheckPassword shoudn’t log user out.
ValidateSubmission shouldn’t save.
GetUser shouldn’t create their session.
ChangeCreditCard shouldn’t send emails.
Make sure method names are comprehensive and tell the whole truth
PAGE 25
26. Naming Warning Signs
And
If
Or
If you use one of them to concatenate method name, you should need more than one method.
PAGE 26
27. Avoid Abbreviation
It’s not the 80s
No standard
We talk about code.
RegUsr
RegistUser
RegisUser
RegisterUser
PAGE 27
34. Ternary is Beautiful
Int registrationFee;
If (isSpeaker)
{
registrationFree = 0;
} else {
registrationFee = 50;
}
PAGE 34
Int registrationFee = isSpeaker ? 0 : 50;
Honors DRY: Don’t repeat your self.
YAGNI: You ain’t gonna need it (add complexity
when needed)
35. Be Strongly Typed, Not “Stringly” Typed
If (employeeType == “manager”)
PAGE 35
If (imployee.type == EmployeeType.Manager)
No typos
IntelliSense
Document states
Searchable
36. Magic Numbers
If (age > 21)
{
}
If (status == 2)
{
}
PAGE 36
const int legalDrinkingAge = 21
If (age > legalDrinkingAge)
{
}
If (status == Status.active)
{
}
43. Table Driven Methods
Great for dynamic logic
Avoids hard coding
Write less code
Avoids complex data structures
Make changes without a code deployment
PAGE 43
44. Methods
PAGE 44
High signal functions
When to create a function
Techniques to maintain simplicity
Approaches to minimize variable
lifetime
Signs a function is to long
Exceptions and error handling
We will cover
45. When to create functions/methods ?
PAGE 45
Avoid
Duplication
Indentation
Unclear
intent
> 1 task
46. Why to create functions/methods?
PAGE 46
DRY
Less is
More
Code is a
liability
Indentation
58. Sign It’s Too Long
PAGE 58
A function should be
1. Rarely be over 20 lines
2. Rarely over 3 parameters
Whitespace &
Comments
Scrolling
required
Naming
issues
Multiple
Conditionals
Hard to digest
(Rule of 7)
59. Handling Exceptions
PAGE 59
Can’t handle the exception?
Fail fast. Fail loud
Unrecoverable
Null reference
File not found
Access denied
Recoverable
Retry connection
Try different file
Wait and try again
Ignorable
Logging click
63. Classes
PAGE 63
Class are look like headings
When to create a class
Measuring quality
Cohesion
Name
Size
Primitive obsession
Proximity principle
Outline rule
We will cover
65. When to create classes?
• Abstract or real-world
New concept
• Method should relate
Low Cohesion
• Small, targeted => reuse
Promote Reuse
• Solve once, hide away
Reduce complexity
• Identify a group of data
Clarify parameters
PAGE 65
66. Class Responsibilities Should Be Strongly Related
PAGE 66
Enhances readability
Increases likelihood of reuse
Avoids attracting the lazy
Watch for
- Standalone methods.
- Fields used by only one method
- Classes that change often.