If I haven't made substantial investment in either C++ or C#, which language
would the experts recommend I become well acquainted with?
Daniel
Jul 17 '08
151 4627
Peter Duniho wrote:
On Sun, 20 Jul 2008 16:49:43 -0700, Arne Vajhøj <ar**@vajhoej.d kwrote:
>Jon Skeet [C# MVP] wrote:
>>Java 1.4 and C# 1.0 were very similar, but the languages have diverged significantly since then. Almost all the new features in C# 2.0 and 3.0 either have no real equivalent in Java (e.g. iterator blocks, nullable types) or have very significant differences (e.g. generics).
I don't agree for 2.0.
My list of .NET 2.0 & C# 2.0 new features and their "Java status":
It's not clear to me that your list is a complete enumeration of all
.NET 2.0 and all C# 2.0 features. Heck, you didn't even include
iterator blocks, which was specifically mentioned by Jon.
It is a list I had from another context.
>generics - Java got it in 1.5 (and it is not that different)
I suppose that depends on your definition of "that different".
Personally, I'd say it's _very_ different. Java generics are just a
compile-time wrapper. I understand why they did it that way, but it
significantly limits their utility.
>nullable types - Java has had wrapper objects forever
Not the same at all. Nullable<Tisn't just a "wrapper" for value types
(though I can see why one might view them that way). In particular,
using a wrapper in Java requires boxing the value.
Of course, since in Java you can't define your own non-nullable types,
the need for Nullable<Tin Java is obviously dramatically reduced. But
the wrapper types still aren't the same.
>anonymous methods - Java has anonymous classes
And is missing delegates. Anonymous methods don't really make any sense
without delegates, so sure...maybe you don't see how anonymous methods
aren't the same as anonymous classes. But they aren't.
Now, if you want to argue that C# is missing anonymous classes, I don't
disagree with that. But having anonymous classes doesn't mean that Java
supports the same thing as anonymous methods.
>different accessability get & set - Java getters & setters obviously can
Java doesn't even have properties. The fact that Java's relatively
inferior work-around to lacking properties inherently allows different
accessibility for the getter and setter seems irrelevant to me.
You are missing the point.
The discussion is whether C#'s and Java's ways had split with C# 2.0
features.
The fact that Java does not have Nullable is not an indication of
such a split, because Java does not have any need for Nullable, because
in Java you use the wrapper classes. Different ways of achieving the
same goal.
Same applies to the rest.
These additions to C# made C# more similar to Java not less similar.
>static classes - missing
I don't understand this. Are you saying that C# didn't get to use
"static" when declaring a class until 2.0? That doesn't sound right to
me. I'm also not clear on what you mean by "missing" with respect to
Java, since you can effectively create a static class in Java just as
easily in C#.
I must be misunderstandin g what you mean by "static classes"...plea se
elaborate.
http://www.google.com/search?hl=en&q...=Google+Search
>7 out of 11 seems to be in Java .
I count different: 8 of 11 seem _not_ to be in Java
Only if you count implementation.
But that is not so relevant for the discussion.
Though, since your
list of new features for .NET 2.0 and C# isn't a complete enumeration
anyway, it's not like any count of that particular list is a useful
comparison anyway.
It is a sample of the features.
As all samples it has some uncertainty, but claiming that a sample
is not useful shows a blatant lack of understanding of statistics.
Arne
>>I once met a very senior person in C++ circles (I won't mention his
>>name) and I asked him for his opinion. He suggested that perhaps 5% of all C++ programmers are competent.
5%? Maybe. It's certainly no more than about 10%.
The percentage doesn't change much for other languages, though, bad programmers will write bad code in any language.
But in languages like C and C++ they can create bugs that are
both disastrous and very hard to find.
Exactly. And that is what led us to get accustomed to personal computers
crashing, in the 1980s. Ten years earlier, in the mainframe era, with "less
powerful" languages, it was very hard for a program written in a high-level
language to crash the machine. Normally they terminated with recognizable
errors (e.g., divide by zero) or they simply misbehaved (produced the wrong
output). C# thankfully brings us back into that world. Program errors are
program errors, not computer crashes.
Daniel James wrote:
C++ can be used to write software for a huge range of systems -- not
only Windows but also Mac, linux and others (including mini and
mainframe computers, and embedded systems).
True.
But how many real life C++ program will actually run unchanged
(and without a zillion #ifdef's) on all those platforms ?
C++ can be used to write system-level code: operating systems, device
drivers, etc.. Although there are research projects and proof of concept
implementation that use C# for these things, current C# implementations
do not allow C# to be used for this kind of work with mainstream OSes --
you can't write even a Windows device driver in C#. If you want to do
driver work then choose C++ (or even C).
If one is into that type of stuff, then C/C++ is absolutely the rigth
way to go.
A good implementation plan is to write your back-end code -- the
business logic of your application -- in a fast portable language (such
as C++)
But why ? You will be able to write the same business logic cheaper
in Java, C# or Python.
You do not need any of the C/C++ specialties for that.
Arne
On Sun, 20 Jul 2008 18:55:20 -0700, Arne Vajhøj <ar**@vajhoej.d kwrote:
[...]
You are missing the point.
That can only be true if you are as well.
The discussion is whether C#'s and Java's ways had split with C# 2.0
features.
The fact that Java does not have Nullable is not an indication of
such a split, because Java does not have any need for Nullable, because
in Java you use the wrapper classes. Different ways of achieving the
same goal.
So why did you include "nullable types" as an example of the "split" of
"C# and Java's ways"? If anything at all, that's an example of
convergence, not divergence.
Same applies to the rest.
Ditto.
These additions to C# made C# more similar to Java not less similar.
The addition of the Ping class make C# more similar to Java, even though
Java doesn't have that? Likewise all the other things that even you agree
Java doesn't have?
If you're trying to make a point, you're not being very clear about what
point it is you're trying to make. You keep writing things that are
mutually exclusive of each other.
>>static classes - missing
I don't understand this. Are you saying that C# didn't get to use "static" when declaring a class until 2.0? That doesn't sound right to me. I'm also not clear on what you mean by "missing" with respect to Java, since you can effectively create a static class in Java just as easily in C#. I must be misunderstandin g what you mean by "static classes"...plea se elaborate.
http://www.google.com/search?hl=en&q...=Google+Search
Well, that's the definition I use. So that doesn't represent a change in
C# 2.0 at all. In either C# or Java you can write a static class (a class
with no instance members is by definition a static class). Just because
the keyword gained usage as a class declaration modifier in 2.0 doesn't
mean you couldn't static classes in 1.0.
In addition, you are again confused about what you're trying to
demonstrate. If Java's object wrappers for value types is in fact just
"different ways of achieving the same goal", then so too is simply
defining a class without any instance members just a "different way of
achieving the same goal".
Suffice to say, I find your assertions uncompelling.
[...]
> Though, since your list of new features for .NET 2.0 and C# isn't a complete enumeration anyway, it's not like any count of that particular list is a useful comparison anyway.
It is a sample of the features.
Then it's useless with respect to measuring the actual differences between
the languages.
As all samples it has some uncertainty, but claiming that a sample
is not useful shows a blatant lack of understanding of statistics.
Claiming that a sample _is_ useful without showing that it's a
statistically significant (large enough sample size) and statistically
correct (sample collected in a statistically random way) sample shows a
blatant lack of understanding of statistics.
Pete
On Jul 21, 12:49*am, Arne Vajhøj <a...@vajhoej.d kwrote:
Java 1.4 and C# 1.0 were very similar, but the languages have diverged
significantly since then. Almost all the new features in C# 2.0 and 3.0
either have no real equivalent in Java (e.g. iterator blocks, nullable
types) or have very significant differences (e.g. generics).
I don't agree for 2.0.
My list of .NET 2.0 & C# 2.0 new features and their "Java status":
I'll restrict it to language features, as that's what I was talking
about.
partial classes - missing
Yup.
generics - Java got it in 1.5 (and it is not that different)
It's *massively* different. Hugely, vastly different. IMO, of course,
but type erasure is fundamental difference IMO.
nullable types - Java has had wrapper objects forever
Not the same thing. While I don't like to micro-optimise too often,
the fact that Nullable<Tis still a value type in C# 2 is a big deal.
Likewise the fact that you can deal with *any* nullable type
generically , instead of having to know the wrapper type in advance.
anonymous methods - Java has anonymous classes
Unwieldy enough to be a real pain, and read-only access to local
variables. As Peter says, the lack of delegates is significant here.
static classes - missing
Yup.
different accessability get & set - Java getters & setters obviously can
Yup.
In addition:
o Iterator blocks
o Other improvements to delegates (irrelevant to Java without
delegates to start with)
7 out of 11 seems to be in Java .
In my count, only "different accessibility for properties" is really
there for Java.
Jon
On Jul 21, 4:28*am, "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
Well, that's the definition I use. *So that doesn't represent a change in *
C# 2.0 at all. *In either C# or Java you can write a static class (a class *
with no instance members is by definition a static class). *Just because *
the keyword gained usage as a class declaration modifier in 2.0 doesn't *
mean you couldn't static classes in 1.0.
No, you couldn't. A static class isn't just "a clas with no instance
members". On the declaration side, when a class is made static the
compiler will *prevent* you from adding instance members. It also
means you don't have any constructors at all, which is impossible in
C# 1 - you get a default constructor if you don't specify any
constructors.
On the calling side, a class declared as static can't accidentally be
used like a "normal" class. You can't declare a variable of that type
(including parameters) or use it as a generic type parameter, for
example.
I'm not claiming these are massive differences, but they're things
which couldn't be achieved in C# 1. They let the compiler help you
find potential problems before they occur - as well as making
intentions clearer to other developers, of course.
Jon
On Sun, 20 Jul 2008 22:45:26 -0700, Jon Skeet [C# MVP] <sk***@pobox.co m>
wrote:
No, you couldn't. A static class isn't just "a clas with no instance
members". On the declaration side, when a class is made static the
compiler will *prevent* you from adding instance members. It also
means you don't have any constructors at all, which is impossible in
C# 1 - you get a default constructor if you don't specify any
constructors. [...]
Yes, I understand that. But by making all the members static, and the
constructor private, without any public member to return an instance of
the class, it's still effectively a static class.
If Arne were willing to accept these kinds of subtle differences as
legitimate differences, I wouldn't push it. But he isn't (see his
comments about nullable types). If he's happy for something to be "the
same" as long as it effectively behaves the same, then there shouldn't in
his view be any difference between these various ways to do a "static
class".
If anything, I'd say you can get a lot closer to a real C# 2.0 "static
class" in Java than you can to a real "nullable type", but Arne says the
former isn't in Java while the latter is. Of course, further complicating
matters is that Arne _also_ says the latter _isn't_. Which is very
confusing. :)
Pete
On Jul 19, 12:40*pm, Pavel Minaev <int...@gmail.c omwrote:
On Jul 19, 4:36*pm, "Giovanni Dicanio" <gdicanio@_NOSP AM_email_DOT_it >
wrote:
The main problem of C++ code is "old style" C++ code, more similar to Cthan
C++.
e.g. when raw pointers like char* are used instead of robust string classes
like std::string/CString, or instead of robust container classes like
std::vector.
Using tools like string classes, container classes and smart pointers makes
C++ code robust and easy to write and manage.
Well, sort of. Until you accidentially invalidate an iterator by
modifying the container - U.B. Or mix signed and unsigned integer
types in an arithmetic expression and get weird results because of the
silent signed->unsigned conversion rule (and it is very easy to do so,
since a lot of standard library functions return unsigned integers -
e.g. size() of any STL container is unsigned). Or forget that
assignment operator and "copy" constructor for auto_ptr are actually
move and not copy. Or put an auto_ptr into a container (and why not,
if it lets you do so without any compaints...). Or try to make sense
of three paragraphs of ISO C++ standard describing overload resolution
for template functions in presence of partial specializations (the one
where synthetic types are involved). The problem is, you have to be a C
++ expert to write good C++ code, and, not any less important, to be
able to understand advanced C++ code written by others that's thrown
at you.
Don't get me wrong, C++ is a great language, and the time I've spent
writing in it was great. But from my experience, I would never let it
anywhere near domain logic except where it is spefically needed, when
I have the choice, because too many times I've witnessed how even
skilled and experienced (5+ years) C++ developers wrote some seemingy
trivial code which then broke things in subtle ways. I once spent 2
whole work days in the debugger trying to find the code that lead to
"Heap corrupted" error which invariably manifested itself under
unclear conditions after the program was used for 2-3 hours. It's not
fun at all. It's also something that's much, much rarer in the
"managed code" land.
Just a definition question. What does "domain logic" mean? Thanks.
On Jul 18, 3:08*pm, "Jon Skeet [C# MVP]" <sk...@pobox.co mwrote:
Indeed, you need the command line option -langversion:lin q but to
quote the documentation:
<quote>
This enables the C# 3.0 support. Only a few features of C# 3.0 have
been implemented in the Mono C# compiler, so not everything is
available.
</quote>
Update to this - I've been chatting with Miguel de Icaza recently
(about something else) and he mentioned that the C# 3.0 support is now
actually completed. I'm not sure how much of it has been released yet,
but when Mono 2.0 comes out it should be fully C# 3.0 compliant.
Jon
On Jul 21, 3:43*pm, jmDesktop <needin4mat...@ gmail.comwrote:
Just a definition question. *What does "domain logic" mean? *Thanks.
Essentially a synonym for "business logic". As usual, see Wikipedia
for details: http://en.wikipedia.org/wiki/Domain_logic This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Rob |
last post by:
i know javascript, vbscript, asp css and alot more and im only 14 i was
wondering which is easier to learn php or cgi. any help?
|
by: Bicho Verde |
last post by:
I have now free time and money to do what I want :-)
I have some basic skills in programming (C, Pascal, Macromedia
Actionscript) but don't know exactly what to do in the world of programming.
And also I don't know exactly why would I learn Python rather than C#,
C++ or Perl. Basicaly I don't know where to start, if there is much to do or
if it is has it seems and there is software to everything nowadays and so
doesn't make sense to spend...
|
by: Elijah |
last post by:
I have read many of the topics on learning C++ or Java first.
It seems like everyone says something different.
I would like to know if I should learn C++ or Java.
First a little about myself.
I know PHP, BASIC, and of course HTML.
I'll be 15 years old in September.
I am interested in programming GUI applications.
I am also interested in programming games.
I know that I should learn C++ to program games, but would learning
Java make the...
|
by: Rhino |
last post by:
I am giving some thought to applying for some jobs that want people with
Java and C++ experience. I have been writing Java for several years and am
fluent enough that I don't have to get help with Java very often. I have no
real C++ experience and not much C experience for that matter.
However, the core Java statements are "borrowed" from C and C++ has often
been called "C with classes". It seems to me that it shouldn't take very
long to...
|
by: Hermawih |
last post by:
Hello ,
I want your opinion about this .
In order to say it clearly , I think I have to describe it in long sentences .
I could consider myself as Intermediate/Advance Access Developer ;
Intermediate/Advanced Database designer .
Because of the requirements , I must create Web Application . Access Pages
is not suitable for that so I think about learning VB Net / ASP Net . I am
| |
by: TAM |
last post by:
Hi,
I read that ASP.NET uses VB.NET instead of VBScript. I also read that
ASP.NET is a subset of VB.NET. So if I learn VB.NET first then do I have the
knowledge for programming ASP.NET applications or do I need to learn both
VB.NET and ASP.NET.
Thank you.
TAM
|
by: abhi |
last post by:
hi everybody am new to this group and help me to learn C
|
by: anand devarajan |
last post by:
hi friends,
im anand im just a beginner in c learning for the past two
weeksnow i can write simple prgs can anyone help me to get well known
to c lang so that i should able to write even tough prgs in c
|
by: pandit |
last post by:
hai all,
i want to become a good programmer. one of my friends ( named
"arnuld", he posts here infrequently), taught me Lisp. so i am not a
programming beginner.
i have heard these 2 points. i want to know how :
1. C gives you a strong base of Procedural style of programming which
forms the basis of learning other paradigms e.g OOP
|
by: Chris Carlen |
last post by:
Hi:
From what I've read of OOP, I don't get it. I have also found some
articles profoundly critical of OOP. I tend to relate to these articles.
However, those articles were no more objective than the descriptions of
OOP I've read in making a case. Ie., what objective
data/studies/research indicates that a particular problem can be solved
more quickly by the programmer, or that the solution is more efficient
in execution time/memory...
|
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...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
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...
|
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();...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |