The document discusses improving the design of existing software by following principles like DRY, SOLID, and refactoring code using techniques such as extracting classes, methods, and interfaces. It emphasizes writing characterization tests to preserve existing behavior when refactoring, and improving code quality by reducing duplication, dependencies, and complexity over time through preventative maintenance and refactoring.
Clean architecture with asp.net core by ArdalisSteven Smith
Clean Architecture with ASP.NET Core
ASP.NET Core provides better support for clean, testable, maintainable architectures than any of its predecessors. Learn the underlying principles that apply to project/solution organization, how best to arrange your projects to support clean code, and how to refactor existing solutions toward this architecture. Examples will use ASP.NET Core but the principles covered apply to all languages and platforms.
About Steve
Steve Smith (@ardalis) is an entrepreneur and software developer with a passion for building quality software as effectively as possible. Steve has published several courses on Pluralsight, covering DDD, SOLID, design patterns, and software architecture. He’s a Microsoft ASP.NET MVP and Insider, a frequent speaker at developer conferences, an author, and a trainer. Steve works with companies that want to avoid the trap of technical debt by helping their teams deliver quality software, quickly. Steve and his team have been described by clients as a “force multiplier”, amplifying the value of existing development teams. Steve’s client list includes Microsoft, Quicken Loans, Celina Insurance, and many other satisfied customers.
Introducing domain driven design - dogfood con 2018Steven Smith
DDD provides a set of patterns and practices for tackling complex business problems with software models. Learn the basics of DDD in this session, including several principles and patterns you can start using immediately even if your project hasn't otherwise embraced DDD. Examples will primarily use C#/.NET.
Design patterns provide common templates for solving similar problems. They also provide a higher-level language for software developers to use to describe approaches they might choose when designing part of an application. This session introduces and applies several patterns useful to web application developers. Examples will primarily use C#/.NET.
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Steven Smith
Design patterns help developers and teams solve problems using proven approaches. In this talk, you'll learn how to solve a series of real world problems by applying patterns. Not only do patterns help individual developers solve particular problems, but they also enable teams to discuss design decisions using a richer, more descriptive language. By the end, you'll have some concrete tools you can apply, and hopefully the desire to master more patterns as you continue to improve!
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Steven Smith
Unit testing software can be difficult, especially when the software wasn't designed to be testable. Dependencies on infrastructure concerns and software we don't control are one of the biggest contributors to testing difficulty. In this session, you'll learn the difference between unit tests and other kinds of tests, how to recognize and invert dependencies, and how to unit test your code's interactions with these dependencies without testing the infrastructure itself.
Improving the Quality of Existing SoftwareSteven Smith
The document discusses techniques for improving the quality of existing software, including reducing technical debt, following principles like DRY and SOLID, using characterization tests to preserve behavior during refactoring, and improving skills to write higher quality code faster. It covers topics like refactoring, test-driven development, dependency inversion, and design patterns. The goal is to maintain and enhance application code quality over time through refactoring and preventing technical debt.
Improving the Quality of Existing SoftwareSteven Smith
How do you improve the quality of your existing software, while continuing to add value for your customers? What are some heuristics and code smells you can look for, and principles and patterns you can use to guide you, as you make your software better over time instead of worse?
Breaking Dependencies to Allow Unit TestingSteven Smith
Unit testing software can be difficult, especially when the software wasn't designed to be testable. Dependencies on infrastructure concerns and software we don't control are one of the biggest contributors to testing difficulty. In this session, you'll learn the difference between unit tests and other kinds of tests, how to recognize and invert dependencies, and how to unit test your code's interactions with these dependencies without testing the infrastructure itself.
Clean architecture with asp.net core by ArdalisSteven Smith
Clean Architecture with ASP.NET Core
ASP.NET Core provides better support for clean, testable, maintainable architectures than any of its predecessors. Learn the underlying principles that apply to project/solution organization, how best to arrange your projects to support clean code, and how to refactor existing solutions toward this architecture. Examples will use ASP.NET Core but the principles covered apply to all languages and platforms.
About Steve
Steve Smith (@ardalis) is an entrepreneur and software developer with a passion for building quality software as effectively as possible. Steve has published several courses on Pluralsight, covering DDD, SOLID, design patterns, and software architecture. He’s a Microsoft ASP.NET MVP and Insider, a frequent speaker at developer conferences, an author, and a trainer. Steve works with companies that want to avoid the trap of technical debt by helping their teams deliver quality software, quickly. Steve and his team have been described by clients as a “force multiplier”, amplifying the value of existing development teams. Steve’s client list includes Microsoft, Quicken Loans, Celina Insurance, and many other satisfied customers.
Introducing domain driven design - dogfood con 2018Steven Smith
DDD provides a set of patterns and practices for tackling complex business problems with software models. Learn the basics of DDD in this session, including several principles and patterns you can start using immediately even if your project hasn't otherwise embraced DDD. Examples will primarily use C#/.NET.
Design patterns provide common templates for solving similar problems. They also provide a higher-level language for software developers to use to describe approaches they might choose when designing part of an application. This session introduces and applies several patterns useful to web application developers. Examples will primarily use C#/.NET.
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Steven Smith
Design patterns help developers and teams solve problems using proven approaches. In this talk, you'll learn how to solve a series of real world problems by applying patterns. Not only do patterns help individual developers solve particular problems, but they also enable teams to discuss design decisions using a richer, more descriptive language. By the end, you'll have some concrete tools you can apply, and hopefully the desire to master more patterns as you continue to improve!
Breaking Dependencies to Allow Unit Testing - DevIntersection Spring 2016Steven Smith
Unit testing software can be difficult, especially when the software wasn't designed to be testable. Dependencies on infrastructure concerns and software we don't control are one of the biggest contributors to testing difficulty. In this session, you'll learn the difference between unit tests and other kinds of tests, how to recognize and invert dependencies, and how to unit test your code's interactions with these dependencies without testing the infrastructure itself.
Improving the Quality of Existing SoftwareSteven Smith
The document discusses techniques for improving the quality of existing software, including reducing technical debt, following principles like DRY and SOLID, using characterization tests to preserve behavior during refactoring, and improving skills to write higher quality code faster. It covers topics like refactoring, test-driven development, dependency inversion, and design patterns. The goal is to maintain and enhance application code quality over time through refactoring and preventing technical debt.
Improving the Quality of Existing SoftwareSteven Smith
How do you improve the quality of your existing software, while continuing to add value for your customers? What are some heuristics and code smells you can look for, and principles and patterns you can use to guide you, as you make your software better over time instead of worse?
Breaking Dependencies to Allow Unit TestingSteven Smith
Unit testing software can be difficult, especially when the software wasn't designed to be testable. Dependencies on infrastructure concerns and software we don't control are one of the biggest contributors to testing difficulty. In this session, you'll learn the difference between unit tests and other kinds of tests, how to recognize and invert dependencies, and how to unit test your code's interactions with these dependencies without testing the infrastructure itself.
Improving the Quality of Existing Software - DevIntersection April 2016Steven Smith
How do you improve the quality of your existing software, while continuing to add value for your customers? What are some heuristics and code smells you can look for, and principles and patterns you can use to guide you, as you make your software better over time instead of worse? How can we improve our skills and techniques so that writing high quality software becomes our default, fastest way of working?
Refactoring with SOLID - Telerik India DevCon 2013Steven Smith
The document discusses refactoring applications using SOLID principles. It covers how software can deteriorate over time through duplication, excess coupling, quick fixes, and hacks. It advocates using preventative maintenance through refactoring to eliminate duplication and simplify design, as well as automated tests to verify correctness and avoid regressions. The document outlines the refactoring process and introduces characterization tests. It then covers each SOLID principle - Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion - and provides examples of how to apply them through various refactorings.
Common ASP.NET Design Patterns - Telerik India DevCon 2013Steven Smith
This document provides an overview of common ASP.NET design patterns, including Singleton, Strategy, Repository, Proxy, Command, and Factory patterns. It discusses the intent, structure, and usage of each pattern. Code examples and references are also provided. Real-world examples are discussed to demonstrate how design patterns can be used to address issues like tight coupling and improve code quality during refactoring or initial design.
Scaling Indexing and Replication in Jira Data Center AppsAtlassian
Building an app that scales well for Jira Data Center can be challenging, especially with regards to index replication.
Andriy Yakovlev, a Principal Premier Support Engineer at Atlassian will share some common problems customers have experienced with apps on large instances, and how to prevent them.
Attendees will learn about how indexing works in Jira, and how indexes are replicated in Jira Data Center, as well as what to look out for to prevent problems before they happen.
The Oracle PL/SQL compiler does much more than compile code. It also automatically optimizes code, supports conditional compilation, and compile-time warning (lint checking).
Arquillian is a Java testing framework that allows running integration tests inside a container. It manages the container lifecycle and allows deploying test archives and accessing managed resources from tests. Citrus is a complementary framework for testing messaging interfaces like REST, SOAP, and JMS. It provides components to simulate clients and servers for messaging protocols. Together, Arquillian and Citrus allow testing applications by deploying them in a container and interacting with services through simulated messaging.
The document discusses introductory concepts and best practices for unit testing, including:
1. Why unit tests are important for reducing bugs, improving design, and making development faster.
2. The different types of tests like unit tests, integration tests, and functional tests.
3. What constitutes a unit test, including that it is small, repeatable, consistent, and fast.
4. An example of writing a "Hello World" unit test in C#.
Concurrency is the ability to run several programs or several parts of a program in parallel. If a time consuming task can be performed asynchronously or in parallel, this improve the throughput and the interactivity of the program.
The document introduces Spring Boot, a framework for building cloud native applications. It discusses how Spring Boot makes it easy to create stand-alone, production-grade Spring based applications that you can "just run". It also covers cloud native principles and deploying Spring Boot applications to Cloud Foundry. The presenter's background and references for further information are provided.
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and MoreSteven Feuerstein
This document discusses unit testing and regression testing for PL/SQL. It introduces three developers - Jacek Gabal, Pavel Kaplya, and Stefan Poschenrieder - who advocate for and actively practice unit testing. They discuss why unit and regression testing are important, tools for testing PL/SQL like utPLSQL, and how Stefan has used Excel as a testing harness for utPLSQL. The document also summarizes new features of utPLSQL version 3.
06 integrating extra features and looking forwardМарина Босова
This document discusses various topics related to integrating extra features into Entity Framework, including stored procedures, concurrency detection, best practices, and new features in Entity Framework 7. Stored procedures can provide a single point of access control and help limit dynamic SQL queries. Concurrency conflicts can be detected by adding a timestamp property to entities. Best practices include using Include to eager load related data and disposing of database contexts properly. Entity Framework 7 brings performance improvements and support for additional platforms and data stores.
Hangfire
An easy way to perform background processing in .NET and .NET Core applications. No Windows Service or separate process required.
Why Background Processing?
Lengthy operations like updating lot of records in DB
Checking every 2 hours for new data or files
Invoice generation at the end of every billing period
Monthly Reporting
Rebuild data, indexes or search-optimized index after data change
Automatic subscription renewal
Regular Mailings
Send an email due to an action
Background service provisioning
Spring AOP is presented to solve the problem of cross-cutting concerns. Core concepts include join points, pointcuts, advice, and aspects. Pointcuts define where advice executes, such as methods matching a signature. Advice includes before, after returning, after throwing and around advice. Aspects modularize concerns using pointcuts and advice. Spring AOP uses proxies to weave aspects at runtime.
Getting Reactive with Spring Framework 5.0’s GA releaseVMware Tanzu
This document discusses the new features of Spring Framework 5.0 including fully reactive web functionality through WebFlux, native Kotlin extensions, JDK 9 support, and integration with Java EE 8 APIs. It introduces Project Reactor and how it allows non-blocking and asynchronous code. It compares the traditional Spring MVC servlet stack to the new reactive stack in Spring WebFlux. It also briefly discusses functional programming models in Kotlin and Spring MVC.
This document summarizes a presentation about SpringBoot, a framework for creating Spring applications. It discusses how SpringBoot uses Groovy and removes the need for XML configuration. It provides an overview of Texas NIC where the presenter works and some of their applications. It then discusses why SpringBoot was created, how it can be used with Groovy, and demonstrates some sample applications. It also covers some good aspects of SpringBoot, things that can be confusing, and unexpected behaviors. It concludes with some tips for using SpringBoot with IntelliJ IDEA.
This presentation includes challenges in testing, levels of testing, best practices and policies, Test Drive Design(TDD),
Behavioral Driven Design (BDD Testing), TDD v/s BDD
Microsoft Fakes help you isolate the code you are testing by replacing other parts of the application with substitute code. These substitutes are called stubs and shims and are under the control of your tests. Microsoft Fakes is ideal when you need to test legacy or “legacy” code that is either restricted for refactoring or “refactoring” practically means rewriting and cost you a lot.
Polaris presentation ioc - code conferenceSteven Contos
This document discusses an introduction to dependency injection (DI) and inversion of control (IOC) using a console application example in C#. It will progressively introduce these concepts through examples, exploring how to transform a simple program into a more complex one while applying DI and IOC. The learning objectives are to understand what DI and IOC are, whether they are always used together, and see how they work in a simple scenario. Examples will be provided on GitHub and various DI containers like StructureMap and Autofac may be explored.
Improving the Quality of Existing SoftwareSteven Smith
Given at DogFoodCon 2016 in Columbus, Ohio
As developers, most of our time is spent working on existing software – even if it’s just the software we wrote ourselves, yesterday. And over time, software rots. If were not diligent, our beautiful code can degrade into a worthless mess. Keeping our code in working condition is no different than changing the oil in our car “ its preventive maintenance. In this session, Steve will cover some common places to look for signs of degradation in existing applications, and describe the steps we can take to improve our code. Examples will use C# and primarily ASP.NET.
Improving The Quality of Existing SoftwareSteven Smith
Presented at DevReach 2013.
As developers, most of our time is spent working on existing software. Sure, occasionally we get the chance to fire up a new Solution in Visual Studio, and that can be exciting. But after the first day, we find ourselves once more having to deal with the work we did yesterday. And today, we know more than we did yesterday, so there are things we’d do differently, if we had it to do over.
Over time, software rots. If we’re not diligent, our beautiful code can degrade into a worthless mess. Keeping our code in working condition is no different than changing the oil in our car – it’s preventive maintenance. In this session, Steve will look at some common places to look for signs of degradation in existing applications, and steps to take to improve the code. Examples will use C# and primarily ASP.NET.
Improving the Quality of Existing Software - DevIntersection April 2016Steven Smith
How do you improve the quality of your existing software, while continuing to add value for your customers? What are some heuristics and code smells you can look for, and principles and patterns you can use to guide you, as you make your software better over time instead of worse? How can we improve our skills and techniques so that writing high quality software becomes our default, fastest way of working?
Refactoring with SOLID - Telerik India DevCon 2013Steven Smith
The document discusses refactoring applications using SOLID principles. It covers how software can deteriorate over time through duplication, excess coupling, quick fixes, and hacks. It advocates using preventative maintenance through refactoring to eliminate duplication and simplify design, as well as automated tests to verify correctness and avoid regressions. The document outlines the refactoring process and introduces characterization tests. It then covers each SOLID principle - Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, and Dependency Inversion - and provides examples of how to apply them through various refactorings.
Common ASP.NET Design Patterns - Telerik India DevCon 2013Steven Smith
This document provides an overview of common ASP.NET design patterns, including Singleton, Strategy, Repository, Proxy, Command, and Factory patterns. It discusses the intent, structure, and usage of each pattern. Code examples and references are also provided. Real-world examples are discussed to demonstrate how design patterns can be used to address issues like tight coupling and improve code quality during refactoring or initial design.
Scaling Indexing and Replication in Jira Data Center AppsAtlassian
Building an app that scales well for Jira Data Center can be challenging, especially with regards to index replication.
Andriy Yakovlev, a Principal Premier Support Engineer at Atlassian will share some common problems customers have experienced with apps on large instances, and how to prevent them.
Attendees will learn about how indexing works in Jira, and how indexes are replicated in Jira Data Center, as well as what to look out for to prevent problems before they happen.
The Oracle PL/SQL compiler does much more than compile code. It also automatically optimizes code, supports conditional compilation, and compile-time warning (lint checking).
Arquillian is a Java testing framework that allows running integration tests inside a container. It manages the container lifecycle and allows deploying test archives and accessing managed resources from tests. Citrus is a complementary framework for testing messaging interfaces like REST, SOAP, and JMS. It provides components to simulate clients and servers for messaging protocols. Together, Arquillian and Citrus allow testing applications by deploying them in a container and interacting with services through simulated messaging.
The document discusses introductory concepts and best practices for unit testing, including:
1. Why unit tests are important for reducing bugs, improving design, and making development faster.
2. The different types of tests like unit tests, integration tests, and functional tests.
3. What constitutes a unit test, including that it is small, repeatable, consistent, and fast.
4. An example of writing a "Hello World" unit test in C#.
Concurrency is the ability to run several programs or several parts of a program in parallel. If a time consuming task can be performed asynchronously or in parallel, this improve the throughput and the interactivity of the program.
The document introduces Spring Boot, a framework for building cloud native applications. It discusses how Spring Boot makes it easy to create stand-alone, production-grade Spring based applications that you can "just run". It also covers cloud native principles and deploying Spring Boot applications to Cloud Foundry. The presenter's background and references for further information are provided.
Unit Testing Oracle PL/SQL Code: utPLSQL, Excel and MoreSteven Feuerstein
This document discusses unit testing and regression testing for PL/SQL. It introduces three developers - Jacek Gabal, Pavel Kaplya, and Stefan Poschenrieder - who advocate for and actively practice unit testing. They discuss why unit and regression testing are important, tools for testing PL/SQL like utPLSQL, and how Stefan has used Excel as a testing harness for utPLSQL. The document also summarizes new features of utPLSQL version 3.
06 integrating extra features and looking forwardМарина Босова
This document discusses various topics related to integrating extra features into Entity Framework, including stored procedures, concurrency detection, best practices, and new features in Entity Framework 7. Stored procedures can provide a single point of access control and help limit dynamic SQL queries. Concurrency conflicts can be detected by adding a timestamp property to entities. Best practices include using Include to eager load related data and disposing of database contexts properly. Entity Framework 7 brings performance improvements and support for additional platforms and data stores.
Hangfire
An easy way to perform background processing in .NET and .NET Core applications. No Windows Service or separate process required.
Why Background Processing?
Lengthy operations like updating lot of records in DB
Checking every 2 hours for new data or files
Invoice generation at the end of every billing period
Monthly Reporting
Rebuild data, indexes or search-optimized index after data change
Automatic subscription renewal
Regular Mailings
Send an email due to an action
Background service provisioning
Spring AOP is presented to solve the problem of cross-cutting concerns. Core concepts include join points, pointcuts, advice, and aspects. Pointcuts define where advice executes, such as methods matching a signature. Advice includes before, after returning, after throwing and around advice. Aspects modularize concerns using pointcuts and advice. Spring AOP uses proxies to weave aspects at runtime.
Getting Reactive with Spring Framework 5.0’s GA releaseVMware Tanzu
This document discusses the new features of Spring Framework 5.0 including fully reactive web functionality through WebFlux, native Kotlin extensions, JDK 9 support, and integration with Java EE 8 APIs. It introduces Project Reactor and how it allows non-blocking and asynchronous code. It compares the traditional Spring MVC servlet stack to the new reactive stack in Spring WebFlux. It also briefly discusses functional programming models in Kotlin and Spring MVC.
This document summarizes a presentation about SpringBoot, a framework for creating Spring applications. It discusses how SpringBoot uses Groovy and removes the need for XML configuration. It provides an overview of Texas NIC where the presenter works and some of their applications. It then discusses why SpringBoot was created, how it can be used with Groovy, and demonstrates some sample applications. It also covers some good aspects of SpringBoot, things that can be confusing, and unexpected behaviors. It concludes with some tips for using SpringBoot with IntelliJ IDEA.
This presentation includes challenges in testing, levels of testing, best practices and policies, Test Drive Design(TDD),
Behavioral Driven Design (BDD Testing), TDD v/s BDD
Microsoft Fakes help you isolate the code you are testing by replacing other parts of the application with substitute code. These substitutes are called stubs and shims and are under the control of your tests. Microsoft Fakes is ideal when you need to test legacy or “legacy” code that is either restricted for refactoring or “refactoring” practically means rewriting and cost you a lot.
Polaris presentation ioc - code conferenceSteven Contos
This document discusses an introduction to dependency injection (DI) and inversion of control (IOC) using a console application example in C#. It will progressively introduce these concepts through examples, exploring how to transform a simple program into a more complex one while applying DI and IOC. The learning objectives are to understand what DI and IOC are, whether they are always used together, and see how they work in a simple scenario. Examples will be provided on GitHub and various DI containers like StructureMap and Autofac may be explored.
Improving the Quality of Existing SoftwareSteven Smith
Given at DogFoodCon 2016 in Columbus, Ohio
As developers, most of our time is spent working on existing software – even if it’s just the software we wrote ourselves, yesterday. And over time, software rots. If were not diligent, our beautiful code can degrade into a worthless mess. Keeping our code in working condition is no different than changing the oil in our car “ its preventive maintenance. In this session, Steve will cover some common places to look for signs of degradation in existing applications, and describe the steps we can take to improve our code. Examples will use C# and primarily ASP.NET.
Improving The Quality of Existing SoftwareSteven Smith
Presented at DevReach 2013.
As developers, most of our time is spent working on existing software. Sure, occasionally we get the chance to fire up a new Solution in Visual Studio, and that can be exciting. But after the first day, we find ourselves once more having to deal with the work we did yesterday. And today, we know more than we did yesterday, so there are things we’d do differently, if we had it to do over.
Over time, software rots. If we’re not diligent, our beautiful code can degrade into a worthless mess. Keeping our code in working condition is no different than changing the oil in our car – it’s preventive maintenance. In this session, Steve will look at some common places to look for signs of degradation in existing applications, and steps to take to improve the code. Examples will use C# and primarily ASP.NET.
Refactoring Applications using SOLID PrinciplesSteven Smith
We’ve all heard about well-designed software projects, where things aren’t (yet) a big ball of mud that’s painful to work with, but many of us aren’t lucky enough to work on these. Nor is it an option for us to get to start a brand new “greenfield” project, where we can leave behind the legacy of spaghetti code and technical debt our current project might have.
But there is hope! By applying refactoring steps based on SOLID principles of object oriented design, we can reduce the technical debt of our existing application, improve our code quality, and hopefully make our application more enjoyable and productive to work with.
In this session, we’ll briefly introduce the SOLID principles and several design patterns, and then we’ll apply these principles and patterns by improving the design of an existing application through several refactoring steps.
Integration strategies best practices- Mulesoft meetup April 2018Rohan Rasane
The document discusses best practices for integration strategies including using an integration platform, designing integrations, and implementing resiliency patterns. It recommends having an integration platform to provide features like batch processing, loose coupling, reuse, governance, and security. When designing integrations, questions about data, users, transactions, orchestrations, and future needs should be considered. Common resiliency patterns discussed are timeouts, circuit breakers, bulkheads, retries, and idempotency.
This deck represents our current thinking about the best way to build enterprise SaaS software in 2015 - using a variety of techniques from several disciplines.
Since I wrote this I have also become very interested in resilience engineering and the notion that web developers are primarily engaged in the construction of socio-technical systems. When I rewrite this I plan to talk about how we should try to minimize mean-time-to-recover (MTTR) instead of mean-time-between-failures (MTBF), and how continuous deployment grows a safety culture around your operations.
I redacted most of the examples that illustrate these points because they use sensitive code examples or URLs. If you want to see the rest of slides, join us!
DevOps is the combination of cultural philosophies, practices, and tools that increases an organization's ability to deliver applications and services at high velocity: evolving and improving products at a faster pace than organizations using traditional software development and infrastructure management processes.
This document discusses object oriented design principles. It begins with an introduction and agenda. It then covers several object oriented design principles including the open-closed principle, single responsibility principle, interface segregation principle, Liskov substitution principle, and dependency inversion principle. Examples are provided for each. It also discusses bad designs, anti-patterns, and some "evil stuff" to avoid like singletons. The document concludes with a review of key principles like encapsulation, composition over inheritance, programming to interfaces, and loose coupling.
Cloud and Network Transformation using DevOps methodology : Cisco Live 2015Vimal Suba
Content presented as part of Cisco Live 2015 in San Diego
Why DevOps and what it means to be a DevOps-Enabled Organization?
Recommendations on Toolchain, Metrics framework, best practices and tips to help you embark on your IT Organization on DevOps journey
Entity Framework: To the Unit of Work Design Pattern and BeyondSteve Westgarth
The document discusses issues with traditional ASP.NET application architectures and how the introduction of MVC helped address some problems. It then describes how the presenter implemented the Unit of Work pattern to help with testing and database consistency in their application. However, this implementation violated SOLID principles. The presenter improved the design by separating concerns into distinct layers and implementing generic repositories. This made the code more testable and decoupled from Entity Framework while better adhering to object-oriented design principles. In the end, the presenter advocates evaluating design patterns critically and continuously challenging accepted approaches.
Test-Driven Development (TDD) is a software development process that relies on writing automated tests before developing code to pass those tests ("red-green-refactor"). TDD promotes writing isolated, repeatable unit tests and decoupling code from external dependencies through techniques like dependency injection and mocking. While TDD has benefits like ensuring quality and preventing regressions, it has also received criticism for potentially leading to over-testing and an over-reliance on mocking. The presentation concludes with an open discussion of experiences and opinions on TDD.
Patterns and practices for building enterprise-scale HTML5 appsPhil Leggetter
Developing large apps is difficult. Ensuring that code is consistent, maintainable, testable and has an architecture that enables change is essential. As is ensuring that multiple developers – across multiple teams – can efficiently contribute to the same application. When it comes to large server-focused apps, solutions to some of these challenges have been tried and tested. But, how do you achieve this when building HTML5 single-page apps?
In this session, Phil will cover the experiences his team have had when building HTML5 apps consisting of more than 250k lines of JavaScript (plus HTML templates, CSS, image, config etc) that are contributed to by multiple teams across multiple companies. He will highlight signs to watch out for as your HTML5 SPA grows, and a set of patterns and practices that help you avoid problems. He will also explain the simple yet powerful application architecture that their HTML5 apps have that is core to ensuring they scale.
Finally, Phil will demonstrate how tooling can be used to support these patterns and practices, and enable a productive developer workflow where the first line of code is feature code, features can be developed and tested in isolation, code conflicts are avoided by grouping assets by feature, and features are composed into apps.
This document provides an overview of clean coding principles and design patterns, including the Model-View-Controller pattern. It discusses encapsulating data and functions, the single responsibility principle, DRY principle, favoring composition over inheritance, using interfaces, design patterns, and programming for the future rather than just the present. It also describes traditional and mediated MVC patterns, with the controller acting as a mediator between the view and model.
Managing one or two unique machines in an ad-hoc manner is not a story that many people talk about nowadays. Today, small teams need to manage hundreds or thousands of nodes, serving a myriad of purposes, running any number of critical Dev and Ops workloads. And they have to do it in a way that still leaves time for unplanned and strategic work.
Learn how HP ties DevOps automation, monitoring information and ChatOps collaboration together to eliminate manual, error-prone work and keep critical services running
Start with passing tests (tdd for bugs) v0.5 (22 sep 2016)Dinis Cruz
"Turning TDD upside down - For bugs, always start with a passing test" - Common workflow on TDD is to write failed tests. The problem with this approach is that it only works for a very specific scenario (when fixing bugs). This presentation will present a different workflow which will make the coding and testing of those tests much easier, faster, simpler, secure and thorough'
Presented at LSCC (London Software Craftsmanship Community) http://www.meetup.com/london-software-craftsmanship on sep 2016.
5 Considerations When Adopting Automated TestingBhupesh Dahal
Most organizations have realized the benefits of and need for test automation—but is your investment being wisely utilized? Are you unknowingly building a test automation suite that will end up costing more than your actual product? Are you building a legacy test automation framework that may be ready to retire before you reap the benefits?
This presentation will discuss five points of consideration that will help your organization answer these questions and mitigate risks that they bring into light.
Test automation lessons from WebSphere Application ServerRobbie Minshall
The document discusses WebSphere testing at IBM. It provides an overview of IBM's:
- Extensive testing resources including over 200 engineers and thousands of systems.
- Daily regression testing of over 1.7 million tests.
- Transition from waterfall to agile development which reduced cycle times and resources needed for testing.
- Use of cloud resources to speed up test deployment and automation.
- Focus on creating meaningful regressions through techniques like integration acceptance tests run continuously on each build.
This document discusses DevOps, a methodology that combines software development (Dev) and IT operations (Ops). It describes how DevOps aims to improve collaboration between developers and operations teams to more quickly identify and solve problems, allowing for faster and more reliable software delivery. The document provides examples of how DevOps streamlines processes like continuous integration, delivery and deployment through automation and bringing the teams together into a single workflow.
This webinar lays the foundation for your PHP app. If you have at least one year of PHP experience, this webinar explains these key building blocks for creating and maintaining enterprise-class applications, mobile services, and third-party libraries. It covers: what makes mission-critical PHP different? (including cloud-based solutions); how to maintain your PHP stack; how to ensure code security; and what to do when your system goes down?
Best Practices for Building WordPress ApplicationsTaylor Lovett
This document provides best practices for WordPress applications, covering topics like caching, database reads/writes, search queries, maintainability, security, third-party code, teams, and workflows. It recommends tools and techniques to optimize performance, including using Redis for caching, Elasticsearch for complex queries, feature plugins, documentation, testing, linting, and managing dependencies with Composer.
Similar to Improving the Design of Existing Software (20)
Finding Patterns in the Clouds - Cloud Design PatternsSteven Smith
The document discusses the evolution of web application architectures from single server deployments to modern cloud-native microservice architectures. It covers how early web apps faced challenges as demand grew that led to adopting caching, load balancing, and the cloud. It then discusses how further scaling issues were addressed through containers, microservices, and patterns like API gateways and circuit breakers. Key lessons are around adopting cloud-native patterns to improve performance, scalability, resilience and developer productivity for applications.
Introducing Domain Driven Design - codemashSteven Smith
DDD provides a set of patterns and practices for tackling complex business problems with software models. Learn the basics of DDD in this session, including several principles and patterns you can start using immediately even if your project hasn't otherwise embraced DDD. Examples will primarily use C#/.NET.
Given at DogFoodCon 2016 in Columbus, Ohio
Domain Events, a Domain-Driven Design (DDD) pattern, provide a way to decouple your code. Rather than hard-coding a series of steps that must be completed in response to a particular action a user takes, that action can raise an event. Handlers for an event can be added without changing the code responsible for raising the event, resulting in a more extensible design. Coupled with SignalR or push notifications in the UI layer, domain events can trigger live updates, even to web-based applications and mobile apps.
ASP.NET 5 has been redesigned with an emphasis on speed, composability, and cross-platform support. The new ASP.NET is leaner, faster, open source, and fixes many of the inconsistencies and problems present in ASP.NET today.
Domain Events, a Domain-Driven Design (DDD) pattern, provide a way to decouple your code. Rather than hard-coding a series of steps that must be completed in response to a particular action a user takes, that action can raise an event. Handlers for that event can be added without changing the code responsible for raising the event, resulting in a more extensible design. Coupled with SignalR in the UI layer, domain events can trigger updates to the application without the user having to refresh the application.
My 2004 deployment to Iraq and missions as a combat engineer platoon leader in support of EOD missions. Presented to Ravenna, Ohio Daughters of the American Revolution chapter 18 October 2014
This document discusses Domain-Driven Design (DDD) and how it can be applied to ASP.NET MVC projects. It covers DDD concepts like ubiquitous language, bounded contexts, entities, value objects, domain services, and domain events. It also discusses how to structure an MVC project to separate the domain model from the rest of the application using patterns like layered architecture and ports and adapters. The document argues that DDD can provide benefits like flexibility, manageable complexity, and centralized business logic, though it may require more time and effort to implement.
Breaking Dependencies to Allow Unit TestingSteven Smith
Unit testing software can be difficult, especially when the software wasn't designed to be testable. Dependencies on infrastructure concerns and software we don't control are one of the biggest contributors to testing difficulty. In this session, you'll learn the difference between unit tests and other kinds of tests, how to recognize and invert dependencies, and how to unit test your code's interactions with these dependencies without testing the infrastructure itself.
Presented at FalafelCON 2014, San Francisco, September 2014
Refactoring with SOLID Principles (FalafelCon 2013)Steven Smith
We’ve all heard about well-designed software projects, where things aren’t (yet) a big ball of mud that’s painful to work with, but many of us aren’t lucky enough to work on these. Nor is it an option for us to get to start a brand new “greenfield” project, where we can leave behind the legacy of spaghetti code and technical debt our current project might have.
But there is hope! By applying refactoring steps based on SOLID principles of object oriented design, we can reduce the technical debt of our existing application, improve our code quality, and hopefully make our application more enjoyable and productive to work with.
In this session, we’ll briefly introduce the SOLID principles and several design patterns, and then we’ll apply these principles and patterns by improving the design of an existing application through several refactoring steps.
Common asp.net design patterns aspconf2012Steven Smith
This document discusses common ASP.NET design patterns. It provides an overview of several design patterns including singleton, factory, repository, dependency injection, and MVC. It also demonstrates these patterns in code examples and discusses when to use certain patterns over others. Real world examples are given and it encourages the use of design patterns to reduce coupling and improve code organization, testability, and maintenance.
Pair programming involves two programmers working together at one computer. One person acts as the driver who types code while the other navigates and reviews. It has benefits like catching mistakes earlier, improving design quality, transferring knowledge between partners, and creating a stronger sense of team. While there is initially a 15% overhead in time, studies show this is outweighed by fewer defects and a more flexible system in the long run. Effective pair programming requires collaboration, respect, communication and regularly alternating roles.
The document discusses anti-patterns and worst practices in software development. Some examples covered include static cling pattern, flags over objects, premature optimization, copy-paste-compile, and reinventing the wheel. It also shares lessons learned from experiences, such as being mindful of date times across time zones, avoiding building SQL from untrusted inputs, and not being too cute with test data. Overall, the document aims to help developers learn from the mistakes of others and adopt better practices.
"Choosing proper type of scaling", Olena SyrotaFwdays
Imagine an IoT processing system that is already quite mature and production-ready and for which client coverage is growing and scaling and performance aspects are life and death questions. The system has Redis, MongoDB, and stream processing based on ksqldb. In this talk, firstly, we will analyze scaling approaches and then select the proper ones for our system.
Monitoring and Managing Anomaly Detection on OpenShift.pdfTosin Akinosho
Monitoring and Managing Anomaly Detection on OpenShift
Overview
Dive into the world of anomaly detection on edge devices with our comprehensive hands-on tutorial. This SlideShare presentation will guide you through the entire process, from data collection and model training to edge deployment and real-time monitoring. Perfect for those looking to implement robust anomaly detection systems on resource-constrained IoT/edge devices.
Key Topics Covered
1. Introduction to Anomaly Detection
- Understand the fundamentals of anomaly detection and its importance in identifying unusual behavior or failures in systems.
2. Understanding Edge (IoT)
- Learn about edge computing and IoT, and how they enable real-time data processing and decision-making at the source.
3. What is ArgoCD?
- Discover ArgoCD, a declarative, GitOps continuous delivery tool for Kubernetes, and its role in deploying applications on edge devices.
4. Deployment Using ArgoCD for Edge Devices
- Step-by-step guide on deploying anomaly detection models on edge devices using ArgoCD.
5. Introduction to Apache Kafka and S3
- Explore Apache Kafka for real-time data streaming and Amazon S3 for scalable storage solutions.
6. Viewing Kafka Messages in the Data Lake
- Learn how to view and analyze Kafka messages stored in a data lake for better insights.
7. What is Prometheus?
- Get to know Prometheus, an open-source monitoring and alerting toolkit, and its application in monitoring edge devices.
8. Monitoring Application Metrics with Prometheus
- Detailed instructions on setting up Prometheus to monitor the performance and health of your anomaly detection system.
9. What is Camel K?
- Introduction to Camel K, a lightweight integration framework built on Apache Camel, designed for Kubernetes.
10. Configuring Camel K Integrations for Data Pipelines
- Learn how to configure Camel K for seamless data pipeline integrations in your anomaly detection workflow.
11. What is a Jupyter Notebook?
- Overview of Jupyter Notebooks, an open-source web application for creating and sharing documents with live code, equations, visualizations, and narrative text.
12. Jupyter Notebooks with Code Examples
- Hands-on examples and code snippets in Jupyter Notebooks to help you implement and test anomaly detection models.
Your One-Stop Shop for Python Success: Top 10 US Python Development Providersakankshawande
Simplify your search for a reliable Python development partner! This list presents the top 10 trusted US providers offering comprehensive Python development services, ensuring your project's success from conception to completion.
Driving Business Innovation: Latest Generative AI Advancements & Success StorySafe Software
Are you ready to revolutionize how you handle data? Join us for a webinar where we’ll bring you up to speed with the latest advancements in Generative AI technology and discover how leveraging FME with tools from giants like Google Gemini, Amazon, and Microsoft OpenAI can supercharge your workflow efficiency.
During the hour, we’ll take you through:
Guest Speaker Segment with Hannah Barrington: Dive into the world of dynamic real estate marketing with Hannah, the Marketing Manager at Workspace Group. Hear firsthand how their team generates engaging descriptions for thousands of office units by integrating diverse data sources—from PDF floorplans to web pages—using FME transformers, like OpenAIVisionConnector and AnthropicVisionConnector. This use case will show you how GenAI can streamline content creation for marketing across the board.
Ollama Use Case: Learn how Scenario Specialist Dmitri Bagh has utilized Ollama within FME to input data, create custom models, and enhance security protocols. This segment will include demos to illustrate the full capabilities of FME in AI-driven processes.
Custom AI Models: Discover how to leverage FME to build personalized AI models using your data. Whether it’s populating a model with local data for added security or integrating public AI tools, find out how FME facilitates a versatile and secure approach to AI.
We’ll wrap up with a live Q&A session where you can engage with our experts on your specific use cases, and learn more about optimizing your data workflows with AI.
This webinar is ideal for professionals seeking to harness the power of AI within their data management systems while ensuring high levels of customization and security. Whether you're a novice or an expert, gain actionable insights and strategies to elevate your data processes. Join us to see how FME and AI can revolutionize how you work with data!
HCL Notes and Domino License Cost Reduction in the World of DLAUpanagenda
Webinar Recording: https://www.panagenda.com/webinars/hcl-notes-and-domino-license-cost-reduction-in-the-world-of-dlau/
The introduction of DLAU and the CCB & CCX licensing model caused quite a stir in the HCL community. As a Notes and Domino customer, you may have faced challenges with unexpected user counts and license costs. You probably have questions on how this new licensing approach works and how to benefit from it. Most importantly, you likely have budget constraints and want to save money where possible. Don’t worry, we can help with all of this!
We’ll show you how to fix common misconfigurations that cause higher-than-expected user counts, and how to identify accounts which you can deactivate to save money. There are also frequent patterns that can cause unnecessary cost, like using a person document instead of a mail-in for shared mailboxes. We’ll provide examples and solutions for those as well. And naturally we’ll explain the new licensing model.
Join HCL Ambassador Marc Thomas in this webinar with a special guest appearance from Franz Walder. It will give you the tools and know-how to stay on top of what is going on with Domino licensing. You will be able lower your cost through an optimized configuration and keep it low going forward.
These topics will be covered
- Reducing license cost by finding and fixing misconfigurations and superfluous accounts
- How do CCB and CCX licenses really work?
- Understanding the DLAU tool and how to best utilize it
- Tips for common problem areas, like team mailboxes, functional/test users, etc
- Practical examples and best practices to implement right away
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframePrecisely
Inconsistent user experience and siloed data, high costs, and changing customer expectations – Citizens Bank was experiencing these challenges while it was attempting to deliver a superior digital banking experience for its clients. Its core banking applications run on the mainframe and Citizens was using legacy utilities to get the critical mainframe data to feed customer-facing channels, like call centers, web, and mobile. Ultimately, this led to higher operating costs (MIPS), delayed response times, and longer time to market.
Ever-changing customer expectations demand more modern digital experiences, and the bank needed to find a solution that could provide real-time data to its customer channels with low latency and operating costs. Join this session to learn how Citizens is leveraging Precisely to replicate mainframe data to its customer channels and deliver on their “modern digital bank” experiences.
[OReilly Superstream] Occupy the Space: A grassroots guide to engineering (an...Jason Yip
The typical problem in product engineering is not bad strategy, so much as “no strategy”. This leads to confusion, lack of motivation, and incoherent action. The next time you look for a strategy and find an empty space, instead of waiting for it to be filled, I will show you how to fill it in yourself. If you’re wrong, it forces a correction. If you’re right, it helps create focus. I’ll share how I’ve approached this in the past, both what works and lessons for what didn’t work so well.
The Microsoft 365 Migration Tutorial For Beginner.pptxoperationspcvita
This presentation will help you understand the power of Microsoft 365. However, we have mentioned every productivity app included in Office 365. Additionally, we have suggested the migration situation related to Office 365 and how we can help you.
You can also read: https://www.systoolsgroup.com/updates/office-365-tenant-to-tenant-migration-step-by-step-complete-guide/
For the full video of this presentation, please visit: https://www.edge-ai-vision.com/2024/06/how-axelera-ai-uses-digital-compute-in-memory-to-deliver-fast-and-energy-efficient-computer-vision-a-presentation-from-axelera-ai/
Bram Verhoef, Head of Machine Learning at Axelera AI, presents the “How Axelera AI Uses Digital Compute-in-memory to Deliver Fast and Energy-efficient Computer Vision” tutorial at the May 2024 Embedded Vision Summit.
As artificial intelligence inference transitions from cloud environments to edge locations, computer vision applications achieve heightened responsiveness, reliability and privacy. This migration, however, introduces the challenge of operating within the stringent confines of resource constraints typical at the edge, including small form factors, low energy budgets and diminished memory and computational capacities. Axelera AI addresses these challenges through an innovative approach of performing digital computations within memory itself. This technique facilitates the realization of high-performance, energy-efficient and cost-effective computer vision capabilities at the thin and thick edge, extending the frontier of what is achievable with current technologies.
In this presentation, Verhoef unveils his company’s pioneering chip technology and demonstrates its capacity to deliver exceptional frames-per-second performance across a range of standard computer vision networks typical of applications in security, surveillance and the industrial sector. This shows that advanced computer vision can be accessible and efficient, even at the very edge of our technological ecosystem.
Connector Corner: Seamlessly power UiPath Apps, GenAI with prebuilt connectorsDianaGray10
Join us to learn how UiPath Apps can directly and easily interact with prebuilt connectors via Integration Service--including Salesforce, ServiceNow, Open GenAI, and more.
The best part is you can achieve this without building a custom workflow! Say goodbye to the hassle of using separate automations to call APIs. By seamlessly integrating within App Studio, you can now easily streamline your workflow, while gaining direct access to our Connector Catalog of popular applications.
We’ll discuss and demo the benefits of UiPath Apps and connectors including:
Creating a compelling user experience for any software, without the limitations of APIs.
Accelerating the app creation process, saving time and effort
Enjoying high-performance CRUD (create, read, update, delete) operations, for
seamless data management.
Speakers:
Russell Alfeche, Technology Leader, RPA at qBotic and UiPath MVP
Charlie Greenberg, host
Introduction of Cybersecurity with OSS at Code Europe 2024Hiroshi SHIBATA
I develop the Ruby programming language, RubyGems, and Bundler, which are package managers for Ruby. Today, I will introduce how to enhance the security of your application using open-source software (OSS) examples from Ruby and RubyGems.
The first topic is CVE (Common Vulnerabilities and Exposures). I have published CVEs many times. But what exactly is a CVE? I'll provide a basic understanding of CVEs and explain how to detect and handle vulnerabilities in OSS.
Next, let's discuss package managers. Package managers play a critical role in the OSS ecosystem. I'll explain how to manage library dependencies in your application.
I'll share insights into how the Ruby and RubyGems core team works to keep our ecosystem safe. By the end of this talk, you'll have a better understanding of how to safeguard your code.
How information systems are built or acquired puts information, which is what they should be about, in a secondary place. Our language adapted accordingly, and we no longer talk about information systems but applications. Applications evolved in a way to break data into diverse fragments, tightly coupled with applications and expensive to integrate. The result is technical debt, which is re-paid by taking even bigger "loans", resulting in an ever-increasing technical debt. Software engineering and procurement practices work in sync with market forces to maintain this trend. This talk demonstrates how natural this situation is. The question is: can something be done to reverse the trend?
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfChart Kalyan
A Mix Chart displays historical data of numbers in a graphical or tabular form. The Kalyan Rajdhani Mix Chart specifically shows the results of a sequence of numbers over different periods.
7. Technical Debt
• Low quality code and shortcuts in our applications
• Financial Debt
• Principal – Amount borrowed
• Interest – Additional cost of the debt
• Technical debt
• Principal – Amount of time required to code solution “properly”
• Interest – Additional time needed to work around improper code
http://deviq.com/technical-debt/
16. “
”
You don’t need permission to practice basic hygiene
when you write software.
http://ardalis.com/when-should-you-refactor/
Make cleaning up your code something you do as part of writing code.
19. The Refactoring Process
• Verify existing behavior
• Write CharacterizationTests if none exist
• Find test points
• Break dependencies
• Apply Refactoring
• Confirm existing behavior is preserved
Commit the working code!
Commit the working code!
20. CharacterizationTests
Process
1. Write a test you know will fail
2. Use the output of the failing test to determine the existing behavior to
assert
3. Update the test with the new value/behavior
4. Run the test again – it should now pass
24. Why new classes?
• Nothing depends on them (yet)
• You can write them to be testable
• Even in an otherwise hard-to-test application
25. Add High-ValueTests to Legacy Apps
• Probably not writtenTest-First
• Trying to UnitTest Everything is likely cost-prohibitive
• Start by writing tests for bugs
• Verify the bug behavior with a test
• Make the test pass by fixing the bug
26. S O L I DPrinciples
http://flickr.com/photos/kevinkemmerer/2772526725/
31. Common Refactorings
• Replace Magic Number/String
• Parameterize Method
• Pull Up Field
• Pull Up Method
• Replace Conditional With Polymorphism
• Introduce Method
32. Common Source of Repetition: Role Checks
if(user.IsInRole(“Admins”)
{
// allow access to resource
}
// favor privileges over role checks
// ardalis.com/Favor-Privileges-over-Role-Checks
var priv = new ContentPrivilege(user, article);
if(priv.CanEdit())
{
// allow access
}
33. Visual Studio Code Clones
• Find similar blocks of code in your projects/solution
• Can detect matches that are similar but vary in small ways (like variable
names)
• Available inVS2015 Premium and Ultimate
34.
35. Single Responsibility Principle
The Single Responsibility Principle states that every object should have a single
responsibility, and that responsibility should be entirely encapsulated by the
class.
Wikipedia
There should never be more than one reason for a class to change.
Robert C. “Uncle Bob” Martin
36. What is a responsibility?
“My CustomerManager class is only responsible for
anything to do with a Customer.That follows SRP, right?”
37. Examples of Responsibilities
• Persistence
• Validation
• Notification
• Error Handling
• Logging
• Class Selection / Construction
• Formatting
• Parsing
• Mapping
38. Dependency and Coupling
• Excessive coupling makes changing legacy software difficult
• Breaking apart responsibilities and dependencies is a large part of working
with existing code
46. Open / Closed Principle
The Open / Closed Principle states that software entities (classes, modules,
functions, etc.) should be open for extension, but closed for modification.
Wikipedia
47. Open / Closed Principle
Open to Extension
New behavior can be added in the future
Closed to Modification
Changes to source or binary code are not required
Dr. Bertrand Meyer originated the OCP term in his 1988 book, ObjectOrientedSoftwareConstruction
52. OCP OK
private IEnumerable<ICustomerRule> _rules;
public bool IsSpecialCustomer(Customer customer)
{
foreach(var rule in _rules)
{
if(rule.Evaluate(customer) == false) return false;
}
return true;
}
53.
54. Liskov Substitution Principle
The Liskov Substitution Principle states that Subtypes must be substitutable for
their base types.
Agile Principles, Patterns, and Practices in C#
Named for Barbara Liskov, who first described the principle in 1988.
58. Nulls Break Polymorphism
foreach(var employee in employees)
{
if(employee == null)
{
// print not found message
break;
}
Helpers.PrintEmployee(employee);
} http://ardalis.com/nulls-break-polymorphism
59.
60. Interface Segregation Principle
The Interface Segregation Principle states that Clients should not be
forced to depend on methods they do not use.
Agile Principles, Patterns, and Practices in C#
Corollary:
Prefer small, cohesive interfaces to “fat” interfaces
65. ISP OK (i.e. to support CQRS)
public IRepository<T> : IReadRepository<T>,
IWriteRepository<T>
{ }
public IReadRepository<T>
{
T GetById(int id);
IEnumerable<T> List();
}
public IWriteRepository<T>
void Create(T item);
void Update(T item);
void Delete(T item);
}
Existing implementations of
IRepository<T> are
unaffected by pulling out
smaller interfaces!
No existing code breaks!
66.
67. Dependency Inversion Principle
High-level modules should not depend on low-level modules. Both
should depend on abstractions.
Abstractions should not depend on details. Details should depend on
abstractions.
Agile Principles, Patterns, and Practices in C#
68. Dependency Inversion Principle
• Depend on Abstractions
• Interfaces, not concrete types
• Inject Dependencies into Classes
• Structure Solution so Dependencies FlowToward Core
• Onion Architecture (a.k.a. Ports and Adapters, a.k.a. Hexagonal Architecture)
70. Common Dependencies
• Framework
• Third Party Libraries
• Database
• File System
• Email
• Web Services
• System Resources (Clock)
• Configuration
• The new Keyword
• Static methods
• Thread.Sleep
• Random
See also responsibilities:
• Persistence
• Validation
• Notification
• Error Handling
• Logging
• Class Selection /
Construction
• Formatting
• Parsing
• Mapping
71. Common Refactorings
• Extract Class
• Extract Interface / Apply Strategy Pattern
• Extract Method
• Introduce Service Locator / Container
73. Hidden Dependencies
• Checkout Depends on an available SMTP server, but the class doesn’t reflect
this
• Follow the Explicit Dependencies Principle
• http://deviq.com/explicit-dependencies-principle/
79. Self-Improvement and Quality
• How fast can you produce:
• Code you believe to be of high quality
• Code that maybe gets the job done, but you believe to be of low quality
• Which one can you produce more quickly?
• Why?
• How can we develop our skills and our tools so that building quality is
natural and easier than not doing so?
84. • New Coworking Space in Hudson,Ohio
• Private offices / Flex desk spaces
• Fiber internet
• Complimentary coffee / tea / water
• Great development community
• @techhubhudson
• Website online soon
Tech Hub Hudson
85. Books
Refactoring http://amzn.to/110tscA
Refactoring to Patterns http://amzn.to/Vq5Rj2
Working Effectively with Legacy Code http://amzn.to/VFFYbn
Code Complete http://amzn.to/Vq5YLv
Clean Code http://amzn.to/YjUDI0
Over time, neglect can turn software from well-oiled machinery into heaps of useless junk.
Typically the low quality code was left because of the need to meet deadlines, but once in place, the justification for having put it there no longer matters.
Whenever you are forced to work around the hacks, bad code, etc, in your application, the decrease in your productivity represents interest on technical debt. If you spend time refactoring the code to improve its quality, you are paying down the principal of the technical debt (and thus reducing future interest costs).
Sometimes principal of technical debt can grow, as when a lot of code is built on top of debt-ridden code. There isn’t a perfect metaphor for this that I’m aware of.
Accidental vs. Deliberate decision to incur the debt.
Reckless vs. Prudent kinds of debt incurred.
Should we spend an iteration or a month just trying to improve the quality of the system, and pay down technical debt?
What would you think if you went to your favorite restaurant, only to find that it was closed for a month, with a sign explaining that it needed to clean up things that had gotten out of hand due to neglect. Would you feel as confident about eating the product of that kitchen, knowing it had let things go so wrong that it now needed a month without producing food just to clean up the mess it had created. How do you think our customers should feel if we request time to clean up our code instead of fixing bugs or delivering new features?
Building in quality becomes a habit. Working with well-crafted code is more enjoyable. Create a virtuous cycle. Help yourself and your team fall into the pit of success that is clean code.
By definition, refactoring attempts to improve the quality of a software application without changing its behavior. If you’re changing behavior, you’re not refactoring, you’re fixing a bug or adding a feature (hopefully – or adding a bug).
Only refactor code while your tests are passing. Make sure they still pass when you are done. Break large refactorings into small steps and test after each step.
Note that characterization tests, though they should be automated, are often not what we would think of as unit tests, or perhaps even integration tests. For instance, you could dump a log file showing the relevant state of the application, and then use that as the basis for your characterization test by comparing against it after your changes.
Avoid creating a big ball of mud system, where tracing through your code and its dependencies is like trying to unwind a tangled mess of spaghetti.
Principles provide guidance for refactoring. They provide a consistent target to aim toward.
A very common source of repetition of code is role checks. These often describe different scenarios in different circumstances. For instance, maybe administrators can do anything, but managers can access resources within their division, etc. Encapsulating the logic of CanView, CanCreate, CanEdit, etc. in privilege objects makes these rules explicit, easier to test, and gives them a single location to live in the application.
Visual Studio can quickly analyze a project and show statistics for the classes and methods in the project. The maintainability index, cyclomatic complexity, and lines of code are all great metrics to pay attention to. The ideal maintainability index is 100, but don’t expect to hit that with any code that’s doing real work. However, you should certainly able to keep it above 50.
Demo GildedRose.
Using Excel
I’m not a fan of regions. They mainly exist because at one time they were a reasonable means of hiding generated code, before we had support for partial classes and other language features to deal with this. The worst offense with regions is when they’re used within a method, like this:
(click)
They’re also bad when used at the class level for “standard” formatting of code, making it impossible to actually see what the code does, like this:
(click)
Can someone tell me what this class does?
(click)
I have a whole article devoted to why using regions is a bad habit, anti-pattern, code smell, whatever you prefer. It includes some survey results on the most common ways people use them as well. (click)
Open-Closed Principle
Software can only be open to extension in a few different axes, and each additional bit of flexibility adds complexity to the software. Thus, this flexibility should be added only when needed, not simply anticipated.
What happens when we need to add another country?
What happens when we must add another rule?
How can we refactor this so this method no longer needs to change?
Define a type to describe a rule. Move each rule into its own type. Create a collection of rules to apply and apply them.
Pass the set of rules into the IsSpecialCustomer() method’s class (or even the method itself).
Any time you find that you need to check the type of an object within a polymorphic block of code (such as a foreach), this is a sign that you are breaking LSP.
Nulls break polymorphism and violate LSP just as much as other subtypes that aren’t substitutable! Try to avoid the possibility of dealing with nulls in polymorphic code like foreach loops – consider using Null Object Pattern to address.
This is an extemely common example of the Repository design pattern. In fact, I use this exact pattern in quite a few production applications today. There’s nothing inherently wrong with this implementation on its own. However, sometimes it does violate ISP if you need to separate Commands from Queries
You can create small interfaces and compose the larger interfaces from the smaller ones if you control all of the code and you can’t simply do away with the larger interfaces. In this case, the separation of interfaces would allow us to do something like implement caching only on the read operations, and implement delayed writes using some kind of queue or message bus for the write operations.
“Legacy” N-Tier Logical Architecture
Hidden Dependencies
Extract interface
Implement interface with tightly coupled original code