How we do MVC β View models π
The ViewModel is a central aspect of our MVC architecture. π
One of the first dilemmas facing MVC developers is to decide what the βMβ in MVC means in ASP.NET MVC. π€
In Rails, this is fairly clear, the M is ActiveRecord (by default). π
But in ASP.NET MVC, the βMβ is silentβοΈ
Its out-of-the-box architecture offers no guidelines nor advice on what the M should be. βοΈ
Should it be an entityβ
Data access objectβ
DTOβ
Something elseβ
https://t.me/pgimg/91
[ Website ] : http://bit.do/mvvm
γ°γ°γ°γ°γ°γ°
#AspMvc #CleanCode #BestPractices
@ProgrammingTip
The ViewModel is a central aspect of our MVC architecture. π
One of the first dilemmas facing MVC developers is to decide what the βMβ in MVC means in ASP.NET MVC. π€
In Rails, this is fairly clear, the M is ActiveRecord (by default). π
But in ASP.NET MVC, the βMβ is silentβοΈ
Its out-of-the-box architecture offers no guidelines nor advice on what the M should be. βοΈ
Should it be an entityβ
Data access objectβ
DTOβ
Something elseβ
https://t.me/pgimg/91
[ Website ] : http://bit.do/mvvm
γ°γ°γ°γ°γ°γ°
#AspMvc #CleanCode #BestPractices
@ProgrammingTip
Telegram
Programming Tips Resources
ASP.NET MVC Best Practices and Guidelines β
While most developers were used to WebForms and Microsoft's stock controls, when developers moved to ASP.NET MVC, a number of developers were shocked because there wasn't enough meat for this to be a full-featured release. π€
Some of the guidelines list below are based on my own experiences over the years since 2008. π
https://t.me/pgimg/93
[ Website ] : http://bit.do/aspbst
γ°γ°γ°γ°γ°γ°
#AspMvc #CleanCode #BestPractices
@ProgrammingTip
While most developers were used to WebForms and Microsoft's stock controls, when developers moved to ASP.NET MVC, a number of developers were shocked because there wasn't enough meat for this to be a full-featured release. π€
Some of the guidelines list below are based on my own experiences over the years since 2008. π
https://t.me/pgimg/93
[ Website ] : http://bit.do/aspbst
γ°γ°γ°γ°γ°γ°
#AspMvc #CleanCode #BestPractices
@ProgrammingTip
Telegram
Programming Tips Resources
Getters/Setters. Evil. Period. πΊ
There is an old debate, started in 2003 by Allen Holub in this Why getter and setter methods are evil famous article, about whether getters/setters is an anti-pattern and should be avoided or if it is something we inevitably need in object-oriented programming. πΈ
The gist of the following text is this β¨ : getters and setters is a terrible practice and those who use it can't be excused. β
Again, to avoid any misunderstanding, I'm not saying that get/set should be avoided when possible. No. I'm saying that you should never have them near your code. π«
https://t.me/pgimg/163
[ Article ] : kutt.it/gset
γ°γ°γ°γ°γ°γ°
#BestPractices
@ProgrammingTip
There is an old debate, started in 2003 by Allen Holub in this Why getter and setter methods are evil famous article, about whether getters/setters is an anti-pattern and should be avoided or if it is something we inevitably need in object-oriented programming. πΈ
The gist of the following text is this β¨ : getters and setters is a terrible practice and those who use it can't be excused. β
Again, to avoid any misunderstanding, I'm not saying that get/set should be avoided when possible. No. I'm saying that you should never have them near your code. π«
https://t.me/pgimg/163
[ Article ] : kutt.it/gset
γ°γ°γ°γ°γ°γ°
#BestPractices
@ProgrammingTip
Framework Design Guidelines, 2nd Edition.pdf
45.3 MB
Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries - 2nd Edition π
Author π : Krzysztof Cwalina
γ°γ°γ°γ°γ°γ°
#Book #DotNet #BestPractices
@ProgrammingTip
Author π : Krzysztof Cwalina
γ°γ°γ°γ°γ°γ°
#Book #DotNet #BestPractices
@ProgrammingTip
Objects Should Be Immutable π€«
In object-oriented programming, an object is immutable if its state canβt be modified after it is created. π€π»
In Java/C#, a good example of an immutable object is String.β
Once created, we canβt modify its state. We can request that it creates new strings, but its own state will never change. β
However, there are not so many immutable classes in JDK. Take, for example, class Date. It is possible to modify its state using setTime(). π
This is an incomplete list of arguments in favor of immutability β‘οΈ:
β’ Immutable objects are simpler to construct, test, and use
β’ Truly immutable objects are always thread-safe
β’ They help to avoid temporal coupling
β’ Their usage is side-effect free (no defensive copies)
β’ Identity mutability problem is avoided
β’ They always have failure atomicity
β’ They are much easier to cache
β’ They prevent NULL references, which are bad
Letβs discuss the most important arguments one by one. π
https://t.me/pgimg/178
[ Article ] : kutt.it/immtb
γ°γ°γ°γ°γ°γ°
#BestPractices #DesignPatterns
@ProgrammingTip
In object-oriented programming, an object is immutable if its state canβt be modified after it is created. π€π»
In Java/C#, a good example of an immutable object is String.β
Once created, we canβt modify its state. We can request that it creates new strings, but its own state will never change. β
However, there are not so many immutable classes in JDK. Take, for example, class Date. It is possible to modify its state using setTime(). π
This is an incomplete list of arguments in favor of immutability β‘οΈ:
β’ Immutable objects are simpler to construct, test, and use
β’ Truly immutable objects are always thread-safe
β’ They help to avoid temporal coupling
β’ Their usage is side-effect free (no defensive copies)
β’ Identity mutability problem is avoided
β’ They always have failure atomicity
β’ They are much easier to cache
β’ They prevent NULL references, which are bad
Letβs discuss the most important arguments one by one. π
https://t.me/pgimg/178
[ Article ] : kutt.it/immtb
γ°γ°γ°γ°γ°γ°
#BestPractices #DesignPatterns
@ProgrammingTip
Telegram
Programming Tips Resources