473,842 Members | 1,945 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 7282
OK ladies and gentlemen, don't feed the troll.

This guy is just trying to gather support for his language (Heron).

For proof of this, one only needs to look at and follow the link that
appears at the bottom of his post and the bottom of his, so called,
"critique" page.

It's perfectly fine that this guy wants to rally support for his "new
language" but he should do it a constructive way, perhaps a "mine vs.
theirs" approach would better support his cause his cause.

The "critique" would be more aptly named, "Why I hate C#"

My 2 cents
Brian W


"christophe r diggins" <cd******@video tron.ca> wrote in message
news:V7******** ************@we ber.videotron.n et...
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 #11
Brian W wrote:
For proof of this, one only needs to look at and follow the link that
appears at the bottom of his post and the bottom of his, so called,
"critique" page.


Or you could just read the very first sentence:

<quote>
This is not a formal critique of C# but more of a personal opinion piece and
a defence of the for my own programming language Heron.
</quote>

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #12
There doesn't need to be a comparative language to be critical of this one.

Jax wrote:

I'm not at all an expert on the whole comparison thing between different languages, despite that even I can notice that your trying too hard to criticize C#.
What language are you offering as the alternitive? And what problems does that one have?


--
Bret Pehrson
mailto:br**@inf owest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl >>
Nov 15 '05 #13

"William Ryan" <do********@nos pam.comcast.net > wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
1) Unsafe Code - Sometimes you need it, plain and simple.
Then I would argue it illuminates weakness in the language to begin with.
2) Attributes - Huh? Take for example FileIOPermissio n attribute...you can mark 10 different directories with only Read permissions thereby eliminating the need for checking hardcoded values and ugly branch logic before reading or writing a file.
You haven't eliminated ugly branch logic. It is just hidden in the
attribute. Because something has been moved into a library and looks pretty
is not sufficient. There are other attributes that people write that are a
complete mystery making understanding someone else's code a real headache
because the branch logic is no longer apparent.
I could go on and on about this, but I think you are way
off base here. And you aren't forced to use them...I bet there are tons of .NET developers that barely know they exist for God's sake.
Yes, but when they use them wrongly it is the biggest nightmare you can
imagine. (i.e. My code doesn't work, oh I see the problem this harmless
little attribute is written wrong).
3- Garbage Collection - Yes, all of the benefits you get from Managed code
aren't totally free.
Yep. And some of us just plain don't want a GC. Hence the title, "Why I
don't use C#"
4- Allows non-deterministic destructors - If you dispose of your objects
when you are done with them, I'm not sure what the problem is. What problem is this causing you?
The destructor gets called when the Garbage collector deallocates the
memory. When will that happen?
5- Type/Reference Types.... Dude, there's so few value types I could recite them off the top of my head. That's hardly a chore and so simple most
college CS freshman would love to have that as a Question on a test
As far as Objects can't exist on the stack....that's part and parcel to your other complaint
Plus user defined structs.
7-Mutability - Ok, but what does that stop you from doing? Couldn't you use Attributes to set the objects value and not provide accessors to change it?

A guarantee of immutability of object across functions and modules is
important for designing well behaved and correct software.
8-Class as Modules and Programs - <<A static class with only static data and static methods should either be a module or a program.>> Why?
Okay, I definitely don't have enough ammo to back this one up.
9-Polymorphism - Why can't you use multiple Interfaces?
You can, but you have to redeclare every function in every class that
implements an interface. That can quickly become really unmaintainable with
sophisticated interfaces.
10-Generics and Missing Templates.... ok, they didn't get everything up
front, but if you want to use it, use it, if not, don't. Would it be better for them to not provide this functionality? What if you were just starting C# programming with the advent of 2.0 and didn't have legacy code? Wouldn't you want generics?
I am just saying that they missed the boat, and are now grafting it on
painfully with some important features missing.
11- Source File Layout - Can't you get all of that information via
reflection or using the CodeModel?
Yes you can. I meant parsing as in reading source code is hard to do.
12 - Public Fields---Not if you don't do it. Is it really Microsoft's
responsibilty to ensure that every programmer doesn't violate the rules of
OOP?
A language has a responsability to try and make it difficult to write bad
code.
Besides, if they tried stopping this, there'd be so many VB
Programmers screaming bloody murder it wouldn't be funny.
Replace them all with properties I say (public fields not the VB
Programmers)
And while I
believe that you shouldn't break encapsulation, there are lots of people
that have...or have inherited code from people that did and prohibiting it
would impede adoption. Say what you want about MS, they bend over backwards to support legacy code.
C# is a new language, it doesn't need to support legacy code. It is
incompatable with all other languages.
Special Primitives - Once again, so what?
I can't write my own.
13- Is it a field..
If it were a function, you'd see the () around it. Go ahead and try, if you don't put the parens around it, it won't compile. As testimony to this, go see how many VB Programmers constantly complain about forgetting the parens when they call ToString without the Parens.
What I am referring to is that assigning to a property behind the scenes can
map to a Set function call.
And finally, other than the issue of unsafe code which VB.NET doesn't
support, aren't all of these related to the CLR and the Framework rather
than C#?


Nope. All of these issues are part of the C# specification.
--
Christopher Diggins
yet another language designer
http://www.heron-language.com
Nov 15 '05 #14
"babylon" <am***@hotmail. com> wrote in message
news:Oc******** ******@TK2MSFTN GP09.phx.gbl...
I think C#/.Net is great, except that there is no mature Virtual Machine /
Class Library for non-windows platform.
mono is not a good solution...
Why?
what I want is a truely java-like write once run everywhere

You mean write once, and run everywhere where there is an up to date,
efficient and correct VM installed. "Write once run everywhere" is simply a
marketing catch phrase with no true meaning.

--
Christopher Diggins
yet another language designer
http://www.heron-language.com
Nov 15 '05 #15
*** NO MULTIPLE INHERITANCE ***!!!

Biggest fault of C# in my opinion.

christopher diggins wrote:

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


--
Bret Pehrson
mailto:br**@inf owest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl >>
Nov 15 '05 #16


"Sami Vaaraniemi" <sa************ ***@jippii.fi> wrote in message
news:bv******** **@phys-news1.kolumbus. fi...
While some of your comments about C# do have a point, most of the time the
case is that you can work around the issues in one way or another.
Yes I agree there are work-arounds for a good programmer. But nothing to
prevents less experienced programmers from going in and doing a heck of a
lot of damage. My problem is using other people's code, which is crucial for
any kind of serious development.
However, I could not disagree more with what you say about attributes.
Attributes allow you to move out code that is not essential to the logic of your function. E.g.,

// non-attributes version
public void DoASensitiveThi ng()
{
if (!LookUpUserAut henticationInfo AndCheckHeHasPr operRoles())
throw new AccessDeniedExc eption();
// do the actual logic here
}

// attributes version
[RolesRequired(" Admin")]
public void DoASensitiveThi ng()
{
// do the actual logic here
}

The code is more readable in the version that uses attributes because things that are not really part of the business logic have been moved out of the
code. It makes it easier for the reader to see what is happening because the business logic is not cluttered with extra code.
That is fine, but then what can appear to be an error in the "actual logic"
could be an error in the attribute itself. Attributes are fine to use in
trivial well written cases, but when everyone and their dog start writing
attributes there will be some serious problems debugging and understanding
non-trivial software.
I do not understand your comparison of attributes with C++ macros. C++
macros are somewhat evil in that they can lead to very obscure and hard to
find bugs due to the fact that they are preprocessed, not compiled. The way macro arguments are evaluated can cause nasty problems due to side-effects, double-evaluation and operator precedence. Attributes do not suffer from any of these problems.
Yes I should not have compared attributes to macros in retrospect. I have
updated the critique. But I do wish to say an attribute can just as easily
have unexpected side effect which can be difficult to uncover if it is badly
written.

Regards,
Sami


Thanks for the good insight and useful points.

--
Christopher Diggins
yet another language designer
http://www.heron-language.com
Nov 15 '05 #17

<Ol**********@s kyscan.be> wrote in message
news:40******** **************@ news.skynet.be. ..
- unsafe code
I think that if you would not allow mixed managed/unmanaged code, then no
one is going to jump on .NET since too much tested code exists and it will
take years to port to .NET code. The transition process is slo, but the
programs wil become more and more stable.


..NET has nothing to do with C#. C# is a new language specification with no
support for any kind of legacy code whatsoever.
I think that the User interfaces will become more and more pure .NET,the but the none-user interface functionality will be ported in time.


In Windows world maybe.
- Objects can't exist on the stack

Objects on the stack are an open door to the dreaded buffer overflows.
I think that this is a very good step forward towards stability of the
software.


Which dreaded buffer overflow are you referring to? How is allowing structs
on the stack okay while objects aren't?

--
Christopher Diggins
yet another language designer
http://www.heron-language.com
Nov 15 '05 #18
Oh, it's not that important.
*** NO MULTIPLE INHERITANCE ***!!!

Biggest fault of C# in my opinion.

christopher diggins wrote:

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


--
Bret Pehrson
mailto:br**@inf owest.com
NOSPAM - Include this key in all e-mail correspondence <<38952rglkwdsl >>

Nov 15 '05 #19
christopher diggins <cd******@video tron.ca> wrote:
- unsafe code
If you don't like it, don't use it. I never have.


When someone else uses it, then I have a problem. i.e. Other assemblies,
libraries, etc.


Somewhere, there *has* to be unsafe code - otherwise you'll never be
able to access the file system etc. Where do you draw the line?
- attributes


Couldn't disagree more - attributes are lovely, when used
appropriately. I rarely need to use them. but when I do they're very
handy.


I have seen some really dastardly usage of the things by Microsoft hackers.
This is why I compared them to Macros, reminded me of the level of
obfuscation introduced into C++ by MFC. Nonetheless, I removed the macro
comparison, and I am desperately looking for that example I had seen in
order to back up my position.


I'd be interested to see it.
- non-deterministic destructors


So don't rely on destructors being deterministic. Don't assume the RAII
idiom of C++ works in C# - it doesn't. Use the IDisposable idiom
instead.


And assuming no one else does neither. Again, problems are not always of our
own creation.


If you have a magical language which lets people write libraries but
*not* let them make mistakes in those libraries, I'm all for it. I have
yet to see such a beast.
- Objects can't exist on the stack


Using reference types for almost everything simplifies things
enormously, I find. Then again, I come from a Java background.


It does lead to the boxing/unboxing problem.


Not necessarily - there's no boxing/unboxing
No, a type itself doesn't decide whether it'll be on the stack or the
heap - not directly, anyway. Reference types will always be on the
heap, but value types will be wherever the variable is declared - only
local variables and variables within other objects on the stack will be
on the stack. Again, I just don't see why this is a problem.


sometype x;

is that a pointer/reference to sometype, or is it a actually an initialized
instance of sometype. Depends on whether sometype is a struct or a class.
That is the problem. The single simple declaration statement is now horribly
unclear.


If you're planning to use the type, you need to know considerably more
about it anyway - why shouldn't you know whether it's a value type or a
reference type? In practice, I find that value types are rare, beyond
those supplied by the framework itself.
- Boxing / Unboxing
<snip>
Yes thanks for pointing out that my example is flawed. Interestingly enough
so is your explanation. It should be "boxing will only occur in the case
where "sometype" is object.
Yes, true. Mine was flawed due to a typo, though, rather than being an
actually important flaw :)
- Mutability


Objects can certainly be immutable - take string, for instance. You
can't, however, declare a variable or method to be "const" - is that
what you're really after?


Yes I want :

const myobject x;

In other words I want to be able to declare a immutable instance of
myobject. I changed the wording :

"C# does not allow immutable user defined objects."

Am I making sense now?


No, because you can write your own classes which are immutable. What
you can't do is have a class which has some mutable instances and some
immutable instances.
- Classes as Modules and Programs


The System namespace most certainly *shouldn't* export a method called
WriteLine. WriteLine is acting on a console, so rightly belongs in a
console class. I don't see anything wrong with a type itself having
data.


Why shouldn't another namespace export methods? It can be very practical to
define modules that do things without always requiring that the exact object
that provides it. I don't recommend modifying the system namespace, but I
would write a new namespace with long nasty old functions shortened to
somethign more usable.


The point is that the logical realm of WriteLine is Console -
Console.WriteLi ne isn't to do with "the system", it's to do with the
console.

If you want to write code with very short names though, don't let me
stop you - I just hope I don't have to read your code. The names in
..NET are generally descriptive without being overly long.
Just because it isn't object oriented doesn't mean that it isn't a useful
technique.

As for types having their own data. This is a delicate stance that I have
very little support in the OO community for. Essentially my argument is that
the role of a class is to define the implementation, methods and data for
instances. Static data is something we have all gotten used to but is
information that would possibly be better suited for a namespace then in the
class IMHO.


But a namespace is precisely that - a space for names. They're not a
"space for stuff there isn't room for elsewhere". Namespaces are
primarily about grouping things and avoiding name collisions.
It strikes me that absolutely none of these is a convincing reason not
to use C#. A few are interesting ideas for future development, but many
just don't seem to be an issue to me.


I agree that no single problem here is enough even for me to reject the
language. But definitely things add up when you start taking two or three.


Even then, they really don't, in my view...

--
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 #20

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
10942
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...
1
10671
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
10310
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
9452
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
7855
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...
0
7035
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5696
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...
2
4088
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3142
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.