473,386 Members | 1,846 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,386 software developers and data experts.

How to develop class library?

Hi,

What would be the best way to develop a class library?
I am planing to develop a couple of classes, needed in our company
enviroment.
These classe will be later used in several projects.

Are there any "how to" links available on how to do that with visual studio?
Would it be best to have a "Windows" or "Console" application to develop and
test each class and then put it into a library later on or is it possible to
have a Library project that can be included into a test application and
thereby still be debuggable?

Thanks for hint, links and help.

Regards
Rainer Queck
Feb 16 '07 #1
16 2545
Just select the Class Library project type in VS when you start your new
solution.

To test it you'll want to add a Windows.Forms or Console project to your
solution that you can build as a client for your class library. Make it the
startup project for your solution. Whether you use a Windows.Forms project
or a Console project makes absolutely no difference, as long as it exercises
all the methods of all the classes in your library, in accordance with your
test plan. It's only for test purposes. So it's up to you: whatever you
feel happiest with.

You do have a test plan, don't you? :0)

Make sure all your classes in your library are in the same namespace: and
pick your namespace wisely. This is probably more important than having all
the classes in the same assembly. I'd make sure all the assemblies that
make up the library (namespace) were signed, so that they can be deployed to
the GAC. This will help you with versioning.

Of course you could always do things the other way around and start your
solution with the test executable and then include another project for your
library (right click on the solution -Add -new project, and then select
"Class library"). As the Perl guys say, "TMTOWTDI". The end result will be
exactly the same.

HTH
Peter
"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:eA**************@TK2MSFTNGP05.phx.gbl...
Hi,

What would be the best way to develop a class library?
I am planing to develop a couple of classes, needed in our company
enviroment.
These classe will be later used in several projects.

Are there any "how to" links available on how to do that with visual
studio?
Would it be best to have a "Windows" or "Console" application to develop
and test each class and then put it into a library later on or is it
possible to have a Library project that can be included into a test
application and thereby still be debuggable?

Thanks for hint, links and help.

Regards
Rainer Queck

Feb 16 '07 #2
Hi Peter,

thanks for you help and tips.

Rainer

"Peter Bradley" <pb******@uwic.ac.ukschrieb im Newsbeitrag
news:%2****************@TK2MSFTNGP05.phx.gbl...
Just select the Class Library project type in VS when you start your new
solution.

To test it you'll want to add a Windows.Forms or Console project to your
solution that you can build as a client for your class library. Make it
the startup project for your solution. Whether you use a Windows.Forms
project or a Console project makes absolutely no difference, as long as it
exercises all the methods of all the classes in your library, in
accordance with your test plan. It's only for test purposes. So it's up
to you: whatever you feel happiest with.

You do have a test plan, don't you? :0)

Make sure all your classes in your library are in the same namespace: and
pick your namespace wisely. This is probably more important than having
all the classes in the same assembly. I'd make sure all the assemblies
that make up the library (namespace) were signed, so that they can be
deployed to the GAC. This will help you with versioning.

Of course you could always do things the other way around and start your
solution with the test executable and then include another project for
your library (right click on the solution -Add -new project, and then
select "Class library"). As the Perl guys say, "TMTOWTDI". The end
result will be exactly the same.

HTH
Peter
"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:eA**************@TK2MSFTNGP05.phx.gbl...
>Hi,

What would be the best way to develop a class library?
I am planing to develop a couple of classes, needed in our company
enviroment.
These classe will be later used in several projects.

Are there any "how to" links available on how to do that with visual
studio?
Would it be best to have a "Windows" or "Console" application to develop
and test each class and then put it into a library later on or is it
possible to have a Library project that can be included into a test
application and thereby still be debuggable?

Thanks for hint, links and help.

Regards
Rainer Queck


Feb 16 '07 #3
classes are bloatware, they add complexity, verbosity and slow code
execution

I've got a dozen books that state this as fact


On Feb 15, 11:45 pm, "Rainer Queck" <Rai...@noemail.noemailwrote:
Hi,

What would be the best way to develop a class library?
I am planing to develop a couple of classes, needed in our company
enviroment.
These classe will be later used in several projects.

Are there any "how to" links available on how to do that with visual studio?
Would it be best to have a "Windows" or "Console" application to develop and
test each class and then put it into a library later on or is it possible to
have a Library project that can be included into a test application and
thereby still be debuggable?

Thanks for hint, links and help.

Regards
Rainer Queck

Feb 16 '07 #4
On 16 Feb, 08:33, pfc_s...@hotmail.com wrote:
classes are bloatware, they add complexity, verbosity and slow code
execution

I've got a dozen books that state this as fact
It all depends on how they are used.

The purpose of a class library is to aid code reuse.
If code is reused wisely it will reduce bloat over multiple projects.
Obviously, if you include a large library for a small amount of code
this will increase the size (bloat) of a single binary.

Complexity and verbosity are issues resulting from design. In that
almost(?) everything in C# starts from a class library. (How much can
you do with no using statements?) Conceptually, the use of customer
libraries shouldn't add to much confusion.

Code will be slightly slower is using library code, but if it is
noticeable, it will be down to what the code is doing and how it is
being run, rather than it being in a separate library.

The most important reason to use libraries is for code reuse. This
reduces testing and development. It also saves time in support and
maintenance, making changes and bug fixes quicker/easier/cheaper.
Professional software development is a business and if you can do
something quicker, it will also be cheaper. This is a good thing in
business.

Feb 16 '07 #5
<pf******@hotmail.coma écrit dans le message de news:
11*********************@m58g2000cwm.googlegroups.c om...

| classes are bloatware, they add complexity, verbosity and slow code
| execution

So, I take it you don't use the .NET framework, where even the basic types
like int and string are classes ? After all, you wouldn't want to use
classes if they are slow and bloated :-)

| I've got a dozen books that state this as fact

Hmmm, they should come in useful for levelling up your desk :-)

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Feb 16 '07 #6
<pf******@hotmail.coma écrit dans le message de news:
11*********************@m58g2000cwm.googlegroups.c om...

Why did I waste time replying ? What a troll !!!

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Feb 16 '07 #7
Don't waste your time; he's trolling.

The correct response is [Delete], perhaps stopping to add to your
blocked list...

Marc
Feb 16 '07 #8
Very interesting. What are you proposing to use instead of classes?

Peter

<pf******@hotmail.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
classes are bloatware, they add complexity, verbosity and slow code
execution

I've got a dozen books that state this as fact


On Feb 15, 11:45 pm, "Rainer Queck" <Rai...@noemail.noemailwrote:
>Hi,

What would be the best way to develop a class library?
I am planing to develop a couple of classes, needed in our company
enviroment.
These classe will be later used in several projects.

Are there any "how to" links available on how to do that with visual
studio?
Would it be best to have a "Windows" or "Console" application to develop
and
test each class and then put it into a library later on or is it possible
to
have a Library project that can be included into a test application and
thereby still be debuggable?

Thanks for hint, links and help.

Regards
Rainer Queck


Feb 16 '07 #9
"Peter Bradley" <pb******@uwic.ac.uka écrit dans le message de news:
OR**************@TK2MSFTNGP02.phx.gbl...

| Very interesting. What are you proposing to use instead of classes?

Easy! VBA spaghetti and globals :-)

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Feb 16 '07 #10
Of course! How could I not have seen that!

You should, though, have added that no comments should be included in the
source files - to cut down on bloat. We definitely don't want bloat, do we.

;)
Peter

"Joanna Carter [TeamB]" <jo****@not.for.spamwrote in message
news:ee*************@TK2MSFTNGP04.phx.gbl...
"Peter Bradley" <pb******@uwic.ac.uka écrit dans le message de news:
OR**************@TK2MSFTNGP02.phx.gbl...

| Very interesting. What are you proposing to use instead of classes?

Easy! VBA spaghetti and globals :-)

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


Feb 16 '07 #11
"Peter Bradley" <pb******@uwic.ac.uka écrit dans le message de news:
eV**************@TK2MSFTNGP06.phx.gbl...

| Of course! How could I not have seen that!

<g>

| You should, though, have added that no comments should be included in the
| source files - to cut down on bloat. We definitely don't want bloat, do
we.

Oh, and remove all excess whitespace and indentations. I have heard tell
that a program can be written as a single (long) line of code <gd&r>

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer
Feb 16 '07 #12
LOL! You've invented Perl.
Peter

"Joanna Carter [TeamB]" <jo****@not.for.spamwrote in message
news:uL**************@TK2MSFTNGP06.phx.gbl...
"Peter Bradley" <pb******@uwic.ac.uka écrit dans le message de news:
eV**************@TK2MSFTNGP06.phx.gbl...

| Of course! How could I not have seen that!

<g>

| You should, though, have added that no comments should be included in
the
| source files - to cut down on bloat. We definitely don't want bloat, do
we.

Oh, and remove all excess whitespace and indentations. I have heard tell
that a program can be written as a single (long) line of code <gd&r>

Joanna

--
Joanna Carter [TeamB]
Consultant Software Engineer


Feb 16 '07 #13
Peter Bradley <pb******@uwic.ac.ukwrote:
Just select the Class Library project type in VS when you start your new
solution.

To test it you'll want to add a Windows.Forms or Console project to your
solution that you can build as a client for your class library.
No no no - to test it, you'll want another class library which contains
all the NUnit test cases :)

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Feb 16 '07 #14
PS

<pf******@hotmail.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
classes are bloatware, they add complexity, verbosity and slow code
execution

I've got a dozen books that state this as fact
Can we have the books names for reference please?
>

On Feb 15, 11:45 pm, "Rainer Queck" <Rai...@noemail.noemailwrote:
>Hi,

What would be the best way to develop a class library?
I am planing to develop a couple of classes, needed in our company
enviroment.
These classe will be later used in several projects.

Are there any "how to" links available on how to do that with visual
studio?
Would it be best to have a "Windows" or "Console" application to develop
and
test each class and then put it into a library later on or is it possible
to
have a Library project that can be included into a test application and
thereby still be debuggable?

Thanks for hint, links and help.

Regards
Rainer Queck


Feb 16 '07 #15
Create a standard Class Library project type. All your class code should go
in here. Name it something like "Company.Common.MortgageCalculations".

Into your solution add another class library called
"Company.Common.MortgageCalculations.Test". Go download the newest version
of NUnit, look through the docs for 15 minutes or so, and you'll be good to
go.

Once you've written code, and written tests for the code, set your startup
project to the Test project, change the startup exe to be the NUnit-Gui.exe,
and go from there. This gives you repeatable Unit Tests, Easy Debugging, and
a host of other benefits.

This is, I have to say, the best way to do a small project like what you
describe.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins

"Rainer Queck" <Ra****@noemail.noemailwrote in message
news:eA**************@TK2MSFTNGP05.phx.gbl...
Hi,

What would be the best way to develop a class library?
I am planing to develop a couple of classes, needed in our company
enviroment.
These classe will be later used in several projects.

Are there any "how to" links available on how to do that with visual
studio?
Would it be best to have a "Windows" or "Console" application to develop
and test each class and then put it into a library later on or is it
possible to have a Library project that can be included into a test
application and thereby still be debuggable?

Thanks for hint, links and help.

Regards
Rainer Queck

Feb 16 '07 #16
"Marc Gravell" <ma**********@gmail.comwrote in message
news:el*************@TK2MSFTNGP06.phx.gbl...
Don't waste your time; he's trolling.

The correct response is [Delete], perhaps stopping to add to your blocked
list...
Unfortunately, that doesn't help when other people quote him. :)

///ark
Feb 16 '07 #17

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

Similar topics

7
by: Tom Szabo | last post by:
Hi, I am looking for some library that will allow developing web-based applications in PHP. I am looking for something that is as close as possible to a windows like application as possible. ...
10
by: John Underwood | last post by:
Can I use python23_d and python23 to develop an extension for a commercial application uses python22.dll? (Providing that I do not use any new features found only in 2.3.) I would bulld version...
66
by: Prashant | last post by:
There are lot of dicussion on C# is much better than C++. Why there is no language to compute C#. This way we are accepting monopoly of M$. Why there is no group which seriously tring to develop...
3
by: David N | last post by:
Hi All, I just wonder if in C#, I can develop a user defined control that can call its parent function which is not yet developed. For example, how do I make my user control call a...
2
by: [b2:ss] | last post by:
Can i distribute an application made with #develop under some commercial license (sahreware)? The GNU license is valid for modifyed versions of #develop source code only, or also for software made...
2
by: aparnasinha26 | last post by:
Hi All, I have to develop an application .The application has to update database.It does not have any user interface.It needs to run on Windows XP/2000 automatically at a particular time say 4...
1
by: Patrick | last post by:
With VS.NET Standard (not VS.NET Professional). Can i develop windows Services with this? Also, can i develop components for .NET Remoting? Currently I develop windows services with my VS.NET...
2
by: John A. Bailo | last post by:
I've been following these guys for a while and use their GPL'd ICSharpZip library quite a bit. The #develop seems to be getting better and better. http://icsharpcode.net/OpenSource/SD/ ...
0
by: TT (Tom Tempelaere) | last post by:
Hi, I have a project to develop a synoptical board, which is a view on a machine we are making. The view should allow monitoring machines in the field and reflect it's state and activity by...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.