C
CSharper
I have been writing code for sometime, but I always get a hang up on
performance. I can't tell which implementation is good and which is
not. I have two scenarios down and I would like your expert opinion on
this
1. I have a situation where I need to read in the arguments passed to
the program and then validate it and parse it to an array. What I did
was to create a class which performs all these tasks as separate
methods. I did it in TDD and everything is fine. After writing I was
wondering is it a right way to do it? Since it is a class, there is a
cost associated with instantiating the class and the heap memory also
GC overhead. What if I would attempt it in Static method?? It also has
the same problems. Not sure about that.
2. I have to read sql database using stored proc. In this also I wrote
a class which perform connection, execution and result. Since this SP
is used more than once opposed to (1), I could create a Extented
method (using static method on string, where I preserve the SQL
connection) or using a static class for the SQL operations.
What is the best way to do it?
Thanks,
performance. I can't tell which implementation is good and which is
not. I have two scenarios down and I would like your expert opinion on
this
1. I have a situation where I need to read in the arguments passed to
the program and then validate it and parse it to an array. What I did
was to create a class which performs all these tasks as separate
methods. I did it in TDD and everything is fine. After writing I was
wondering is it a right way to do it? Since it is a class, there is a
cost associated with instantiating the class and the heap memory also
GC overhead. What if I would attempt it in Static method?? It also has
the same problems. Not sure about that.
2. I have to read sql database using stored proc. In this also I wrote
a class which perform connection, execution and result. Since this SP
is used more than once opposed to (1), I could create a Extented
method (using static method on string, where I preserve the SQL
connection) or using a static class for the SQL operations.
What is the best way to do it?
Thanks,