Issue #4: DotNet (.NET) & JavaScript (JS)
Photo by Lucas Santos on Unsplash

Issue #4: DotNet (.NET) & JavaScript (JS)

This issue would be about some?topics for DotNet (.NET)?and?JavaScript (JS)?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 ??

This issue would be about some topics for DotNet (.NET) and JavaScript (JS) developers. https://medium.com/@eng_ahmed.tarek

DotNet (.NET)

How To Fully Cover I/O File Based Applications in .NET C# With Unit Tests

While working for different software houses, in more than one occasion I had the chance to work on an application which is mainly based on?I/O File?operations.

The biggest challenge the team was facing while working on such kind of applications is that the I/O File operations are so hard to be covered by unit tests, automate Bamboo builds, and many other things.

Therefore, once and for all, I decided to come up with the best design I can come up with to overcome these challenges. However, just as a reminder, nothing in software is an absolute truth. For every application you have to reconsider your design, see where it fits, where it doesn’t fit, and finally you need to adapt.

Now, as usual, I am going to provide a simple example and walk you through the trip to come up with the best -possible- solution.

How To Fully Cover I/O File Based Applications in .NET C# With Unit Tests. https://medium.com/@eng_ahmed.tarek

When String.GetHashCode() in .NET C# Drives You Crazy

I was working on a side project of a tool to help me with my daily work. In one module, I needed to keep track of some transactions which could be executed between the tool runs. In other words, when I close and open the tool, these transactions should be there.

For storage, I used a SQLite database where I save a hash-code of an entity representing my Transaction class. I was depending on this hash-code as at some point the tool would generate a new hash-code and compare it to the one already saved in the database.

So, after setting everything in place, I started the tool, give it a try, yes… it is working. I close the tool, do some stuff, then try testing another thing, now it is not working as it should!!

I kept trying to understand what is going on and finally I got it. The hash-code comparison is not working fine. During the same run session of the tool, the comparison is working fine. However, when I close and open the tool, the newly generated hash-code -to the same exact transaction-is not the same as the one saved in the database.

When String.GetHashCode() in .NET C# Drives You Crazy. https://medium.com/@eng_ahmed.tarek

JavaScript (JS)

How to Recursively Call APIs to Get All Results in JavaScript

Most of the time while working on a JavaScript project, I write some code to call?REST APIs. This is normal.

However, sometimes a REST API could have restrictions on the number of items it returns per request. In other words, while calling the API to get some items, these items would be divided into indexed pages/groups and you have to provide the page/group index. This would return only the items in this page/group. To get the rest, you would need to repeat the same API call but now with a different index, and so on…

How to Recursively Call APIs to Get All Results in JavaScript. https://medium.com/@eng_ahmed.tarek

Paging/Partitioning — Learn the Main Equations to Make it Easy

The?Paging?or?Partitioning?concept is used in many fields. When you have a set of items and you want to divide them equally between some sort of containers or groups, you are thinking of paging or partitioning but may be you don’t recognize it, yet…

The main goals of this story are to:

  1. Explain some mathematical equations which can make it easy for you to implement the paging or partitioning concept.
  2. Provide some code examples of how to implement paging.

Paging/Partitioning — Learn the Main Equations to Make it Easy. https://medium.com/@eng_ahmed.tarek

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


#ahmed_tarek_hasan?#javascript #dotnet #csharp #coding #code #programming #development #devcommunity #computerscience #softwaredesign #softwaredevelopment #softwareengineering #softwarearchitecture #bestpractices

要查看或添加评论,请登录

Ahmed Tarek Hasan的更多文章

  • ?? Exciting News: Official Launch Of DSP Community ??

    ?? Exciting News: Official Launch Of DSP Community ??

    I am thrilled to share with you the official launch of my new software engineering website, blog, and community. A…

    4 条评论
  • Converting an Enum to Another In .NET C#

    Converting an Enum to Another In .NET C#

    Guide on how to convert an Enum to another in .NET C#.

  • When using += Is Not Good In .NET C#

    When using += Is Not Good In .NET C#

    The main goal of this article is to demonstrate how a simple detail in our code could cause huge problems which are so…

  • Secrets of the Single Responsibility Principle

    Secrets of the Single Responsibility Principle

    Uncover the secrets about the Single Responsibility Principle (SRP) of the SOLID Principles. Almost all developers…

  • Issue #14: DotNet (.NET)

    Issue #14: DotNet (.NET)

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

  • Importance of Immutability In .NET C#

    Importance of Immutability In .NET C#

    Is Immutability really a good thing? Why? How To Apply? This is one of the most interesting topics to me to the extent…

  • Dangers of Using Optional Parameters In .NET C#

    Dangers of Using Optional Parameters In .NET C#

    When to be cautious while using Optional Parameters in .NET C# We all know about Optional Parameters and we love to use…

  • Defensive Copy In .NET C#

    Defensive Copy In .NET C#

    Everything about Defensive Copy in .NET C# Did you ever hear about Defensive Copy in .

    1 条评论
  • Compiler-Friendly Code: Sealed Keyword in .NET C#

    Compiler-Friendly Code: Sealed Keyword in .NET C#

    Why & When Sealed Keyword could lead to a performance boost in .NET C# What does it mean to write compiler friendly…

  • Why Split Large Methods Into Smaller Ones?!

    Why Split Large Methods Into Smaller Ones?!

    Learn when splitting large methods into smaller ones makes the impossible possible. As a software developer, you have…

    1 条评论

社区洞察

其他会员也浏览了