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

Code Reuse

Hi,

I am an IT person who uses .Net to support our infrastructure. Since I have
been doing this for a while it would be a misnomer for classify myself as a
newbie; perpetual amatuer seems more appropriate.

Notwithstanding, I am tired of cutting and pasting code and moving classes
from one project to the next and would like to know the "proper" way to
store code for reuse. I have used .dll's with some success but am still not
organized.

Ideally, I'd like to have a hierarchial namespace with "myOrg" at the root.
Underneath I should find myOrg.AD, myOrg.AD.Queries, myOrg.Exchange... I
assume professional developers do it this way.

I have seen a lot on Namespaces but I haven't been able to conceptually move
from the simple concept of scope to that of organizing code for reuse.
Does this happen by creating a 1 dll / namespace, copying that dll into a
matching directory structure, then adding a reference to each dll in all
subsequent projects?

advice or referrals would be greatly appreciated.

Thanks, bob

Jun 22 '06 #1
4 2037
The best way to dea with namespaces in this case is not to think of them as
part of scoping. Think of them as just a way to organize your libraries by
grouping similar things together.

You seem to be on the right track in your last paragraph except that there's
really no reason to store individual .dlls in their own directory structure.
Just make sure that the name of the .dll synchs up with the name of the
namespace. (Your source code, of course, is a different matter)

The other thing I would suggest is to plan at least your namespace
hierarchy if not the entire libraries in advance. This will help to ensure
that things get put in the proper namespace as you create them.

Good luck.

--
Jeffrey Hornby
Hornby Consulting, Inc.

"Bob Weiner" wrote:
Hi,

I am an IT person who uses .Net to support our infrastructure. Since I have
been doing this for a while it would be a misnomer for classify myself as a
newbie; perpetual amatuer seems more appropriate.

Notwithstanding, I am tired of cutting and pasting code and moving classes
from one project to the next and would like to know the "proper" way to
store code for reuse. I have used .dll's with some success but am still not
organized.

Ideally, I'd like to have a hierarchial namespace with "myOrg" at the root.
Underneath I should find myOrg.AD, myOrg.AD.Queries, myOrg.Exchange... I
assume professional developers do it this way.

I have seen a lot on Namespaces but I haven't been able to conceptually move
from the simple concept of scope to that of organizing code for reuse.
Does this happen by creating a 1 dll / namespace, copying that dll into a
matching directory structure, then adding a reference to each dll in all
subsequent projects?

advice or referrals would be greatly appreciated.

Thanks, bob

Jun 22 '06 #2
That's good to know.

Since you mentioned it, I don't know why I thought there should be a
relationship between the dll files and the namespaces. I think that might
have been an old Java concept creeping in.

Thanks!
bob

"Jeffrey Hornby" <Je***********@discussions.microsoft.com> wrote in message
news:84**********************************@microsof t.com...
The best way to dea with namespaces in this case is not to think of them
as
part of scoping. Think of them as just a way to organize your libraries
by
grouping similar things together.

You seem to be on the right track in your last paragraph except that
there's
really no reason to store individual .dlls in their own directory
structure.
Just make sure that the name of the .dll synchs up with the name of the
namespace. (Your source code, of course, is a different matter)

The other thing I would suggest is to plan at least your namespace
hierarchy if not the entire libraries in advance. This will help to
ensure
that things get put in the proper namespace as you create them.

Good luck.

--
Jeffrey Hornby
Hornby Consulting, Inc.

"Bob Weiner" wrote:
Hi,

I am an IT person who uses .Net to support our infrastructure. Since I
have
been doing this for a while it would be a misnomer for classify myself as
a
newbie; perpetual amatuer seems more appropriate.

Notwithstanding, I am tired of cutting and pasting code and moving
classes
from one project to the next and would like to know the "proper" way to
store code for reuse. I have used .dll's with some success but am still
not
organized.

Ideally, I'd like to have a hierarchial namespace with "myOrg" at the
root.
Underneath I should find myOrg.AD, myOrg.AD.Queries, myOrg.Exchange... I
assume professional developers do it this way.

I have seen a lot on Namespaces but I haven't been able to conceptually
move
from the simple concept of scope to that of organizing code for reuse.
Does this happen by creating a 1 dll / namespace, copying that dll into a
matching directory structure, then adding a reference to each dll in all
subsequent projects?

advice or referrals would be greatly appreciated.

Thanks, bob

Jun 22 '06 #3


You can override the names of the files to alternate versions... if youd
like

Most people don't.

MyOrg.Applications.NorthwindManager
MyOrg.Applications.NorthwindManager.Presentation.W informs.1
MyOrg.Applications.NorthwindManager.BusinessLogic
MyOrg.Applications.NorthwindManager.Data
MyOrg.Applications.NorthwindManager.Data.DataSets

that's am example of what I do for an application.

I put those in file/folders like this:

c:\development\MyOrg\
c:\development\MyOrg\Applications\
c:\development\MyOrg\Applications\NorthwindManager
cc:\development\MyOrg\Applications\NorthwindManage r.Presentation.Winform.1
c:\development\MyOrg\Applications\NorthwindManager \BusinessLogic\
c:\development\MyOrg\Applications\NorthwindManager \Data\
(etc)

so I'd have (one example only this time)
c:\development\MyOrg\Applications\NorthwindManager \BusinessLogic\MyOrg.Appli
cations.NorthwindManager.BusinessLogic.csproj

something like that.
then I'd get a file like this:
MyOrg.Applications.NorthwindManager.BusinessLogic. dll

perhaps I override the name.... and do this:
MyOrg.Applications.NWM.BusinessLogic.dll

the NAMESPACE would remain:
MyOrg.Applications.NorthwindManager.BusinessLogic
but the filename would be
MyOrg.Applications.NWM.BusinessLogic.dll

the only time i do this is when I might encounter the overall windows issue
of filepath/names length. I think the max is .. 255 characters or something
like that??


my framework stuff would be:

MyOrg.Email
MyOrg.Data

etc

"Bob Weiner" <bo*@engr.uconn.edu> wrote in message
news:uH**************@TK2MSFTNGP04.phx.gbl...
That's good to know.

Since you mentioned it, I don't know why I thought there should be a
relationship between the dll files and the namespaces. I think that might
have been an old Java concept creeping in.

Thanks!
bob

"Jeffrey Hornby" <Je***********@discussions.microsoft.com> wrote in message news:84**********************************@microsof t.com...
The best way to dea with namespaces in this case is not to think of them
as
part of scoping. Think of them as just a way to organize your libraries
by
grouping similar things together.

You seem to be on the right track in your last paragraph except that
there's
really no reason to store individual .dlls in their own directory
structure.
Just make sure that the name of the .dll synchs up with the name of the
namespace. (Your source code, of course, is a different matter)

The other thing I would suggest is to plan at least your namespace
hierarchy if not the entire libraries in advance. This will help to
ensure
that things get put in the proper namespace as you create them.

Good luck.

--
Jeffrey Hornby
Hornby Consulting, Inc.

"Bob Weiner" wrote:
Hi,

I am an IT person who uses .Net to support our infrastructure. Since I
have
been doing this for a while it would be a misnomer for classify myself as a
newbie; perpetual amatuer seems more appropriate.

Notwithstanding, I am tired of cutting and pasting code and moving
classes
from one project to the next and would like to know the "proper" way to
store code for reuse. I have used .dll's with some success but am still not
organized.

Ideally, I'd like to have a hierarchial namespace with "myOrg" at the
root.
Underneath I should find myOrg.AD, myOrg.AD.Queries, myOrg.Exchange... I assume professional developers do it this way.

I have seen a lot on Namespaces but I haven't been able to conceptually
move
from the simple concept of scope to that of organizing code for reuse.
Does this happen by creating a 1 dll / namespace, copying that dll into a matching directory structure, then adding a reference to each dll in all subsequent projects?

advice or referrals would be greatly appreciated.

Thanks, bob


Jun 22 '06 #4
With C#, I put all the code that I've written (and plan to reuse
elsewhere) in a lib/ folder not too far from the root of the drive. For
me, this is E:\lib\.

It takes a bit of time to learn how to separate presentation from
processing, but once you get it, you'll be cranking out APIs faster than
you can use them.

--
jeremiah();

sloan wrote:
You can override the names of the files to alternate versions... if youd
like

Most people don't.

MyOrg.Applications.NorthwindManager
MyOrg.Applications.NorthwindManager.Presentation.W informs.1
MyOrg.Applications.NorthwindManager.BusinessLogic
MyOrg.Applications.NorthwindManager.Data
MyOrg.Applications.NorthwindManager.Data.DataSets

that's am example of what I do for an application.

I put those in file/folders like this:

c:\development\MyOrg\
c:\development\MyOrg\Applications\
c:\development\MyOrg\Applications\NorthwindManager
cc:\development\MyOrg\Applications\NorthwindManage r.Presentation.Winform.1
c:\development\MyOrg\Applications\NorthwindManager \BusinessLogic\
c:\development\MyOrg\Applications\NorthwindManager \Data\
(etc)

so I'd have (one example only this time)
c:\development\MyOrg\Applications\NorthwindManager \BusinessLogic\MyOrg.Appli
cations.NorthwindManager.BusinessLogic.csproj

something like that.
then I'd get a file like this:
MyOrg.Applications.NorthwindManager.BusinessLogic. dll

perhaps I override the name.... and do this:
MyOrg.Applications.NWM.BusinessLogic.dll

the NAMESPACE would remain:
MyOrg.Applications.NorthwindManager.BusinessLogic
but the filename would be
MyOrg.Applications.NWM.BusinessLogic.dll

the only time i do this is when I might encounter the overall windows issue
of filepath/names length. I think the max is .. 255 characters or something
like that??


my framework stuff would be:

MyOrg.Email
MyOrg.Data

etc

Jun 23 '06 #5

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

Similar topics

3
by: DPfan | last post by:
What's exactly the meaning of "code reuse" in C++? Why such kind of reuse have more advantages over the counterpart in other language like in C? How is "code reuse" realized in C++? By...
6
by: patrick t music-images dt nl | last post by:
Hi, I'm evaluating Visual Studio and the .NET concept for his company, which is currently using Borland C++ Builder. Now I tried to create components/controls etc. in .NET and I can reuse it...
2
by: Daniel Granatshtein | last post by:
I am writing for both Windows XP and Pocket PC an application that implements the same behavior. In the architecture design I am using several foundation libraries for better code reuse. The...
0
by: Glenn Engelbart | last post by:
I am trying to find out a way to get more code re-use & object orientation in the UI portion of my apps. (There already is plenty of both in the DataAccess & Business Logic portion of my apps. ...
3
by: Simon | last post by:
Hi all, I'm hoping that some of you clever chaps could offer me some advice on code reuse. You see, whenever I make applications, I typically only find very limited
4
by: Simon | last post by:
Hi all, I'm hoping that some of you clever chaps could offer me some advice on code reuse. You see, whenever I make applications, I typically only find very limited
16
by: sailor.gu | last post by:
Hi all guys, As an embeded programmer with five year C experience, I did read many great books related with design, coding, test,debug,algorithms, compiler, design, os, pm and others. I...
6
by: Bart Simpson | last post by:
I remember reading on parashift recently, that "Composition is for code reuse, inheritance is for flexibility" see (http://www.parashift.com/c++-faq-lite/smalltalk.html#faq-30.4) This confused...
7
by: RichB | last post by:
I am just trying to get to grips with C# and OOP, and one of the benefits would seem to be code reuse. However I am not sure where to draw the line. I have the following section of code: if...
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: 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?
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:
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...
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...

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.