The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

C++ versus .NET/VB/Java etc.

I understand Joel has some issues with C++ and seems to like VB a lot. However, I still don't understand why C++ is not the ultimate language, with the ultimate future. Sure, VB, .NET et. al are great for simple apps which are GUI focussed and targeted to do your typical client/server / database / ordering type system. But in the end isn't C++ inherently the language with the most flexibility, low-level operability, speed and expandability.

All that GUI stuff can be done using MFC, WTL etc., and is actually easier to modify when using plain C++ as your basis. My guess is that a lot of people in IT these days are actually not that smart, and consider dragging components onto a sheet, double-clicking and writing a small piece of code to be programming - whereas I see that to be something any teenager could do (and what I did as a teenager). It brings to mind our ASP developer, whose web-apps completely suck but are very pretty to look at and do the simple employee database comms our company requires to an acceptable level.

And I still struggle to see how VB/.NET/Java can be used for any serious P2P application, client/server app which does more than transfer text, AI, high performance app or otherwise. Would, or even can, a person write a decent music sharing program using a laguage other than C++?

Is the industry simply divided into serious developers writing serious apps (C++) and those writing the company employee database (ASP/VB/Java/.NET)?
Hello World
Sunday, September 19, 2004
 
 
Ammendum... On an additional note to the above, I have written a very big client app for our company using MFC and WTL. There are so many resources on-line that I was able to add all the fancy XP type styles to our app using these sources to add to the missing functionality inherent to MFC/WTL. And in advantage, I was able to change a lot of these MFC/WTL classes and behaviours directly at the source to match our app's look-n-feel. Can (especially) non-WTL code provide such flexibility?
Hello World
Sunday, September 19, 2004
 
 
If your ASP developer's app is pretty good to look at and performs to an acceptable level, why does it suck? I am sure most users would rather have a nice looking, working tool; than a beatifully engineered, but hard to use tool anyday. Although, of course, a nice looking, well designed and beatifully engineered tool is trumps.

Joel is advocating the right tool for the job, sometimes its C++, sometimes VB, sometimes ASP, etc.

I don't think there is one perfect languge. Each language trades off between low-level control/complexity and performance/expressiveness. Some languages are better suited to certain tasks than others.

When you have more low-level control, you also have more low-level tasks (in particular memory management) to worry about and the actual implementation of a given algorithm can become more complex. The biggest performance gains are generally found in changes to the algorithm as a whole (as opposed to optimisation of the existing algorithm), so languages which let the developer focus on the algorithm as a whole, over the implementation details of the algorithm can result in better overall performance, despite not having as good a performance in any particular area.

Tools that free us from low-level tasks, and allow us to focus on how to solve the user's problem instead of how worrying about how to solve our own coding problems are a good thing. It is more important (and more difficult) to solve the right problem, than to solve the problem right. More expressive languages can abstract away low-level details, leaving us free to focus the WHAT, rather than the HOW.

Most importantly, the interoperability between languages means that we should not need to argue about which is the BEST language overall, just which is the best for the task at hand. C/C++ are great for demanding applications like graphics drivers or network stacks, but it is pobably best to bubble up to a more abstract language for tasks like business logic or UI validation. SQL is far better suited to data extraction than any language I know; but I wouldn't want to try code an AI using it.

I think the development landscape consists of developers with varying skill levels. There is a continuum of skill and experience, which is just as well, because there is a continuum of tasks out there each requiring a different level of skill and experience. There are plenty of serious ASP/Java/.net developers whose clients require products that are more approriately delivered in one of those languages than C++. I think the REALLY serious developers can work comfortably in most languages and simply choose the tools that best suit the job at hand.
Bruce Thompson Send private email
Sunday, September 19, 2004
 
 
This same debate raged 20-40 years ago between those who wanted to program in assembly and those who liked compiled level languages like C, COBOL, or Fortran. Eventually the most cost-effective approach will win.

It's not the world of developers that's divided into two parts, it's the domain problems to be solved; some require the speed and comtrol C++ gives, some can be solved perfectly well with a higher level language. Simple data entry/reporting tasks can be written quickly and easily with languages like PHP or VB; there's no reason to fuss with cumbersome languages like C++ or Java when the end user will see the same thing either way.
Tom H
Sunday, September 19, 2004
 
 
Dude, go work with some C++ code written by an "average" programmer. Then come back and talk some more about how great the language is.

There is a class of problems that C++ is suitable for, but it's shinking quickly. It's down now to writing video games and some servers.

You're the prototypical "if all you have is a hammer, every problem looks like a nail" guy.
Dutch Boyd
Sunday, September 19, 2004
 
 
ABC is a bittorrent client written in Python and uses wxPython for GUI. So, p2p is something that is not limited to C++. Even something as slow and as easy as Python can help you solve the problem.

PS. I'm not religious about python (actually never even wrote any serious stuff with it). I just love the word "Pythonic". :-)
Pythonic
Sunday, September 19, 2004
 
 
--> "Sure, VB, .NET et. al are great for simple apps which are GUI focussed and targeted to do your typical client/server / database / ordering type system..."

That sort of statement is just no longer true.  Mainstream languages are so powerful now that the choices are often largely arbitrary.

On the subject of VB, be it VB6 or VB.NET, while I am by no means some sort of VB nut, I do appreciate its strengths and I think it's often very under-rated, perhaps because its original claim to fame (and still one of its strong features) was ease of use.

I continue to be impressed by the stuff that is turned out in VB.  A few random examples:  Microsoft has submitted a decent FTP client to some of the VB forums as an example of VB comms programming; I've seen a sophisticated realtime signal-processing app written in VB, and there's a reasonable chess-playing program written in VB (www.gmap.com.mx/MigoyaChess) with a nice drag-and-drop interface.  Pretty cool stuff for a language that is put down as just good for forms-based dialogs.

Perhaps more relevant to this discussion would be a comparison between Visual C#.NET and C++.......
Wolfpup
Sunday, September 19, 2004
 
 
I've spanked others on this message board for making gross general statements like that before, so this will be no different. 

Uhm, have you heard of morpheus? Do you know what language that was written in?  I agree, VB is an extremely weak language.  Thats exactly the reason microsoft created .NET, they realized that more and more people were using VB for simplicity over C++.  Where are you getting that java is orders of magnitute slower than C++ in non-gui applications?     
Since just about every JVM comes equipped with JIT, java has been almost if not as fast as C++.  http://www.idiom.com/~zilla/Computer/javaCbenchmark.html

I'm not going to lie and say that you can optimize more in Java. Thats obviously where C will and always remain king. 
But if we are talking enterprise applications, we are talking scaleability.  And it will take a c++ programmer 3x as long (and 3x as much money )to develop a horizontally scaleable solution.  Sure you'll get more performance per box perhaps, but how cheap is ram these days? How much is another 1U server vs. paying a team of programmers another month to do debug your transaction container? 

Sure, c++ has a razor's edge. but sometimes you just need a really nice sword.  Java fits the bill for that.
Vince
Sunday, September 19, 2004
 
 
We do client-side multimedia work--which is just *that* far off of being a video game--and we find Java grossly unsuitable for this kind of stuff.  It just doesn't have the APIs, performance, or general crispness that we need.

C# looks a lot better, in theory.  It would let us talk to the native system APIs when needed.  Because it has arrays of structs (and not just references to objects), there's some problems where it could be an order of magnitude faster than Java.  I can see writing an app like ours in C#, someday.

We did have a parallel Java project.  The C++ application was easier to develop and far higher quality.  Yes, you can get fired for using Java.

Of course, C++ is only useful under certain circumstances:

1. You use modern C++: STL, boost, and other high-level libraries.  A surprising number of C++ programmers are completely ignorant of modern C++, and spend their time reinventing the wheel.  For example, I do almost no manual memory management.

2. You have competent C++ programmers.  Surprisingly, this hasn't been as big a problem for us as I expected; even the junior interns have written pretty good code.

3. You're willing to use a lot of off-the-shelf open source libraries.

4. Your application benefits more from low-level performance that it would from a drag&drop GUI builder.
J. Random Hacker Send private email
Monday, September 20, 2004
 
 
To clarify: Back in the day, I *hated* working on C++ projects with other people.  Their code usually stank.

Now, with the STL and boost, any reasonably competent junior programmer can bang out passable C++ code.  Once you have std::string and boost::shared_ptr, you can pretty much stop writing destructors and manual memory management.  I call "delete" perhaps once every couple of weeks, tops.  And thanks to the wonders of the Internet, you can get excellent free libraries for almost any imaginable task.

So my former reasons for being a vicious anti-C++ partisan have largely passed.  Not that I wouldn't do many kinds of new development in C# or Mono, but I'm not complaining about where I am now.
J. Random Hacker Send private email
Monday, September 20, 2004
 
 
Most of my young career has been spent developing in C++, and I have seen some of the horrors of past C++ misuse--my old project was apparently written by C hackers who must've thought early Java was the best thing to ever come along in the history of computing but were bound to use pre-standard C++, all of whom left the company en masse to join AOL a year before I arrived.  Add to that the lack of a standard and the experts still working out how to use the language effectively, it's no wonder things were a mess.

However, I've arrived at an exciting time, since not only does the C++ community have the second revision of the standard published--including an incredibly effective standard library of containers and algorithms--but a body of literature and cultural lore has developed, documenting effective usage idioms that largely eliminate many classic complications.  Resource Allocation Is Initialization (RAII) helps with most memory and other resource management issues, and developing with exception safety in mind actually helps decrease logical complexity as it increases robustness.  Add elements of OO, generic, and procedural program organization to taste, with disciplined application of appropriate design patterns, and C++ can build as maintainable and robust a system as perhaps any other language available.

I have no experience in .NET/VB and very little in Java, and have tinkered some with Python, Perl, and Lisp, but I think I'm justified in saying that there are valuable lessons, both positive and negative, to be taken away from every language (though proportions of positive to negative may vary).  C++ isn't the right tool for every job, and I hope not to remain pigeonholed as "the C++ guy" for my entire career, but rumors of its irrelevance and demise have been greatly exaggerated.
Mike Bland Send private email
Tuesday, September 21, 2004
 
 
"Would, or even can, a person write a decent music sharing program using a laguage other than C++?"

In addition to all the Python and Java BitTorrent clients mentioned so far, consider also MLDonkey (an ED2K filesharing client written in OCaml).  In fact, are there any major filesharing apps NOT written in a higher-level language than C++?

Filesharing is a perfect example of an application where raw speed is pointless.  It is entirely I/O bound.  I could write a filesharing app in GW-BASIC and run it on a 386, and it would probably have no trouble keeping up with today's average DSL transfer rates.

That's the thing, really.  Most applications are I/O bound.  There's not much point running twice as fast when you're working, if you still spend most of your time waiting - you still take the same amount of time to do your task.
Iago
Wednesday, September 22, 2004
 
 
Iago, I think thats an excellent point.  The few applications where IO isn't a bottleneck, ( Scientific, AI, etc. ) no one is arguing that C++ is the best.  Both "Hacker" and "Bland" brought up good points too.  It almost seems like C++ can be written in two entirely different ways.  It can be C with more confusing syntax, or almost like Java (not quite as clean though) with STL and 3rd party GC type functionality.
Vince
Thursday, September 23, 2004
 
 
Vince, I'd say more than two ways...  Because C++ incorporates procedural, OO, and generic paradigms, it opens a whole shelf of cans of worms.  Some people latch onto one style to the exclusion of others, despite the fact that applying the strengths of another style would greatly simplify a solution; and some try to use them all just 'cause they can without regard to whether each style is appropriate or not to the task at hand.  In my development as a programmer, I've been guilty of such misuse myself.  But when you use the paradigms together effectively, it can be an exhilarating and gratifying experience.

Of course, some of my own C++ work that I've been fondest of in which I incorporated all these elements did begin to resemble Lisp quite a bit...  At least in my mind, it did.
Mike Bland Send private email
Friday, September 24, 2004
 
 
As others have pointed out, "C++ versus X" is a false opposition. Here's a typical pattern of language use in investment banking:

* C++ for pricing analytics
* Java/.NET for middleware
* Java for cross-platform UIs
* .NET for Windows UI clients
* SQL for data access
* Python for (cross-platform) scripting

I have seen disasters from people using C++ to code cross-platform UI clients. I have seen disasters from people using Java to code pricing analytics. Both are equally inappropriate choices. Incidentally, if you don't understand *why* pure OO is increasingly viewed as a poor fit for mathematical programming, you are very much part of the problem rather than part of the solution. A hint: currying.

The real problem with languages is people trying to use one technology for everything, whether it's C++, Java, Python, OCaml or DOS batch files.
Arkestra
Tuesday, September 28, 2004
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
 
Powered by FogBugz