473,403 Members | 2,323 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Novice question on Performance

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,
Sep 3 '08 #1
2 987
On Sep 3, 11:39*am, CSharper <cshar...@gmx.comwrote:
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.
Do you have any idea how many classes are created by the simplest win
app?, believe me one more will have no impact what so ever :)
In this case the maintenability and logic has more importance that
creating one class.
Not only that, but as the class probably is static you will not create
an instance of it in the first place :)
Sep 3 '08 #2
On Sep 3, 10:47*am, "Ignacio Machin ( .NET/ C# MVP )"
<ignacio.mac...@gmail.comwrote:
On Sep 3, 11:39*am, CSharper <cshar...@gmx.comwrote:
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.

Do you have any idea how many classes are created by the simplest win
app?, believe me one more will have no impact what so ever :)
In this case the maintenability and logic has more importance that
creating one class.
Not only that, but as the class probably is static you will not create
an instance of it in the first place :)
Thanks, that make me feel better.
Sep 3 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Marian | last post by:
Hi, I am totaly novice in .NET and I am studying a book about this. There was mentioned "assembly". I did not understand, how function does it has . I would like to know the exact run of code...
4
by: Tim Bird | last post by:
Hi all. I have recently installed VB2005 so teach myself programming, could anyone suggest any links to useful websites, or help sites, Ideally I am looking for tutorials, written for the...
2
by: Ted Duross | last post by:
Hi, I’ve created an educational software application accessed by students from a central server. On Start-Up the application reads an XML file that stores student progress records. This XML...
1
by: gretchen.ogrady | last post by:
I admit - I'm a simple user but looking to improve skills. Instructions aren't helping and have searched this group but am getting bogged down by some of the programming-speak. I have a query...
3
by: Zach | last post by:
I'm writing an app which is going to rely extremely heavily on the usage of regular expressions. I'm reading the docs but having trouble wrapping my head around some of this since it's all fairly...
25
by: gordon | last post by:
I aksed a few days ago about static methods and got some good answers that were really useful. Now I am not sure if about the use of static on members (variables) and classes. Can someone...
18
by: BillE | last post by:
When a user opens a new IE browser window using File-New-Window the integrity of an application which relies on session state is COMPLETELY undermined. Anyone who overlooks the fact that...
5
by: Joe C. | last post by:
hello, thanks for reading. this topic was probably covered in the past; if so, i apologize for the repost, and would you kindly redirect me to the topic? i have small app that monitors the...
3
by: Mo | last post by:
I thought that this was going to be super easy (and it probably is), but I couldn't figure it out. I have results from a MySQL query which include PartNumber, Qty, Cost, and Price. In one part of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.