Programming Tips πŸ’‘
51.6K subscribers
67 photos
10 videos
30 files
354 links
Programming & AI:
Tips πŸ’‘
Articles πŸ“•
Resources πŸ‘Ύ
Design Patterns πŸ’Ž
Software Principles βœ…

πŸ‡³πŸ‡± Contact: @MoienTajik

🎯 Buy ads: https://telega.io/c/ProgrammingTip
Download Telegram
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
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
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
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
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
β€’ T
hey 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