473,507 Members | 2,368 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Question about namespaces.

Hi,

there is a logging service called "log4net". It uses namespaces such as
"log4net" and "log4net.Appender".

If I am writing my own software, would it be considered bad style to use
namespaces like log4net and log4net.Appender in my own code (given that
log4net is well-known product)?

I am using some 3rd party software which does just this. They use log4net in
their product, and have written some of their own code in the
log4net.Appender namespace. Should I expect to see other classes in the
System namespace?
Peter
May 10 '06 #1
7 1059
Hello Peter,

PK> there is a logging service called "log4net". It uses namespaces such
PK> as "log4net" and "log4net.Appender".
PK> If I am writing my own software, would it be considered bad style to
PK> use namespaces like log4net and log4net.Appender in my own code
PK> (given that log4net is well-known product)?

It's ok. If you are so conserning about styling, wrap using log4net to the
YourApp.Common namespace and include it only.

PK> I am using some 3rd party software which does just this. They use
PK> log4net in their product, and have written some of their own code in
PK> the log4net.Appender namespace. Should I expect to see other classes
PK> in the System namespace?

Not clear. Could u describe it more wide?

---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 10 '06 #2
My person opinion is that this is just strange to do. Typically, the
company name will start off a namespace - it seems wrong to start off
something you wrote with some other company's namespace.

"Peter Kirk" <pk@alpha-solutions.dk> wrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
Hi,

there is a logging service called "log4net". It uses namespaces such as
"log4net" and "log4net.Appender".

If I am writing my own software, would it be considered bad style to use
namespaces like log4net and log4net.Appender in my own code (given that
log4net is well-known product)?

I am using some 3rd party software which does just this. They use log4net
in their product, and have written some of their own code in the
log4net.Appender namespace. Should I expect to see other classes in the
System namespace?
Peter

May 10 '06 #3
"Michael Nemtsev" <ne*****@msn.com> skrev i en meddelelse
news:9c**************************@msnews.microsoft .com...
Hello Peter,

PK> there is a logging service called "log4net". It uses namespaces such
PK> as "log4net" and "log4net.Appender".
PK> If I am writing my own software, would it be considered bad style to
PK> use namespaces like log4net and log4net.Appender in my own code
PK> (given that log4net is well-known product)?

It's ok. If you are so conserning about styling, wrap using log4net to the
YourApp.Common namespace and include it only.

PK> I am using some 3rd party software which does just this. They use
PK> log4net in their product, and have written some of their own code in
PK> the log4net.Appender namespace. Should I expect to see other classes
PK> in the System namespace?

Not clear. Could u describe it more wide?


Here's an example:
I am writing a control system which has some text processing capabilities.
So I write a class, starting:

namespace System.Text
{
...

I would call this bad style, but I wanted to hear some other opinions.
May 10 '06 #4

"Peter Kirk" <pk@alpha-solutions.dk> wrote in message
news:OI**************@TK2MSFTNGP05.phx.gbl...
"Michael Nemtsev" <ne*****@msn.com> skrev i en meddelelse
news:9c**************************@msnews.microsoft .com...
Hello Peter,

PK> there is a logging service called "log4net". It uses namespaces such
PK> as "log4net" and "log4net.Appender".
PK> If I am writing my own software, would it be considered bad style to
PK> use namespaces like log4net and log4net.Appender in my own code
PK> (given that log4net is well-known product)?

It's ok. If you are so conserning about styling, wrap using log4net to
the YourApp.Common namespace and include it only.

PK> I am using some 3rd party software which does just this. They use
PK> log4net in their product, and have written some of their own code in
PK> the log4net.Appender namespace. Should I expect to see other classes
PK> in the System namespace?

Not clear. Could u describe it more wide?


Here's an example:
I am writing a control system which has some text processing capabilities.
So I write a class, starting:

namespace System.Text
{
...

I would call this bad style, but I wanted to hear some other opinions.


It's not a matter of style. It's just stupid.

Firstly, if Microsoft add a class to System.Text with the same name as yours
then all your code will break and secondly, you will confuse anyone who has
the misfortune to maintain your code because they will be wondering why some
classes in System.Text don't appear in the MS help or any book that they
have ever read.

The whole point of namespaces is to prevent this.
May 10 '06 #5
On Wed, 10 May 2006 22:46:52 +0200, "Peter Kirk" <pk@alpha-solutions.dk> wrote:
"Michael Nemtsev" <ne*****@msn.com> skrev i en meddelelse
news:9c**************************@msnews.microsof t.com...
Hello Peter,

PK> there is a logging service called "log4net". It uses namespaces such
PK> as "log4net" and "log4net.Appender".
PK> If I am writing my own software, would it be considered bad style to
PK> use namespaces like log4net and log4net.Appender in my own code
PK> (given that log4net is well-known product)?

It's ok. If you are so conserning about styling, wrap using log4net to the
YourApp.Common namespace and include it only.

PK> I am using some 3rd party software which does just this. They use
PK> log4net in their product, and have written some of their own code in
PK> the log4net.Appender namespace. Should I expect to see other classes
PK> in the System namespace?

Not clear. Could u describe it more wide?


Here's an example:
I am writing a control system which has some text processing capabilities.
So I write a class, starting:

namespace System.Text
{
...

I would call this bad style, but I wanted to hear some other opinions.

You're right. using System.Text for one of your namespaces is a sure road to
disaster, as would be using another companies namespace. I's probably not
illegal, but think of the headaches it could cause you and the users of your
product.

Good luck with your project,

Otis Mukinfus
http://www.arltex.com
http://www.tomchilders.com
May 10 '06 #6

"Nick Hounsome" <Ne**@NickHounsome.Me.Uk> wrote in message
news:EJ******************@text.news.blueyonder.co. uk...

Here's an example:
I am writing a control system which has some text processing
capabilities. So I write a class, starting:

namespace System.Text
{
...

I would call this bad style, but I wanted to hear some other opinions.


It's not a matter of style. It's just stupid.

Firstly, if Microsoft add a class to System.Text with the same name as
yours then all your code will break and secondly, you will confuse anyone
who has the misfortune to maintain your code because they will be
wondering why some classes in System.Text don't appear in the MS help or
any book that they have ever read.

The whole point of namespaces is to prevent this.


It's actually a bit worse than that. Any file that uses classes from
System.Text probably begins

using System.Text;

If it compiles against an assembly that contains your classes, it has now
imported your class name without knowing it. So even people who *aren't*
specifically maintaining your code will be confused by System.Text.XXX
classes that aren't documented where expected.
May 10 '06 #7
Hello Peter,

Don't do this. There are a guideline how to name your namespace it's <Company>.<Project>.<Module>
In your case it could be PeterCorporation.CoolSystem.Processing and call
you class "Text"
Hello Peter,

PK> there is a logging service called "log4net". It uses namespaces
such
PK> as "log4net" and "log4net.Appender".
PK> If I am writing my own software, would it be considered bad style
to
PK> use namespaces like log4net and log4net.Appender in my own code
PK> (given that log4net is well-known product)?
It's ok. If you are so conserning about styling, wrap using log4net
to the YourApp.Common namespace and include it only.

PK> I am using some 3rd party software which does just this. They use
PK> log4net in their product, and have written some of their own code
in PK> the log4net.Appender namespace. Should I expect to see other
classes PK> in the System namespace?

Not clear. Could u describe it more wide?

PK> Here's an example:
PK> I am writing a control system which has some text processing
PK> capabilities.
PK> So I write a class, starting:
PK> namespace System.Text
PK> {
PK> ...
PK> I would call this bad style, but I wanted to hear some other
PK> opinions.
PK>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 11 '06 #8

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

Similar topics

11
1738
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
11
1023
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
22
1139
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
0
7223
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
7319
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
7376
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...
1
7031
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...
0
4702
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
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...
0
1542
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 ...
1
760
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
412
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...

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.