I would have thought that all your points could equally be asked about generics themselves.
Printable View
I would have thought that all your points could equally be asked about generics themselves.
There are two ways to answer this question....Quote:
I would have thought that all your points could equally be asked about generics themselves.
1) If writing common, typesafe code is not a significant feature then the topic is immaterial to the language decision, and C++ has no advantage over C# because of this issue.
2) The ability to write code once that will work in a typesafe manner is significant from both a development and maintenance perspective. In this case, my argument is that generics provide sufficient capabilities compared to templates, that impact at the higher levels is insignificant.
Mmm.. but that isnt really the point of the question.. We arent looking at generic as a standalone.. The question calls for a demonstration of the difference between templates and generics in any case(s) of a/b/c/dQuote:
Originally Posted by Zaccheus
The question poses real-world hurdles run into during development, and basically asserts that both generics and templates, assist or detriment to the same degree with the process of clearing those hurdles. Ergo, the assertion is that generics and templates can be considered equivalent in a "real-world" scenario.
If the cap fits..
Non-generic C# is typesafe. If you cast a reference to the wrong type, you merely get an exception.
Now as far as I know, .net generics cannot operate on unknown types. For example, you cannot write a generic vector class which supports the usual 3D vector operations.
It may not be a commercial project, but for my Gravel hobby project I would have liked to implement the whole gravity simulation as a generic class, such that any number type can be used. I don't think this is possible.
I'm still kinda choosing, but I'm going for C#/C++
I've got some basic things down... If statements, hello world... That's about it :p
But yeah, I decided to jump into the deep end. I'll be looking for some source code first, it's so much easier to understand when you can read it easily :)
Nalk about a nonsensical statement. You can go for C# or C++/CLI, or even a combination of the two, but there is no such thing as "C#/C++" :rolleyes:Quote:
but I'm going for C#/C++
In general when talking about "typesafe" the discussion is at build (compile) time.Quote:
Non-generic C# is typesafe. If you cast a reference to the wrong type, you merely get an exception.
Remember the rule of "tens"
A error in the initial concepts that would cost $1 to fix....
Will cost $10 if it is caught at the final architectre phase
Will cost $100 if it is caught at the final design phase
Will cost $1,000 if it is caught at the final design phase
Will cost $10,000 if it is caught at the final QA (testing) phase
Will cost $100,000 if it is caught at the customers site.
For professional software packages these numbers can actually be fairly acurate....
Ok, in that case how are you using reflection in C# to replace the flexibility of templates ?Quote:
Originally Posted by TheCPUWizard
Also, any comment on the viability of writing a 3D vector class using generics ?
Didnt you hear? MS have taken a keen interest in this thread, saw the folly of their ways and now are drawing up the next version of these languages, which will be an effective merge of the two.Quote:
Originally Posted by TheCPUWizard
Oh and everyone who posts in this thread will also get $10K from Bill himself!
I assumed he was talking about sitations that generate an InvalidCastException..Quote:
Originally Posted by TheCPUWizard
Remember kids, weeks of coding can save you hours of planning! ;)Quote:
For professional software packages these numbers can actually be fairly acurate....
I forgot this one:Quote:
Originally Posted by TheCPUWizard
In C++/CLI there is built in support for indexed properties. This support actually exists in .net, but C# does not expose it, forcing you to write indexer helper classes.
Um.. do you assert that templates write code at runtime?Quote:
Originally Posted by Zaccheus
Um ... no, I'm saying reflection happens at runtime.
Agreed, but these are typically trivial when necessary, and there is always the option of exposing a collection as a property, so no additional class may be necessary....Quote:
In C++/CLI there is built in support for indexed properties. This support actually exists in .net, but C# does not expose it, forcing you to write indexer helper classes.
Agreed, but I am trying to figure out what this has to do with the discussion, properly designed, reflection does not necessarily mean that there is the introduction of any non type safe items [although they surely can be introduced....Quote:
Reflection occurs at runtime.
There will always be workarounds, but I think it is undeniable that C++/CLI has a few nice features which are not in C#.
You are thinking of C++/Java ... Microsoft called it C#. Do keep up.Quote:
Originally Posted by cjard
:D
There is no denying that C++/CLI has some features that are not available in C#, just as there are features in C# that are not available in C++/CLI. Even the other .Net languages (VB.Net, Cobol.Net, etc.) each have nice features of their own.Quote:
but I think it is undeniable that C++/CLI has a few nice features which are not in C#.
My issue with with people who say that C++/CLI should be used over C# in the development of Business Applications. I have seen no compelling reason whatsoever to support this. On the other hand, there is compelling evidence that the simplicity (you can even read this as restrictions) of C# can reduce development and maintenance costs significantly.
Yes, as I repeatedly said - for example in post #118:Quote:
Originally Posted by TheCPUWizard
We are in agreement about that.Quote:
Originally Posted by Zaccheus
Naww, C++/Java was their J# language.. This new one is going to be called CplusHarp and it will be sponsored by Guinness. And youll only be allowed to code it if you have a beard.Quote:
Originally Posted by Zaccheus
For more information, write to:
Microsoft
[There is only] One [way, the] Microsoft Way
Redmond..
I'd love to know what nice things VB.NET does that C# doesnt. Retarded loops, default instances, an IDE that defies most of the case conventions that MS lay down are features, but i wouldnt proclaim them nice ;)Quote:
Originally Posted by TheCPUWizard
Ooh, no wait.. I did think of something! If you reference Microsoft.VisualBasic then you get a nice way of making your app single instance.. Your app registers a remoting server on startup, successive attempts to register the same server fail (the app is already running) and best of all, the existing app receives an event that someone tried to start the app again, and the eventargs detail the command line params passed to the new instance.
Now thats cool! (avail in C# by reffing MS.VB)
:D :D :DQuote:
Originally Posted by cjard
Hi again.
I've decided to go for C++/CLI.
I'm going to write as much as possible in native classic C++ and the CLI parts will be as few as possible and kept isolated in libraries. So although newly developed the application will be fitted into C++/CLI as if being ported legacy code. The application then becomes as portable as possible (at the C++ source level) while still having full access to managed Windows.
I first thought of mainly use the managed part of C++/CLI but was discouraged by the fact that not even Sutter, chief architect of C++/CLI, recommends this, and because the Visual C++ team isn't going to position C++/CLI as a strong alternative to C#. In my view this means that C++/CLI is never going to "fly" as a managed language in its own right. It's likely to stay a "glue" language.
So in principle I picked classic C++ over C#. Although I have yet to write a single line of C# I know what I'm doing because I have extensive experience from Java (and of C++ of course). The relative merits of classic C++ in relation to "modern" languages like C# and Java is not the topic of this thread but in my personal view (not negotiable :) ) the latter are quite hyped.
Thank you everybody for this discussion!
_uj, maybe you've already mentioned it in the previous 11 pages of discussion, but what kind of app is this?
It's Molecular Dynamics. You can watch in 3D how molecules interact with each others. It's a little like a game actually. There's both computer graphics involved and heavy floating point calculations to simulate how the molecules are moving around.Quote:
Originally Posted by Arjay
It's a hobby project I've been considering for many years and I've developed a prototype in Java but now I'm going to pursue it full-time for half a year first and then I'll decide how to continue. I'm a great fan of Java and an early adopter but somehow it never fully delivers for what I'm attempting. This experience has made me reluctant to continue on the managed path using C#.
Now that.. sounds cooool; can we play with it when it's done? Are you looking to turn it into a PhD, or do you really do this instead of watching tv, or playing squash?Quote:
Originally Posted by _uj
Incidentally; had you mentioned this, I dont think I would have advocated C# despite personally preferring it to all other languages for my current tasks.. For this kind of math, I'd choose the same route you have.. Majority C++
If you end up with some consultancy work (cause everybody's gotta eat;)) and they are mandating C#, I'm sure you can find your needed answers here :DQuote:
I'm going to pursue it full-time for half a year
There's an old adage round where I come from that I generally apply to some physical manipulation of the world; "If it's hard, youre doing it wrong, or using the wrong tool"Quote:
I'm a great fan of Java and an early adopter but somehow it never fully delivers for what I'm attempting.
While there are exceptions to every rule, i've found this applies in software nearly as much as it applies to winding a rusted nut off the car or refitting a windscreen.. Just a thought..
I'm working on a second degree in Engineering Biology so that's how I got interested in this. The idea is to be able to test drug candidates (molecules) for biological activity (how they interact with protein molecules) in the computer insted of chemically. This is much more efficient so there's a commersial interest if it works really well.Quote:
Originally Posted by cjard
Well, maybe I should but I didn't want to direct the discussion too much. Anyway I think I now know the main differences between C++/CLI and C# and what kind of applications are suitable for each.Quote:
Incidentally; had you mentioned this, I dont think I would have advocated C# despite personally preferring it to all other languages for my current tasks.. For this kind of math, I'd choose the same route you have.. Majority C++
Or I'm not using the tool properly. As I mentioned I already have a prototype in Java which just isn't slick enougth. If it doesn't get better in C++ then at least I know I'm the one to blame.Quote:
There's an old adage round where I come from that I generally apply to some physical manipulation of the world; "If it's hard, youre doing it wrong, or using the wrong tool"
It reminds me of an article I read in New Scientist years ago, about a team at cambridge using computers to molecularly model the hardness of materials; they were looking for things harder thann diamond for the cutting and drilling industry.. Did well too; proposing several new formulae some time before the more classical techniques of working such things out produced any results.. Good luck with it!Quote:
Originally Posted by _uj
How cruel..Quote:
Well, maybe I should but I didn't want to direct the discussion too much.
Dont forget that slickness requires the brilliance of diversity; Vista is slick. OSX is slick. Neither are the child of one [wo]man ;)Quote:
Or I'm not using the tool properly. As I mentioned I already have a prototype in Java which just isn't slick enougth. If it doesn't get better in C++ then at least I know I'm the one to blame.
Stick to being the brains behind the app; that's a far more rare resource than the "art-asses" who can come alonf after and put a pretty skin on it ;)
I want both. I want to stay on top of theory of course but I also want people to feel this is a very professional application. I found it increasingly difficult to invest more and more of my time when I wasn't 100% satisfied with the look&feel. Okay Java really has improved the last couple of years but I always found myself waiting for the next version when feature X hopefully should be fixed so that some corner of the program would work smoothly.Quote:
Originally Posted by cjard
So I said enougth is enougth. I give up the Java portability and do something I can be proud of and feel good about on one platform instead. And it will be semi-portable because the core will be in ISO C++ and who knows, some day also C++/CLI may be widely available. And the Java prototype is in no way wasted. I've learned OO techniques and patterns, and I have the core simulaton algoritms tested and ready to just lift over.
I'm glad I came to this decision. This is fun again. :)
Hi,
I chose C # because I had to basically. I am in IT school working on a software development degree and this semester I had the option to choose between web client server programming (html javascript and ASP) or c#. web client server programming was canceled. The only other programming class available was C#. And I definitely didn't want to go the networking direction. I am glad I am taking this because I am more and more fascinated with it every time I use it. I already know HTML pretty well so I am glad this class worked out. Much better for my resume. Next semester I have the option of Java or Visual Basic. my choice is to learn java which will be taught on a suse linux platform.