This presentation introduces the principles of high-quality programming code construction during the software development process. The quality of the code is discussed in its most important characteristics – correctness, readability and maintainability. The principles of construction of high-quality class hierarchies, classes and methods are explained. Two fundamental concepts – “loose coupling” and “strong cohesion” are defined and their effect on the construction of classes and subroutines is discussed. Some advices for correctly dealing with the variables and data are given, as well as directions for correct naming of the variables and the rest elements of the program. Best practices for organization of the logical programming constructs are explained. Attention is given also to the “refactoring” as a technique for improving the quality of the existing code. The principles of good formatting of the code are defined and explained. The concept of “self-documenting code” as a programming style is introduced.
With code examples from the real world that could give you a stroke.
The slides I used on my talk at t3chFest Madrid 2014.
A talk about Code Quality, Clean Code, and good and bad practices when writing code. A fun walk through the experiences from the real world with some advices and introducing some principles that will help you to write better code.
.NET Coding Standards For The Real World (2012)David McCarter
Revamped for 2012, this session will guide any level of programmer to greater productivity by providing the information needed to write consistent, maintainable code. Learn about project setup, assembly layout, code style, defensive programming and much, much more. Code tips are included to help you write better, error free applications. Lots of code examples in C# and VB.NET. This session is based off my latest book, David McCarter's .NET Coding Standards.
Entering in the full TDD, including:
- how TDD works and why it is required in Agile development
- why there are so many people that say that TDD does not work
- how to fix the problems in bad TDD to make it effective
- and the primary value of the sofware: make it adaptable
This presentation introduces the principles of high-quality programming code construction during the software development process. The quality of the code is discussed in its most important characteristics – correctness, readability and maintainability. The principles of construction of high-quality class hierarchies, classes and methods are explained. Two fundamental concepts – “loose coupling” and “strong cohesion” are defined and their effect on the construction of classes and subroutines is discussed. Some advices for correctly dealing with the variables and data are given, as well as directions for correct naming of the variables and the rest elements of the program. Best practices for organization of the logical programming constructs are explained. Attention is given also to the “refactoring” as a technique for improving the quality of the existing code. The principles of good formatting of the code are defined and explained. The concept of “self-documenting code” as a programming style is introduced.
With code examples from the real world that could give you a stroke.
The slides I used on my talk at t3chFest Madrid 2014.
A talk about Code Quality, Clean Code, and good and bad practices when writing code. A fun walk through the experiences from the real world with some advices and introducing some principles that will help you to write better code.
.NET Coding Standards For The Real World (2012)David McCarter
Revamped for 2012, this session will guide any level of programmer to greater productivity by providing the information needed to write consistent, maintainable code. Learn about project setup, assembly layout, code style, defensive programming and much, much more. Code tips are included to help you write better, error free applications. Lots of code examples in C# and VB.NET. This session is based off my latest book, David McCarter's .NET Coding Standards.
Entering in the full TDD, including:
- how TDD works and why it is required in Agile development
- why there are so many people that say that TDD does not work
- how to fix the problems in bad TDD to make it effective
- and the primary value of the sofware: make it adaptable
Test-drevet utvikling er en hellig gral innen smidig utvikling og ofte hører man uttrykk som "TDD fører til bra design", "med TDD trenger man ikke tenke på arkitektur" og "TDD er meningen med livet" (okei, det siste der fant jeg muligens på selv). Men vil TDD automatisk føre til bra design? Eller er det noe de ikke har fortalt deg?
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.
We will dive into the basics of Inversion of Control (IOC) and Dependency Injection (DI) to review different ways of achieving decoupling, using and exploring both: Best Practices, Design and Anti Patterns. This presentation requires knowledge and understanding of basics like DRY, SoC, SRP, SOLID etc. which are building the base for decoupled architecture. However, we will start at the basics of DI and will work towards intermediate and advanced scenarios depending on the participating group.
This presentation is based on C# and Visual Studio 2013. 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
2015-06-25 Bay.NET South Bay, Mountain View, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
Seconda serata di introduzione al Test-Driven Development, tenuta in XPeppers a Trento il 24 Ottobre 2012.
Nelle slide c'è anche la descrizione del coding dojo sullo string calculator che abbiamo svolto assieme.
Every project has a development standard.
Sometimes the standard is “if it was hard to write, it should be hard to maintain.”
Developing, and following, a corporate Best Practices standard will lead to continuity, maintainability, robustness, and pride.
Clean Code - Design Patterns and Best Practices at Silicon Valley Code CampTheo Jungeblut
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 almost every other programming language too.
Partitioning Composite Code Changes to Facilitate Code Review (MSR2015)Sung Kim
Yida's presentation at MSR 2015!
Abstract—Developers expend significant effort on reviewing source code changes, hence the comprehensibility of code changes directly affects development productivity. Our prior study has suggested that composite code changes, which mix multiple development issues together, are typically difficult to review. Unfortunately, our manual inspection of 453 open source code changes reveals a non-trivial occurrence (up to 29%) of such composite changes.
In this paper, we propose a heuristic-based approach to automatically partition composite changes, such that each sub-change in the partition is more cohesive and self-contained. Our quantitative and qualitative evaluation results are promising in demonstrating the potential benefits of our approach for facilitating code review of composite code changes.
Good quality code is an essential property of a software because it could lead to financial losses or waste of time needed for further maintenance, modification or adjustments if code quality is not good enough.
Slides and notes presented at Albany.pm on Thursday, January 23, 2014, covering static code analysis and an internal perl tool AutoLint, which automates Gimpel PC-Lint runs over large legacy C/C++ codebases. (The per-slide notes contain most of the spoken content.)
Test-drevet utvikling er en hellig gral innen smidig utvikling og ofte hører man uttrykk som "TDD fører til bra design", "med TDD trenger man ikke tenke på arkitektur" og "TDD er meningen med livet" (okei, det siste der fant jeg muligens på selv). Men vil TDD automatisk føre til bra design? Eller er det noe de ikke har fortalt deg?
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.
We will dive into the basics of Inversion of Control (IOC) and Dependency Injection (DI) to review different ways of achieving decoupling, using and exploring both: Best Practices, Design and Anti Patterns. This presentation requires knowledge and understanding of basics like DRY, SoC, SRP, SOLID etc. which are building the base for decoupled architecture. However, we will start at the basics of DI and will work towards intermediate and advanced scenarios depending on the participating group.
This presentation is based on C# and Visual Studio 2013. 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
2015-06-25 Bay.NET South Bay, Mountain View, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
Seconda serata di introduzione al Test-Driven Development, tenuta in XPeppers a Trento il 24 Ottobre 2012.
Nelle slide c'è anche la descrizione del coding dojo sullo string calculator che abbiamo svolto assieme.
Every project has a development standard.
Sometimes the standard is “if it was hard to write, it should be hard to maintain.”
Developing, and following, a corporate Best Practices standard will lead to continuity, maintainability, robustness, and pride.
Clean Code - Design Patterns and Best Practices at Silicon Valley Code CampTheo Jungeblut
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 almost every other programming language too.
Partitioning Composite Code Changes to Facilitate Code Review (MSR2015)Sung Kim
Yida's presentation at MSR 2015!
Abstract—Developers expend significant effort on reviewing source code changes, hence the comprehensibility of code changes directly affects development productivity. Our prior study has suggested that composite code changes, which mix multiple development issues together, are typically difficult to review. Unfortunately, our manual inspection of 453 open source code changes reveals a non-trivial occurrence (up to 29%) of such composite changes.
In this paper, we propose a heuristic-based approach to automatically partition composite changes, such that each sub-change in the partition is more cohesive and self-contained. Our quantitative and qualitative evaluation results are promising in demonstrating the potential benefits of our approach for facilitating code review of composite code changes.
Good quality code is an essential property of a software because it could lead to financial losses or waste of time needed for further maintenance, modification or adjustments if code quality is not good enough.
Slides and notes presented at Albany.pm on Thursday, January 23, 2014, covering static code analysis and an internal perl tool AutoLint, which automates Gimpel PC-Lint runs over large legacy C/C++ codebases. (The per-slide notes contain most of the spoken content.)
Indian Government Passed Coal Mines Bill 2015, In March 2015. The Coal Mines which were the Meat and Bones of Corruption in Indian Economy Were Auctioned in March 2015, Under the Proviso of the Bill. The Indian Supreme Court has asked the Indian Government to Bring out Norms and Auction the Mines.
The Creditsafe Commercial Credit Managment Suite CreditsafeUK
Creditsafe's commercial credit management suite product guide explains our extensive range of business solutions available that are used by over 200,000 subscription customers across the globe.
WB Engineering provides Rapid Prototyping and Product Design Services in Miami, Florida. Our Product Design division is concerned with effective idea generation and development
The following report from IBM explores the latest Security trends—from malware delivery to mobile device risks—based on 2013 year-end data and ongoing research.
In the ICMA Quarterly Report for the First Quarter of 2014, the Foreword by Martin Scheck looks at the task facing ICMA in the year ahead. The Quarterly Assessment is on European Banking Union and capital markets. We review new regulatory developments in response to the crisis, both at global and European level; and we consider the impact of new regulations on market practice in the repo and ECP markets; the primary and secondary markets; asset management; and the market infrastructure. There is also an introduction by Lee Goss on ICMA's Sovereign Bond Consultation Paper.
In the new healthcare industry, providers and patients will thrive by deploying intelligent technology to deliver care sooner and more effectively. New solutions include Kofax Smart Process Applications and Smart Mobile Apps, which enable healthcare organizations to automatically and accurately capture, validate, extract and classify information form anywhere inside or outside the organization.
Talk given in DevFest Asturias 2019 (GDG Google Developer Group Asturias)
16.11.2019 Gijón (Spain)
The Legacy Code came to stay
(spanish)
El legacy vino para quedarse
RESUMEN
Es una charla que pone en relieve que los servicios que damos los agilistas, no están orientados a sustituir el trabajo de otros, sino que entre todos conseguimos mejorar nuestros productos y nuestra vida diaria en el trabajo.
ABSTRACT
Casi todos sabemos lo que es el Legacy Code, ese proyecto al que todos nos hemos enfrentado alguna vez y que cuesta trabajar con él.
Lo que era algo a evitar o a sustituir, en los últimos años por diversas razones, se ha convertido en algo que debe seguir existiendo durante mucho tiempo, por lo que se busca la manera de seguir manteniendolo con confianza.
Esta necesidad parece técnica, y a lo sumo se entiende que involucra a los equipos que lo mantienen, pero realmente es una estrategia empresarial en la que se busca además de mantener la funcionalidad existente, avanzar el producto y cubrir la necesidad actual, con la ayuda de un equipo al que hay que mantener motivado, practicando además, eso tan difícil que hoy se conoce como La Retención del Talento.
Explicaremos en esta charla los diferentes tipos de retos enmarcados en Código Legado, tantos técnicos como con los equipos a los que nos hemos enfrentado en Codesai y qué estrategias usamos para afrontarlos.
Writing code that works and writing code that other people can read and understand are two different skills. And writing code that other people can read and understand became more and more essential skills as the project grows larger, and more people start working on it.
But because it is a skill, you need to train it consciously. It's a lot like writing essays and books. Everybody can write letters and words; many can also connect them in grammatically correct sentences. But not everybody is a J. R. R. R. Tolkien and have their books read by everyone.
An essential part of learning this skill is reading and analyzing other people's code on the one hand. And making other people read your code and give you feedback about it.
The speaker will talk about different methods of how to make programmers better writers and how to work out the skill of writing code that other people will want to read.
Container Days, 23.09.2021, online: Talk of Mario-Leander Reimer (@LeanderReimer, Principal Software Architect at QAware)
== Dokument bitte herunterladen, falls unscharf! Please download slides if blurred! ==
Abstract:
The clean code principles are well-known in modern, agile software development. But what has become the default for our business code, unfortunately by no means applies to our infrastructure code. Instead, we find badly crafted, complicated and highly tangled code that is manually tested using a trial and error approach. However, for modern cloud based systems the infrastructure code plays a crucial role. So it's about time we being to treat it as a 1st class citizen! In this hands-on session we show several useful patterns, practices, tools and frameworks that help to write and craft clean infrastructure as code.
Slides for a presentation on advanced PHP (object-orientation, frameworks, security and debugging) given for the CS25010 web development module at Aberystwyth University.
Design patterns - Common Solutions to Common Problems - Brad WoodOrtus Solutions, Corp
How unique is the problem you’re coding for right now? What’s the chance it’s been solved hundreds, maybe thousands of times? Is your solution the best way? You’ve no doubt heard other developers talk about using “design patterns”. These are reusable solutions to the problems that we all face as developers. The best thing is that most patterns can carry over from one language to another. It’s a great idea to familiarize yourself with these common solutions so you identify them and know when you plug them into your apps.
Let’s take a pragmatic look at exactly what design pattern are – and aren’t! The more you learn, the bigger toolbox you’re building that you can dip into to solve problems. You’ll also start to notice these familiar designs in frameworks and other people’s apps. Learning to recognize common patterns, their names, and when to use them will grow you as a developer, stretch your thinking outside the box, and make you better at what you do. A solid OO background will really help you, and most of what we cover will be generic to any language. Expect to cover some of the most common design patterns along with examples and their pros and cons with examples in CFML.
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.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
Generating a custom Ruby SDK for your web service or Rails API using Smithyg2nightmarescribd
Have you ever wanted a Ruby client API to communicate with your web service? Smithy is a protocol-agnostic language for defining services and SDKs. Smithy Ruby is an implementation of Smithy that generates a Ruby SDK using a Smithy model. In this talk, we will explore Smithy and Smithy Ruby to learn how to generate custom feature-rich SDKs that can communicate with any web service, such as a Rails JSON API.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
State of ICS and IoT Cyber Threat Landscape Report 2024 previewPrayukth K V
The IoT and OT threat landscape report has been prepared by the Threat Research Team at Sectrio using data from Sectrio, cyber threat intelligence farming facilities spread across over 85 cities around the world. In addition, Sectrio also runs AI-based advanced threat and payload engagement facilities that serve as sinks to attract and engage sophisticated threat actors, and newer malware including new variants and latent threats that are at an earlier stage of development.
The latest edition of the OT/ICS and IoT security Threat Landscape Report 2024 also covers:
State of global ICS asset and network exposure
Sectoral targets and attacks as well as the cost of ransom
Global APT activity, AI usage, actor and tactic profiles, and implications
Rise in volumes of AI-powered cyberattacks
Major cyber events in 2024
Malware and malicious payload trends
Cyberattack types and targets
Vulnerability exploit attempts on CVEs
Attacks on counties – USA
Expansion of bot farms – how, where, and why
In-depth analysis of the cyber threat landscape across North America, South America, Europe, APAC, and the Middle East
Why are attacks on smart factories rising?
Cyber risk predictions
Axis of attacks – Europe
Systemic attacks in the Middle East
Download the full report from here:
https://sectrio.com/resources/ot-threat-landscape-reports/sectrio-releases-ot-ics-and-iot-security-threat-landscape-report-2024/
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
2. breadcrumbs
Tech Lead at Compufácil compufacil.com.br
Github: jeanCarlomachado
Contributor of:
• Doctrine
• Zend Framework
• PHPmd
Twitter: JeanCarloMachad
Researching optimization based on nature inspirations
2
3. what clean code stands for?
Reader-focused development style
Produces software that’s easy to:
• write
• read
• maintain
Programming is the art of telling another human what one wants
the computer to do Donald Knuth
3
4. why it matters?
Broken windows theory
“All the rest of this code is crap, I’ll just follow suit.”
Software entropy, software rot.
4
7. rotting software 1 - rigidity
It’s hard to solve simple problems.
Estimating is hard.
7
8. rotting software 2 - fragility
The software breaks too often.
A change in one unrelated part breaks others.
Changes must be echoed in many places.
8
9. rotting software 3 - immobility
It’s the inability of reusing software from other places.
9
10. rotting software 4 - viscosity
It’s easier to go to the hacking mode than to the design preservation mode.
10
11. implications
• Software rot implies in frustrated developers
• Frustrated developers implies in more rotting
• Too much rooting implies in system rewrite
• Loss of money
• Loss of users
11
14. clean coder skills
Follow the ones what suites you most.
Relatively simple things can tolerate a certain level of disorganiza-
tion. However, as complexity increases, disorganization becomes sui-
cidal. Robert Martin
14
15. naming
Need to see the source for to know what a function does? Work on names!
Longer names are generally better than smaller one’s.
No And or Or in names.
15
16. comments
Usage scenarios
• Authors name
• Explain trade-offs of implementations
Avoid scenarios
• To express code
Inaccurate comments are way worse than no comments at all.
16
17. dry
Don’t Repeat Yourself
DRY on comments
/**
*
* @param $title The title of the CD
* @param $author The author of the CD
* @param $tracks The number of tracks of the CD
*
*/
public addCd($title, $author, int $tracks);
17
18. dry on documentation
Code and documentation are different views of the same model
Two places to edit models? DRY violation
Generate code from diagrams or diagrams from code
zendframework/ZendDeveloperTools
18
19. methods arguments
The ideal number of arguments of a method is ZERO.
More than tree is unacceptable.
Flags
public function useResultCache($bool, $lifetime = null/**...**
{
if ($bool) {
$this->setResultCacheLifetime($lifetime);
$this->setResultCacheId($resultCacheId);
return $this;
}
//...
}
19
20. classes - journal metaphor
Classes should be like journal articles.
In the header you get an general overview.
You are able to decide if you go further or not.
As you read down details increases.
20
21. objects vs data structures
Objects: hide data, expose operations over it
Data structures: expose data, no meaningful operation
21
22. kiss - keep it simple stupid
Related with few parts, few responsabilities, decoupling
Simplicity is different of easy
Easy is more related with your current understandings (relative)
There are systems which are easy but not simple
Over time simplicity pays off easiness
UNIX is very simple, it just needs a genius to understand it’s simplicity.
Dennis Ritchie
22
23. no magic
Before you commit to a framework, make sure you could write it
Simpler version
Some assembly
23
24. remove is better than adding
Don’t let existing code dictate future code
Be ready to refactor
Build a state of art namespace
24
25. tests
TDD is a design process
Prove the parts to prove the hole
Invert dependencies
Use gateways
What make testing harder is a bad in itself
Tests are the best documentation
test$method_$expectedResult_$conditions
25
26. law of demeter
Don’t play with your toy’s toys
If you need to change an object’s state, get the object to do it for you
Any method of an object should call only methods belonging to:
• itself;
• any parameters received;
• any objects it creates and any directly held component objects
26
27. composite reuse
One should build upon interfaces
OO languages replace function pointers with convenient polymor-
phism Robert C. Martin
Closure protocols and haskell type classe
Benefits
• Easier to maintain (no unexpected behaviors)
• Performance gain
• The inversion of source code and run time dependencies
27
28. many little classes vs few big ones
Any regular system will contain a vast quantity of logic
The same amount of business logic to care of
You prefer your tools being organized in boxes with little compartments and
good names?
Or only a compartment and all inside?
28
29. solid
Or the “first five principles” by Michael Feathers.
To make systems that are: is easy to maintain and extend over time
29
30. single responsibility principle (srp)
If you can think of more than one reason for changing a class, then that class
has more than one responsibility
<?php
interface UserInterface
{
public function setId($id);
public function getId();
public function setName($name);
public function getName();
public function findById($id);
public function insert();
public function update();
public function delete();
}
30
31. open close principle (oc)
The interface is closed to modification and new implementation implement
that interface
Rectangle, Square
Relates to composite reuse
31
32. liskov substitution (ls)
It’s possible to change subclasses without breaking the program
Usually instanceof is a sign of code smell
32
33. interface segregation principle (isp)
It’s better more interfaces than less
Clients should not be forced to depend upon interfaces that they don’t use
abstract class AbstractPostgreSQLDriver implements
Driver,
ExceptionConverterDriver,
VersionAwarePlatformDriver
33
34. dependency inversion
One should depend only on abstractions.
For PHP:
• https://github.com/container-interop/container-interop
• https://github.com/auraphp/Aura.Di
• https://github.com/zendframework/zend-servicemanager
34
36. 1 - one level of indentation per method
Benefits
Finding bugs is much easier
If you have more than one indentation level you have more than one abstrac-
tion level
36
37. 2 - don’t use else keyword
Else’s encourages the inclusion of more intermediate if’s
When possible avoid even if’s
Use polymorphism instead
37
38. 3 - wrap all primitives and strings
Small objects make programs more maintainable
They serves as a container for logic that otherwise would be sparse
38
39. 4 - first class collections
Any class with a collection shouldn’t contain other member variables
39
40. 5 - one dot per line
Bad:
this->myMemberObject
->myMemberObjectMemberObject
->doFoo();
Good:
this->myMemberObjectMemberObject
->functionThatDoFooToo();
Relates to Law of Demeter
40
41. 6 - don’t abbreviate
Abbreviation because of exhaustive use?
DRY violation
Too long names?
Maybe a SRP problem
41
42. 7 - keep all entities small
No classes over 50 lines and no packages over 10 files
42
43. 8 - no classes with more than two instance variables
Figure 3: Instance variables
43
44. 9 - no getters/setters/properties
Encapsulate everything
Make objects change dependencies by themselves
Invert Dependencies
44
47. literature
1. Clean code: A hand book of Agile Software craftsmanship; Robert C.
Martin
2. The pragmatical programmer; Andrew Hunt
3. Code Complete; Steve McConnell
4. Refactoring: Improving the Design of Existing Code;
5. Release It!: Design and Deploy Production-Ready Software; Michael T.
Nygard
Those who do not remember the past are condemned to repeat it.
Jorge Agustin Nicolas Ruiz de Santayana y Borras
47
48. conclusion
Quality is a team issue. Andy hunt.
Teams as a hole should not tolerate broken windows.
Clean code is not about perfection.. It’s about honesty.
We made our best to leave the camp cleaner than we find it?
48
49. conclusion
But if we aim for the 80% where code needs the most. We are good enough.
Parts not critical to performance must be clean - not optimized.
The best programmers are 28 times best than the worst ones. Robert
Glass, Facts and Fallacies of Software Engineering
There’s always room for improvement.
49