10 Opinions For Creating More Maintainable .NET Apps - Scott Sauber - NDC Sydney 2024

  Рет қаралды 10,795

NDC Conferences

NDC Conferences

28 күн бұрын

This talk was recorded at NDC London in London, England. #ndclondon #ndcconferences #developer #softwaredeveloper
Attend the next NDC conference near you:
ndcconferences.com
ndclondon.com/
Subscribe to our KZbin channel and learn every day:
/ ‪@NDC‬
Follow our Social Media!
/ ndcconferences
/ ndc_conferences
/ ndc_conferences
#devops #dotnet #microservices
As an application adds more and more features, if you're not careful, it can quickly spiral into becoming the application no one on the team enjoys working on. This session is structured as a series of lightning talks on various topics to help you improve the maintainability of your .NET applications. We'll discuss libraries and best practices to help with folder structure, validation, ORM's, automated testing, code flow, DevOps, microservices, and more. By the end, you should be able to take a few ideas away that you can start implementing immediately when you get back to work.

Пікірлер: 49
@larshanisch
@larshanisch 25 күн бұрын
Topic "enable" vs. "true": in regard to "nullable" you can enable/disable it with a precompiler directive in a file and you can "restore" it. So the value of "nullable" is more an enum than a bool. I prefer enums over bool because of clarity and readability.
@moinakbhattacharya878
@moinakbhattacharya878 10 сағат бұрын
at 33:27 about how more indentation makes code harder to read, I was thinking about yaml :-P
@andresbeltran5779
@andresbeltran5779 24 күн бұрын
Excellent talk
@kvloover
@kvloover 20 күн бұрын
Its a good opinions topic. I don't agree with some, but it's brought clean and understandable.
@asedtf
@asedtf 24 күн бұрын
Indentation Proclamation is just Never Nester but more polite
@josefromspace
@josefromspace 25 күн бұрын
IaC and App in the same repo presents permissions problems. A dev may not be allowed to change infrastructure resources, such as firewall rules, replica counts, ingresses, etc.
@Mig440
@Mig440 25 күн бұрын
Then you have an organizational problem with devops if that is the case
@josefromspace
@josefromspace 25 күн бұрын
@@Mig440 Not really.
@Mig440
@Mig440 25 күн бұрын
@@josefromspace so who then is responsible? An OPS guy that knows nothing about the app in question and so is ill equipped to handle any issues that a developer might have known immediately?
@scottsauber
@scottsauber 23 күн бұрын
If you’re in that spot where a dev can’t change IaC, you can setup a CODEOWNERS file (assuming GitHub) where a GitHub Team or user owns a folder path like /infrastructure and require an approval from that Team/User. Other platforms besides GitHub have similar features for this scenario. Ideal state would be if you require things to be done a certain way, you’re enforcing that with the pipeline (ie IaC scans) and stuff like cloud policies so that people have automated guard rails to fall into the pit of success and you’re not waiting on a manual review that causes delays and also might miss a misconfiguration if you’re relying on a person to spot it.
@wyngates8408
@wyngates8408 17 күн бұрын
Ideally, neither a developer nor an ops person would be changing infrastructure. It would be changed by the deployment stage(s) of your pipeline. Then it's a question of who has the permission to trigger the pipeline stage (if it isn't fully automated). Even if you don't yet have a pipeline, building the application code and deploying the infrastructure changes will happen at different times, and may well be triggered or otherwise "done" by different people, but that's no reason why the code for both shouldn't live together. Keeping them together means the source of truth for each is in the same place, and they therefore can be reasoned about and changed with correspondingly easier and more direct reference to each other.
@TechTalksWeekly
@TechTalksWeekly 22 күн бұрын
This talks is excellent and it has been featured in the last issue of Tech Talks Weekly newsletter 🎉 Congrats Scott!
@Fl00wt13
@Fl00wt13 26 күн бұрын
10 opinions on .Net plus bunus opinion on name of X
@marcosborunda7607
@marcosborunda7607 25 күн бұрын
Treating warning as errors is a headache during the development phase, in this phase you don't need perfect code, you want to experiment and find answers as fast as possible, this involves having imperfect code that we are not ready to commit yet but that we might want to debug or test. So when do we need to have perfect code? easy, when we are ready to merge our changes. We can add a flag to the build step of our CI process `dotnet build -warnaserror`, that way we don't add speed bumps during the development phase, but we ensure we don't have dirty warnings in our code base.
@scottsauber
@scottsauber 23 күн бұрын
I’m good with that too since you’re preventing it from getting it into main! I think the tradeoff you’re accepting there is people might have to re-test things after they make their changes and get “surprised” by a CI block they didn’t see locally. Not a problem if you have good automated tests you trust though! Appreciate you sharing the flag for dotnet build - I’ve never used that myself!
@marcosborunda7607
@marcosborunda7607 22 күн бұрын
@@scottsauber Yeah I guess there's always a tradeoff, by the way, I missed mentioning that this was a really nice talk, very insightful
@wyngates8408
@wyngates8408 18 күн бұрын
The problem with ignoring warnings because you think that dealing with them is some form of hinderance is that developers on your team won't then take the time to understand what the compiler is telling them, and then use that information to take an informed decision regarding what action to take. Eliminating them requires understanding, then you can choose to change the code if the warning is about a potential problem you hadn't considered,, or to explicitly ignore it (so the compiler doesn't show it) if you reason it to be irrelevant. Fix them early so they don't stack up and become unmanageable.
@marcosborunda7607
@marcosborunda7607 17 күн бұрын
@@wyngates8408 Oh, no, I agree with you, I also think warnings should be addressed quickly. The developer should be responsible for not introducing new warnings, and treating warnings as errors is great for that purpose. I, as a developer, prefer the error to be thrown during the CI stage, instead of during development time. This is because during development time my code doesn't need to be perfect, I tend to iterate, finding a solution and refactoring until I have a good enough solution, during that period I can have a partial solution, it could be ugly code, it could have bugs, it could contain warnings, etc, and I don't want the compiler to get in the way of that process. But once I'm done with my code and I'm ready to merge I want the compiler to stop me if by mistake I'm introducing any warning. That's where `-warnaserror` shines.
@wyngates8408
@wyngates8408 17 күн бұрын
@@marcosborunda7607 Your way of working wouldn't work for me. If I write code the complier wants to issue a warning about, I want to address that immediately. That's because I want to understand what the compiler thinks might be an issue with what I've written, so I can assess whether that issue needs rectifying or not. I might still throw that code away at some point, but if I don't, then I don't have to return to it at some later time, when my focus on that particular piece of code has long been lost, to address the potential issues I left there. I accept that your way of working will address the issues at some point in time, but I want that point in time to be as close as possible to the time I'm thinking about the code, and that means as I write it.
@AndrzejPauli
@AndrzejPauli 25 күн бұрын
Actually good talk 🙂
@djchrisi
@djchrisi 26 күн бұрын
So, you're saying we should use Serilog because of maintainability? Are you seriously claiming that using NLog will make .NET apps unmaintainable?
@lolyasuo1235
@lolyasuo1235 26 күн бұрын
Tbh many advices reminds me of bad advices on linkedin "do this instead of this". For example: classes with > 200 loc advice. Lol. Do not forget: there are many ways to do things correctly.
@Ruslan_0990
@Ruslan_0990 26 күн бұрын
it's true and all the software engineers in the audience switched their codebase to Serilog when they came back from the conference. 😂
@7th_CAV_Trooper
@7th_CAV_Trooper 26 күн бұрын
He didn't say that at all. He said he preferred Serilog and disclaimed the entire talk with "these are just opinions"
@alexaka1
@alexaka1 26 күн бұрын
Nlog 5 is just as good as Serilog now. Nlog gets a bad rep because
@sgtgunfodder9263
@sgtgunfodder9263 26 күн бұрын
I think this most be highlighted more, because I heard so many people in work and on KZbin claim, "switch to SeriLog", but I am still waiting for an compelling argument why an up-to date Nlog should be thrown out in favor of Serilog. It seams to be more of an preference choose rather than an technical choose. Both are good, use the one you like.
@nenadvicentic
@nenadvicentic 24 күн бұрын
Most of those opinions would not hold water in any proper review of pros and cons. Like changing well-known project structure of MVC into something that is different for each project. Then naming your project with something as generic as "Core" and throwing all but UI dependencies into it. Fluent validation integrates with MVC pipeline via 3rd party Github project, no official support. Feature Toggles have tendency to leave you with bunch of unfinished/never finished code in the code base. Etc...
@7th_CAV_Trooper
@7th_CAV_Trooper 22 күн бұрын
Well known project structure of MVC is wrong. The template is based on the temperature sample. Real projects should use domain context based naming. His advice on this point was spot on.
@nenadvicentic
@nenadvicentic 22 күн бұрын
​@@7th_CAV_Trooper Haha, `WeatherController` was added years later (if not a decade). MVC project structure was based on... MVC pattern. Problem with naming based on "domain context" is that you would not find a common naming ground even within a single team. Imagine when someone from outside world looks at your project. As your models become more complex and you need to divide them in multiple files and folders, mess would grow bigger. Further, Views (includes Areas) folders have to stay in their prescribed structure. So you can't copy a view into your "domain folder". I would also throw here that "complex validation" can be done by implementation `IValidatableObject` interface on a model. That interface exists since MVC v1.0, year 2009, and integrates natively in a binding pipeline. FluentValidation is not needed to achieve that. It's matter of taste, at the cost of performance and probably reliability. We can go on and on... I suspect that most of this advices come from a long time user of a different framework, and lack of knowledge of existing MVC features and concepts.
@7th_CAV_Trooper
@7th_CAV_Trooper 22 күн бұрын
@@nenadvicentic naming is hard. As we said in the army, embrace the suck.
@wyngates8408
@wyngates8408 18 күн бұрын
The advice in this presentation is almost all good and beneficial. Vertical slicing/organizing by feature promotes loose coupling and high cohesion,, both highly desirable. Tight coupling is the cause of most regression type bugs, when changes to the behaviour in one part of an application result in unintended changes to a different part, because those parts are coupled together in some way by some common feature. Vertical slices are much better at promoting the separation of different parts of an application when compared with the horizontal slicing or layering promoted by the default structure. Also, the default structure promotes and emphasises the framework, not the business solution. Most developers working with this technology are familiar with the framework, and don't need it to be promoted by the directory structure. By definition, the framework is the same for every application using this technology, and doesn't need emphasising. Conversely, the one thing that's unique about any given application is the business features it supports and implements. All developers working with the application need to understand those business features, so emphasising them via the application's structure is massively advantageous.
@nenadvicentic
@nenadvicentic 17 күн бұрын
​@@wyngates8408 ASP.NET MVC is highly testable and decoupled, because it follows MVC pattern and separation of concerns well. Loose coupling has nothing to do with vertical slicing of folders. Regarding high cohesion, it is not only about folder structure. In this case, it is affected more by how you group your functionality (actions) per controllers. Folders for Views and Areas have to follow specific structure so that display, edit, shared views and layouts can be found by engine. Following "feature folders" you introduce 2nd, parallel convention. And what happens when you have to renderer ViewModel, from, let's say "User" feature in header, or elsewhere? In the same way you can find use-cases that break cohesion of default MVC folder structure, you can find use-cases that break "folder per feature" structure. Over last 2 decades it has been proven that, when smarter developers start to build smarter conventions, smarter helper functions wrappers, smarter model binding on top established frameworks, it leads to maintenance problems and hard to reproduce bugs. Because it always turns out that they haven't been familiar enough with important use-cases that underlying framework supports and deeper reasons for certain framework behaviours. And lastly, when you hire externals or new developers, do you want to spend time explaining that your version of ASP.NET MVC behaves differently? I am sure that, if you would follow standard MVC structure to build your business features, no developer would have problem to find his way around. They would be able to start contributing sooner and you would avoid lot of confusion.
Китайка и Пчелка 4 серия😂😆
00:19
KITAYKA
Рет қаралды 3,6 МЛН
1❤️#thankyou #shorts
00:21
あみか部
Рет қаралды 71 МЛН
A Complete .NET Developer's Guide to Span with Stephen Toub
1:02:48
Why I Quit the Scrum Alliance
7:58
The Passionate Programmer
Рет қаралды 7 М.
Technical Neglect - Kevlin Henney - NDC London 2024
1:07:18
NDC Conferences
Рет қаралды 17 М.
Clean Architecture with ASP.NET Core 8 | .NET Conf 2023
29:17
Contract Testing For Microservices IS A MUST
18:36
Continuous Delivery
Рет қаралды 28 М.
Building Beautiful Blazor Websites in .NET 8
1:01:47
Devessence
Рет қаралды 6 М.
cool watercooled mobile phone radiator #tech #cooler #ytfeed
0:14
Stark Edition
Рет қаралды 9 МЛН
How charged your battery?
0:14
V.A. show / Магика
Рет қаралды 4,9 МЛН