By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,210 Members | 1,405 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,210 IT Pros & Developers. It's quick & easy.

Question about namespaces.

P: n/a
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
Share this Question
Share on Google+
7 Replies


P: n/a
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

P: n/a
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

P: n/a
"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

P: n/a

"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

P: n/a
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

P: n/a

"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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.