Linked by Thom Holwerda on Mon 18th Jul 2005 17:07 UTC, submitted by haysmz
General Development The Spec# programming system is a new attempt at a more cost effective way to develop and maintain high-quality software. Spec# is an extension of the object-oriented language C#. It extends the type system to include non-null types and checked exceptions. It provides method contracts in the form of pre- and postconditions as well as object invariants.
Order by: Score:
checked exceptions
by Anonymous on Mon 18th Jul 2005 17:40 UTC
Anonymous
Member since:
---

Finally! If some of you ever tried socket programming in .net you will very well know why strict exception checking would be a must in c#.

Reply Score: 0

RE: checked exceptions
by Lumbergh on Mon 18th Jul 2005 18:15 UTC in reply to "checked exceptions"
Lumbergh Member since:
2005-06-29

Others would disagree that checked exceptions "would be a must" Check out some of Bruce Eckel's writings on checked exceptions in java.

Reply Score: 1

v Interesting
by Anonymous on Mon 18th Jul 2005 18:15 UTC
News?
by Anonymous on Mon 18th Jul 2005 19:48 UTC
Anonymous
Member since:
---

This was announced quite awhile ago, what's the news on it?

Reply Score: 0

v RE: Interesting
by Anonymous on Mon 18th Jul 2005 20:28 UTC
RE[2]: Interesting
by Anonymous on Mon 18th Jul 2005 20:53 UTC in reply to "RE: Interesting"
Anonymous Member since:
---

Like what features?

Reply Score: 0

RE[3]: Interesting
by japail on Mon 18th Jul 2005 21:08 UTC in reply to "RE[2]: Interesting"
japail Member since:
2005-06-30

Value types, generics with RTTI, pseudo-closures, operator overloading, properties, ref and out parameters, a preprocessor, unsigned numeric types, delegates, multidimensional arrays, what is essentially a very convenient FFI, and probably other things that I'm missing.

Reply Score: 2

RE[4]: Interesting
by ahmetaa on Mon 18th Jul 2005 22:47 UTC in reply to "RE[3]: Interesting"
ahmetaa Member since:
2005-07-06

those are not really "advantages" over Java - or any other modern language. they are simply results of language design desicions. Maybe all has posible pros-cons.

if you go next Java (Mustang) forums, you will see same stuff over and over again. This is because people could not get that Java is not C++.

http://forums.java.net/jive/forum.jspa?forumID=23&start=0

Most of the cons i can say is making the language more complex and unsafe. Same likes it that way, some likes a language aspect trying to please everbody. Java is simpler in this aspect, easier to learn. People thinks Java should behave like C++ - or C# , but it really should not.
And a last note: Please talk about currently implemented features. i can talk Java Mustang, or Dolphin if you want.

Reply Score: 0

RE[5]: Interesting
by japail on Mon 18th Jul 2005 23:26 UTC in reply to "RE[4]: Interesting"
japail Member since:
2005-06-30

The poster asked what features that C# had that differed from Java. Instead of demonstrating that you are a Java zealot you could have taken my post for what it was. I will talk about whatever features I want that are part of the language specification.

I don't really care what your opinion is regarding whether these are "advantages" or not. I expressed no opinion regarding anything.

It isn't even clear to me what I listed that you think are aspects of C++. C#'s generics are runtime constructs, don't offer specialization, and only take type parameters. They're safer than Java's in that type-correctness is preserved and isn't compromised by reflection. They're completely different than C++'s templates.

C++ has no anonymous functions, although libraries like Boost Lambda FC++ add vaguely similar features. They're hardly a C++ feature.

Well I could go on, but really I don't feel like it. Neither C# nor Java are especially "modern" languages in much other than their age. Neither are especially simple, either.

Reply Score: 1

RE[3]: Interesting
by Lumbergh on Mon 18th Jul 2005 21:18 UTC in reply to "RE[2]: Interesting"
Lumbergh Member since:
2005-06-29

Like what features?

- User defined value types: important for high-performance and numerical applications

-out and ref parameters

-true generics in .NET 2.0 - not a compiler trick like Java 5 that just boxes everything into objects

-java finally got enums - who knows why it took them so long

-delegates - much cleaner callback mechanism than java's anonynmous methods. It's horrible that java has these stupid adaptor classes all over the place.

-unsafe code and pointers - much easier interop with native code than JNI

-unsigned integer types

-much less "academic" class libraries in my opinion - the .NET framework libraries tend to have little static helper methods that are not as "pure" from an academic point of view, but most programmers like them. look at IO for example

-java finally got variable length parameters which allows it to have a proper printf-like method

- no checked exceptions (which i consider nice. others might disagree)

Overall the CLR (the common language runtime) is more advanced than the JVM. For example, the JVM will most likely never be able to run a language like C++, such as the CLR can.

I'm sure there's more I'm forgetting.

I think Microsoft and Sun are both starting to realize the importance of dynamic languages. Post .NET 2.0 and post Java 6 are both supposed to have changed to their runtime engines to make them more conducive to dynamic languages.

Reply Score: 5

RE[4]: Interesting
by Anonymous on Mon 18th Jul 2005 22:20 UTC in reply to "RE[3]: Interesting"
Anonymous Member since:
---

|- User defined value types
|-out and ref parameters
|-java finally got enums
agree, i would also add the field getter/setters.

|-delegates
There are actually numerous ways to implement delegate-like functionality in java, some can be used just like the c# delegates. Example: http://www.onjava.com/pub/a/onjava/2003/05/21/delegates.html?page=2
Yes, the api does not make use of this, thats a valid argument.

|-unsigned integer types
oh yeah, they would be very nice if half of the .net api would not be ignoring their existence. Try to do endian conversion on them for example.

|-much less "academic" class libraries in my opinion
So much less, that a good part of them does not work at all, or works completely differently under win2k and winxp. Look at Socket for example.

|- no checked exceptions
It can be quite a pain to empiricaly find out that the documentation forgot to mention that a certain method can throw a completely unexpected kind of exception. This especially happens when running multiple threads or asyncronous calls. Well yes, you can catch a generic exception and that catches everything, but it does not help in handling the error condition at all. At least the ide could try to enforce exception declaration like Eclipse does. In fact the way eclipse warns about unhandled exceptions and allows to autocomplete the declaration or add the try/catch block makes the strict exception checking very confortable. Intellisense has a lot to catch up in VS.NET.

Reply Score: 0

RE[3]: Interesting
by Anonymous on Mon 18th Jul 2005 22:08 UTC in reply to "RE[2]: Interesting"
Anonymous Member since:
---

Delegates
Events
Properties
ref/out parameters
Explicit interface implementation

Reply Score: 0

RE[2]: Interesting
by ahmetaa on Mon 18th Jul 2005 20:57 UTC in reply to "RE: Interesting"
ahmetaa Member since:
2005-07-06

Strange my friend was just swearing at monitor while developing beyond "Hello C#" applications. He used to program under Java with IDEA. i asked their honest opinions several times, he says it is no different than Java in most cases but IDE (Vs.net) is just horrible comparing with IDEA for anything more serious than "Hello World", there is not enough mature OS libraries, stack traces are pityfull. He does not like the framework (such as Collections) structure as well. He is an experienced person in both languages by the way. So, i guess you have gound stg he did not see there ;) (mAybe you have never programmed in Java, or did it 5 years ago?)

Reply Score: 1

Contracts!
by Calroth on Mon 18th Jul 2005 23:28 UTC
Calroth
Member since:
2005-07-07

If there's anything I learned about C# and Java, it is there is no easy answer to checked vs. unchecked exceptions. There are some very persuasive arguments either way, and anyone who says that one is definitely better than the other is under-informed.

But anyway, all this should become irrelevant. Because of... contracts! Pre- and post-conditions and invariants. In my opinion, designing with these in mind is much smarter than designing around exceptions. Not that they make exceptions obsolete, but they truly become exceptional - as they should be! Whereas contracts should become everyday and iron-clad - as they also should be.

Reply Score: 1

v Contracts...
by Anonymous on Tue 19th Jul 2005 02:10 UTC
v Checked Exceptions...
by Anonymous on Tue 19th Jul 2005 02:24 UTC
RE: Checked Exceptions...
by Anonymous on Tue 19th Jul 2005 02:52 UTC in reply to "Checked Exceptions..."
Anonymous Member since:
---

I withdraw my previous comment.
This new Extension looks Very Good.
Too bad it's alpha. C# can't compete with Java without it.

Reply Score: 0

Verbosity
by axiom255 on Tue 19th Jul 2005 11:11 UTC
axiom255
Member since:
2005-07-19

I like C# because it is so much less verbose than Java.

e.g. I don't need to implement a whole class to implement delegates. The library is also (in most places) very clean in comparison to Java. Compare System.IO.

The Java community lost me because Sun dragged their feet...

Reply Score: 1

Checked Exceptions
by ketan on Tue 19th Jul 2005 11:17 UTC
ketan
Member since:
2005-06-30

The C# compiler has the option of allowing unsafe code, and it also has the option of treating warnings as errors. With so many different views on whether it's a good or bad thing, wouldn't it be nice to have the option of enforcing exception checking?

Reply Score: 1

This freaks me out.
by Anonymous on Tue 19th Jul 2005 14:03 UTC
Anonymous
Member since:
---

I am totally convinced of the usefullness of static program verification. I don't know the future of programming, but my bet is that in some way or another, this will be an important part of it.

I am an Open-Source enthousiast, and it freaks me out to see MS making such good progress in this field. One of the most proper implementations so far was ESC/Java, and MS hired at least one highly competent member of the ESC/Java team. I've been lurking at the Spec# mailinglist, and things seem to be moving forward steadily.

As far as I know, there has been about zero progress in this field in Open-Source land. I am worried.

Reply Score: 0

RE: This freaks me out.
by Anonymous on Tue 19th Jul 2005 16:53 UTC in reply to "This freaks me out."
Anonymous Member since:
---

Nice to see some educated posts for once about Java vs C#/.NET

If you spend more than 5 mins using it you will see there are alot of things different as stated in posts above.

I think one reason why C# and .NET are making such fast advances is simply because its a very focused project. They need what they need to get done.

I'm very much a open source advocate, but I'm very much a .NET advocate as well (.NET/Portable.NET/Mono).

But open source projects just aren't as focused as companies are. I get paid to write code that our company needs. I don't get paid for functionality I think we need, or what I WANT to work on.

Almost all open source developers are guilty of it, I know I am. I don't join an open source project that needs me, I join a project working on something I enjoy, so does everyone. I work on features I enjoy etc etc.

Most successful open source projects I think have been funded in some sort of manner to try and focus a few people on the important things. But this isn't always the case obviously.

Reply Score: 0