-
Notifications
You must be signed in to change notification settings - Fork 0
/
BadCodeExample.cs
50 lines (45 loc) · 1.13 KB
/
BadCodeExample.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System;
namespace BadCodeExample
{
class Program
{
static void Main(string[] args)
{
int x = 10, y = 20;
var manager = new Manager();
manager.DoSomething(x, y);
Console.WriteLine("End of program");
Console.ReadKey();
}
}
class Manager
{
public void DoSomething(int a, int b)
{
DatabaseStuff(a, b);
}
private void DatabaseStuff(int param1, int param2)
{
var util = new Utility();
var result = param1 + param2;
Console.WriteLine("Processing data...");
util.ProcessData(result, "hardcoded string");
}
}
class Utility
{
public void ProcessData(int data, string info)
{
if (data > 1000)
{
Console.WriteLine("Big number");
}
else if (data < -1000)
{
Console.WriteLine("Negative number");
}
string path = "C:\\Users\\HardcodedPath";
Console.WriteLine("Info: " + info);
}
}
}