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

Source Tree Structure

Newbie to .NET from Java, have a question about requirements/conventions for
source tree layout. In Java there a convention-bordering-on-requirement that
a source file's location in the source tree be determined by the package it
belongs to. Java IDEs do this automatically. I haven't found any
documentation for this in dotnet. VS by default dumps new source files into
the root regardless of namespace. Are there any conventions for this? Thanks!
Nov 17 '05 #1
4 1948
No, there is no relation between namespaces and the source file locations in
..NET. By default, if you create a repertory and create a source file there,
VS.NET will add the name of the repertory to the namespace but it's not
mandatory and can be changed.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
"pearsons_11114" <pe***********@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
Newbie to .NET from Java, have a question about requirements/conventions
for
source tree layout. In Java there a convention-bordering-on-requirement
that
a source file's location in the source tree be determined by the package
it
belongs to. Java IDEs do this automatically. I haven't found any
documentation for this in dotnet. VS by default dumps new source files
into
the root regardless of namespace. Are there any conventions for this?
Thanks!

Nov 17 '05 #2
Hmm, not sure I follow. I wasn't able to find anything on "repertory", a term
I'm not familiar with. But I take what you said below to mean that VS will
follow the same convention as Java for a pre-existing source tree? For
example, with the following source file:

/com/company/xxx/yyy/MyClass.cs

VS will add a namespace statement of "com.company.xxx.yyy" to the source?

If so, does that mean that that's the typical convention that people follow?
Just looking for a consensus opinion. Thanks!

"Sylvain Lafontaine" wrote:
No, there is no relation between namespaces and the source file locations in
..NET. By default, if you create a repertory and create a source file there,
VS.NET will add the name of the repertory to the namespace but it's not
mandatory and can be changed.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
"pearsons_11114" <pe***********@discussions.microsoft.com> wrote in message
news:FF**********************************@microsof t.com...
Newbie to .NET from Java, have a question about requirements/conventions
for
source tree layout. In Java there a convention-bordering-on-requirement
that
a source file's location in the source tree be determined by the package
it
belongs to. Java IDEs do this automatically. I haven't found any
documentation for this in dotnet. VS by default dumps new source files
into
the root regardless of namespace. Are there any conventions for this?
Thanks!


Nov 17 '05 #3
Repertory has the same meaning as Directory or as Folder.

You are right about your example, if /com is the root or the starting
directory of your solution. This is mandatory in Java but not in .NET.

I don't know if that is the typical convention followed by people but it
doesn't hurt to follow it. Also, this is for C#; it is possible that
VStudio for VB.NET follows a different convention.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
"pearsons_11114" <pe***********@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com...
Hmm, not sure I follow. I wasn't able to find anything on "repertory", a
term
I'm not familiar with. But I take what you said below to mean that VS will
follow the same convention as Java for a pre-existing source tree? For
example, with the following source file:

/com/company/xxx/yyy/MyClass.cs

VS will add a namespace statement of "com.company.xxx.yyy" to the source?

If so, does that mean that that's the typical convention that people
follow?
Just looking for a consensus opinion. Thanks!

"Sylvain Lafontaine" wrote:
No, there is no relation between namespaces and the source file locations
in
..NET. By default, if you create a repertory and create a source file
there,
VS.NET will add the name of the repertory to the namespace but it's not
mandatory and can be changed.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
"pearsons_11114" <pe***********@discussions.microsoft.com> wrote in
message
news:FF**********************************@microsof t.com...
> Newbie to .NET from Java, have a question about
> requirements/conventions
> for
> source tree layout. In Java there a convention-bordering-on-requirement
> that
> a source file's location in the source tree be determined by the
> package
> it
> belongs to. Java IDEs do this automatically. I haven't found any
> documentation for this in dotnet. VS by default dumps new source files
> into
> the root regardless of namespace. Are there any conventions for this?
> Thanks!


Nov 17 '05 #4

"pearsons_11114" <pe***********@discussions.microsoft.com> wrote in message
news:0C**********************************@microsof t.com...
Hmm, not sure I follow. I wasn't able to find anything on "repertory", a
term
I'm not familiar with. But I take what you said below to mean that VS will
follow the same convention as Java for a pre-existing source tree? For
example, with the following source file:

/com/company/xxx/yyy/MyClass.cs

VS will add a namespace statement of "com.company.xxx.yyy" to the source?
No, VS will not modify any source when you load it. You can define a root
namespace for all source files you create(which defaults to the project
name), but loaded source will always remain the same.

VS will also append sub-directories to the namespace, so for a root
namespace of X, if you create a source file in a folder within the project,
you will get X.FolderName as the namespace in the file.

If so, does that mean that that's the typical convention that people
follow?
Just looking for a consensus opinion. Thanks!


I follow a convention something closer to

<assem>/<sub1>/<sub2>

so for a project named OConnell.Magic with the namespace
OConnell.Magic.Wands the directory structure would be

OConnell.Magic/Wands/

and the assembly would be named OConnell.Magic. My general rule is if I want
to go above the root namespace its time to create a new assembly.
Nov 17 '05 #5

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

Similar topics

9
by: FISH | last post by:
Ever have one of those days when you're not sure if it's you who's gone mad, or the rest of the world? I have an Open Source project on SourceForge for communication with YSMG - Yahoo's IM...
3
by: Steve Johnson | last post by:
Been banging my head on this for two days now. Hope someone can help! My test program below is in the form of a single JSP, with a Node class build in. (All the coded needed to run is below.) ...
1
by: Srihari | last post by:
I'm trying to develop a tree structure using javascript. The node values of the tree are generating from a mysql table depending on login. The tree structure contains 3 sub levels. I developed...
4
by: Stephan Tobies | last post by:
Hi everyone, I am looking for a good data structure that could be used to represent families of trees with shared sub-trees and copy-on-write semantics. On a very abstract level, I would like...
1
by: David Hirschfield | last post by:
I've written a tree-like data structure that stores arbitrary python objects. The objective was for the tree structure to allow any number of children per node, and any number of root nodes...and...
5
by: Kent Boogaart | last post by:
Hi, I have some hierarchical data (FAQs) that I would like to bind to. The basic structure is: FAQ Category + Categories + FAQs So an FAQ category has any number of sub-categories and any...
5
by: hankypan1 | last post by:
Hi All, I need a tree data structure for my application. It is the non -cyclic simple tree where i can have any number of children node and each child can recursively become a sub tree like a...
8
by: =?ISO-8859-1?Q?m=E9choui?= | last post by:
Problem: - You have tree structure (XML-like) that you don't want to create 100% in memory, because it just takes too long (for instance, you need a http request to request the information from...
0
by: mac | last post by:
I found that with memory allocating techniques used nowadays (addresses alignment, eg. on 32bit machines) one can detect loops in a tree structure very fast, without using extra memory. This is due...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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:
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...
0
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...

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.