Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 19th, 2008, 10:18 AM
Registered User
 
Join Date: Apr 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default i need help for my coding problem...

Hi..

I am a beginner C# programmer and I did some simple program with database(mssql 2005) but i think my coding system is poor because I found some of codes that are redundant, one of the example is the execution of the query.
what i want to happen here is to normalize my code and to find better techniques on coding.

what are the things I need to learn and to study? to make my learning faster....
what will I do so that my code are not redundant?

somebody here please...i need your opinion....

thanks....




http://www.johnalsopinsurance.com/
 
Old May 19th, 2008, 10:27 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

How about posting some code to look at and discuss? We'd be happy to help!

Especially the code for execution of a query because as far as I know, with the exception of LINQ, it hasn't changed much since 1.1?

As for learning and studying, I would say you definatly need a firm grasp on Data Access, logical blocks (if, while, switch etc). Like any other trade, a lot of the rest comes from experience, blood, sweat, maybe some tears and lots more work ;)

Rob
http://robzyc.spaces.live.com
 
Old May 19th, 2008, 03:51 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Some basic guidelines to reducing redundancy:

- When you find yourself copying and pasting the same chunk of code to use elsewhere, think about putting it into a reusable method.
- When you need to reuse code in different files (i.e. other classes) you'll need to explore creating utility classes (helpers). For this you'll need to learn how to construct your own classes, and where you can put them in order to reuse them.
- When you need to reuse code in different assemblies (i.e. other applications) you'll need to explore creating shared class library assemblies. For this you'll need to learn how to work with binary/project references and namespaces.

Unfortunately, there is a lot to learning how to write code efficiently. It is very much a crawl/walk/run metaphor. As Rob said, only years of experience will make you very efficient. In spite of that, you'll always find a better and faster way to do something. No one can become an expert overnight.

-Peter
compiledthoughts.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in coding with ndbm library shayanppp BOOK: Beginning Linux Programming, 4th Edition ISBN 978-0-470-14762-7 1 August 8th, 2008 11:32 AM
coding problem in common dialog box cancertropica Visual Basic 2005 Basics 0 July 30th, 2008 09:38 AM
javascript coding problem hosefo81 Javascript How-To 3 December 4th, 2003 04:56 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.