163. How Do I Structure My Application?

  Рет қаралды 19,784

IAmTimCorey

IAmTimCorey

Күн бұрын

Пікірлер: 84
@ManuelBasiri
@ManuelBasiri Жыл бұрын
Tim, This video is arguably one of the most important and best videos you've ever published. As I was listening to you I could actually see and remember so many occasions over the years that your words were exactly correct. If you're a junior developer and learning your way in, save this video and repeat it once every 6 months. Thanks Tim.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
I appreciate the kind words.
@petetrimby
@petetrimby Жыл бұрын
This is gold. Made me feel a lot better about some of the more simplistic projects I’ve developed. They do what they need to do without conforming to whatever the latest fashion is.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
I'm glad you enjoyed it.
@caseyspaulding
@caseyspaulding Жыл бұрын
Great timing. I just implemented clean architecture in an app I am working on and while I was doing it I really questioned myself if was worth all the complexity. You are the only one saying this . Thanks!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@bujin1977
@bujin1977 Жыл бұрын
I built a web app for my college a few years ago using clean architecture. It's now an absolute maintenance nightmare and I want to rewrite it as soon as I get a chance. Currently leaning towards vertical slice architecture, based solely on the fact that with the current version of the app, if I want to change something on one screen, I have to modify around 20 files spread over 4 projects. I undoubtedly got a lot wrong while building the application (I'm learning as I go) but using clean architecture was definitely the wrong way to go for the level of complexity of the app.
@VitaliChuzha
@VitaliChuzha Жыл бұрын
I passed through clean architecture and now do use VSA. It allows do changes much easier than Clean architecture. That is why my vote is for VSA.
@sereyvathanakkhorn760
@sereyvathanakkhorn760 Жыл бұрын
My main take away here is: - Junior Dev: Write simple code to solve simple problem. - Mid Dev: Make everything looked as complex as it could get to solve the complex problem. (Stuck here) - Senior Dev: Every complex problem can be solved by writing simple code. (I wonder when am I going to get here)
@IAmTimCorey
@IAmTimCorey Жыл бұрын
That last one takes practice. Push yourself to honestly evaluate your code and see if you can make it better/simpler.
@techsamurai11
@techsamurai11 Жыл бұрын
That's amazing advice! I think the highest praise you can receive as a developer is if smart developers that look at your code eventually start writing code the way you do. I've always felt my code looked stupid but I felt that was one of the best parts of my code 😀 Over the years, I've realized that it's very hard to break stupid code and it's also very easy to maintain because you can immediately identify the object and the method that you need to modify and usually it's about as simple as updating this comment.
@jasonhodges8055
@jasonhodges8055 Жыл бұрын
“Write Simple Code” Tim say it again for the people in the back lol 😂 I remember a previous job where we would design something and go back and ask. Is this simple enough! Great video!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thanks!
@shahzaibhassan2777
@shahzaibhassan2777 Жыл бұрын
You always exceed my expectations when dealing with these obscure & kinda unclear questions Literally man you are my hero! Landed a great job, just because of you. Thank you so much!!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Congratulations! I'm glad I could be a part of your success.
@Prakash4691SV
@Prakash4691SV Жыл бұрын
Well explained. Thank you Tim for eye opening explanations for developers. Not to screw up applications by adding unwanted things without understanding.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@ShabirHakim
@ShabirHakim 3 ай бұрын
I have experienced such dozens of projects, Tim, I completely agree with you.
@IAmTimCorey
@IAmTimCorey 3 ай бұрын
Thanks for sharing!
@antoniusivan8767
@antoniusivan8767 Жыл бұрын
Great One Tim. I have a dream to built a startup using C#, or sold my Application to Indonesian Conglomerates/VC. Now i spare my 4% income beside investment for learning from you. Hope my earning or stock options or application usage increases.
@narelehlohonolopapo9299
@narelehlohonolopapo9299 Жыл бұрын
Legend. I always tell my colleagues and dev friends about your episodes and tell them my learnings
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Awesome! Thanks for sharing!
@jonnygudman1815
@jonnygudman1815 Жыл бұрын
So far I have used many of your c# lessons for myself without really thanking you for it. I would like to take this opportunity to thank you personally for everything you have taught us developers or even beginners about #coding so far. Thank you for all your great videos and that you will stay with us for a very long time!😉
@VitaliChuzha
@VitaliChuzha Жыл бұрын
Very useful video. You voiced my thoughts, Tim. Thank you!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@andergarcia1115
@andergarcia1115 Жыл бұрын
Master, thank you very much again, blessings.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@rendellgood
@rendellgood Жыл бұрын
This is the kind of content I'm subscribed for!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Awesome!
@bombrman1994
@bombrman1994 Жыл бұрын
and most importantly, drop the ego. The enemy of growth and learning for every developer
@IAmTimCorey
@IAmTimCorey Жыл бұрын
That is important.
@iandalrymple7255
@iandalrymple7255 Жыл бұрын
This makes a lot of sense. I have been studying design patterns for the past few years. Adhering to dependency inversion seems like a commitment that has to be had from the start. I wonder how it’s balanced with this general approach of add complexity only when needed. Regardless thank you Tim for what you do
@IAmTimCorey
@IAmTimCorey Жыл бұрын
This is where experience comes in. You will have a general idea of the scope of your application. With DI especially, your application won't need to be that big to get value out of it (especially since it also helps you test your code more easily). So you would look ahead at your application and say "based upon my experience, an app of this size will benefit from these patterns". The key is to not just always apply those patterns. Evaluate the complexity of each app to determine what it needs.
@iandalrymple7255
@iandalrymple7255 Жыл бұрын
@@IAmTimCorey Perform an initial assessment of complexity and go with patterns that seem appropriate then add patterns as the complexity grows due to additional features or poor initial assessment. I got it that makes a lot of sense. Thank you for the response and God bless.
@anuomotayo7035
@anuomotayo7035 6 ай бұрын
Well said Tim! I however think that the DRY (don't repeat yourself) principle should not be violated under any circumstance. Having duplicated code doing the same thing is a maintenance/reliability nightmare. If the code/logic needs to change, there is a high tendency of forgetting to update the duplicated code. This causes issues in production.
@IAmTimCorey
@IAmTimCorey 6 ай бұрын
If you ever find yourself having a rule that cannot be violated under any circumstances, you've probably made a significant error. I cannot think of any principle or pattern that is inviolate. Here is a quick example for DRY. In the JavaScript world, there is not a built-in way to pad a string on the left side (so "123" becomes "00123", etc.) So, one person in the open-source community created an npm package called left-pad. It was 11 lines of code that efficiently added padding to the left of any string using any character as the padding character. Other developers decided not to repeat that same code, so they took a dependency on that npm package. Then, the original author deleted the package. That broke thousands of sites and services around the globe. That's just one way DRY can go bad. You might say that the issue here is a dependency, not DRY itself. While I disagree, let's shrink this a bit. Imagine you decided to write a bit of code like left-pad for your company. Maybe it is C# code. So, you create it once and then reference it in every application your company uses. Now imagine you did that with a .NET Framework dll. It would work because, at the time, all of your applications were .NET Framework. Along comes .NET Core. Now what? You can't upgrade your library until you are ready to upgrade all of your applications as well. And you cannot upgrade your applications until you upgrade your library. All of the sudden, every application that your company makes is tied together into one big ball. The typical solution? Not upgrade. Just keep everything at the working version. All because you decided DRY was paramount. That's the trap of absolutes. The key with DRY is to evaluate both sides. Yes, duplicate code means changing something in multiple places. However, it also means that those places can change independently of each other. With DRY, you only need to change things in one place, but those multiple places are all tied to each other. You've created coupling. There are ways around this, and there are solutions to make things less drastic (.NET Standard could have been a solution for my original C# example), but DRY is not without downsides.
@techsamurai11
@techsamurai11 Жыл бұрын
@8:25 Design Pattern Bingo! 😀 You should coin that phrase! It also applies to writing code as well, not just structuring it. If the code isn't easily understood in a quick scan, then the architect/developer has to explain how writing that code in a more complex fashion benefited the application. I think it also applies to writing code conventions as well. Clear and concise code with named functions is a lot easier to understand than a whole page of anonymous lambda expressions that in some case may require a manual to explain what's going on which I see a lot more of nowadays.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Maybe I should make tshirts.
@techsamurai11
@techsamurai11 Жыл бұрын
@@IAmTimCorey No kidding! You should!
@Cornelis1983
@Cornelis1983 Жыл бұрын
I work on a project now where a former employee of the company was neither, junior, mid-level nor senior. He mentioned to achieve write complex code for simple issues. Those type of developers really should go back to school or redo a course with an actual teacher because those type of developers eliminates the fun of programming for other developers.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Sounds frustrating.
@SvendKoustrup
@SvendKoustrup Жыл бұрын
It's great advice you give in this video, it always depends. But it would have been nice to have some examples, like "if you're building this thing, then I'd go this way and structure it this way. If you're building this other thing, then I'd rather go this way instead.". Like your console over-engineering project, which was great, because it was a simple goal, easy to understand, but with some more complex concepts thrown at it. I'm building a WPF app that takes a spreadsheet file (csv, excel etc) of product data and ultimately insert/updates the products via an API into a specific store in a POS platform with some login credentials. Tha app validates the file against some business rules (some columns is required, but the column names each have some aliases, because files is coming from multiple sources and can be structured a bit differently) and loads it into a datagrid. There are some textboxes, checkboxes and dropdowns that control if we should prefix the productnumber, what product group the products should belong to, whether to update existing products and such other uploading behavioural stuff. I have the API data access repository in a seperate project, but the app itself,, as simple as it seems, is a bit more complex than can be handled in the UI code behinds. And as you so eloquently mentioned, it's not the recommended way. I just have a bit of a hard time structuring this app. I'm also following Milan Jovanovic and his demonstrations into DDD and I really like it. He makes things look pretty simple. But going from his videos to my unstructured app is a bit hard. Any recommendations is welcomed.
@torrvic1156
@torrvic1156 Жыл бұрын
You shared some very profound knowledge here Tim! But I think to really know when and where to apply each design you’ll have to be a really experienced developer. I think it is very very difficult for a junior dev to understand which patterns he or she really wants to use and how he or she is going to structure his program.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Absolutely. That's why I don't recommend that junior developers focus on design patterns. They actually make it harder for those developers to write good code. You need to be experienced in what the code is doing and its complexities before you can work to simplify it.
@techsamurai11
@techsamurai11 Жыл бұрын
Does anyone really know when to apply each design properly? I think if you get it right 60% of the time, you're probably one of the best architects in the world especially if you apply them at the start of the project. Who even knows all the patterns? I think a lot of developers invent their own version of the pattern as they are building the application and they realize the need to resolve a problem that they run into. Coding is similar to filmmaking - a director like Spielberg may not know everything about making a movie - he usually applies what has worked for him in the past or finds one new thing to add.
@torrvic1156
@torrvic1156 Жыл бұрын
@@techsamurai11 I guess you’re right sir. I want to know the answers to your questions too.
@cdoubleplusgood
@cdoubleplusgood Жыл бұрын
So the message is: Make the architecture as simple as possible, and apply patterns & principles only if they outweigh the cost. Sounds good and reasonable, BUT: I reality most of us are expected to get the structure right in the first approach. For two reasons: - Management usually expects that the code is "done" at some point and doesn't want to "pay" for the refactoring when the code gets more complex. - Often some other person of the team continues with the code you started, and most of the time this other person does not want the apply architectural changes to "someone else's" code. So for production grade code most of us need to have some kind of structure right in the beginning, expecting things to get more complex in future. Even if that structure seems to be over the top at the moment.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
That's the hard part, and why companies often want work experience when hiring for any position. Experience tells you how complex an application is going to get. That allows you to make some initial design decisions when it comes to patterns to apply globally. That's why, for example, ASP.NET Core web applications start with dependency injection and logging built right in. The team at Microsoft knows that almost any web application will need these two concepts. Even choosing to build an MVC project is an up-front decision on the complexity of your web application. So, you make the decision on when to implement something based upon your planning of the application's complexity. The other thing to consider, though, is that not all patterns are application-wide. There are some things that can be chosen on a smaller scale. Those things should be applied when it becomes obvious and not before. Finally, when in doubt about when to apply a pattern, it is often better to NOT apply the pattern and regret it/refactor it later rather than applying it and regretting it later.
@xiggywiggs
@xiggywiggs Жыл бұрын
Tim: ooor everything in the code behind of your forms, you know who you are... Me: They found me, I don't know how but they found me RUN FOR IT MARTY!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
😂
@robindehood207
@robindehood207 Жыл бұрын
I needed this!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
I am glad it was helpful.
@athourrahman9604
@athourrahman9604 Жыл бұрын
Hi Tim, im Mohamed Athour, from today i started to love u tim❤🎉🎉🎉🎉
@IAmTimCorey
@IAmTimCorey Жыл бұрын
👋
@Dimitris.Christoforidis
@Dimitris.Christoforidis Ай бұрын
Thank you Tim! for your valuables information. I just need your advice in my project structure. My UI communicates with an API. Then i have a class library that includes folders for each View-Form. Example Folder Customers contains two other folders Data and Models. In Folder Data contains all the logic for database and in folder models contains all models about my customers Both Ui and Api are connected with this shared class library. Is it good practice? Or is it better to separate models and data in two different libraries? in Ui i need only models. And in my api i need models and data
@runtimmytimer
@runtimmytimer Жыл бұрын
I like to tell young developers that it's easy to write complicated code and very difficult to write simple code. I see this in my current project. For example, they're storing the connection strings in app settings with placeholders for username and password. At runtime, grabbing the username and password from key vault and substituting the values in. Just store the entire connection string in key vault and be done with it.🤦‍♂ Be wary of unnecessary complexity.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Absolutely.
@damienfenton3880
@damienfenton3880 Жыл бұрын
Thanks for a very useful video. What are your thoughts on the use on implementing business logic within stored procedures. I don't mean validation logic to prevent invalid or inconsistent values being inserted, but rather the stored procedures implementing business logic so that the application code is nothing more than a link between the UI and the db. I've seen solutions architectured this way. My opinion is that unless there is a significant performance expense, business logic should be implemented in the application code and the SPs only used for db specific operations.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
I like to keep application logic in the application and database logic in the database. Let each system do what it does best. That means I don't typically put business logic in the database.
@miyu545
@miyu545 Жыл бұрын
Now you just have to come up with a video explaining the different approaches you spoke about. Chop chop... :)
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/
@ndrcreates_per
@ndrcreates_per 8 ай бұрын
As always, Nailed it.
@IAmTimCorey
@IAmTimCorey 8 ай бұрын
Thanks!
@kevingrems
@kevingrems Жыл бұрын
Great tips
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thanks!
@harrisonwell1719
@harrisonwell1719 Жыл бұрын
1:41 That used to be me LOL
@IAmTimCorey
@IAmTimCorey Жыл бұрын
And me.
@jaimeandrescatano
@jaimeandrescatano Жыл бұрын
this is exactly what i want my boss to understand
@IAmTimCorey
@IAmTimCorey Жыл бұрын
I hope you can share it in a way that makes a positive impact.
@viruslab1
@viruslab1 Жыл бұрын
thank you master!
@IAmTimCorey
@IAmTimCorey Жыл бұрын
You are welcome.
@rd_45
@rd_45 Жыл бұрын
It depends
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Always (which is ironic).
@khanfaizan05
@khanfaizan05 Жыл бұрын
Awesome
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Thanks!
@bdowns
@bdowns 8 ай бұрын
Diaphanous 🔥
@IAmTimCorey
@IAmTimCorey 8 ай бұрын
👍
@jasonpricealt7122
@jasonpricealt7122 Жыл бұрын
So what you are saying is dry kisses only :P
@IAmTimCorey
@IAmTimCorey Жыл бұрын
I think I might be sick.
@BeyondAppearances-0
@BeyondAppearances-0 11 ай бұрын
I really don't agree about the DRY one you(and others) expose : when just two parts of the (initially exact) same code evolves thier own way..., you arrive at a point where you even are not able to know that this COMMON part exists, things become entangled/mixed up, and then : even if you take this long time... to try to extract common things (which should have been done since long ago) you're gonna take risks getting afraid to touch things..., and lose quite more time that the necessary one if things had been done (DRY) initially. Things/algorithms that have a NAME should be framed at one (correct) place, and reusable as such. And there we come to documentation/communication.
@mrt7948
@mrt7948 Жыл бұрын
I like your approach, you try to make things simple. in clean architecture they make so many separations that I think its too much. however, your examples are sometime too simple sometimes ancient.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Simple applications are resilient applications.
@fanzfanzilla
@fanzfanzilla Жыл бұрын
Good answer, but not actionable for me. I guess I am just too confused and looking for easy answer.
@IAmTimCorey
@IAmTimCorey Жыл бұрын
Practice will help. The more you have seen, the more you will understand.
181. How Do I Start My Job Well? What Do I do First?
21:19
IAmTimCorey
Рет қаралды 5 М.
How to "think" (and design) like a Software Architect at Silicon Valley Code Camp 2019
1:12:57
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 104 МЛН
Кто круче, как думаешь?
00:44
МЯТНАЯ ФАНТА
Рет қаралды 4,8 МЛН
бабл ти гель для душа // Eva mash
01:00
EVA mash
Рет қаралды 9 МЛН
МЕНЯ УКУСИЛ ПАУК #shorts
00:23
Паша Осадчий
Рет қаралды 4,5 МЛН
153. What Should a Software Developer Not Do?
22:14
IAmTimCorey
Рет қаралды 13 М.
How I Structure New Projects In Golang
21:32
Anthony GG
Рет қаралды 63 М.
Clean Architecture with NET 8
54:38
NimblePros
Рет қаралды 4,4 М.
57. What Are the Common Application Layers? Is 3 Layers Standard?
15:54
The Perfect C# Console Application...Or Not.
59:20
IAmTimCorey
Рет қаралды 75 М.
105. How Do I Understand a Complex Codebase At Work?
10:39
IAmTimCorey
Рет қаралды 45 М.
169. What Is A Back-End Developer?
10:56
IAmTimCorey
Рет қаралды 8 М.
How to Structure a Modular Monolith Project in .NET
15:57
Milan Jovanović
Рет қаралды 39 М.
The BEST Tool to Structure Golang Projects
7:58
Melkey
Рет қаралды 38 М.
139. What Are Your Thoughts on Entity Framework Core vs. Dapper?
21:49
1, 2, 3, 4, 5, 6, 7, 8, 9 🙈⚽️
00:46
Celine Dept
Рет қаралды 104 МЛН