By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,785 Members | 1,318 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,785 IT Pros & Developers. It's quick & easy.

Coding - Best practices?

P: n/a
Hi,
I have been developing using C# in ASP.Net for about a year now. And have
been a programmer for about 10 years. I have learned many different things
in .NET, but still when I look at sample code fromother programmers I feel
like I am so far behind. I see them usingstuff like Interfaces,
IEnumerables, StringBuilders, etc. I have written several applications in C#
since I started, but I don't ever seem to need or use those more "Advanced"
features.

I have just been assigned a new application to build from scratch.
So this is what I am asking. Where can I find a simple list of what
I should do as I build a new application. I don't really have time
for a 300 page book. What I am looking for is something that says.
"If I were to build a new application I would do A,B,C,etc. I would
use Interfaces for this,because of this, and I would use IEnumerables here
because of this, etc." I know every application is different and you might
not need all of those for every application. But I want to start out
writting this "right" from the beginning. I don't know where people learned
all those advanced things, but I can't seem to find a diffenative web site
that explains the "right" way to do things.

Thanks for all your help. (I know it's alot to ask)

Michael
Feb 5 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Hi Michael,

Well I think I can sympathize with your feelings of many .net concepts
like Interfaces, Stringbuilder and IEnumerable.

But the fact of the matter is that these techniques, or tools aren't
really specific at all to .net. In fact, these tools are pretty
commonplace in other OOP languages and you'd be wise to take advantage
of them.

I think the best time to learn about these tools when they're born out
of need. Like when you find yourself concatenating a lot of String
data that's inside of a looping construct. After a certain point you
may notice your program is bottle-necking at this function and you
realize the need to make it faster. And that's where StringBuilder
comes in. StringBuilder will pretty much do the exact same thing but
do it in another fashion that makes it run much more fast and
effeciently.

As for Interfaces and IEnumerable it's true that you can get away with
coding without these things...but have you ever noticed how convenient
it is to loop over a collection using the foreach construct? Perhaps
if you ever wanted your own custom collections to behave in this
fashion you can give them that same functionality. How would you go
about doing it though? Would you write it completely from scratch?
You could...but the tool that comes to mind is the IEnumerable. When
properly implemented it will enhance your custom collection and allow
you or other users of your code to easily enumerate over your
collection...worry free.

Which brings me to my next topic other people: These concepts and
tools really start coming into play when working with other
programmers. You all need a way to organize your classes and provide
mechanisms to hook up into each others work. Interfaces provide this
type of enforcement or flexibility.

I'm not going to go into what Interfaces are or why you should use
them but it's definately worth it's weight in gold to get to know
these constructs...after all they are there to make your life easier.
Sure there is overhead getting to know these tools...but the payback
is tremendous and that's really what programming is about.

-Ralph

On Feb 5, 1:16 pm, Michael <Mich...@discussions.microsoft.comwrote:
Hi,
I have been developing using C# in ASP.Net for about a year now. And have
been a programmer for about 10 years. I have learned many different things
in .NET, but still when I look at sample code fromother programmers I feel
like I am so far behind. I see them usingstuff like Interfaces,
IEnumerables, StringBuilders, etc. I have written several applications in C#
since I started, but I don't ever seem to need or use those more "Advanced"
features.

I have just been assigned a new application to build from scratch.
So this is what I am asking. Where can I find a simple list of what
I should do as I build a new application. I don't really have time
for a 300 page book. What I am looking for is something that says.
"If I were to build a new application I would do A,B,C,etc. I would
use Interfaces for this,because of this, and I would use IEnumerables here
because of this, etc." I know every application is different and you might
not need all of those for every application. But I want to start out
writting this "right" from the beginning. I don't know where people learned
all those advanced things, but I can't seem to find a diffenative web site
that explains the "right" way to do things.

Thanks for all your help. (I know it's alot to ask)

Michael

Feb 6 '07 #2

P: n/a
I think the best time to learn about these tools when they're born out
of need.
I couldn't agree more. Though I also find it very useful to read a
bit.
I like the Wrox series a lot (I'd recommend C# Professional, it's very
general
and goes in deeper on some specific topics that make life easier)

As for a good website: this one has been posted quite often:
http://www.yoda.arachsys.com/csharp/

Regards,
Joachim

Feb 6 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.