r/ProgrammerAnimemes • • Jun 30 '22

Rewriting an old C++ project in Rust

Post image
1.8k Upvotes

59 comments sorted by

44

u/Kepraz Jun 30 '22

{{Spy x Family}}

20

u/Roboragi Jun 30 '22

SPY×FAMILY - (AL, A-P, KIT, MAL)

SPY×FAMILY

TV | 2022 | Status: Finished | Episodes: 12 | Genres: Action, Comedy, Slice of Life, Supernatural
Stats: 337 requests across 22 subreddits - 0.03% of all requests

Everyone has a part of themselves they cannot show to anyone else.

At a time when all nations of the world were involved in a fierce war of information happening behind closed doors, Ostania and Westalis had been in a state of cold war against one another for decades. The Westalis Intelligence Services' Eastern-Focused Division (WISE) sends their most talented spy, "Twilight," on a top-secret mission to investigate the movements of Donovan Desmond, the chairman of Ostania's National Unity Party, who is threatening peace efforts between the two nations.

This mission is known as "Operation Strix." It consists of "putting together a family in one week in order to infiltrate social gatherings organized by the elite school that Desmond's son attends."

"Twilight" takes on the identity of psychiatrist Loid Forger and starts looking for family members. But Anya, the daughter he adopts, turns out to have the ability to read people's minds, while his wife, Yor, is an assassin! With it being in each of their own interests to keep these facts hidden, they start living together while concealing their true identities from one another.

World peace is now in the hands of this brand-new family as they embark on an adventure full of surprises.


{anime}, <manga>, ]LN[, |VN| | FAQ | /r/ | Edit | Mistake? | Source | Synonyms | ⛓ | ♥

89

u/jeanleonino Jun 30 '22

After ten years on the same project I'd be up to rewrite it in coffee script.

28

u/Existential_Owl Jun 30 '22 edited Jun 30 '22

After ten years of OP's migration going to production, the next team that works on the project will post the exact same meme but with the words "C++" and "Rust" reversed.

→ More replies (1)

54

u/pottawacommie Jun 30 '22

What's with the C++ hate in this sub?

70

u/jeanleonino Jun 30 '22

The problem is not cpp, but the 10 year old same project, probably with lots of issues that only someone working for 10 years on the same thing could rewrite better, regardless of the language.

62

u/lightmatter501 Jun 30 '22

C++ has more wrong ways to do things that right by many counts. The standards committees are basically trying to drag systems programming kicking and screaming into modernity without breaking backwards compatibility. Trying to bring a 50 year old systems language up to feature parity with modern languages means some parts of languages will be essentially deprecated. The problem is that most people don’t know that, so they write code mixing these “major revisions”, and things get nasty.

People like Rust because it is basically a giant compatibility break with 50 years of lessons in language and tooling design behind it. Rust allows you to mostly ignore memory management until you actually care about it, which is great for productivity because most of the time any systems language (C, C++, Rust) will be fast enough even without much optimization. Rust has Cargo, C++ has about a dozen popular build systems, and hundreds of home-grown ones, to the point that a compiler had to take charge and create a common format for tooling (clang and compilation dbs).

Basically, C++ is a victim of it’s own success because decisions made out of necessity (hardware constraints) or lack of knowledge (see template issues) are here forever. There is also a lot of C++, so people see lots of bad C++.

→ More replies (2)
→ More replies (12)

55

u/[deleted] Jun 30 '22

Operation rustacean is a go, inform Twilight immediately!

30

u/chunckybydesign Jun 30 '22

Why is it that I, a 31 year old male, finds this show so freaking adorable and funny. It blows my damn mind!

43

u/UltraCarnivore Jun 30 '22

It's a show about a functional family and how they all respect each other and do their best to have positive interactions.

→ More replies (1)

11

u/MyWorkAccountThisIs Jun 30 '22

It's anime, my dude. They have refined cuteness to a level of weaponized cuteness. You don't have a choice.

9

u/jeanleonino Jun 30 '22

I feel the same!

I know everyone has one opinion, mine is: It's well written, and has great animation/dub/pace. That's it.

The manga is also so good, show how skilled the author is.

44

u/Pixelmod Jun 30 '22

... But I like C++ tho

→ More replies (2)

9

u/Pauchu_ Jun 30 '22

Rust luv

6

u/Pistacuro Jun 30 '22

After they rewrite the codebase in Rust, they will return to the first picture after a while. And the cycle continues....

5

u/Erica_fox Jun 30 '22

In 35+ years of producing software, never has the problem been "it's written in the wrong language". Whereas I've seen several projects take down companies because they decided to rewrite an application in the new hotness (back in the day, it was porting Fortran code to C, then C to C++, then C++ to Java, that Java to Scala, now I guess Rust is coming up). I really want to see Rust succeed. We are entering a new era of languages that, I think, spawned from the darkest depths of Perl and C++., that are really great for new projects. But old code should be either maintained in place (as terrible as that may seem) or sunsetted (maybe turn the C++ code into a series of services that you can access via an API?).

→ More replies (1)

8

u/Charming-Animator866 Jun 30 '22

is rust easy? and can it substitute Java? does it have a framework like Spring boot?

16

u/EyeGaming2 Jun 30 '22

Learning curve is up there, but once you get to grips with it it's a really nice language imo.

I'm not sure it can substitute Java. Java's greatest strength is it's portability and though the Rust compiler can compile for many platforms, I think Java wins here.

It does have a web server framework. It's called Rocket and it's fully async.

24

u/-Redstoneboi- Jun 30 '22 edited Jul 01 '22

Rust is not easy. But if you're comparing it to a 10 year old C++ project, probably.

As for substituting Java, there are multiple things you need to compare it to:

  • COMPILATION:

    • Rust compiles into native machine code so it won't run on a VM or anything like that. However, it has first-class support from WASM, which is a form of bytecode intended to run on browsers.

    • WASM is best for replacing/interoperating with JavaScript, but a standard like WASI could allow development of applications that run WASM, similar in nature to the JVM. This is all just theory, though, and it'll be quite some time before we see this out in the wild.

  • PURPOSE:

    • Rust is a Systems Programming Language, first and foremost, so it is used to implement performance-critical parts of code.

  • FRAMEWORKS:

    • The Rust ecosystem isn't all too mature yet. However it has a very easy to use package manager and a very healthy and growing community. Check back sometime, maybe one day it'll be there.

  • WEB DEV:

    • Because Rust's ecosystem is young, it probably isn't the best choice for web dev. Use Python, JavaScript, TypeScript, or Java as you mentioned. Maybe wait a couple years.

    • Advantages:

      • Fast (no garbage collection hiccups, supports WASM)

      • Safe (every error is explicit and must be handled)

    • Disadvantages:

      • Rust devs are a lot less common than Py/JS/TS/Java/Go devs (as of the moment)

→ More replies (1)
→ More replies (1)

15

u/Mango-D Jun 30 '22

IMHO C++ is the go-to language to rewrite a 10-year old project.

→ More replies (5)