What next generation low level language is the best bet to migrate the code base?

29

3

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?

e-satis

Posted 2009-11-29T14:02:39.160

Reputation: 348 932

Question was closed 2015-04-24T09:58:56.253

11Did COBOL leave when I wasn't looking? – Nosredna – 2009-11-29T15:36:23.100

13Why do people act like COBOL is alive and well? Yes, there are legacy maintenance projects in it because people have little choice here, but it's dead in the sense that noone would ever use it for a greenfield project anymore. It wouldn't surprise me if C++ is the same way in 15 years. – dsimcha – 2009-11-29T15:41:23.227

8

COBOL is still here, very much here, and alone, that's the problem. In my country, the entire postal pay system is written in Cobol. And it's true for the USA as well : http://www.careerjet.com/cobol-jobs.html. But nobody wants to code in COBOL anymore, nobody even dream of learning it, no matter how well payed can be the job, and some offers are outrageous.

– e-satis – 2009-11-29T16:18:54.777

3Do you have a particular reason for wanting to stay low-level? 10-year-old C programs can make great (and much shorter!) Python or Ruby programs today. – Ken – 2009-11-29T16:26:40.530

I have absolutely no reason to do so, I make a living coding in Python. The "Let's say you have a company" is clearly an hypothetical case, I don't talk about me like a tv show character would to his shrink :-) – e-satis – 2009-11-29T16:30:05.827

Or maybe I am a TV show character, maybe I am a Monthy Python Flying circus character. And maybe I'm going for something completely different. – e-satis – 2009-11-29T16:32:10.580

3Are you kidding me? Double my salary and I'll learn COBOL for you. Heck, I'll learn it anyway if it's needed for the job. The problem that legacy COBOL systems have isn't that programmers aren't prepared to learn COBOL no matter what the money, it's that the average legacy system (in any language) is boring, and nobody wants to take a job that screams "maintain an old system and never invent anything again as long as you live" if they can avoid it. Rightly or wrongly I don't know, but COBOL is like a sign saying "we're trapped in the system architecture of ancient times". – Steve Jessop – 2009-11-29T18:37:34.507

1And yes, I am saying that so that vibrant, dynamic COBOL shops doing exciting things with cutting edge concepts can come along and make me an "outrageous" offer. If there are going to be outrageous offers in 10 years just for knowing C/C++, then sign me up for those too! – Steve Jessop – 2009-11-29T18:40:47.430

2Lol. Of course, but cutting edge and COBOL are indeed oxymoron – e-satis – 2009-11-29T19:55:00.637

Rust. 'nuff said. – emlai – 2015-11-01T20:41:12.880

Answers

39

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.

Vladimir Panteleev

Posted 2009-11-29T14:02:39.160

Reputation: 20 795

1amen to that. C is awesome, and C++ comes with enough features packed on top that we begrudgingly accept its presence. – Matt Joiner – 2010-01-02T02:22:35.257

4Unfortunately they would have to be pretty lucky to become mainstream like python and ruby. – Roman A. Taycher – 2010-10-05T11:55:04.560

35

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

Posted 2009-11-29T14:02:39.160

Reputation: 205 311

33"won't happen this decade" - easy to say in the last month of the decade :-) – Lawrence Dol – 2009-12-04T02:43:32.637

3lol, you know what I meant... ;) +1 to you though ;) – jalf – 2009-12-04T13:31:56.237

23

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

Posted 2009-11-29T14:02:39.160

Reputation: 44 782

Would you need a strong rooted understanding of C, in terms of memory and hardware, to be able to use "The D Programming Language" effectively? To rephrase, is knowledge of C a prerequisite for learning from the book? – Abdul – 2017-01-10T15:47:44.483

14

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

Posted 2009-11-29T14:02:39.160

Reputation: 24 546

Re C++ improving all the time - just look at 03 vs 11. My initial foray in C++ was uninformed by versions; I just assumed the tutorial was for 'the' version. On restarting later and committing to C++11/14, I was amazed by how much C++11 added. It's what C++ should always have been (and what I'd been subconsciously wishing C was). And it's only getting better! – underscore_d – 2016-02-25T23:58:20.090

13

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

Posted 2009-11-29T14:02:39.160

Reputation: 6 674

13

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

Posted 2009-11-29T14:02:39.160

Reputation: 62 386

2this principle seems very good. i wish i'd considered it more often in the past. – Matt Joiner – 2010-01-02T02:24:17.437

8

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

Posted 2009-11-29T14:02:39.160

Reputation: 10 168

6

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

Posted 2009-11-29T14:02:39.160

Reputation: 814

5

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

Posted 2009-11-29T14:02:39.160

Reputation: 427

2

There are countless machines running C++ software, 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

Posted 2009-11-29T14:02:39.160

Reputation: 4 501

2

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

Posted 2009-11-29T14:02:39.160

Reputation: 184

0

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

Posted 2009-11-29T14:02:39.160

Reputation: 53 815

12The question is about low-level languages. Java, Ruby and Scala don't fit that bucket. – Pavel Minaev – 2009-11-29T20:55:41.083

Eh? Your phone probably has Java on it.. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2009-12-08T00:27:44.727

12Is that why my phone is so slow? – Nosredna – 2009-12-08T01:04:15.047

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 – 2009-12-08T01:06:14.403

1AFAIK Java is usually around the speed of C/C++, this is definitely true on Java processors. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2009-12-08T01:32:34.793

1@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 – 2009-12-08T05:50:41.017

I find it a little silly that you're relying on the TIOBE index. Langpop is better, and still flawed. – Rayne – 2010-02-21T14:35:18.443

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 – 2010-02-22T06:42:29.767

That's the way it goes with subjective questions. :\ – Rayne – 2010-02-22T11:48:11.353

@Longpoke: Java processors as in.... the ones that never left the lab because they're such an amazingly silly idea? – jalf – 2010-05-27T18:39:05.377

@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... – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2010-05-27T19:27:04.297

@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 – 2010-05-27T20:11:06.183

@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... – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2010-05-27T21:32:40.457

0

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

Posted 2009-11-29T14:02:39.160

Reputation: 121 517

-8

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...

L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳

Posted 2009-11-29T14:02:39.160

Reputation: 9 784

8Java 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 – 2009-12-08T14:23:31.287

3We're talking about low level languages here. Java is not. – e-satis – 2009-12-08T18:36:23.997

>

  • no it doesn't need a VM.
  • you use native interface for the 0.0001% of code that really needs to be low level...
  • please read http://www.google.ca/search?q=site%3Aembedded.com+java In 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.
  • – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2009-12-08T18:48:15.270

    ..s/want/wont.. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2009-12-08T18:51:19.010

    4@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 – 2009-12-08T20:58:22.573

    1C 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. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2009-12-08T21:43:56.903

    9But 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 – 2009-12-08T21:54:08.557

    whatever dude enjoy getting stacksmashed. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2009-12-09T00:27:09.010

    1Umm 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 – 2010-05-28T11:52:46.647

    @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. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2010-05-28T12:31:27.067

    1Hate 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 – 2010-05-28T13:30:41.740

    @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. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2010-05-28T14:09:09.303

    1False. Saying "always" just invites disaster. Every computer instruction, especially between C & assembler is predictable. And why on Earth would I use Ada? C is better because of the portability. Namely, I can use the same crypto library on my microcontrollers as my desktop if I so wish. Learning assembly forces you to learn the whole architecture to do anything other than trivial programs. And if C is invented by "cavemen", how do you explain Linux, Unix, and Windows? Granted theres other languages in there, but I GUARANTEE there is a huge amount of C in there. – samoz – 2010-05-28T17:27:45.880

    @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 – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2010-05-28T17:47:24.627

    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 – 2010-05-28T22:46:21.447

    @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. – L̲̳o̲̳̳n̲̳̳g̲̳̳p̲̳o̲̳̳k̲̳̳e̲̳̳ – 2010-05-28T23:27:48.117

    2Gratuitous Java plug FAIL. – Jeff Allen – 2010-12-03T15:25:37.970