Issue #14: DotNet (.NET)
Photo by dlxmedia.hu on Unsplash

Issue #14: DotNet (.NET)

This issue would be about some topics for DotNet (.NET) developers.


Notes:

  • If you like the content, you can always follow me on Medium and Twitter.
  • If you don't already have a Medium.com account, you can subscribe through my referral link to help me get something back 😃
  • All article links are Friend Links. This means that you don’t need Medium.com Premium Membership to view the articles 😉
  • I would appreciate🙏 if you Clap 👏 (up to 50 times) and Comment 📝 on my articles on Medium.
  • Check our company page Development Simply Put

No alt text provided for this image

DateTime Best Practices In .NET C#

Best practices to follow when using DateTime in .NET C#

In almost all the software systems we are working on we need to use DateTime to represent a timestamp for some actions.

However, what I noticed is that sometimes we do some mistakes which could be fatal in some occasions.

Therefore, I decided to write this article to share with you some of the best practices to follow when dealing with DateTime in .NET C#.


In this article we are going to cover the following topics:

  1. DateTime vs DateTimeOffset.
  2. Note when value initialized.
  3. Unify the source.
  4. Static vs Abstracted.

Now, you can buckle up and enjoy the trip.

No alt text provided for this image

Prototype Design Pattern In .NET C#

Learn about the Prototype Design Pattern in .NET C#

In this article, we will discuss the Prototype Design Pattern in .NET C#

The Prototype Design Pattern is one of the creational design patterns. It is mainly concerned with creating a new object by copying an already existing one without missing any of its encapsulated internal details and at the same time without depending on the class structure.

Wow, a big definition, right? Let me simplify it for you.

When you use any diagram builder software tools, you always look for the feature of copying one of the diagram shapes you had already added.

Using this feature, you expect the following:

  1. You can duplicate a diagram shape.
  2. Then apply minor changes like changing the color without having to configure all the shape properties from scratch.
  3. The color of the main shape you copied from should not be affected by the new color you set to the duplicate shape.

All that you expected is actually what the Prototype Design Pattern is about. The diagram shape you are copying or duplicating is actually an object created from a class defined in the software code.

No alt text provided for this image

Curse of Recursion in .NET C#

Why and How you should always try to replace Recursion with something else in .NET C#

One of the famous mistakes I come across from time to time while performing code reviews is the excessive uncalled-for usage of Recursion.

I can hear someone asking now:

What is wrong with Recursion?!!

My answer is:

Recursion is not always bad if you know when and how to use it. Sometimes there is some better alternatives which you could be missing.

The main concern about using recursion is that it is too expensive in terms of memory consumption. That’s why you need to be cautious about using it.

You don’t believe me, right? Let me show you an example.

No alt text provided for this image

That’s it, hope you find reading this newsletter as interesting as I found writing it 🙂

#ahmed_tarek_hasan #developmentsimplyput #dotnet #csharp #coding #code #programming #designpattern #bestpractices #devcommunity #computerscience #softwaredesign #softwaredevelopment #softwareengineering #softwarearchitecture

To view or add a comment, sign in

More articles by Ahmed Tarek Hasan

Insights from the community

Others also viewed

Explore topics