Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

What is better in c#?

Posted on 2009-07-06
3
Medium Priority
?
192 Views
Last Modified: 2012-05-07
Put connection string and some common function I use it in public class
Like {GetLastID , FillGrid,&}
Or put every function in its class
Note: I used N-tier (layer) at my work.
Thanks for help
0
Comment
Question by:hazemfadl
  • 2
3 Comments
 
LVL 13

Expert Comment

by:crazyman
ID: 24783800
Why on earth would you want to put the same function in every class, what if you need to change it.

DRY : http://en.wikipedia.org/wiki/Don't_repeat_yourself
0
 
LVL 18

Expert Comment

by:Richard Lee
ID: 24786635
Okay I believe in having Utility classes. An approach you can take is creating your own framework project so it can be consumed within any of your tiers. For example

Company.Framework
Company.Application.Business --> uses Company.Framework
Company.Application.Data --> uses Company.Framework
Company.Application.Presentation --> use Company.Framework

Within your framework project you can different Utility classes that assist with different things for example serialization, data access, string manipulation, etc. Now it absolutely doesn't make sense for a class to have one method, that's not to say that a class cannot have one method if that's the only one that's relevant.

Group related functions in the same class.
0
 
LVL 13

Accepted Solution

by:
crazyman earned 150 total points
ID: 24793025
I agree with DaTribe

We have

Company.Core
Company.Data
Company.Web
Company.Web.UI



Then for products we use
Company.ProductName.Business
Company.ProductName.UI
Company.ProductName.Data
Company.ProductName.Services
etc...

Each with
Company..ProductName.Business.Tests

for unit tests
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Loops Section Overview
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question