Back

r/rust icon

Go to rust

r/rust

•

1 yr. ago

met100

The Rust programming language absolutely positively sucks

I am quite confident that I will get torn to shreds for writing this post and called stupid, but I really don't care. I have to call a spade a spade. The emperor has no clothes. The Rust programming language is atrocious. It is horrible, and I wish it a painful and swift death.

I've been programming for well over thirty years. I'm quite good at it (usually). I have been told by many coworkers and managers that I'm super fast. Well, not in Rust!

I've used quite a lot of languages over the years, though I am by far the most proficient in Java. I started working before Java even existed, so I programmed in C professionally for 10 years too, then switched to Java. (I recall when I learned Java I thought it was the greatest thing since sliced bread.)

Now, here I am, forced to use Rust for a project at work. It is beyond painful.

All the advice out there to "go slow", "take your time", etc etc is just unrealistic in a real-world work environment when you have to actually accomplish a task for work. I need to write something that is highly multi-threaded and performant. I need what I need; it's not like I have the luxury to spend months building up to what I need from Rust.

Right off the bat, as a total Rust newbie, I'm hitting all kinds of rough edges in Rust. For example, I'm trying to use rusqlite. It would be natural to stash DB prepared statements in a thread local for reuse in my multi-threaded code. I can't pass the connections around, because I need them in a C call-back (too much detail here I know) so I have to be able to look them up. Alas, after banging my head against the wall for a full day, I'm just giving up on the thread-local approach, because I simply can't get it to work. Part of the problem is that I can't stash a prepared statement in the same (thread local) struct as the connection from which they are created, due to lifetime limitations. It also seems that you can't really use two thread locals (one for the connection and one for the prepared statements) either. If there's a way to do it, I can't figure it out.

Also right off the bat I am having trouble with using async in Trait functions. I tried to get it working with async_trait crate, but I'm failing there too.

All in all, Rust is a nightmare. It is overly verbose, convoluted, hard to read, slow to compile, and lifetimes really are a cruel joke. Googling for what I need rarely results in good answers.

I am truly convinced that all the people who claim Rust is great are either lying to themselves or others, or it is just a hobby for them. It shouldn't be this hard to learn a language. Rust feels like a MAJOR step back from Java.

I had to rant, because there is so much purple kool-aid drinkers out there on the Rust front. I call B.S.

Upvote

380

Downvote

207

comments

0 awards

Share

Share

Add a Comment

Sort by:

Best

Search Comments

Expand comment search

u/zuurr avatar

zuurr

•

1y ago

Right off the bat, as a total Rust newbie, I'm hitting all kinds of rough edges in Rust. For example, I'm trying to use rusqlite. It would be natural to stash DB prepared statements in a thread local for reuse in my multi-threaded code

I'm the maintainer of rusqlite. It's true that there are patterns you might be used to in C SQLite use that don't translate well to Rust. This is for safety reasons, Statements borrow from the Connection, which will definitely prevent the things you're trying to do.

Instead you should just use .prepare each time, or .prepare_cached if it's a large/complex query. It's fine.

Upvote

176

Downvote

Reply

reply

Award

0 awards

Share

Share

u/met100 avatar

met100

OP

•

1y ago

Thanks for the pointer to prepare_cached; I'll give that a look. Thanks also confirming that I can't do what I was trying to do. Seems very unfortunate, but good to know.

Upvote

75

Downvote

Reply

reply

Award

0 awards

Share

Share

u/zuurr avatar

zuurr

•

1y ago

The alternative would be for us to

Keep something like a Weak<Connection> on each statement (to ensure the statement is not used after dropping the connection, which would be a use-after-free)

Keep a thread id on the Statement (to ensure the statement is not used on a different thread from the connection, which would be a data race)

Track a few other minor pieces of book-keeping along similar lines.

Each time we use the underlying sqlite3_stmt, check that all the pieces of book-keeping match up for what is required for safe usage.

I experimented with this at one point but the overhead was substantial. The current approach has basically no overhead on statement usage (if you use the _cached api, there's a hashmap lookup on statement preparation), and is safe...

It does have the downside that someone more experienced with SQLite than Rust might try an approach that does not work well, though.

Upvote

70

Downvote

Reply

reply

Award

0 awards

Share

Share

u/met100 avatar

met100

OP

•

1y ago

It does have the downside that someone more experienced with SQLite than Rust might try an approach that does not work well, though.

Lol. That was my day. But again, thanks for the pointer. Tomorrow I will switch to using the _cached API.

Upvote

40

Downvote

Reply

reply

Award

0 awards

Share

Share

6 more replies

[deleted]

•

1y ago

stumblinbear

•

1y ago

So you started learning rust by trying to make something multithreaded that also interops with C instead of starting with something simpler so you can learn to understand the borrow checker? That's a recipe for disaster.

You're trying to write code in a way that is fundamentally different from the way Rust wants you to, that's the crux of it. Start smaller, learn what it wants from you, then writing what you need here will be significantly easier.

It sounds like you're trying to write things in an object oriented manner. Don't do that. Rust isn't object oriented.

Upvote

202

Downvote

Reply

reply

Award

0 awards

Share

Share

u/met100 avatar

met100

OP

•

1y ago

You're trying to write code in a way that is fundamentally different from the way Rust wants you to, that's the crux of it.

Wow, you can devine that from what I posted? You must be clairvoyant.

It's amazing how the rust community gaslights everyone that doesn't fall for the hype. Toxic.

Maybe if the Rust community wanted to discourage any attempt at being remotely object oriented, then chapter 17 of the Rust book - titled "Object-Oriented Programming Features of Rust" - should be removed. I did not attempt anything not referenced in the official docs. They have a chapter on Traits and how to use them in an object oriented way. And they have tons written on async and await. Yeah, only an idiot would assume you could put both features together. Silly me.

And as for using a thread local; what is "object oriented" about that? Sqlite explicitly states that you can't share connections among threads; trying to stash prepared connections in thread locals is perfectly reasonable to assume should be doable.

Upvote

51

Downvote

Reply

reply

Award

0 awards

Share

Share

stumblinbear

•

1y ago

If you're getting borrow checker complaints, that is the definition of doing something it doesn't want you to do. No clairvoyance to it.

You posted no code--not even pseudo code. If you wanted real feedback, then give us something to work with.

Upvote

64

Downvote

Reply

reply

Award

0 awards

Share

Share

10 more replies

cheater00

•

7mo ago

Wow, you can devine that from what I posted? You must be clairvoyant.

it's not hard, buddy. i've been programming even longer than you - your top post betrays some glaring mistakes when approaching an actually new-to-you technology.

sorry to break it to you, but all the languages you've known until now - Java, C, etc - are essentially the same language. the same semantics, the same stupid conceptual model of "follow a recipe step by step", global interference between disjoint parts, no types, etc. the differences are superficial: a different executable runs or compiles the code; the syntax is minimally different; dynamic dispatch is done with minimally different rules; there's a different set of libraries. you might think you know 20 different programming languages, but in reality, it's like... 3 or 4 tops.

most likely, being at the stage you're at, the only other complex language you know is SQL. if at some point you've found it hard to learn SQL, you'll know what it takes to learn an actually new language. you know, new, as in it works in a deeply conceptually different way. as in it's not just new syntax, it's new capabilities and new approaches to what's being done.

don't be stupid. you're acting stupid. you've been doing this for 30 years. be better and expect more of yourself. you can probably do it, but acting like the king on his throne who expects perfectly working programs to be bestowed upon him by ... spirits? fairies? peasants? isn't going to work here. this is the step where you have to put in actual, serious mental work. where you have to open a book like you did when you were first learning java or whatever ungodly corporate bs you started with in the 90s. start from zero and even go through the hello world tutorials, they will have massive amounts of knowledge you'll need later on. don't underestimate the complexity of a gedore toolset just because you've been playing with fischer price sets all your life.

Upvote

16

Downvote

Reply

reply

Award

0 awards

Share

Share

7 more replies

SvenyBoy_YT

•

1mo ago

As the rusqlite maintainer said to you in another comment, you are actually writing your program in a different way that Rust wants you to. You think it's toxic but that really is how it works. If you were having trouble with Java and you wanted to not use a class, then that is also trying to write code in a fundamentally different way to how you want to, but you wouldn't call a Java developer toxic or a gaslighter if they said that to you.

Now I'm not sure about the specific issue you had, but all those other complaints aren't valid. Lifetimes and the general "verboseness" are the only way to have a safe and fast program. Without a GC and lifetimes, you'll get use-after-frees and with a GC and no lifetimes, you'll get memory leaks. And with both you'll get dataraces. And slow compile times is such a silly complaint, who cares really? It's because LLVM is not very fast, but produces fast code. It's not like Java has speedy compile times either, but at least Rust has something to show for it.

Your management giving you a very difficult project in a language that is very strict to avoid errors where you have no experience is not the fault of Rust, it's the fault of the management. And even if that wasn't the case, that doesn't mean Rust should die. Just because one person had a bad experience with it doesn't mean no one else should get to use it.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/met100 avatar

met100

OP

•

1y ago

This is what I don't get about Rust advice. How you can you say "[start] with something simpler", when the task is what the task is? I'm not playing around here; I have something that is needed at work, and the decision to use Rust was not mine. The task *is* multithreaded, and in fact that was part of the reason for choosing Rust by the decision makers in the first place; supposedly it's fast for multi-threaded apps. No one on the project has ever used Rust before, BTW.

What is fundamentally different from the way Rust wants me to work? That is a serious question. Is it the thread local thing? Because DB connections absolutely should be prepared once and then reused over and over again, as the time to prepare the statements is high. Yet I absolutely cannot pass them around. A thread local seems very logical and natural.

Upvote

0

Downvote

Reply

reply

Award

0 awards

Share

Share

stumblinbear

•

1y ago

If your work needs something and you're unable to do it, that's not your fault or your problem. If they absolutely need it done by you, they need to allot the time necessary for you to learn how to do it. If you told them you had the experience to do it but you don't actually know a lick of Rust, it sounds like you have some nights ahead of you in your off-work hours as penance.

There really is no in-between, here.

This sounds more like a SPIKE than anything. You were given a task with unknown complexity in a language nobody knows. The chance of failure is there, you seem to have been tasked with researching it.

Now, to the actual issue: define thread-local. How are you keeping the connection in memory? Have you wrapped it in an Arc before cloning the reference into your different threads? Are the threads "always there" or are they created on demand? There are crates out there which will do db connection pooling for you, such as r2d2, if you haven't already looked at them

Upvote

108

Downvote

Reply

reply

Award

0 awards

Share

Share

2 more replies

ondono

•

1y ago

This is what I don’t get about Rust advice. How you can you say “[start] with something simpler”, when the task is what the task is?

Because your first task is learning your tools.

If you did not know C, would you really start by building a multi-threaded application that called python libraries?

It’s pretty clear that that’s a recipe for disaster.

the decision to use Rust was not mine No one on the project has ever used Rust before

Then that was probably a bad decision, and someone should have explained the decision makers that learning Rust would take time.

Upvote

32

Downvote

Reply

reply

Award

0 awards

Share

Share

SirKastic23

•

1y ago

•

Edited 1y ago

your work environment seems real shitty

management shouldn't take a decision about a technology that their devs aren't comfortable using

it makes no sense you're blaming rust instead of your bosses. what was the dev position? "dev needed, expected to know all the languages"

if you actually want to learn rust, to google that, there are many resources and communities out there.

for starters, you can always ask for help over on the forum or on the learning subreddit

second, there's the book. it goes over how to code in rust for people who already have some development experience (it even has a step-by-step for a multithreaded web server)

it'll take some time to build the skill necessary to code in rust, but that's exactly what makes it a good language. all the issues you're hitting that are slowing you down were errors that you were deploying to production

Upvote

48

Downvote

Reply

reply

Award

0 awards

Share

Share

1 more reply

[deleted]

•

1y ago

trevg_123

•

1y ago

•

Edited 1y ago

Just take a step back:) imagine you’re brand new to C and for your first project you encounter:

async (io_uring)

sqlite3, which is very easy to make pointer mistakes with

concurrency, proper thread synchronization, etc

of course that’s going to be daunting and extremely error prone.

Now getting Rust to compile the first time is painful. Extremely. But I guarantee that the first time it does, it will do exactly what you expect: no segfaults, no thread races, no async mismanagement, no “my struct’s string should print ‘hello world’ but it says ‘$3!19hwbqk7ny8!’”

Give it 0.5% of your 30 years experience with the other language, and you’ll kind of hit enlightenment: “I have to think about these same lifetime things when I write C, the compiler just doesn’t know about them”

And of course, we’re always ready to help when you get stuck!

Also, fwiw on performance - Rust scales extremely well. Getting the single threaded proof of concept is hard and takes time. Turning it into something that handles 10k requests/sec on 16 threads is almost trivial, significantly easier than C. So maybe just single threaded is a better place to start

Upvote

126

Downvote

Reply

reply

Award

0 awards

Share

Share

u/accidentally_myself avatar

accidentally_myself

•

1y ago

Gonna necromance + piggyback here since I'm new to Rust myself -- I find that the OP would make a lot more sense if they phrased it as "learning a completely new paradigm and language with heavy time constraints while implementing extremely nontrivial functionality... absolutely, positively sucks". Now that would be a very fair point, lol.

Upvote

34

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

ebyr-tvoey-mamashi

•

1y ago

IMHO the best comment so far

Even thou others aren't that bad -- yours just seems better than any other one. Great job, man, at least I got a lot to learn from you when it comes to formulating the ideas into text

Upvote

8

Downvote

Reply

reply

Award

0 awards

Share

Share

trevg_123

•

1y ago

That’s a very nice thing to say, thank you for sharing! I think I rewrote this comment like 7 times just thinking about my initial experiences with Rust and C… I am glad to know others can relate

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

Popular_Option_9286

•

4mo ago

significantly easier than C.

LOL so you are telling us that using a library that does EXACTLY that(multithreading) in C has to be harder than just using the rust environment?

Seriously are you joking? do you realize that you can probably literally just use a C library designed with 'simplicity and ease of use' in mind rather than learning a complete clusterfuck of a language with tons of syntatic buIIshit from scratch just to get 'ease of use' ?

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

trevg_123

•

4mo ago

It’s not hard to throw pthread_create at something in C. But yes, it is significantly more difficult to make sure your threaded code does the right thing.

int COUNTER = 0;

// always running

void thread1() {

while(1) {

delay(100 * MICROSECONDS);

counter += 1;

}

}

// spins up occasionally

void thread2() {

handle_something();

counter = 0;

}

There’s a race condition in the extremely simple above code, and I would guess that the majority of C programmers wouldn’t see it right away - much less so if something like this gets hidden behind a few more layers.

Imho, I find much easier if my compiler tells me exactly where I need a lock or atomic, rather than running into a difficult-to-reproduce race condition. Even good libraries don’t help reduce that risk as long as you need to send your types to the library.

Upvote

9

Downvote

Reply

reply

Award

0 awards

Share

Share

4 more replies

[deleted]

[deleted]

•

9mo ago

I learned C and C++ in a weekend, used C++ 20+ years without an issue. Rust is much more painful to start.

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

u/ZZaaaccc avatar

ZZaaaccc

•

1y ago

I'm really sorry to hear you're having problems! Inflammatory language aside, I've found this subreddit to be genuinely helpful with getting a handle on some of Rust's harder concepts. It certainly sounds like you've been thrown into the deep-end as far as using Rust is concerned, and I think that's terribly irresponsible of your employers.

I'm probably a few decades your junior so I won't pretend to know the answers to your problems. I will say that in general, Rust highly encourages clear ownership of data throughout your program, and discourages mutability as much as possible.

I would also suggest writing your program in the "dumbest" way you can first, and performance optimise it later. Because of Rust's compile time guarantees and really elegant testing (using cargo test and benchmarking with criterion), it's really easy to modify a Rust program.

Multithreaded? Don't bother. Write the single threaded version first, and use either tokio or rayon to add multithreading afterwards.

Caching? Too hard. You can use .prepare_cached as u/zuurr once it's working.

Bit-packing booleans for minimal memory usage? Just waste the RAM now and make a more efficient version later.

Lifetimes not working? Just clone the data, and don't bother with a reference. Deriving the Clone trait is one line of code (usually) and is surprisingly fast.

Compile times too slow? Yeah not much you can really do about that. I'd suggest using cargo check to minimise your issues, but sadly the Rust compiler does a lot of work on each compilation.

If you have any specific problems you're having trouble solving, post them here and you'll have heaps of people chomping at the bit to get the most upvotes for a correct answer.

I hope this helps!

Upvote

78

Downvote

Reply

reply

Award

0 awards

Share

Share

u/RelevantTrouble avatar

RelevantTrouble

•

1y ago

This smells like bait. I'm almost certain of it. I can't believe a programmer with 30 years of experience can't handle his manager. When a task is bigger than your skills you let management know early so they can assign someone better suited, when that is not an option you let them know you can deliver with your preferred language. No need to suffer like this.

Upvote

75

Downvote

Reply

reply

Award

0 awards

Share

Share

KhorneLordOfChaos

•

1y ago

I think OP is being genuine. I think it's just frustration that something is turning out to be much more complicated than it feels like it should be

I can understand that. I remember going through similar pains when I was originally learning Rust (although I didn't have the stress of having to deliver an actual project on top of things)

Upvote

45

Downvote

Reply

reply

Award

0 awards

Share

Share

natelovell

•

6mo ago

typical rust gaslighting

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

u/met100 avatar

met100

OP

•

1y ago

I assure you, it is not bait. Funny you say that about doing it in another language, because I *also* have it in Java, which I wrote on my own time (weekends). The problem is, I've been told that there's little chance the company would go with Java - despite the team being all Java developers - because of some emerging religion that "thou shalt write system code in Rust".

Upvote

22

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Royal-Bid-2849 avatar

Royal-Bid-2849

•

1y ago

It seems there are several problem at hand here :

you need it working asap (you have a Java working code, with a Java team around)

you don’t know rust, that is known to be hard and different from others languages (management hopefully stumbled upon this while googling the new religion ;) )

So you’re willing to skip all tutorials to do asap a complex task that you are used to write in other languages.

My approach would be :

propose to implement your Java working solution (not unmaintainable as Java team).

then learn rust ( you’re experience will kick in and help you speed up the process). Rust is known to be a different coding paradigm and management is expected to know this. At least show them a graphic or a screenshot from the internet about starting in rust

then write the thing, replace.

In your case the fastest way to code a complex rust program is that way. Skipping steps would be slower overall. You need to adjust to « rust thinking » first. The book helps a lot.

You also meet the « working asap » requirement with your already working Java code.

Cheers

Upvote

24

Downvote

Reply

reply

Award

0 awards

Share

Share

u/lordkitsuna avatar

lordkitsuna

•

1y ago

it's less about religion and more that multiple large companies did massive audits and found that 70+% of production vulnerabilities were memory based. see this and this which is why you are seeing a large shift in a huge number of sectors towards rust. it's more upfront work but with a large long term payoff.

Upvote

17

Downvote

Reply

reply

Award

0 awards

Share

Share

6 more replies

u/RelevantTrouble avatar

RelevantTrouble

•

1y ago

So a company that prefers Rust, and won't even consider Java? I think you are working at my dream Job.

Upvote

60

Downvote

Reply

reply

Award

0 awards

Share

Share

3 more replies

u/crusoe avatar

crusoe

•

1y ago

The rust version will use like 1% of the ram and 10% of the CPU...

At least that's been our experience with Rust services in k8s.

Upvote

17

Downvote

Reply

reply

Award

0 awards

Share

Share

zerosign0

•

1y ago

despite the team being all Java developers

Did the one that propose Rust has some due dilligence ? If it's more like an exploration tasks with discussable known risks (where all the devs also can provide a feedback to the timeline & devs plan) and you could do some exploration first then commit, I think it still doable. I think the problem in this case is either management/teams proceeds to YOLO stuffs without discussing the risks itself.

Upvote

7

Downvote

Reply

reply

Award

0 awards

Share

Share

68_65_6c_70_20_6d_65

•

1y ago

u/smart_procastinator avatar

smart_procastinator

•

9mo ago

I can empathize with OP. I’m not an expert in Rust and I follow this reddit subgroup to gain exposure to solutions of problems. Reading a lot on this forum, I’ve observed that the solutions offered seem to be inline with hacks. Examples such as use Box and then Dyn and do Mutex and it keeps going on and on which instead of simplifying the solution complicates it further. If someone needs to maintain Dyn<Box<Mutex<>>>, how does this fit an elegant solution? I’m gonna get bashed for this but I still posted it to understand the rustaceans view point

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

•

1y ago

u/Ill-Confection-9618 avatar

Ill-Confection-9618

•

3mo ago

you obviously have never worked for a very large company (think telecommunications) where these things are decided several levels above you and no one bothers to ask the developers which language they think would be best suited for the project. It doesn't matter if you go to your "project manager" or not. If they decide the language has to be Java and the database has to be Cassandra, then you are stuck with it and no amount of "suggesting" is going to change things.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/the_hoser avatar

the_hoser

•

1y ago

Sounds like the company you're doing this for has poor engineering management practices. This isn't Rust's fault.

Upvote

63

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Sufficient-Culture55 avatar

Sufficient-Culture55

•

1y ago

It certainly seems like you came into this project wanting to hate rust. That said, it's pretty irresponsible of your company to task you with something you are both inexperienced in, and unwilling to learn properly. If this is a time sensitive project, they should hire rust developers. If it isn't time sensitive, you should put time into learning the language properly.

Some advice on the db connection. You could maybe use mpsc. Not sure if it solves your problem perfectly, but it prevents multiple threads from owning the dbc

Upvote

26

Downvote

Reply

reply

Award

0 awards

Share

Share

u/met100 avatar

met100

OP

•

1y ago

I did not come into this wanting to hate Rust. I had no opinion of it either way when I started.

I am also not "unwilling to learn properly". What is properly? I've read the entire Rust book. I just don't have the luxury of writing a ton of tiny "learning" projects, and admittedly, I'm starting with a pretty complicated task. That said, I'm an *extremely* seasoned developer, so I *should* be able to figure out whatever needs to be done.

But why do Rust developers all say how important it is to "go slowly"? I mean, I've learned a lot of languages in my day, and never found one as painful as this. I've never *not* been able to do what I need to do in a language before.

I *will* get this to work, but I am afraid it will not be as performant as it needs to be if I have to re-prepare db statements. BTW, I also do need multiple threads to be able to access the DB concurrently. But sqlite requires that a single connection not be used concurrently by multiple threads, hence the thread-local desire for a connection.

Upvote

9

Downvote

Reply

reply

Award

0 awards

Share

Share

Anaxamander57

•

1y ago

Have you often been forced to learn a new language while simultaneously being pressured to create a high performance multithreaded application in that language? It seems like the problem here is mainly that you haven't been given a real chance to learn Rust and that you and your bosses have unrealistic expectations.

Upvote

62

Downvote

Reply

reply

Award

0 awards

Share

Share

1 more reply

u/the_hoser avatar

the_hoser

•

1y ago

It sounds like most of the languages that you've learned all share an algol-ish or c-ish background. That's not the only style of programming language out there. Being experienced in those languages might actually be working against you right now. The suggestion to start small is to help you get around that learning curve without crashing.

Upvote

22

Downvote

Reply

reply

Award

0 awards

Share

Share

workingjubilee

•

1y ago

Your experience can work against you if you are assuming that it's necessarily like the previous languages you have learned. Rust hails from somewhere between OCaml and separation logic, and only looks vaguely C-like on the surface because it dressed up in the local syntax to try to fit in and be more comprehensible.

There's quite a lot of JavaScript programmers who have learned Rust (and indeed from there as a springboard have gotten into quite low-level programming). I suspect it's because we're used to programming in a language that is another language that is masquerading in a questionably-tailored suit.

Upvote

17

Downvote

Reply

reply

Award

0 awards

Share

Share

cameronm1024

•

1y ago

Rust is different to every other language I've learned, in part because it was significantly more painful. Many paradigms that are common in other languages are inexpressible in Rust, and breaking old habits can be really hard. I almost think it's easier for a beginner to learn Rust than someone with 30 years experience, because the beginner doesn't have to unlearn patterns from C or Java or whatever.

It probably took 6 months before I felt comfortable in Rust, but I usually feel pretty productive in other languages after a weekend or 2. There simply is a big cost to learning the language, but there's a reward at the end that many people (especially on this sub) think is worth the pain. I personally found it to be a pretty humbling experience.

As many others have said in this thread, the fuck up is really on your employer. Sounds like a total management failure

Upvote

9

Downvote

Reply

reply

Award

0 awards

Share

Share

u/zombodb avatar

zombodb

•

1y ago

•

Edited 1y ago

Rust can be rough at first. I hired a trainer a few years back to teach me the basics and intermediate concepts. Like you I formally had countless years of C and Java experience.

When you hear “start small” or whatever my practical advice would be to break the problem down into a simplified program. Having trouble sharing something with lifetimes across threads? Sit down and write a little multi-threaded program that instead shares u32s. Once you get that working, which won’t be hard, change it to share &u32s. Sort out the lifetime issues with that. Then add mutation into the mix and look into Mutexes, RwLocks, and Arcs. Then take those lessons back to your original problem and code.

I can’t speak to the specifics of rustqlite but I’d imagine you can totally share connections or prepared statements or keep them as a thread local so long as they’re properly guarded.

With 30y experience you’ve got a huge advantage since you understand looping and branching. Weaving in Rust’s new concepts of ownership takes a bit, especially after doing Java for so long. Soon tho you’ll find that Rust is kinda like Java in that you still don’t need to worry about garbage collection — you just have to worry about the stack and ownership.

And for the record, Rust is great. I am not lying to myself. I write it every day for my real job along with my coworkers that are also experienced rust programmers and also think Rust is great. We’re real people.

I’d also suggest reading the Rust Book a few times. I still go back to it at least once a month.

Good luck out there.

Upvote

18

Downvote

Reply

reply

Award

0 awards

Share

Share

u/qdot76367 avatar

qdot76367

•

1y ago

So this is what aging out of your career looks like.

Upvote

17

Downvote

Reply

reply

Award

0 awards

Share

Share

u/met100 avatar

met100

OP

•

1y ago

I'm sure I could still run circles around you. I know someone with a mind of their own is not something youngsters like these days; sheeple.

Upvote

20

Downvote

Reply

reply

Award

0 awards

Share

Share

u/eboody avatar

eboody

•

1y ago

this doesn't seem like a very mature response to an immature comment.

I hope that when I get older that I'll adopt a wholesome fatherly persona and apply it to childish responses like u/qdot76367's

Upvote

17

Downvote

Reply

reply

Award

0 awards

Share

Share

xkalibur3

•

1y ago

Pretty sure it's hard to keep the "wholesome" persona, when someone is so deeply frustrated and stressed at the moment, especially while replying to immature comments.

Upvote

14

Downvote

Reply

reply

Award

0 awards

Share

Share

1 more reply

Vegetable_Lion2209

•

2mo ago

I hope that when I get older I stay sharp and full of gumption like u/met100, and have the odd pop at upstart whippersnappers

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/kohugaly avatar

kohugaly

•

1y ago

I am quite confident that I will get torn to shreds for writing this post and called stupid, but I really don't care. I have to call a spade a spade. The emperor has no clothes. The Rust programming language is atrocious. It is horrible, and I wish it a painful and swift death.

Yes, this is a typical initial reaction actually. I rage-quitted maybe 2 or 3 times with a few months of programming it, until it "clicked" for me. However, unlike you, I had the luxury of learning it as a hobby. I had the option to drop it on the spot and come back to it later.

It seems your management dropped the ball on this one. They expected you to tackle some complicated problems as a newb in a language that is infamous for being hard to get into even for experienced programmers. They should have included at least a month of training in their plan, especially when nobody on the team is proficient in Rust.

On paper, Rust is a multiparadigm language. In practice, the ownership and borrowing system is a paradigm of its own. It has its own coding patterns that you couldn't have possibly learned anywhere else, because no other language imposes these kinds of limitations on your code. It simply takes a bit of time to learn them.

I do not have any specific advice, unfortunately. All I can give you is a virtual pat on the back.

Upvote

16

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

1y ago

Rust feels like a MAJOR step back from Java.

Yikes, you really do sound like an aging engineer. Ive dealt with Java for about a decade, we quite literally have whole departments dedicated to supporting our live Java applications, why? Because Java is Java and garbage collection is great only on paper not at scale in distributed systems. This among a couple of other snippets from your rant say allot about your approach that would make a 'good' engineer wince, even your definition of good, using good interchangeably with 'fast'.

I feel its likely that your decades of experience are working against you, especially your specialization with java which arguably is the greatest sinner as far as the sins Rust claims to alleviate or resolve completely.

The short of it is, Rust has a steep learning curve especially (and im speaking from personal experience now) for those moving from Java. But believe me when i say it, once i got to grips with the borrow checker and lifetimes and really understood what was happening i found that ive never been more comfortable or more capable of building solutions in a timely manner than i have with Rust.

Upvote

14

Downvote

Reply

reply

Award

0 awards

Share

Share

u/llogiq avatar

llogiq

•

1y ago

I also moved from Java to Rust, and my experience couldn't differ more. In Java, I had to be very careful not to introduce race conditions, and only would get ConcurrentModificationException on a best effort basis. Or I'd need to add locking with its own set of performance and deadlock-risk caveats. In Rust, I simply cannot reach those points because the compiler will tell me off. I still can use map-reduce style parallelism with rayon just as if I was using Java Streams without having to wrestle with GC configs to make it fast.

I am however wary about using async; if I can avoid it, I'll usually stick with threads. Also wrapping C code to create a good API is masterclass Rust.

All in all, thanks for being forthright with the problems you encountered. I think the important thing is to not blindly react to the perceived negativity and use the lessons of your experience to improve the situation for everyone.

Upvote

14

Downvote

Reply

reply

Award

0 awards

Share

Share

u/eboody avatar

eboody

•

1y ago

i really like this comment.

I'm (I think) at the stage between beginner and intermediate. I'm not sure what this says about me but the intuition about when to make something async and when to do something in a new thread still eludes me.

From what i understand you do async things when the overhead involved in creating a new thread isnt appropriate and you do things in a new thread if the task is so computationally heavy that it's better to relieve the main thread of that burden.

Is that right?

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

u/llogiq avatar

llogiq

•

1y ago

An easy rule of thumb is: Threads are for running together, async tasks are for waiting together. So if your workload contains unserialized file or network IO, going async might be a good idea.

Upvote

6

Downvote

Reply

reply

Award

0 awards

Share

Share

u/I_Love_Vanessa avatar

I_Love_Vanessa

•

1y ago

It is horrible, and I wish it a painful and swift death.

I have to disagree with you.

I do not want its death to be swift, I want it to be painful and extremely slow, preferably as long as it takes for a Swift program to compile.

Upvote

14

Downvote

Reply

reply

Award

0 awards

Share

Share

u/LoganDark avatar

LoganDark

•

1y ago

Your Swift programs finish compiling?

Upvote

8

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Rafael20002000 avatar

Rafael20002000

•

7mo ago

You guys are compiling?

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

1 more reply

SirKastic23

•

1y ago

Rust isn't a language you can just pick up on one day.

You just have a bad experience, you shouldn't be tasked to write a complex program in a language you don't know.

Rust is the kind of language you learn first, and use later, it takes proficiency.

I can write Rust fast like it's no issue, but it also took me over a year to get here.

skill issue

Upvote

12

Downvote

Reply

reply

Award

0 awards

Share

Share

u/_TheDust_ avatar

_TheDust_

•

1y ago

•

Edited 1y ago

The Rust programming language is atrocious. It is horrible, and I wish it a painful and swift death.

[...]

All in all, Rust is a nightmare. It is overly verbose, convoluted, hard to read, slow to compile, and lifetimes really are a cruel joke.

At least you’re providing constructive criticism

I've been programming for well over thirty years. I'm quite good at it (usually). I have been told by many coworkers and managers that I'm super fast. Well, not in Rust!

Maybe you're not as good at programming as you thought. Or looked at differently, you're good at programming use a particular set of language and Rust does not fit into that set (yet?).

Upvote

10

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

•

1y ago

u/iancapable avatar

iancapable

•

1y ago

Meh I’m coming to this late… I’m genuinely interested if OP persisted and solved the problem!

I’ve been writing code commercially now for ~23 years. I started learning rust. I too have a mainly Java / Kotlin background. I also used to write c and c++ (along with another 20-30 languages).

Tbh I can understand the frustration - lots of things I’d do naturally in Java - I can’t do in the same way as rust. However a poor workman will blame his tools….

I started learning rust as follows:

I wrote a demo program in a day. I was hooked.

I wrote a more complex program and I had issues.

I took a step back and understood that I had to unlearn all my OOP bad habits. Yes it’s great that Java takes care of stuff under the hood. Rust makes you do it. As an engineer you adapt.

My third mini project (not so mini) is a distributed log (think Kafka in rust) - highly multithreaded. I’m getting there. And I don’t buy this idea that rust is hard, you just change your thinking slightly, take a step back and work the problem like an engineer would.

I honestly would love to know how the story ends - and as one old timer to another - we shouldn’t be set in our ways.

Upvote

9

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Sw429 avatar

Sw429

•

1y ago

•

Edited 1y ago

The fundamental problem I'm seeing here is that you were thrown into a project that was way too complicated to be done alongside learning a new language. Your manager is a fool for doing this. They need to give you ramp-up time when you start on any new technology. The task may be the task, but you can't actually complete it without learning the language first. Either convince your boss to let you write it in C, or convince them to give you enough time to figure out what you're doing in Rust.

Such a project would be hard when migrating to any new language. Imagine you had only ever coded Python, and suddenly you're told to write your same project in C. Your quickly face a whole other slew of errors: segmentation faults, undefined behavior, etc. You'd try storying self-referential data, like you were complaining about being unable to do in Rust, and then wonder later why your pointers randomly become invalidated when you move your structs around. You'd come on Reddit complaining about how C sucks and why the hell wouldn't anyone use Python instead.

Upvote

8

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

1y ago

"Rust feels like a MAJOR step back from Java." Successful troll is successful.

Seriously it's just not possible for a Java programmer to complain about ANY other language with a straight face.

Upvote

7

Downvote

Reply

reply

Award

0 awards

Share

Share

Trader-One

•

1y ago

Rust is trying to solve problems which are ignored/undefined behaviour in Java and many other languages (for example Go, C++).

This makes naturally language more strict but it is trying to enforce what you should be coding anyway.

Do not blame rust for lifetimes. Rust haven't invented lifetimes. They exists in C/C++ and many other languages. You can't use pointer after structure he is pointing to got freed. Its universal rule.

Upvote

6

Downvote

Reply

reply

Award

0 awards

Share

Share

u/trs-rmc avatar

trs-rmc

•

1y ago

I think the idea behind “going slow” with rust is that you get used to idiomatic rust. Because of the safety guarantees and language models it is either really hard or impossible to write non-idiomatic rust, which is very different for most programming languages where you can shoehorn non-idiomatic code.

One thing I realized in my still ongoing learning of rust is that, when something doesn’t work the way I was expecting or it’s getting really hard to do, it’s because I am approaching the problem the wrong way.

Maybe you could try this approach. Instead of trying to fight against rust, try to understand what it is trying to tell you. Maybe your design choices doesn’t fit well with rust programming principles so you should try to redesign your program. In the end, it will guide you to a safer and more performant code.

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

RemusWT

•

1y ago

You can't teach an old dog new tricks

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

u/hydrogen2718 avatar

hydrogen2718

•

1y ago

Rust seems to have a very steep learning curve, it took me quite a while and a lot of coding in Rust before I started to like the language. Also I get your comment on googling being useless, borrow checker problems are often so context dependent that there is no one thing to google. I've found the questions post in this sub here quite helpful for figuring out why what I wanted to do just doesn't make sense in the world of the borrow checker.

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

u/spoonFullOfNerd avatar

spoonFullOfNerd

•

3mo ago

Idk, the rust analyser is excellent at pointing out exactly where the issue is and oftentimes gives a very Google-able error number. That is in my experiences anyway.

Lord knows I haven't had the opportunity to debug unsafe, multi threaded FFI code.

Thoughts and prayers to OP, lol.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

1y ago

How are you feeling op? Still the same? I know it been very slow for me to learn any programming language and rust even more so.. but things do eventually click and then start to feel natural.

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

aikii

•

1y ago

it's not like I have the luxury to spend months building up to what I need from Rust.

well either way you will have that luxury or have to drop the project altogether. Just don't ruin you health on this, it's bad planning in the first place, shit happens

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

BehavedJackMott

•

1y ago

Nothing really wrong with what your experience has been. Imagine if you had never used C++ before and someone had you trying to do this same project in C++?

Neither language are good for a newcomer to pick up and do hard or big projects with. They are languages where the performance is necessary, and they are hard.

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

u/techzilla avatar

techzilla

•

5mo ago

C++ is better for the new user, if they have a C background. If you came from a Python background.... you don't know systems level concerns enough to know how painful shit should be.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

---nom---

•

1y ago

Here's some JS vs Rust, which shows clearly why Rust is icky.

JS const arr = [1, 2, 3, 4, 5];

const doubled = arr.map(x => x * 2);

console.log(doubled); // Output

Rust fn main() { let arr = vec![1, 2, 3, 4, 5];

let doubled: Vec<i32> = arr.iter().map(|x| x * 2).collect();

println!("{:?}", doubled); // Output: [2, 4, 6, 8, 10]

}

-- JS function add(a, b) { return a + b; }

Rust fn add(a: i32, b: i32) -> i32 { a + b }

-- JS console.log("Hello, World!");

Rust println!("Hello, World!");

-- Rust is a complete mess. I'm writing quite a few programs in it - however it's a complete disaster. For Python programmers they'll tend to like it, but for people who like to write clean code - it's horrible.

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

u/EuXxZeroxX avatar

EuXxZeroxX

•

1y ago

Rust is a complete mess.

Meanwhile in JS

< add(-1.0, [1,2,3])

> -11,2,3

< add(-1.0, {})

> -1[object Object]

Upvote

10

Downvote

Reply

reply

Award

0 awards

Share

Share

8 more replies

cidit_

•

1y ago

Bruh what 💀 what's wrong with it???

Upvote

6

Downvote

Reply

reply

Award

0 awards

Share

Share

QuickSilver010

•

1y ago

explicit types is icky?

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

3 more replies

u/Ill-Confection-9618 avatar

Ill-Confection-9618

•

3mo ago

that syntax is absurd

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

cidit_

•

1y ago

u/met100 we want an update!

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

FelixLeander

•

1y ago

Your new in rust, so let's say at best because of your previous experience you are a junior.

Would you give a junior the ask you have right now?

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

u/RareIndependence2020 avatar

RareIndependence2020

•

1y ago

False. Using a new language does not make you junior.

Upvote

4

Downvote

Reply

reply

Award

0 awards

Share

Share

2 more replies

fullouterjoin

•

1y ago

I am sorry for your pain.

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

---nom---

•

1y ago

Yeah, Rust is pretty bad. It's like they wanted to make the language as unreadable as possible for no reason. All the keywords are shortened as if we're writing it on a t9 keyboard. And the syntax is unnecessarily unique.

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

u/mrxyz9999 avatar

mrxyz9999

•

1y ago

Agree! I started learning it after programming for over two decades in C, Ada, fortran, pascal... and it is the stupidest thing! In college, i learnt there are two classes of languages: structured and OOP, and now i learnt there is a third dumb class which contains rust! Full of obfuscation, strange syntax, i was disappointed after all the hype! It would be a sad day when linux kernel sees first line of rust code........ These half ass software engineers who have no clue of computer science or software engineering, are making decisions they should stay away from!

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

u/zennsunni avatar

zennsunni

•

1y ago

I don't know anything about Rust, but I found it interesting in the most recent TIOBE index that Fortran is more popular than, and growing faster than (by their metrics), Rust. I don't read into that, I just thought it was funny.

Perhaps the most telling thing to me, as someone curious about learning the language versus pushing deeper into C++, is that C++ is growing in the TIOBE index about 4x faster than Rust.

I guess what I'm getting at is that unless you need to learn Rust for a job or something, you would probably be better served learning another compiled language like C++ or Go just as a general statement. The notion that Rust is going to displace C++ in any kind of meaningful way seems farfetched to me.

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

brightblades

•

10mo ago

It's the politics that drove me away. It's absolutely insufferable.

Upvote

3

Downvote

Reply

reply

Award

0 awards

Share

Share

JhraumG

•

1y ago

you're using rusqlite, you can prepared &cache statements. Would it suits your needs ? I think you need a pool of threads and connections prepared aside your async processing (since SQLite seems not that async ready, even though there is a tokio-rusqlute), and probably some channels to link both words : you could also prepare them once and for all by running the same code multiple time at the start of the program (I suppose there are created to handle such connection pool, but I never used SQLite, so I can't tell).

For the rant itself, I must say that usually rust feels akin to java ) the fluent notation, iterators vs Stream,...) but more consise. And javacc/maven/Gradle are really slow, incremental compilation should feel feast for you since the project is young this small I guess

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

JhraumG

•

1y ago

(I suppose there are created to handle such connection pool

I suppose there are crates to handle such...

Should no respond from phone, but only read reddit from it :-p

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Kodieg17 avatar

Kodieg17

•

1y ago

My advice would be to simplify your architecture to have something to start with. Accept possibility that you will sacrifice some performance you would have if you write C and start making some progress. All in all when you learn enough, it will be easier to make more complex or unsafe solutions.

Learning rust takes time not because language is very complex but because you need to learn new patterns and libraries that provide safe abstractions for otherwise unsafe code.

One escape hatch is unsafe which is quite hard to learn (be sure to learn it and not assume its C) , other may be box::leak and maybe crate owning_ref.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

1y ago

Well, first of all, I think the downvoting is a bit unfair. I get your frustration. That said, Rust isn't bad, it just isn't a good fit to achieve what you want to achieve.

It is kinda awkward how management forces Rust (Go, any other technology) usage because they heard it's "fast" ("easy to pick up", "trendy" etc.) Sometimes it's plain wrong to use something, and it is quite obvious if you stop thinking in terms of hype.

JS+Node: a shitty fit for avionics.Rust: a shitty fit for prototyping browser apps.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

1y ago

With years of experience in C#, it surely was hard to start with Rust, not because the language is verbose or anything, but because Rust introduces a different way of programming that is focused on correctness and actually thinking through how you manage memory.

Being forced to learn Rust at work, with project deadlines, is not the way to learn not just Rust, but any language. If you can step back and take some time to really understand the language proposals, you'll understand it's advantages.

My personal experience, after really understanding the different concepts Rust introduces, I feel more productive coding in Rust after a few weeks of learning, than in C# which I have years of experience. There's no boilerplate to go through, the language is less verbose, no runtime surprises if you're using safe Rust only, less production bugs due to unexpected behavior, it's just better in a lot of ways.

Of course it's not all roses, Rust is still a relative new programming language, async in traits is something the Rust team is working already, to make it work seamlessly like in other languages.

Just like everything in tech, it's all a trade-off :)

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/RareIndependence2020 avatar

RareIndependence2020

•

1y ago

There's no boilerplate to go through, the language is less verbose,

2 absolutely untrue statements.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

1y ago

So, you were thrown into using that language without your employers giving you time to learn the language. Uff. That's just bad from a management pov.

I would recommend you to talk with your co-workers about it and how they are doing. It's always easier to learn something as a group than alone (and to complain to management if needed). It's often the case that you need to relearn how you solve certain problems.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/jdzndj avatar

jdzndj

•

1y ago

Rust is a radically different language from Java. If you never programmed in ML family languages, the frustration is understandable. However, Rust itself is a really nice language to work with. I’ve introduced Rust to our predominantly Java team and people started loving it after a period of adjustment. It’s probably the management’s fault making a programmer hate this wonderful language.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

fantasmagorix

•

1y ago

So yeah, you switched from like English to Japanese, and now you are surprised it's not just Aussie dialect...

I started learning Rust just recently. To get bit more bare-bone after like 30yrs of programming again, but with something modern. It's a steep ride, but it's fun.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/mkartist avatar

mkartist

•

1y ago

So in your 30 years of career in programming, you really had to complain about Rust to us Rust developers who don’t have any deal with your work, not the company who ordered you to use Rust?

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

1y ago

Man, plz just return to Java

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/RareIndependence2020 avatar

RareIndependence2020

•

1y ago

kool aid drinker

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

jwburn19

•

1y ago

Please pass along your company information…I’d love to know more about a company that wants to use Rust, especially if they’re looking to hire developers who’d love to be using it professionally :)

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/sirnewton_01 avatar

sirnewton_01

•

1y ago

I found the transition from Java to Go to be quite pleasant. Perhaps that’s another option for a compiled language with good performance options. It compiles quickly too.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

•

1y ago

07dosa

•

1y ago

I'm a C guy, too, and I found my inner peace by concluding that Rust is just a new Java, both in good and bad ways.

The one common mistake they both make - there's no good ideas that is true in every single context.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

•

1y ago

68_65_6c_70_20_6d_65

•

1y ago

u/Sarwen avatar

Sarwen

•

10mo ago

•

Edited 10mo ago

> I am truly convinced that all the people who claim Rust is great are either lying to themselves or others, or it is just a hobby for them. It shouldn't be this hard to learn a language. Rust feels like a MAJOR step back from Java.

Your rant was to be expected. Actually I completely understand your points. You seem to have been forced to use a language on a project with heavy time constraints. Let's start by being clear: Rust disallow a lot of standard techniques. Learning Rust for us with a lot of experience in other programming languages is unlearning lots of things. Of course it's frustrating.

Rust is great for what it provides: very good safety guarantees while letting you a lot of control. Of course it comes at a price: you have to program in a way that makes the type-checker happy. Is Rust more difficult to learn than Java? Yes, for sure. But it brings cool features: you can make your objects live on the stack, which is a HUGE performance boost for data processing (it's not really a surprise considering almost every data-oriented java application goes off heap).

> All in all, Rust is a nightmare. It is overly verbose, convoluted, hard to read, slow to compile, and lifetimes really are a cruel joke. Googling for what I need rarely results in good answers.

You have to consider these points in regards of what Rust offers. Considering the control Rust gives you over where data lives and when, it's actually very concise. Lifetimes exist in every language with no GC. The only difference in Rust is the type-checker is helping you to be correct while C/C++ let you on your own (we all know segfaults, double-free and leaks are a myth ;) ).

I have almost 30 years of experience in software development too. I've been learning Rust of some years now and I had to learn the Rust way of doing things. It means I had to unlearn a lot, develop a deep understanding of the consequences of ownership on what is possible and what is not (without cheating, of course). Was it worth it? Oh Yes!! Seeing Rust process terabytes of data in no time with no bugs on the first try is so enjoyable!

Like others here said, the problem is neither you nor Rust. The real issue is your company's management. Rust is not a drop-in replacement for Java/C, it's a completely different language with a completely different paradigm. I've seen this situation happening much to often with Scala:

- Step 1: a company adopt the language because the hype says it's cool.

- Step 2: management don't plan a serious training for developers to learn this new tech.

- Step 3: management don't let developers time to train by themself because they think software development is a sprint, not a marathon.

- Step 4: the Dunning–Kruger effect burns developer hard when they realize the new tech is not as magical as they though.

- Step 5: everyone blames the new tech for being so complicated and so unproductive but no-one ever question low-training and toxic deadlines expectations.

A new tech has to be chosen carefully, taking into account all the costs and benefits involved. It does include training.

As a side note: experience matters in the context the experience was gained. Learning a new language is still learning something new. The more unknown concepts/techniques there are to learn, the more time and practice it requires.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

prtamil

•

7mo ago

u/No_Rutabaga5267 avatar

No_Rutabaga5267

•

3mo ago

Rust is california hypetrain crap.  Slow garbage no one asked for.  "Its new, it must be better".

You know why most development languages look similar?  Because that syntactical structure works, and it works well.   New often means worse, not better,  and this is no different.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/AcaLudi avatar

AcaLudi

•

3mo ago

You are so right with all you've stated here.

Rust is bad news for any real engineer/developer.

This comes from C/C++/Java/Typescript/PHP/C#/Obj C/Visual Basic developer. +20 years of experience.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

aikii

•

1y ago

Also, given that frankly this is more a career situation than a programming language issue I would suggest seeking feedback on r/ExperiencedDevs

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/That-Stranger-7298 avatar

That-Stranger-7298

•

3mo ago

I am also new to Rust. I can understand why people like it. A language that forces a "safe" result is very attractive, but I also take issue with the syntax. It seems the same goals could have been achieved with a simpler syntax. There are times when I feel like Rust syntax is the way it is simply to be different and not because there is an advantage. idk, maybe I'll feel different in a few months ...

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/pentichan avatar

pentichan

•

2mo ago

i’m not in the industry and i’m hardly even a programmer at all at this point in time but i am curious, why would your job ask u to work on a project specifically in a programming language that u don’t know? is that a normal thing? why wouldn’t they hire someone who already knows rust to get the job done instead of handing the project to a complete rust newbie and saying “figure it out i guess”?? that just sounds inefficient for both the programmer and the company

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/_filmil_ avatar

_filmil_

•

2mo ago

I have an impression that getting to rust by way of C++ (and especially having been burnt by C++) is the canonical path to rust.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/a97ebb9bbb avatar

a97ebb9bbb

•

2mo ago

•

Edited 2mo ago

You are right. I agree with you. I have the same feeling, and also feel there is very few of people want to shout it out.

The issue you've met is just a case showing the language sucks. And I believe there is a solution to a problem in this language does not mean it does not suck.

Overall the language SUCKS! Totally agree. A bucket of water depends on the shortest plank. There ARE smart parts of the language, but some stupid parts make it stupid finally.

PS: unwrap() all over a project is stupid, and I saw lot of projects doing this.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

sedj601

•

2mo ago

I am starting to learn rust coming from Java. I am curious about how it is going for you a year later.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

ghi7211

•

1mo ago

I understand your frustration with Rust, and I appreciate your candid feedback. Adopting a new programming language, especially one as complex as Rust, can be a significant challenge, especially in a real-world work environment with tight deadlines.

Understandably, you need help with some of Rust's unique features, like the borrow checker and lifetimes. These can be tricky concepts to grasp, and it takes time and practice to become proficient. The lack of readily available solutions for your specific use case with SQLite is also a valid concern.

You need to remind yourself that you're not alone in your struggles with Rust. Even seasoned developers can find the language's learning curve challenging. Your concerns about the practicality of 'go slow' and 'take your time' advice in a professional setting are valid.

At the same time, I wouldn't completely dismiss Rust as a language. It does have some powerful features, like its focus on memory safety and concurrency, which can be incredibly useful in the right contexts. But it's not a silver bullet, and there may be better fits for some projects or developers.

Your feedback is invaluable, and I appreciate your candid thoughts. It's crucial to have diverse perspectives, particularly when it comes to emerging technologies like Rust. Your insights could potentially help the Rust community better understand the real-world challenges developers face and contribute to future language improvements.

Ultimately, you should use the best tools and languages for your specific needs and preferences. There's no one-size-fits-all solution in the world of software development. Keep an open mind, but don't be afraid to voice your concerns and frustrations. Constructive criticism can be a valuable part of the evolution of any language or technology.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/audulus avatar

audulus

•

1y ago

Rust targets a certain domain (systems programming, usually the domain of C) but offers (awesome) safety guarantees. I think it might be hard to craft a simpler/easier language that achieves that because you need a pretty rich type system (traits) and a borrow checker at minimum. You need traits to express constraints on what you can pass between threads, etc. You need a borrow checker to ensure you are safely using references. You can't have a GC'ed environment like Java, which makes things much easier.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

SirKastic23

•

1y ago

I've replied this in another comment but actually i want this replied directly to you:

if you actually want to learn rust, google that, there are many resources and communities out there.

for starters, you can always ask for help over on the forum or on the learning subreddit

second, there's the book. it goes over how to code in rust for people who already have some development experience (it even has a step-by-step for a multithreaded web server)

it'll take some time to build the skill necessary to code in rust, but that's exactly what makes it a good language. all the issues you're hitting that are slowing you down were errors that you were deploying to production

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

CornedBee

•

1y ago

I can't pass the connections around, because I need them in a C call-back (too much detail here I know)

A callback API without a context parameter? I pity you for having to work with that. Sounds far worse than Rust.

Upvote

0

Downvote

Reply

reply

Award

0 awards

Share

Share

u/No_Rutabaga5267 avatar

No_Rutabaga5267

•

3mo ago

I pity da foo who writes rust

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

•

1y ago

New_Percentage931

•

1y ago

If you are an experienced programmer, I don't think you have to learn Rust. You can already master the lifetime of references in C/C++. I don't think concurrency and reference issues are a problem for experienced programmers. Generally speaking, those who claim that C/C++ memory is unsafe are usually beginners.

If you want absolutely memory safety, functional language with GC builtin is best for

many applications, for example Elixir like language is best.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/PowerSideKick avatar

PowerSideKick

•

1y ago

the problem is these don't know C/C++ well, try to use segfault and threading as excuse to get away from them.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/ma-2022 avatar

ma-2022

•

10mo ago

Anyone else here from a ThePrimeTime video?

https://www.youtube.com/watch?v=BB-H5ivmdwQ

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

[deleted]

•

10mo ago

I am still scratching my head how a person with 30 years of experience is still working as a dev/programmer? He must be in his 50s and he must be already in a management role.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Enough-Monitor-7634 avatar

Enough-Monitor-7634

•

10mo ago

•

Edited 10mo ago

Because management is not the end goal of many really good engineers? Some of the worst programmers I know try to race to management as quickly as possible.

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

GregMoller1

•

8mo ago

I'm still scratching my head why people would think a good developer would ever want to be a manager. Manager vs Programmer are two extremely different skillsets. Of course, there are some who can be very good at both, but in general they are two very different lanes. I feel it is a such a loss when I see a good developer move into a management role, but each to their own.

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

[deleted]

•

10mo ago

Outside_Scientist365

•

10mo ago

Just so you know, your post got picked up https://www.youtube.com/watch?v=BB-H5ivmdwQ

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/thenegativehunter avatar

thenegativehunter

•

7mo ago

new to rust. trying to create a global variable. they made it impossible to make one without overhead -_-. i'm tired of all this bullshit languages like swift and kotlin and rust trying to guarantee safety while forgetting what programming is.they aren't trying to improve data safety. they are trying to guarantee it while forgetting what programmers need to do.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

FutTra

•

7mo ago

You should learn a new language before you start using it. You should know this with your 30 years of experience. You are trying to do something the old way: Wrong structure, methods and principles. From the perspective of 40 years of coding, I can tell you to forget your ego and just be humble and grateful: the signs of a very good programmer.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/QuickPieBite avatar

QuickPieBite

•

7mo ago

What the editor are you using? Just tell us!

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

natelovell

•

6mo ago

agree, rust is garbage.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

smith987654321

•

6mo ago

the empire really is naked... rust sucks.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

moonboyzzz2

•

6mo ago

"Trying writing c code in java I'm so frustrated."

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Ok-Victory168 avatar

Ok-Victory168

•

6mo ago

AI will render these over verbose languages useless in the next 5 years.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

SnooCupcakes3855

•

5mo ago

u/Ill_Ad7271 avatar

Ill_Ad7271

•

4mo ago

Learning Rust is easier than managing C++ dependencies.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

Smart_Bonus_1611

•

4mo ago

Any language that either has a stupid name or gets "updated" more than once per decade can't be taken seriously.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

s3r3ng

•

4mo ago

I don't want a language that tweaks bit level stuff or that gets all pedantic about internal computer details. I want a language that is great for building with logical inter-operating abstractions, a language that allows me to succinctly capture and exploit every recurring pattern I come across getting computers to do what I would like them to do. That ain't Rust.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

s3r3ng

•

4mo ago

I have been paid to program in at least 10 languages and have taken the time to learn at least a dozen more. Rust is at a level I seldom work in.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

Popular_Option_9286

•

4mo ago

•

Edited 4mo ago

rust dev be like "instead of debugging for 2 days, I'll learn some overlycomplicated and convoluted clusterfuck, I like to spend my time reading about other peoples mental construct of what programming should be like just to get around trying to run a database without memory leaks"

Ohh and don't forget how much they like syntactic sugar, they live for learning new tricks to make their code even more unreadable and obfuscated for people who didn't spend 2 month learning about all the syntax

C dev be like: programming is programming and C is the only language with the best compilers and its compiled straight to assembly not like python running 10x slower

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

mpw-linux

•

3mo ago

No_Excitement1337

•

3mo ago

I am with you, brother!

I hate this syntax, it's so anti-everything I knew. And everybody always preaches it's safety. But in the end it produces the same x86 operations than every other language on x86. It only protects you from your own stupidity, and I think you have to burn yourself first to learn from your mistakes. I know security is a big thing, but then maybe don't let a junior dev code your most important netcode (or whatever)

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

SuccessIsMental

•

3mo ago

Some folks, especially the younger set, just don't know any better. As someone who also has decades of experience, and over that time, have learned and used over 45 languages. All of the at the time each language was the new "Had to be used" thing. At the end of the day, a language is a language and the best one usually is the one you are most familiar with. I have learned however, not to fall for it. Remember Forth, Pascal, Modula-2, Ada, Lisp, ya, fortunately I have forgotten about them also. C# / C++ / Java still here over 25 years now and for AI efforts python has it's value.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Ill-Confection-9618 avatar

Ill-Confection-9618

•

3mo ago

I cut my programming teeth on C++ when Turbo Pascal was still the language being taught at college universities, and I feel your pain. I also don't like Java or any "loosely typed" or "not typed at all" language. The main reason is because it lets programmers be lazy. By not forcing the strong typing, you leave room for all kinds of nonsense errors to make it into runtime that should have been caught at compile time, all because the programmer didn't want to bother checking for null, didn't pay attention to the fact that they are trying to assign an object to an integer, or some other unsafe assignment that is "allowed" by the compiler.

Also, if a programmer is too lazy to put a try/catch block around their code, or some other mechanism to catch errors, they deserve what they get. And that is why so much software blows up, has memory leaks, and causes BSOD (although that has been mostly reduced to driver level issues and memory management).

I'll stick with my C++ (not as much lately) and C# (better all the way around) and Rust can flake off.

Upvote

1

Downvote

Reply

reply

Award

0 awards

Share

Share

small_kimono

•

1y ago

> Right off the bat, as a total Rust newbie, I'm hitting all kinds of rough edges in Rust.

"I'm not good at new things!"

Upvote

-2

Downvote

Reply

reply

Award

0 awards

Share

Share

u/BarDifficult avatar

BarDifficult

•

1y ago

Could you name 5 UB cases in C from top of your head?

Upvote

-3

Downvote

Reply

reply

Award

0 awards

Share

Share

u/Dark-Philosopher avatar

Dark-Philosopher

•

1y ago

Can you name 5 defined things in C from the top of your head? ;-)

Upvote

5

Downvote

Reply

reply

Award

0 awards

Share

Share

1 more reply

u/BarDifficult avatar

BarDifficult

•

1y ago

But anyways, don't use other than main company's language unless it would be a game changer. Using Rust is not a game changer in most cases, sometimes it's just a fancy trend.

Upvote

2

Downvote

Reply

reply

Award

0 awards

Share

Share

dlq84

•

1y ago

I mean, if you don't like it, don't use it. Nobody cares that you're mad for failing. There are other jobs.

Upvote

-4

Downvote

Reply

reply

Award

0 awards

Share

Share

Compux72

•

1y ago

Bro doesnt even know what the difference between str and String yet is writing multithreaded code 💀

Upvote

-4

Downvote

Reply

reply

Award

0 awards

Share

Share

fullcoomer_human

•

1y ago

skill issue

Upvote

-4

Downvote

Reply

reply

Award

0 awards

Share

Share

candid_claim2