Refactoring Messy to Testable Code in .NET (Part 5 - Magic Strings)

  Рет қаралды 1,621

Wes Doyle

Wes Doyle

3 жыл бұрын

In this series, we'll work through refactoring a messy .NET Core MVC web application with a lot of procedural code and no tests. When we're done, we'll have a more testable, object-oriented, extensible application, complete with unit tests and static code analysis wired up with a continuous integration loop with GitHub Actions. We'll cover topics like inversion of control via dependency injection, replacing conditionals with polymorphism, factory methods, sending messages between small objects, unit testing, naming, and much more!
What is Legacy Code?
“Code without tests is bad code. It doesn’t matter how well-written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.”
― Michael Feathers, Working Effectively with Legacy Code
Legacy code - code without tests - is everywhere. It is not unusual in practice to encounter entire applications with few or even no tests. It is perhaps just as common to find software with legacy tests that don't adequately test current software behavior.

Пікірлер: 1
@WesDoyle
@WesDoyle 3 жыл бұрын
We're getting closer to completing cleaning up some of the code in this series. In this video, we clean up use of the Chamber of Commerce API. In the next video, we'll start writing unit tests, and look at how we need to continue to refactor some code that's coupled to the system clock.
"Stop Using Async Await in .NET to Save Threads" | Code Cop #018
14:05
터키아이스크림🇹🇷🍦Turkish ice cream #funny #shorts
00:26
Byungari 병아리언니
Рет қаралды 27 МЛН
Increíble final 😱
00:37
Juan De Dios Pantoja 2
Рет қаралды 111 МЛН
NERF WAR HEAVY: Drone Battle!
00:30
MacDannyGun
Рет қаралды 28 МЛН
Why You Should Use Pydantic in 2024 | Tutorial
13:56
ArjanCodes
Рет қаралды 62 М.
Don't throw exceptions in C#. Do this instead
18:13
Nick Chapsas
Рет қаралды 251 М.
The Difference Between Islam and Christianity - Jordan Peterson
5:09
Bill Gates Reveals Superhuman AI Prediction
57:18
Next Big Idea Club
Рет қаралды 53 М.
Abstract Factory Pattern (Gang of Four)
31:13
Wes Doyle
Рет қаралды 3,8 М.
How to Do 90% of What Plugins Do (With Just Vim)
1:14:03
thoughtbot
Рет қаралды 870 М.
ИГРОВОВЫЙ НОУТ ASUS ЗА 57 тысяч
25:33
Ремонтяш
Рет қаралды 292 М.
iPhone 16 с инновационным аккумулятором
0:45
ÉЖИ АКСЁНОВ
Рет қаралды 422 М.
Will the battery emit smoke if it rotates rapidly?
0:11
Meaningful Cartoons 183
Рет қаралды 37 МЛН
Simple maintenance. #leddisplay #ledscreen #ledwall #ledmodule #ledinstallation
0:19
LED Screen Factory-EagerLED
Рет қаралды 8 МЛН