tags:

views:

1412

answers:

14

Let's say you have a company running a lot of C/C++, and you want to start planning migration to new technologies so you don't end up like COBOL companies 15 years ago.

For now, C/C++ runs more than fine and there is plenty dev on the market for it.

But you want to start thinking about it now, because given the huge running code base and the data sensitivity, you feel it can take 5-10 years to move to the next step without overloading the budget and the dev teams.

You have heard about D, starting to be quite mature, and Go, promising to be quite popular.

What would be your choice and why?

+13  A: 

Stick with C and C++. I don't see it going the way of COBOL, it runs as well as anything, and you'll have no problem finding people to code in C and C++.

Ewan Todd
+7  A: 

C++ will stay around for the next 10 years... (if not, I will correct this answer, when it will not be relevant any more....)

the reason companies works with COBOL today is b/c they already have millions of COBOL code written. if the could throw it - they will do it at once, on the other hand - companies work with C/C++ as part of their needs and new projects using this language b/c they can't / don't want to use java/c# any other framework based language - so COBOL is not the analogy here.

Dani
+31  A: 

D and Go will probably just become as popular as Python and Ruby are today. They each fill a niche, and even though D was supposed to be a full-fledged replacement of C++, it probably will never acquire enough mass to push C++ away. Not to mention that they both aren't stable/mature enough, and it's unknown whether you'll have support for these languages in 10-20 years for the then-current hardware and operating systems. Considering that C/C++ is pretty much the compiled language and is used in the great majority of operating systems and native-code applications, it's very unlikely that it'll go away in the foreseeable future.

CyberShadow
amen to that. C is awesome, and C++ comes with enough features packed on top that we begrudgingly accept its presence.
Matt Joiner
Unfortunately they would have to be pretty lucky to become mainstream like python and ruby.
Roman A. Taycher
+1  A: 

there are countless machines running C++ SW , I don't see them shutting down all at once. if C++ will go in the way of COBOL there will be a huge market for application migration. there will be specialized tools developed to translate C++ applications to the popular language of the time (Z++ ???).

so I guess the best advice is to cross that bridge when you come to it

Alon
+10  A: 

If you believe in the lean manufacturing principles, you should strive to "decide as late as possible". The moment should be the last responsible moment, meaning the moment at which failing to make a decision eliminates an important alternative.

I think this principle can be applied to your situation. Instead of committing now to a language (that you don't even know will be around in 10 years), you should keep your options open. Maybe refactor some of your code so it is a bit more generic or is built on more abstractions, so that when it is indeed required to migrate, the process will be easier.

JRL
this principle seems very good. i wish i'd considered it more often in the past.
Matt Joiner
+2  A: 

Check out Intel® Cilk++ Software Development Kit if you want to spark your interest in C++/Multi-Core development. I don't see C or C++ going away anytime soon either.

Israel ANY
+13  A: 

C++ -- it is relatively young and updated... It has a big number of compiler vendors and got improved all the time.

C -- it would live for a long time filling the gap between assembler and higher level languages. It is also very simple and easy to implement language, so it would remain the first language for various "strange" architectures like embedded or extremely new ones.

D is promising but still very new and unstable specifications and libraries.

Go was born few weeks ago... Never use anything of version 0 for big important projects. Also it is significantly more limited the C++ or D.

Artyom
A: 

We have no idea if Go will find acceptance. Just being by Google is probably not going to be enough.

D? Well, some nice things are being said about it but it won't be taking off either. No user base to speak of. D is #20 in popularity on the TIOBE Index, and dropping fast.

You may say that a language's popularity has little to do with how well it's suited for your company's work. But it has a lot to do with how easy it will be to find people qualified to program in it.

Java is on top and I would be surprised if it went far away in the next 20 years. It's not considered a systems programming language but performs well enough that there are few tasks you'd do in C++ that you couldn't in Java. Certainly these days nobody is willing to task human programmers with the job done (flawlessly and often more effectively) by the garbage collector. I for one considered Java a significant step up from C++ in terms of programming effectivity.

I'm quite impressed by Ruby. It's an elegant, expressive language: You can accomplish a lot with not too much code, yet that code is still mostly legible. One of Ruby's main principles is to be consistent and not hold surprises for the developer. This is an extremely good idea, IMO, and boosts productivity. At the time of the big Rails hype (which may still be ongoing), I made a wide berth around Ruby because its reference implementation is abysmally slow. However, the JRuby folks at Sun have made it blazingly fast on a JVM, so now it's definitely worth some consideration. Ruby provides closures and a good handful of functional programming capabilities (see below for why this important), though it's not really considered a FP language. TIOBE index: 10 and rising.

Something to consider for the future is the fact that CPU makers have run up against a performance limit imposed by physics. No longer is there a 30% faster CPU available every Christmas, as it was in the past. So now to get more performance you need more cores. Software development will need all the help it can get in supporting multi-core concurrent programming. C++ leaves you mostly alone with this, and Java's solutions are horrible by modern standards.

In view of this, there's a certain trend toward functional programming (which eliminates much of the hassle associated with concurrency) as well as languages with better concurrency support. Erlang was written specifically for this and for the ability to swap code in a running program (Ericsson wanted incredible uptimes). Scala is similar to Java but with much stronger support for functional programming and concurrency. Clojure, ditto, but it's a Lisp and it's not even in the top 50 (yet!!).

Scala was developed academics, and shows it: It's sophisticated and downright pedantic about data types; it tries to be the Swiss Army Knife of programming languages. I believe a lot of medium-smart programmers will have trouble getting a grip on Scala. Ruby is less FP and doesn't do so much about concurrency, but it's pragmatic, and fun and easy to get stuff done in. Also, running on the JVM, there is an enormous amount of code readily available in Java libraries, which Ruby can interface with. So:

My bet would be on Ruby, with an outside chance on Scala. But there are plenty of alternatives!

Carl Smotricz
The question is about _low-level_ languages. Java, Ruby and Scala don't fit that bucket.
Pavel Minaev
Eh? Your phone probably has Java on it..
Longpoke
Is that why my phone is so slow?
Nosredna
Moore's law has not slowed yet. "The trend has continued for more than half a century and is not expected to stop until 2015 or later."
Nosredna
AFAIK Java is usually around the speed of C/C++, this is definitely true on Java processors.
Longpoke
@Nosredna: Yes, the number of transistors on a die is still going up. But the speed of one CPU is pegged at a little over 3 GHz and has been there for years.
Carl Smotricz
I find it a little silly that you're relying on the TIOBE index. Langpop is better, and still flawed.
Rayne
Looking at the votes, you may be best off going with the opposite of anything I claim :) @Rayne: Thanks for the pointer to Langpop, I'd never heard of it!
Carl Smotricz
That's the way it goes with subjective questions. :\
Rayne
@Longpoke: Java processors as in.... the ones that never left the lab because they're such an amazingly silly idea?
jalf
@jalf, no... the current common architectures are not the _only_ way of doing things. there are neural networks, quantum computing, etc, there will be more paradigms of processing in the future. I'm sure they can work something out that efficiently augments garbage collection (they already do this, but it's probably pretty pragmatic..). And no, they did leave the lab. ARM's Jazelle (on your phone) for example...
Longpoke
@Longpoke: Oh yeah, the extensions which on modern ARM chips **provide no actual hardware acceleration**. Yeah, what a great speedup that provides. And I never said that current CPU's are the only, or best, way to do things. Just that a CPU to natively understand Java bytecode is a silly idea. Which is why modern ARM chips only provide a trivial implementation -- for compatibility, but without wasting die space trying to speed it up.
jalf
@jalf: It can't be as silly as relying on a bunch of memory juggling constructs hacked together for integrity of massive systems. For tiny hardware, yes it's okay, because it's basically like writing the hardware logic itself.. "The Jazelle extension uses low-level binary translation, implemented as an extra stage between the fetch and decode stages in the processor instruction pipeline. Recognised bytecodes are converted into a string of one or more native ARM instructions." Hmmm...
Longpoke
+29  A: 

C and C++ are a pretty much unbeatable combo when it comes to native/unmanaged/"lowlevel" languages.

Not because they're the best languages, far from it, but because they're there, they do the job, and they're good enough. There's little doubt that D, for example, is better than C++ in most respects. But it fails in the most important one: Compatibility with all the existing C++ code. Without that requirement, most of that code would be written in a managed language today anyway. The only reason so many codebases use C++ today is because they used it last year, and it'd be too much of a pain to switch to something else. But if and when they switch, they typically don't switch to D. They switch to C# or Java or Python.

The problem for D and other "upcoming" languages competing for the same niches, is that while they're better, they're not groundbreaking enough to motivate people to actually switch to them.

So C and C++ are here to stay. C is unlikely to evolve much further. It is as it is, and one of the niches it has to fill is "simplicity, even for compiler writers". No other language is likely to beat it in that niche, even if they never revise the standard again.

C++ is evolving much more dramatically, with C++0x getting nearer, and they've already got a huge list of features they want to do afterwards. C++ isn't a dead end in any way.

Both languages are here to stay. Perhaps in 50 years other languages will have replaced them, but it won't happen this decade.

jalf
"won't happen this decade" - easy to say in the last month of the decade :-)
Software Monkey
lol, you know what I meant... ;) +1 to you though ;)
jalf
+5  A: 

I wouldn't concentrate on a language but more on the libraries surrounding it. C++ in combination with the boost libraries are an excellent choice. People who develop in C++ tend to have a better understanding of computing, I myself started of with Java which made my life easier by hiding a lot of fundamental stuff, which is good, however I only really started to understand programming once I learned C/C++ (pointers etc).

I do recognise that C++ can be hard (e.g. memory management) so I think it's good to have a 'add on' language where performance is not essential and readability (==maintainability) scores high: I recommend Python for this.

Cyberroadie
+18  A: 

I currently use D regularly. I wouldn't recommend it yet for people writing production code because it's too bleeding edge. I get away with it because most of my code is research prototypes in bioinformatics. However, the language is starting to stabilize. Andrei Alexandrescu is releasing a book titled "The D Programming Language" next March, and right now there is a push to stabilize the spec for version 2 of the language in time for the book.

While D is not a formal superset of C, it is what I'd call an idiomatic superset except for the lack of a preprocessor. In other words, any code written in C proper (ignoring the preprocessor), can be trivially translated to D without a redesign, because C concepts like pointers and inline ASM are there and work the same in D as in C. D also supports direct linking to C code and the D standard library includes the entire C standard library.

Also, despite D's lack of libraries because it is still a bleeding edge language, it's a library writer's dream because of its metaprogramming capabilities. If it takes off, it will probably have some pretty impressive libs. For a preview of this, see std.range or std.algorithm in the D2 standard library (Phobos). As another example, I implemented an OpenMP-like parallelism model (parallel foreach, parallel map, parallel reduce, futures) as a pure library in D, without any special compiler support. (See http://cis.jhu.edu/~dsimcha/parallelFuture.html)

Given that you're mostly interested in the long term, I'd say give D 6 months to stabilize (given Andrei's book and the current push to stabilize the language, version 2 should be stable by then) and then take a hard look at it.

Edit: Now that the core language spec is relatively stable and the focus has turned to toolchain and library development, I would recommend D for small production projects unless you are in a very risk-averse environment. Larger projects that absolutely must have good toolchain and library support should still wait, though.

dsimcha
A: 

Comparing C* to Cobol is questionable

Comparing C* to Cobol may lead to the wrong conclusion. C was perfect for its day, a huge leap forward on its introduction, and it still gets the job done today.

I would sum up Cobol on my most charitable day with "nice try".

C and C++ will survive for a long time because they fit the bill well as implementation languages. This won't ever really change.

Also, consider that the main negative issue with C/C++ is the lack of memory safety. This tends to be less and less of a problem as codes mature. This means there will not be a serious reason to replace the old codes.

I expect that software systems will grow outwards from C. Look at the hierarchy today:

  • application written in a framework such as Rails
  • application back-end written in Ruby, PHP, Python, C#, whatever
  • Ruby, PHP, Python, or C# run-time implementation (written in C*)
  • OS kernel (written in C89)

I don't think the old layers will vanish, and I think legacy higher layers written in C and C++ will simply be supported that way for an indefinite period of time, eventually being phased out for their replacements written in Ruby, Python, C#, or a future development.

DigitalRoss
+5  A: 

Like dsimcha said the D way is currently risky. Yet the language has a huge potential, it is low-level and i've experienced drastically better productivity with D (instead of C++). Perhaps what people feel with dynamic languages.

Go is so much blog-marketed it seems like a joke to me. Dispatching an interface method is not trivial, and actually slower than dispatching a regular single-inheritance method.

If you'd have a huge codebase the decision is of course more difficult, I would advise only to switch for new projects, not for existing ones.

ponce
A: 

Java. For most low level things Java is fine these days. Why go with a partial solution to C/C++ such as D or Go when you can have something as safe and easy to develop with as Java? If you are looking for a real time solution, D and Go are definitely not it, not to mention they are probably even less supported than Java.


Java is now a system programming language. I don't see how you can consider anything with unsafe constructs such as pointers "next gen". The only reason those insecure constructs ever existed is because it was the pragmatic approach to building a turing complete language. There was no concern of representing the memory in discrete objects, because they just wanted to build something that worked. There are already hard and soft realtime applications in Java, a variety of hardware bytecode processors, and over 2 billion mobile devices running Java. At most all you would have to do is add some constructs for interoperability with devices, which wouldn't be that much code; even in C/C++ you'd still have to add these constructs...

What are you programming? 8-bit microcontrollers with 1KB ram? In that case, it would be pointless to use anything other than the assembler for that platform...

Longpoke
Java is a restricted language that requires a heavyweight VM in most implementations, has no inline assembler, no pointers, no function pointers, no lightweight objects (structs), etc. It is admittedly not slow, but it was not designed with the idea that the programmer should be in complete control.
dsimcha
We're talking about low level languages here. Java is not.
e-satis
1. no it doesn't need a VM.2. you use native interface for the 0.0001% of code that _really_ needs to be low level...3. please read http://www.google.ca/search?q=site%3Aembedded.com+javaIn the cases where you can't use Java you probably have ridiculously small resources so you might as well just use C and assembly since you want have tons of code anyways.
Longpoke
..s/want/wont..
Longpoke
@Longpoke: Doesn't using the JNI for the code that really needs to be low-level **prove** that Java is not up to the job of writing low level code?
dsimcha
C needs assembly if you're doing something that is low level. A few simple JNI calls is the same as functions composed of inline assembler. The only real issue with Java can be performance, specifically, non-deterministic garbage collection, which is probably the only real reason Java currently can't be used in all scenearios.
Longpoke
But C can handle about 70 or 80% of programming that would be described as "low level" w/o resorting to inline ASM. Java can handle almost none of it without resorting to JNI.
dsimcha
whatever dude enjoy getting stacksmashed.
Longpoke
Umm have you ever even tried microcontrollers? C is king there generally. And how do you conclude that using C as opposed to Java will help someone get stack smashed?
samoz
@samoz, I've only used assembler for microcontrollers. C will be stacksmashed because it's an unsafe language, no bounds checking, no pointer dereference checking, no integer overflow checking; a myriad of undefined behaviour. In a sea of code one undefined behavior will take down the entire system. Java is a _safe_ language. Why do I have to explain this? It's obvious. And if Java was implemented at the hardware level with a theorem prover, it would be **MUCH** safer than any normal CPU. Even Java on top of C is safer than C despite the inherit vulnerabilities that brings.
Longpoke
Hate to break it to you, but assembler is an unsafe language. As a programmer it is your responsibility to prevent applications from abusing the system and being ready for attacks such as overflow and bounds checking. And I'd recommend trying C for microcontrollers, it's just so much more convenient for having portable applications, rather than having to learn 4 seperate sets of assembly language.
samoz
@samoz: assembler is _always_ more simple and predictable (and elegant) than C. You can always just use Ada (or SPARK :) if you are forced to a constrained environment, way better than C... C is a hack made by some caveman.
Longpoke
samoz
@samoz: Windows is a joke, *nix is indeed very caveman as the entire architecture still revolves around a terminal, and "everything is a file" doesn't work, nor does the text oriented ("everything is a lexical parser") chaotic hack of scripts that bring up the O/S. Everything is an object, that's how the O/S should act. Would you call COBOL sane just because there are billions of lines written in? What about the web where we code thousands of lines of hacks to make our webapp work for IE instead of the standard? Is that good just because it's done large scale? nope. just an unfortunate state
Longpoke
btw if you're using GCC afaik C and Ada both compile to the same intermediate language..
Longpoke
Windows is a joke? Give me a break. Even if the OS architecture is bad, Windows still dominates the market. What would you propose using instead of Windows or Unix? Actually, I think I'm just going to stop indulging your trolling. Cheers.
samoz
@samoz: "Even if the OS architecture is bad, Windows still dominates the market." This is true, nothing else. Let's just stick everything in the kernel, shall we? The only trolling happening here is people defending outdated thoughts. These things were designed back when we had tiny constrained environments, and they just wanted to get the things deployed, not design them well.
Longpoke