“Do one thing and do it well”
class or module should have one, and only one, reason to be changed.
Incorrect
class User
{
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc.Testing; | |
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.DependencyInjection; | |
using Microsoft.Extensions.DependencyInjection.Extensions; | |
using Tweetbook.Contracts.V1; | |
using Tweetbook.Contracts.V1.Requests; | |
using Tweetbook.Contracts.V1.Responses; |
public class Factorial { | |
public int fact(int number) { | |
int i = 1; | |
int result = 1; | |
while (i <= number) { | |
result = result * i; | |
i++; | |
} | |
return result; | |
} |