re you working on code poorly designed or on legacy code that’s hard to test? And you cannot refactor it because there are no tests?
During this Coding Dojo you’ll be assigned a coding challenge in Java, C#, Ruby, JavaScript or Python. You will face the challenge of improving the design and refactoring existing code in order to make it testable and to write unit tests.
We will discuss SOLID principles, the relation between design and TDD, and how this applies to your solution.
Reading list:
Growing Object-Oriented Software, Guided by Tests; Steve Freeman, Nat Pryce
Test Driven Development: By Example; Kent Beck
Working Effectively with Legacy; Michael Feathers
Agile Software Development, Principles, Patterns, and Practices; Robert C. Martin (C++, Java)
Agile Principles, Patterns, and Practices in C#; Robert C. Martin (C#)
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Introduction to TypeScript, demo ( http://goo.gl/VtE4Vm ), Comparison with couple of popular alternatives. (Sadly layout of the slides are a bit ruined by conversion to SlideShare format - original file: http://goo.gl/eeJgbR )
An overview of functional programming. You can do functional programming in any language, it’s just that some languages push you toward this style. There are many styles of programming, depending on the dimension you look at and the features available in the language: Imperative vs Functional, Compiled vs Scripting, Static vs Dynamic, Implicit vs Explicit type conversion, Managed vs Unmanaged (memory). We'll talk about these concepts.
Github: https://github.com/ijcd
Twitter: @ijcd
San Francisco, California
The Art of Unit Testing - Towards a Testable DesignVictor Rentea
Slides of the Talk I gave at Devoxx Belgium 2019.
=== Abstract ===
Focusing on the creative work without being terrified of breaking the existing behavior can make software development very addictive! Good automated tests can buy you that!
However, if your tests are not maintainable they may end up slowing you down and causing you painful headaches, compilation errors and spurious failures. To avoid that, your unit tests should be significant; expressive; clean; DRY; non-overlapping; and blazing fast. Writing good tests becomes the toughest challenge for any developer, no matter how battle-hardened: you need to balance risk with test maintenance costs, while looking out for test design smells that call for [risky] refactoring to drive your design towards a set of key principles (included:).
Principles that will end up shaping the way you craft the Production code itself. Because in the end, a good, clean design is more important than coverage%.
But testing gives you the best feedback to get there.
Grab a black coffee and join this snippet from Victor’s Pro Unit Testing #training, to learn about testing priorities, buggy tests, the shared @Before, Mocks vs Stubs and how to reduce them by "purifying" your logic, testing Legacy Code and refactoring @Spy-es out.
All of that in an entertaining, dynamic and memorable session.
Introduction to TypeScript, demo ( http://goo.gl/VtE4Vm ), Comparison with couple of popular alternatives. (Sadly layout of the slides are a bit ruined by conversion to SlideShare format - original file: http://goo.gl/eeJgbR )
An overview of functional programming. You can do functional programming in any language, it’s just that some languages push you toward this style. There are many styles of programming, depending on the dimension you look at and the features available in the language: Imperative vs Functional, Compiled vs Scripting, Static vs Dynamic, Implicit vs Explicit type conversion, Managed vs Unmanaged (memory). We'll talk about these concepts.
Github: https://github.com/ijcd
Twitter: @ijcd
San Francisco, California
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Edureka!
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Functions tutorial covers all the important aspects of functions in Python right from the introduction to what functions are, all the way till checking out the major functions and using the code-first approach to understand them better.
Agenda
Why use Functions?
What are the Functions?
Types of Python Functions
Built-in Functions in Python
User-defined Functions in Python
Python Lambda Function
Conclusion
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This presentation educates you about objectives of python with example syntax, OOP Terminology, Creating Classes, Creating Instance Objects, Accessing Attributes and Built-In Class Attributes.
(Video and code at http://fsharpforfunandprofit.com/composition)
Composition is a fundamental principle of functional programming, but how is it different from an object-oriented approach, and how do you use it in practice?
In this talk for beginners, we'll start by going over the basic concepts of functional programming, and then look at some different ways that composition can be used to build large things from small things.
After that, we'll see how composition is used in practice, beginning with a simple FizzBuzz example, and ending with a complete (object-free!) web application.
C++ allows the common function to be made friendly with both the classes, thereby allowing the function to have access to the private data of these classes. Such a function need not be a member of any of these classes.
The tutorial will give you a brief introduction to Generators in Python. Next, you will learn the advantages of using generators in Python. Further, you will know the utility of the next() function.
After that, we will have hands-on demonstrations for Generators in Python.
Pointer
Features of Pointers
Pointer Declaration
Pointer to Class
Pointer Object
The this Pointer
Pointer to Derived Classes and Base Class
Binding Polymorphisms and Virtual Functions
Introduction
Binding in C++
Virtual Functions
Rules for Virtual Function
Virtual Destructor
Refactoring legacy code driven by tests - ITALuca Minudel
Are you working on code poorly designed or on legacy code that’s hard to test? And you cannot refactor it because there are no tests?
During this Coding Dojo you’ll be assigned a coding challenge in Java, C#, Ruby, JavaScript or Python. You will face the challenge of improving the design and refactoring existing code in order to make it testable and to write unit tests.
We will discuss SOLID principles, the relation between design and TDD, and how this applies to your solution.
Reading list:
Growing Object-Oriented Software, Guided by Tests; Steve Freeman, Nat Pryce
Test Driven Development: By Example; Kent Beck
Working Effectively with Legacy; Michael Feathers
Agile Software Development, Principles, Patterns, and Practices; Robert C. Martin (C++, Java)
Agile Principles, Patterns, and Practices in C#; Robert C. Martin (C#)
Python Functions Tutorial | Working With Functions In Python | Python Trainin...Edureka!
** Python Certification Training: https://www.edureka.co/python **
This Edureka PPT on Python Functions tutorial covers all the important aspects of functions in Python right from the introduction to what functions are, all the way till checking out the major functions and using the code-first approach to understand them better.
Agenda
Why use Functions?
What are the Functions?
Types of Python Functions
Built-in Functions in Python
User-defined Functions in Python
Python Lambda Function
Conclusion
Python Tutorial Playlist: https://goo.gl/WsBpKe
Blog Series: http://bit.ly/2sqmP4s
Follow us to never miss an update in the future.
Instagram: https://www.instagram.com/edureka_learning/
Facebook: https://www.facebook.com/edurekaIN/
Twitter: https://twitter.com/edurekain
LinkedIn: https://www.linkedin.com/company/edureka
This presentation educates you about objectives of python with example syntax, OOP Terminology, Creating Classes, Creating Instance Objects, Accessing Attributes and Built-In Class Attributes.
(Video and code at http://fsharpforfunandprofit.com/composition)
Composition is a fundamental principle of functional programming, but how is it different from an object-oriented approach, and how do you use it in practice?
In this talk for beginners, we'll start by going over the basic concepts of functional programming, and then look at some different ways that composition can be used to build large things from small things.
After that, we'll see how composition is used in practice, beginning with a simple FizzBuzz example, and ending with a complete (object-free!) web application.
C++ allows the common function to be made friendly with both the classes, thereby allowing the function to have access to the private data of these classes. Such a function need not be a member of any of these classes.
The tutorial will give you a brief introduction to Generators in Python. Next, you will learn the advantages of using generators in Python. Further, you will know the utility of the next() function.
After that, we will have hands-on demonstrations for Generators in Python.
Pointer
Features of Pointers
Pointer Declaration
Pointer to Class
Pointer Object
The this Pointer
Pointer to Derived Classes and Base Class
Binding Polymorphisms and Virtual Functions
Introduction
Binding in C++
Virtual Functions
Rules for Virtual Function
Virtual Destructor
Refactoring legacy code driven by tests - ITALuca Minudel
Are you working on code poorly designed or on legacy code that’s hard to test? And you cannot refactor it because there are no tests?
During this Coding Dojo you’ll be assigned a coding challenge in Java, C#, Ruby, JavaScript or Python. You will face the challenge of improving the design and refactoring existing code in order to make it testable and to write unit tests.
We will discuss SOLID principles, the relation between design and TDD, and how this applies to your solution.
Reading list:
Growing Object-Oriented Software, Guided by Tests; Steve Freeman, Nat Pryce
Test Driven Development: By Example; Kent Beck
Working Effectively with Legacy; Michael Feathers
Agile Software Development, Principles, Patterns, and Practices; Robert C. Martin (C++, Java)
Agile Principles, Patterns, and Practices in C#; Robert C. Martin (C#)
GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Per...GlobalLogic Ukraine
16 грудня 2021 року відбувся GlobalLogic Test Automation Online TechTalk “Test Driven Development as a Personal Skill”! Анатолій Сахно (Software Testing Consultant, GlobalLogic) розібрав принципи TDD (розробки, керованої тестами) та приклади їх застосування. Крім того, поговорили про:
- Ефективне використання модульних тестів у повсякденних задачах;
- Використання TDD при розробці тестових фреймворків;
- Застосування принципів TDD при написанні функціональних автотестів.
Більше про захід: https://www.globallogic.com/ua/about/events/globallogic-test-automation-online-techtalk-test-driven-development-as-a-personal-skill/
Приємного перегляду і не забудьте залишити коментар про враження від TechTalk!
Ця активність — частина заходів в рамках GlobalLogic Test Automation Advent Calendar, ще більше заходів та цікавинок за посиланням: https://bit.ly/AdventCalendar_fb
This workshop is about testing the right way. Get a clear view on how to test your code in an efficient and useful way!
This first testing-related workshop is about all aspects of unit testing. Integration testing and TDD will have their own dedicated workshops.
It takes two to tango - why tech and business succeed or fail together v4.1 b...Luca Minudel
In this session, we will discuss how to achieve real technical excellence that matters to the Business, how to build trust between Business and Tech, and how Business can react quickly and beat the competition with help from Tech. After many years in professional software development, we experienced the impact of Business’ decisions on Tech, the importance of technical excellence for the Business, and the role of Software Craftsmanship/Craftswomenship in achieving technical excellence.
We learned that Tech is an enabler for the Business, that Business is a key stakeholder, that mastery in practices such as Software Craftsmanship/Craftswomenship leads to technical excellence that really matters. Then, in an unexpected turn of events, we learned these assumptions were flawed, it was much more than that.
Project management in the age of accelerating change - IT/Tech specificLuca Minudel
- What is Agile and why is becoming increasingly popular?
- For what types of endeavours Agile is best suited?
- What additional tools does Agile add to a PM toolbox?
- How does a traditional project differ from an Agile digital product delivery?
- What is the role of the PM in an Agile delivery?
This session gives a short introduction of Agile for traditional Project Managers and describes the structure, the steps and the activities of an Agile project from Inception to delivery.
Project management in the age of accelerating change - general non IT specificLuca Minudel
- What is Agile and why is becoming increasingly popular?
- For what types of endeavours Agile is best suited?
- What additional tools does Agile add to a PM tool box?
- How does a traditional project differ from an Agile digital product delivery?
- What is the role of the PM in an Agile delivery?
This session gives a short introduction of Agile for traditional Project Managers, and describes the structure, the steps and the activities of an Agile project from Inception to delivery.
New Self-assessment radar for Scrum Masters.
Use this as a permanent link to always get access to the latest version: http://www.smharter.com/blog/scrum-master-skills-self-assessment-radar/
What is Agility?
What are the characteristics that contribute to Agility?
What are the team/org structures that support Agility?
What are the challenges that require Agility?
New Lean-Agile Coach Self-Assessment - detailed descriptions v3Luca Minudel
Detailed descriptions for the Lean-Agile Coach Self-Assessment
Includes references to resources useful to improve in each competency area (download the deck and look at the notes)
From Continuous Integration to Continuous Delivery and DevOpsLuca Minudel
An overview of Continuous Delivery from a business and a technical point of view.
Includes an overview of:
- business value proposition of CD
- prerequisites and tips for CD implementation
- CD implementation was stories and strategies
- CD technical practices
Draft your next training course with ideas from Training from the Back of the...Luca Minudel
A personal approach on applying the 4Cs techniques for the book 'Training from the Back of the Room!' starting from the end like the legend of the Phoenix.
Pratica avanzata del refactoring (2004)Luca Minudel
Abstract
- Perché fare Refactoring?
Riconoscere le situazioni ed i problemi che si risolvono con il Refactoring
- Quali i prerequisiti per fare Refactoring?
Dotarsi del necessario per applicare il Refactoring in continuo miglioramento
- Come comprendere e reagire ai feedback del codice?
Esempio "Live" di Refactoring del 2° tipo applicato al codice dell'interazione utente
Agility: The scientific definition of how to be(come) AgileLuca Minudel
Many talks about doing Agile versus being Agile. The session presents a scientific definition of Agility, how to move from doing Agile to being Agile. Characteristics of Agility that can be enhanced, inhibitors the can be reduced and removed and contexts where Agility is an advantage are all presented in this session. All this enables you, a team and an organization to decide when and to know how to go from doing Agile to being Agile.
References
The content of this session is based on studies and experiments promoted by U.S. DoD and NATO research and presented in these books:
The Agility Advantage: A Survival Guide For Complex Enterprises and Endeavors; David Alberts; 2011.
Power to the Edge: Command...Control...in the Information Age; David Alberts and Richard Hayes; 2003.
Lightning talk: Active Agility, the magic ingredient of Lean and AgileLuca Minudel
Many talks about doing Agile versus being Agile. The session presents a scientific definition of Agility, how to move from doing Agile to being Agile. Characteristics of Agility that can be enhanced, inhibitors the can be reduced and removed and contexts where Agility is an advantage are all presented in this session. All this enables you, a team and an organization to decide when and to know how to go from doing Agile to being Agile.
References
The content of this session is based on studies and experiments promoted by U.S. DoD and NATO research and presented in these books:
The Agility Advantage: A Survival Guide For Complex Enterprises and Endeavors; David Alberts; 2011.
Power to the Edge: Command...Control...in the Information Age; David Alberts and Richard Hayes; 2003.
Software development in Formula One: challenges, complexity and struggle for ...Luca Minudel
This is an experience report based on more than 3 years (2006-2009) of software development in F1 with Scrum, Lean and XP, developing evolving and maintaining software to support the F1 racing team from the vehicle conception and throughout every test and race.
In these 3 years I promoted and supported the advancement of the existing Agile practices in my team and then for all the software development teams of the F1 racing team.
How was this experience? It was dense and intense. What made it valuable? It was:
- the unique context characterized by very high levels of competition, speed and unpredictable rapid changes.
- the challenge of doing computer programming in an F1 team: the team and I had to learn and invent how to work with a code-base that is very large and long lived, a product that is uncommonly complex, in an organization that has high levels of interdependency and with technologies and competitors that are fast moving targets. We found ourselves far behind the boundaries where centralized top-down approaches could possibly work and where a book, a school degree or an expert could possibly reveal the right answer.
We had to do software development in extreme conditions and push ourselves to the limit as F1 drivers that really push and find the limits with the aim of outperforming competitors.
Have we survived this chaos? How did we survive? Which team and coding practices emerged? This experience report will look at the answers to all those questions and will try to answer questions from participants.
May Marketo Masterclass, London MUG May 22 2024.pdfAdele Miller
Can't make Adobe Summit in Vegas? No sweat because the EMEA Marketo Engage Champions are coming to London to share their Summit sessions, insights and more!
This is a MUG with a twist you don't want to miss.
Accelerate Enterprise Software Engineering with PlatformlessWSO2
Key takeaways:
Challenges of building platforms and the benefits of platformless.
Key principles of platformless, including API-first, cloud-native middleware, platform engineering, and developer experience.
How Choreo enables the platformless experience.
How key concepts like application architecture, domain-driven design, zero trust, and cell-based architecture are inherently a part of Choreo.
Demo of an end-to-end app built and deployed on Choreo.
Large Language Models and the End of ProgrammingMatt Welsh
Talk by Matt Welsh at Craft Conference 2024 on the impact that Large Language Models will have on the future of software development. In this talk, I discuss the ways in which LLMs will impact the software industry, from replacing human software developers with AI, to replacing conventional software with models that perform reasoning, computation, and problem-solving.
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus
As part of the DOE Integrated Research Infrastructure (IRI) program, NERSC at Lawrence Berkeley National Lab and ALCF at Argonne National Lab are working closely with General Atomics on accelerating the computing requirements of the DIII-D experiment. As part of the work the team is investigating ways to speedup the time to solution for many different parts of the DIII-D workflow including how they run jobs on HPC systems. One of these routes is looking at Globus Compute as a way to replace the current method for managing tasks and we describe a brief proof of concept showing how Globus Compute could help to schedule jobs and be a tool to connect compute at different facilities.
Gamify Your Mind; The Secret Sauce to Delivering Success, Continuously Improv...Shahin Sheidaei
Games are powerful teaching tools, fostering hands-on engagement and fun. But they require careful consideration to succeed. Join me to explore factors in running and selecting games, ensuring they serve as effective teaching tools. Learn to maintain focus on learning objectives while playing, and how to measure the ROI of gaming in education. Discover strategies for pitching gaming to leadership. This session offers insights, tips, and examples for coaches, team leads, and enterprise leaders seeking to teach from simple to complex concepts.
Quarkus Hidden and Forbidden ExtensionsMax Andersen
Quarkus has a vast extension ecosystem and is known for its subsonic and subatomic feature set. Some of these features are not as well known, and some extensions are less talked about, but that does not make them less interesting - quite the opposite.
Come join this talk to see some tips and tricks for using Quarkus and some of the lesser known features, extensions and development techniques.
Code reviews are vital for ensuring good code quality. They serve as one of our last lines of defense against bugs and subpar code reaching production.
Yet, they often turn into annoying tasks riddled with frustration, hostility, unclear feedback and lack of standards. How can we improve this crucial process?
In this session we will cover:
- The Art of Effective Code Reviews
- Streamlining the Review Process
- Elevating Reviews with Automated Tools
By the end of this presentation, you'll have the knowledge on how to organize and improve your code review proces
First Steps with Globus Compute Multi-User EndpointsGlobus
In this presentation we will share our experiences around getting started with the Globus Compute multi-user endpoint. Working with the Pharmacology group at the University of Auckland, we have previously written an application using Globus Compute that can offload computationally expensive steps in the researcher's workflows, which they wish to manage from their familiar Windows environments, onto the NeSI (New Zealand eScience Infrastructure) cluster. Some of the challenges we have encountered were that each researcher had to set up and manage their own single-user globus compute endpoint and that the workloads had varying resource requirements (CPUs, memory and wall time) between different runs. We hope that the multi-user endpoint will help to address these challenges and share an update on our progress here.
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Globus
Large Language Models (LLMs) are currently the center of attention in the tech world, particularly for their potential to advance research. In this presentation, we'll explore a straightforward and effective method for quickly initiating inference runs on supercomputers using the vLLM tool with Globus Compute, specifically on the Polaris system at ALCF. We'll begin by briefly discussing the popularity and applications of LLMs in various fields. Following this, we will introduce the vLLM tool, and explain how it integrates with Globus Compute to efficiently manage LLM operations on Polaris. Attendees will learn the practical aspects of setting up and remotely triggering LLMs from local machines, focusing on ease of use and efficiency. This talk is ideal for researchers and practitioners looking to leverage the power of LLMs in their work, offering a clear guide to harnessing supercomputing resources for quick and effective LLM inference.
Software Engineering, Software Consulting, Tech Lead.
Spring Boot, Spring Cloud, Spring Core, Spring JDBC, Spring Security,
Spring Transaction, Spring MVC,
Log4j, REST/SOAP WEB-SERVICES.
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar
The European Union Agency for Law Enforcement Cooperation (Europol) has suffered an alleged data breach after a notorious threat actor claimed to have exfiltrated data from its systems. Infamous data leaker IntelBroker posted on the even more infamous BreachForums hacking forum, saying that Europol suffered a data breach this month.
The alleged breach affected Europol agencies CCSE, EC3, Europol Platform for Experts, Law Enforcement Forum, and SIRIUS. Infiltration of these entities can disrupt ongoing investigations and compromise sensitive intelligence shared among international law enforcement agencies.
However, this is neither the first nor the last activity of IntekBroker. We have compiled for you what happened in the last few days. To track such hacker activities on dark web sources like hacker forums, private Telegram channels, and other hidden platforms where cyber threats often originate, you can check SOCRadar’s Dark Web News.
Stay Informed on Threat Actors’ Activity on the Dark Web with SOCRadar!
Globus Connect Server Deep Dive - GlobusWorld 2024Globus
We explore the Globus Connect Server (GCS) architecture and experiment with advanced configuration options and use cases. This content is targeted at system administrators who are familiar with GCS and currently operate—or are planning to operate—broader deployments at their institution.
Listen to the keynote address and hear about the latest developments from Rachana Ananthakrishnan and Ian Foster who review the updates to the Globus Platform and Service, and the relevance of Globus to the scientific community as an automation platform to accelerate scientific discovery.
Into the Box Keynote Day 2: Unveiling amazing updates and announcements for modern CFML developers! Get ready for exciting releases and updates on Ortus tools and products. Stay tuned for cutting-edge innovations designed to boost your productivity.
Custom Healthcare Software for Managing Chronic Conditions and Remote Patient...Mind IT Systems
Healthcare providers often struggle with the complexities of chronic conditions and remote patient monitoring, as each patient requires personalized care and ongoing monitoring. Off-the-shelf solutions may not meet these diverse needs, leading to inefficiencies and gaps in care. It’s here, custom healthcare software offers a tailored solution, ensuring improved care and effectiveness.
5. Scope of this workshop
Specification
(documentation)
DesignVerification
6. Types of Automatic Tests
End-to-end, out-of-process, business facing
Unit, in-process, technology facing
7. Scope of this workshop
End-to-end, out-of-process, business facing
Unit, in-process, technology facing
8. Exercise 1: Tire Pressure Monitoring System
Alarm class:
monitors tire pressure and sets an alarm if the pressure falls
outside of the expected range.
9. Exercise 1: Tire Pressure Monitoring System
Alarm class:
monitors tire pressure and sets an alarm if the pressure falls
outside of the expected range.
Sensor class:
simulates the behavior of a real tire sensor, providing random
but realistic values.
10. Exercise 1: Tire Pressure Monitoring System
Write the unit tests for the Alarm class.
Refactor the code as much as you need to make the Alarm
class testable.
11. Exercise 1: Tire Pressure Monitoring System
Write the unit tests for the Alarm class.
Refactor the code as much as you need to make the Alarm
class testable.
Minimize changes to the public API as much as you can.
12. Exercise 1: Tire Pressure Monitoring System
Write the unit tests for the Alarm class.
Refactor the code as much as you need to make the Alarm
class testable.
Minimize changes to the public API as much as you can.
Extra credits:
Alarm class fails to follow one or more of the SOLID principles.
Write down the line number, the principle & the violation.
13. The SOLID acronym
S single responsibility principle
O open closed principle
L Liskov substitution principle
I interface segregation principle
D dependency inversion principle
14. Dependency Inversion Principle (DIP)
Martin Fowler's definition:
a) High level modules should not depend upon
low level modules, both should depend upon
abstractions.
b) Abstractions should not depend upon details,
details should depend upon abstractions.
15. Dependency Inversion Principle (DIP)
Both low level classes and high level classes
should depend on abstractions.
High level classes should not depend on low
level classes.
16. DIP Violation In Example Code
High Level Class
Low Level Class
Dependency
17. Open Closed Principle (OCP)
Bertrand Meyer's definition:
Software entities (classes, modules, functions,
etc.) should be open for extension, but closed for
modification.
18. Open Closed Principle (OCP)
Classes and methods should be
open for extensions
&
strategically closed for modification.
So that the behavior can be changed and
extended adding new code instead of changing
the class.
19. OCP Violation In Example Code
Want to use a new type of sensor?
Must modify code; cannot extend it
21. Exercise 2: Unicode File To Htm Text Converter
UnicodeFileToHtmTextConverter class:
formats a plain text file for display in a browser.
22. Exercise 2: Unicode File To Htm Text Converter
Write the unit tests for the UnicodeFileToHtmTextConverter
class.
Refactor the code as much as you need to make the class
testable.
23. Exercise 2: Unicode File To Htm Text Converter
Write the unit tests for the UnicodeFileToHtmTextConverter
class.
Refactor the code as much as you need to make the class
testable.
Minimize changes to the public API as much as you can.
24. Exercise 2: Unicode File To Htm Text Converter
Write the unit tests for the UnicodeFileToHtmTextConverter
class.
Refactor the code as much as you need to make the class
testable.
Minimize changes to the public API as much as you can.
Extra credits:
UnicodeFileToHtmTextConverter class fails to follow one or
more of the SOLID principles. Write down the line number,
the principle & the violation.
25. Feathers’ rules of thumb. Extended !
A test is not a unit test when:
It talks to the database
It communicates across the network
It touches the file system or reads config info
It uses DateTime.now() or Random
It depends on non-deterministic behavior
It can't run at the same time as any of your other unit
tests
You have to do special things to your environment
(such as editing config files) to run it.
26. Mike Cohn's Test Pyramid. Explained !
UI
tests
Integration
tests
Unit tests
32. Exercise 3: Ticket Dispenser
TicketDispenser class:
manages a queuing system in a shop.
There may be more than one ticket dispenser but the same
ticket should not be issued to two different customers.
33. Exercise 3: Ticket Dispenser
TurnTicket class:
represent the ticket with the turn number.
TurnNumberSequence class:
returns the sequence of turn numbers.
34. Write the unit tests for the TicketDispenser class.
Refactor the code as much as you need to make the
TicketDispenser class testable.
Exercise 3: Ticket Dispenser
35. Write the unit tests for the TicketDispenser class.
Refactor the code as much as you need to make the
TicketDispenser class testable.
Minimize changes to the public API as much as you can.
Exercise 3: Ticket Dispenser
36. Write the unit tests for the TicketDispenser class.
Refactor the code as much as you need to make the
TicketDispenser class testable.
Minimize changes to the public API as much as you can.
Extra credits:
TicketDispenser class fails to follow one or more of the OO
and SOLID principles. Write down the line number, the
principle & the violation.
Exercise 3: Ticket Dispenser
38. Exercise 4: Telemetry System
TelemetryDiagnosticControl class:
establishes a connection to the telemetry server through the
TelemetryClient,
sends a diagnostic request and receives the response with
diagnostic info.
TelemetryClient class:
simulates the communication with the Telemetry Server, sends
requests and then receives and returns the responses
39. Write the unit tests for the TelemetryDiagnosticControl class.
Refactor the code as much as you need to make the class
testable.
Exercise 4: Telemetry System
40. Write the unit tests for the TelemetryDiagnosticControl class.
Refactor the code as much as you need to make the class
testable.
Minimize changes to the public API as much as you can.
Exercise 4: Telemetry System
41. Write the unit tests for the TelemetryDiagnosticControl class.
Refactor the code as much as you need to make the class
testable.
Minimize changes to the public API as much as you can.
Extra credits:
TelemetryClient class fails to follow one or more of the OO and
SOLID principles. Write down the line number, the principle &
the violation.
Exercise 4: Telemetry System
43. Single Responsibility Principle (SRP)
There should never be more than one reason for
a class to change.
A class should have one and only one
responsibility.
45. Interface Segregation Principle (IRP)
Clients should not be forced to depend upon
interface members that they don't use.
Interfaces that serve only one scope should be
preferred over fat interfaces.
47. Synergy between testing and design
Michael Feathers:
writing tests is another way to look the code and
locally understand it and reuse it,
and that is the same goal of good OO design.
This is the reason for
the deep synergy
between testability and good design.
They could be code you inherited from a legacy code-base.
They could be code you inherited from a legacy code-base.
They could be code you inherited from a legacy code-base.
Michael Feathers, NDC 2010
The Deep Synergy Between Testability and Good Design
http://vimeo.com/15007792
http://michaelfeathers.typepad.com/michael_feathers_blog/2007/09/the-deep-synerg.html