473,842 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Another C# critique

I have posted a C# critique at
http://www.heron-language.com/c-sharp-critique.html. To summarize I bring up
the following issues :

- unsafe code
- attributes
- garbage collection
- non-deterministic destructors
- Objects can't exist on the stack
- Type / Reference Types
- Boxing / Unboxing
- Mutability
- Classes as Modules and Programs
- Polymorphism through Class Inheritance
- Interface Delegation
- Interface Extensions
- C# Missing Template Template Parameters
- Late Added Generics
- Source File Layout
- Public Fields
- Special Primitives
- Is it a Property or is it a field?
- Microsoft

I am perhaps guilty somewhat of being a flame baiting troll, but at the same
time I honestly want to improve on the critique.

Thanks in advance for your responses.

--
Christopher Diggins
yet another language designer
http://www.heron-language.com
Nov 15 '05
188 7272
> Is there a clear advantage to *having* a header file? The C# devs and
users
don't seem to think so.
The metadata is available and readable, just not in notepad (or your text
editor of choice), but i think that's hardly a good reason to enforce the
usage of header files :-)
Could be this is just another case of personal preference, which goes back
to the analogy of programmers of one language not liking how the other
language reads.

Header files sucks, always synchronization problems with them, wrong search
paths, 2 locations to edit...
The Delphi way is better, you have your class description en then the
implementation section, but still 2 locations to edit.
The C# is far better in use, only one location to edit. And you have an
immediate overview what is actually inside that method.

One note: Visual Studion .NET C# have this outlining function and the
#region trick, to hide code so your classes become as readable as the
original use of header files. Hiding the implementation details. Reading C#
in notepad is maybe harder to read, these outlining functions in Visual
Studio makes programming a lot easier.

Nov 15 '05 #51
You DONT need to duplicate method signitures in this day and age, the reason
C++ has that is because of the bad design in the compilers.

Function prototypes are bad and are only there to fix compiler bad design.
Tools should work for us not us work for them.

You just are stuck in the dark ages and refuse to budge. I guess no job here
for you :D We need better Software Designers and not ones that stick to old
ways for the sake of it.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************** @news.skynet.be ...
Is there a clear advantage to *having* a header file? The C# devs and users
don't seem to think so.
The metadata is available and readable, just not in notepad (or your text editor of choice), but i think that's hardly a good reason to enforce the usage of header files :-)
Could be this is just another case of personal preference, which goes back to the analogy of programmers of one language not liking how the other
language reads.

Header files sucks, always synchronization problems with them, wrong

search paths, 2 locations to edit...
The Delphi way is better, you have your class description en then the
implementation section, but still 2 locations to edit.
The C# is far better in use, only one location to edit. And you have an
immediate overview what is actually inside that method.

One note: Visual Studion .NET C# have this outlining function and the
#region trick, to hide code so your classes become as readable as the
original use of header files. Hiding the implementation details. Reading C# in notepad is maybe harder to read, these outlining functions in Visual
Studio makes programming a lot easier.

Nov 15 '05 #52
Are we in a flaming mood?????
Please make your point why you think that we are stuck in old ways?
Because both the original writer and I wrote that we don't prefer header
files at all.

And my message below clearly indicates that I prefer the C# way without
function prototyping.

<di********@dis cussion.microso ft.com> wrote in message
news:Ow******** ******@TK2MSFTN GP11.phx.gbl...
You DONT need to duplicate method signitures in this day and age, the reason C++ has that is because of the bad design in the compilers.

Function prototypes are bad and are only there to fix compiler bad design.
Tools should work for us not us work for them.

You just are stuck in the dark ages and refuse to budge. I guess no job here for you :D We need better Software Designers and not ones that stick to old ways for the sake of it.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************** @news.skynet.be ...
Is there a clear advantage to *having* a header file? The C# devs and

users
don't seem to think so.
The metadata is available and readable, just not in notepad (or your text editor of choice), but i think that's hardly a good reason to enforce the usage of header files :-)
Could be this is just another case of personal preference, which goes back to the analogy of programmers of one language not liking how the other
language reads.

Header files sucks, always synchronization problems with them, wrong

search
paths, 2 locations to edit...
The Delphi way is better, you have your class description en then the
implementation section, but still 2 locations to edit.
The C# is far better in use, only one location to edit. And you have an
immediate overview what is actually inside that method.

One note: Visual Studion .NET C# have this outlining function and the
#region trick, to hide code so your classes become as readable as the
original use of header files. Hiding the implementation details. Reading

C#
in notepad is maybe harder to read, these outlining functions in Visual
Studio makes programming a lot easier.


Nov 15 '05 #53
There is no reason for function prototypes, this was only there to fix a bad
compiler design.

And yeah I got my flameproof suit on.

Every day I hear oh I miss the C .H function prototypes in the header files,
thats the OLD ways, there is NO point in them except bad compiler design.
Its not there to make it easier to give out developer information becuase
they contain private and protected information also, so that arguemnt is out
of the window. Its plain and simply a bad compiler design issue.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************@n ews.skynet.be.. .
Are we in a flaming mood?????
Please make your point why you think that we are stuck in old ways?
Because both the original writer and I wrote that we don't prefer header
files at all.

And my message below clearly indicates that I prefer the C# way without
function prototyping.

<di********@dis cussion.microso ft.com> wrote in message
news:Ow******** ******@TK2MSFTN GP11.phx.gbl...
You DONT need to duplicate method signitures in this day and age, the

reason
C++ has that is because of the bad design in the compilers.

Function prototypes are bad and are only there to fix compiler bad design. Tools should work for us not us work for them.

You just are stuck in the dark ages and refuse to budge. I guess no job

here
for you :D We need better Software Designers and not ones that stick to

old
ways for the sake of it.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************** @news.skynet.be ...
> Is there a clear advantage to *having* a header file? The C# devs and users
> don't seem to think so.
> The metadata is available and readable, just not in notepad (or your

text
> editor of choice), but i think that's hardly a good reason to enforce
the
> usage of header files :-)
> Could be this is just another case of personal preference, which
goes back
> to the analogy of programmers of one language not liking how the
other > language reads.
>
Header files sucks, always synchronization problems with them, wrong

search
paths, 2 locations to edit...
The Delphi way is better, you have your class description en then the
implementation section, but still 2 locations to edit.
The C# is far better in use, only one location to edit. And you have an immediate overview what is actually inside that method.

One note: Visual Studion .NET C# have this outlining function and the
#region trick, to hide code so your classes become as readable as the
original use of header files. Hiding the implementation details. Reading C#
in notepad is maybe harder to read, these outlining functions in

Visual Studio makes programming a lot easier.



Nov 15 '05 #54
Yes, you are right in this, but why flame me????
I am the good guy, not the bad guy!!!!

I hate header files!

<di********@dis cussion.microso ft.com> wrote in message
news:eo******** ******@TK2MSFTN GP12.phx.gbl...
There is no reason for function prototypes, this was only there to fix a bad compiler design.

And yeah I got my flameproof suit on.

Every day I hear oh I miss the C .H function prototypes in the header files, thats the OLD ways, there is NO point in them except bad compiler design.
Its not there to make it easier to give out developer information becuase
they contain private and protected information also, so that arguemnt is out of the window. Its plain and simply a bad compiler design issue.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************@n ews.skynet.be.. .
Are we in a flaming mood?????
Please make your point why you think that we are stuck in old ways?
Because both the original writer and I wrote that we don't prefer header
files at all.

And my message below clearly indicates that I prefer the C# way without
function prototyping.

<di********@dis cussion.microso ft.com> wrote in message
news:Ow******** ******@TK2MSFTN GP11.phx.gbl...
You DONT need to duplicate method signitures in this day and age, the

reason
C++ has that is because of the bad design in the compilers.

Function prototypes are bad and are only there to fix compiler bad design. Tools should work for us not us work for them.

You just are stuck in the dark ages and refuse to budge. I guess no job here
for you :D We need better Software Designers and not ones that stick
to
old
ways for the sake of it.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************** @news.skynet.be ...
> > Is there a clear advantage to *having* a header file? The C# devs

and > users
> > don't seem to think so.
> > The metadata is available and readable, just not in notepad (or
your text
> > editor of choice), but i think that's hardly a good reason to

enforce the
> > usage of header files :-)
> > Could be this is just another case of personal preference, which goes back
> > to the analogy of programmers of one language not liking how the other > > language reads.
> >
> Header files sucks, always synchronization problems with them, wrong
search
> paths, 2 locations to edit...
> The Delphi way is better, you have your class description en then the > implementation section, but still 2 locations to edit.
> The C# is far better in use, only one location to edit. And you have an > immediate overview what is actually inside that method.
>
> One note: Visual Studion .NET C# have this outlining function and the > #region trick, to hide code so your classes become as readable as the > original use of header files. Hiding the implementation details. Reading C#
> in notepad is maybe harder to read, these outlining functions in Visual > Studio makes programming a lot easier.
>
>
>



Nov 15 '05 #55
As for preprocessors, theyre evil, hard to debug and just not good in any
way to have mixed compiled code.

I prefer to use a const value rather than conditional compile, at least C#
has reduced this need by having defines limited to true or false values,
still I would prefer it not there at all.

The lack of .lib static linking was a bad thing to not have, thankfully its
back in 2.0.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************@n ews.skynet.be.. .
Yes, you are right in this, but why flame me????
I am the good guy, not the bad guy!!!!

I hate header files!

<di********@dis cussion.microso ft.com> wrote in message
news:eo******** ******@TK2MSFTN GP12.phx.gbl...
There is no reason for function prototypes, this was only there to fix a

bad
compiler design.

And yeah I got my flameproof suit on.

Every day I hear oh I miss the C .H function prototypes in the header

files,
thats the OLD ways, there is NO point in them except bad compiler design.
Its not there to make it easier to give out developer information becuase they contain private and protected information also, so that arguemnt is

out
of the window. Its plain and simply a bad compiler design issue.

<Ol**********@s kyscan.be> wrote in message
news:40******** *************@n ews.skynet.be.. .
Are we in a flaming mood?????
Please make your point why you think that we are stuck in old ways?
Because both the original writer and I wrote that we don't prefer header files at all.

And my message below clearly indicates that I prefer the C# way without function prototyping.

<di********@dis cussion.microso ft.com> wrote in message
news:Ow******** ******@TK2MSFTN GP11.phx.gbl...
> You DONT need to duplicate method signitures in this day and age, the reason
> C++ has that is because of the bad design in the compilers.
>
> Function prototypes are bad and are only there to fix compiler bad

design.
> Tools should work for us not us work for them.
>
> You just are stuck in the dark ages and refuse to budge. I guess no job here
> for you :D We need better Software Designers and not ones that stick to old
> ways for the sake of it.
>
>
>
> <Ol**********@s kyscan.be> wrote in message
> news:40******** *************** @news.skynet.be ...
> > > Is there a clear advantage to *having* a header file? The C# devs and
> > users
> > > don't seem to think so.
> > > The metadata is available and readable, just not in notepad (or your > text
> > > editor of choice), but i think that's hardly a good reason to

enforce
> the
> > > usage of header files :-)
> > > Could be this is just another case of personal preference, which

goes
> back
> > > to the analogy of programmers of one language not liking how the

other
> > > language reads.
> > >
> > Header files sucks, always synchronization problems with them,
wrong > search
> > paths, 2 locations to edit...
> > The Delphi way is better, you have your class description en then the > > implementation section, but still 2 locations to edit.
> > The C# is far better in use, only one location to edit. And you
have an
> > immediate overview what is actually inside that method.
> >
> > One note: Visual Studion .NET C# have this outlining function and

the > > #region trick, to hide code so your classes become as readable as the > > original use of header files. Hiding the implementation details.

Reading
> C#
> > in notepad is maybe harder to read, these outlining functions in

Visual
> > Studio makes programming a lot easier.
> >
> >
> >
>
>



Nov 15 '05 #56
[snip]
You must be disapointed by the .NET framework then. There are many types
like e.g. FileStream, where the constructors can throw and the finalizers
perform actions that can fail. Why exactly do you think a constructor should
not propagate exceptions? Why is it better to first construct a type and
then call Open/Init/Whatever?

Ok, with the use of exceptions constructors could do more things that might
fail.
The big problem lays in the fact that if something goes wrong, you have no
access to internal error information since the class does not exist since it
failed.


That's why you can define your own exception classes. Put all error
information in the exception and there won't be a problem.
You have to rely on specialized exception classes that pass on enough
information.
Exactly. What's so bad about that?
For small classes that generates only one unique error, this is
not a problem, but classes that could generate multiple errors (e.g.:
copying multiple files,...loadin g a big document and parse multiple fields
that might contain errors) could be a big problem.
Why? Do it just like they did with the FileStream class. Define a new
exception for each error you want to give your clients the opportunity
to discriminate on. Expose all necessary info with properties and
you're done. I don't see any problems at all.
Since I do not like to program in a mixed style, I try to use this general
rule to create constructors that normally do not fail. But sometimes you
have exceptions of course.
What's mixed about throwing from a constructor?
But destructors should not! (e.g.: close files) .
I didn't say that, did I? I just said that finalizers sometimes have
to call functions that can fail (e.g. FileStream). If the function
fails the finalizer simply swallows the error. You claimed that
destructors should not call functions that can fail.
The class that opens files should have at least one exposed method to
release the resources used, for example close a file.
Some .NET components do not have this, ...
A really? Exactly which classes are you talking about?
... and I had this very annoying problem
that when I opened the same file 2 times in a row, then it sometimes failed
the second time because it was still locked the first time. The destructor
was not called yet, so the file did not close when I tried to reopen it. It
did not show up in the debug version, but only the release version.


That's one of the reasons why you have to call Dispose() on all
objects of classes that implement IDisposable...

Regards,

Andreas
Nov 15 '05 #57
Thanks to the excellent response from this group, I have re-written the
critique significantly. It is much less of a soapbox now, and has fixed up
many technical flaws and inconsistencies . This new version is going to need
picking apart as well, and I would appreciate more comments.

The new version is at the same location as the old one :
http://www.heron-language.com/C-sharp-critique.html.

In regards to the common suggestion that I should write a comparison between
C# and Heron, perhaps I will in the future but I don't think it negates a
stand-alone C# critique.

Thanks to all for your time and input.

--
Christopher Diggins
yet another language designer
http://www.heron-language.com
Nov 15 '05 #58
christopher diggins <cd******@video tron.ca> wrote:
Thanks to the excellent response from this group, I have re-written the
critique significantly. It is much less of a soapbox now, and has fixed up
many technical flaws and inconsistencies . This new version is going to need
picking apart as well, and I would appreciate more comments.

The new version is at the same location as the old one :
http://www.heron-language.com/C-sharp-critique.html.

In regards to the common suggestion that I should write a comparison between
C# and Heron, perhaps I will in the future but I don't think it negates a
stand-alone C# critique.

Thanks to all for your time and input.


Two things spring to mind after only a very cursory glance

1) Garbage collection - you've got a sentence which doesn't finish
2) User defined type values can't be used as constant expressions, but
you can certainly have readonly variables:

readonly MyValueType foo = new MyValueType(... );

--
Jon Skeet - <sk***@pobox.co m>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #59
christopher diggins wrote:
Thanks to the excellent response from this group, I have re-written
the critique significantly. It is much less of a soapbox now, and has
fixed up many technical flaws and inconsistencies . This new version
is going to need picking apart as well, and I would appreciate more
comments.

The new version is at the same location as the old one :
http://www.heron-language.com/C-sharp-critique.html.

In regards to the common suggestion that I should write a comparison
between C# and Heron, perhaps I will in the future but I don't think
it negates a stand-alone C# critique.

Thanks to all for your time and input.


AFAICT, array<complex<f loat>> will be legal ("although constructed types may
be used as generics").

Regards,

Andreas

Nov 15 '05 #60

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

Similar topics

14
3749
by: Long | last post by:
How to include an HTML doc in another HTML doc Problem: to insert the body section of an HTML doc in another HTML document at a specific location. One possible way is to add a WebCharm tag like this: <%@charm:html 20 0 my_services.htm %> When the HTML template is processed by a WebCharm-aware web server, the
19
2561
by: TC | last post by:
Are there any good sites or forums for a web critique? I went to alt.html.critique and it's pretty dead.
9
2290
by: bowsayge | last post by:
Inspired by fb, Bowsayge decided to write a decimal integer to binary string converter. Perhaps some of the experienced C programmers here can critique it. It allocates probably way too much memory, but it should certainly handle 64-bit cpus :) #include <stdio.h> #include <stdlib.h> char * to_binary (unsigned long value) {
39
1947
by: Eric | last post by:
There is a VB.NET critique on the following page: http://www.vb7-critique.741.com/ for those who are interested. Feel free to take a look and share your thoughts. Cheers, Eric. Ps: for those on comp.programming, this may be off topic, but I've posted there because the critique was part of a discussion in that group.
0
9867
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9709
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
10939
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10308
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
9449
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...
1
7853
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4498
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
4086
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3140
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.