473,662 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Querie s, 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 2045
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.Querie s, 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.mic rosoft.com> wrote in message
news:84******** *************** ***********@mic rosoft.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.Querie s, 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.Applicati ons.NorthwindMa nager
MyOrg.Applicati ons.NorthwindMa nager.Presentat ion.Winforms.1
MyOrg.Applicati ons.NorthwindMa nager.BusinessL ogic
MyOrg.Applicati ons.NorthwindMa nager.Data
MyOrg.Applicati ons.NorthwindMa nager.Data.Data Sets

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\Applicati ons\
c:\development\ MyOrg\Applicati ons\NorthwindMa nager
cc:\development \MyOrg\Applicat ions\NorthwindM anager.Presenta tion.Winform.1
c:\development\ MyOrg\Applicati ons\NorthwindMa nager\BusinessL ogic\
c:\development\ MyOrg\Applicati ons\NorthwindMa nager\Data\
(etc)

so I'd have (one example only this time)
c:\development\ MyOrg\Applicati ons\NorthwindMa nager\BusinessL ogic\MyOrg.Appl i
cations.Northwi ndManager.Busin essLogic.csproj

something like that.
then I'd get a file like this:
MyOrg.Applicati ons.NorthwindMa nager.BusinessL ogic.dll

perhaps I override the name.... and do this:
MyOrg.Applicati ons.NWM.Busines sLogic.dll

the NAMESPACE would remain:
MyOrg.Applicati ons.NorthwindMa nager.BusinessL ogic
but the filename would be
MyOrg.Applicati ons.NWM.Busines sLogic.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******** ******@TK2MSFTN GP04.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.mic rosoft.com> wrote in message news:84******** *************** ***********@mic rosoft.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.Querie s, 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.Applicati ons.NorthwindMa nager
MyOrg.Applicati ons.NorthwindMa nager.Presentat ion.Winforms.1
MyOrg.Applicati ons.NorthwindMa nager.BusinessL ogic
MyOrg.Applicati ons.NorthwindMa nager.Data
MyOrg.Applicati ons.NorthwindMa nager.Data.Data Sets

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\Applicati ons\
c:\development\ MyOrg\Applicati ons\NorthwindMa nager
cc:\development \MyOrg\Applicat ions\NorthwindM anager.Presenta tion.Winform.1
c:\development\ MyOrg\Applicati ons\NorthwindMa nager\BusinessL ogic\
c:\development\ MyOrg\Applicati ons\NorthwindMa nager\Data\
(etc)

so I'd have (one example only this time)
c:\development\ MyOrg\Applicati ons\NorthwindMa nager\BusinessL ogic\MyOrg.Appl i
cations.Northwi ndManager.Busin essLogic.csproj

something like that.
then I'd get a file like this:
MyOrg.Applicati ons.NorthwindMa nager.BusinessL ogic.dll

perhaps I override the name.... and do this:
MyOrg.Applicati ons.NWM.Busines sLogic.dll

the NAMESPACE would remain:
MyOrg.Applicati ons.NorthwindMa nager.BusinessL ogic
but the filename would be
MyOrg.Applicati ons.NWM.Busines sLogic.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
6888
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 composition mainly? What're others? Thanks in advance for your comments!
6
2015
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 very easily by adding the control to the toolbox. This is great and more 'safe' to do than in Borland. But... although I'm nice, I'm not so nice that I am willing to give away
2
1482
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 libraries are intended to work within the limits of the Compact framework so I can write a single source for both applications My problem is that I can't find a way to make 2 compilation libraries for the Smart Device and the windows XP. I tried using 2...
0
1439
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. But the code behind in each aspx page is huge, often 1000 lines. My apps are heavilly data driven, like the old client server apps with tons of DataGrids. I use Infragistics UltraWebGrid as my primary server control. And on each page, the code is...
3
1828
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
1551
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
2323
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 always dream to achieve a refined and reusable design and implementation. I am very interested with code reuse.
6
3812
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 me somewhat as I have always thought you get code reuse "for free" with inheritance. Am I missing something?. Will someone care to explain ??
7
1438
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 (ev.locationList != null) { //isListNull = true ensures that we do not recheck the list every time we add a new item bool isListNull = false;
0
8343
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8762
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8545
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8633
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.