The Threadiverse is growing again, this time offering an effort to build a new Lemmy replacement from scratch, with API compatibility.
Seems like an interesting effort. A developer is building an alternative Java-based backend to Lemmy's Rust-based one, with the goal of building in a handful of different features. The dev is looking at using this compatibility to migrate their instance over to the new platform, while allowing the community to use their apps of choice.
Because modern Java is an OK language with a great ecosystem to quickly build web backends. And there are lots of java devs which means more potential contributors.
Exactly. It's also using Spring Boot, Hibernate, and Lombok. It looks just like projects at work. It might be the first fediverse project I contribute regularly to.
I tried to contribute to Lemmy, spent a few hours really confused by rust and gave up. I can meaningfully contribute to a Java/Spring project, not a rust one.
Ah, yes. How about he kitchen sink and another 5000 dependencies to make Java bareable to code in? Actually lets skip Java cos it's an over-engineered cluster-fuck that considers verbosity a virtue.
And yet it’s still a better option than 90% of languages out there.
Trendy languages are great until they break something or lose support. Java is consistent, and that’s the most important part.
You sound like some Java dev personally offended you so much that you can’t separate the language from a person you hate for completely irrelevant reasons.
Like I said, I’ll take Java and extreme OOP over Python/Rust/Go any day of the week because it’s actually readable code instead of a clusterfuck of hundreds of methods in one file
The only reason you don't like Rust is it's the first language in a long time that's threatened the dominance of C, the bedrock of programming. If it can do that then Java is going to be under threat too. Go failed cos it's a shit language and Python isn't even the same category. Java is more readable than Python? You're having a laugh or you've never seen a friggin line of Python in your life.
Python:
for i in range(1, 10):
print("Hello: ", i)
Java:
import static java.lang.*;
public class BentJavaClass
{
public static void main (String args[])
{
for(int i=1;i<11;i++){
System.out.println("Java is shit: " + i);
}
}
}
10 lines vs 2. And you think Java is more readable?
Back in the day Java couldn't even handle concatenating strings and numbers and needed you to fucking convert the integer into a string beforehand (String.valueOf()). I see it only took you about 20 fucking years to figure out something most other languages had out of the box.
What's with all the unnecessary braces? The semicolons? Punctuation causes blindness and coldsores. Java is a cancer and it's devs should be shot and their bodies piled high before being tipped into the sea.
Ok, so now build an api that can handle 100k iops with a cache, db calls and everything else, and tell me how simple that is in Python.
Java and Python, like any programming languages don’t do everything well. They do a few things well, and most things adequately. Python is great for scripting and small applications, but once you’re hundreds of files into a corporate software project it becomes near unreadable. Java is great for large scale applications but suffers if you want to make a single purpose app.
I’d also argue that yes, the Java is more readable at scale. Everything is explicitly typed, braces are so much better than indents (is something 20 indents or 21 idents deep, I never know), semicolons are useful for delineating ends of statements.
It sounds like your only expose was Java in uni and have never worked with anything at scale.
is something 20 indents or 21 idents deep, I never know
You don't know because you're a mongoloid who's never heard of an IDE or a well configured text editor. Stop blaming your own inadequacies on tools and accept the fact you're a shit dev.
Like I said - Python and Java are different categories so I agree they aren't competing. But you do know Dropbox, Netflix and Reddit are built in Python don't you?
However, Rust and Java are competing and that scares you. Because Rust has all the benefits of Java with none of the downsides. The only benefit Java has (like COBOL) is inertia. Even Google want rid of Java and it's why they created Kotlin.
Java has reached it's zenith and s in decline. It's only a matter of time before tech debt and new concepts kill the language off and it goes the way of COBOL and Fortran.
Just accept it with grace and stop fighting the inevitable.
I genuinely could not give a shit about Rust. It doesn’t scare me, because just like COBAL, Java isn’t going anywhere. An IDE helps, but it’s no easier visually than checking if something is within a pair of brackets.
I’m not saying you can’t do it with Python, just that it gets exponentially more complicated as you do so. Just like you can build single purpose tiny applications in java, you can build massive ones in python.
Rust and Java aren’t competing outside of Silicon Valley and Big Tech, and even they often still use a significant amount Java in legacy tech. Rust still can’t replicate everything that libraries and plugins for Java can, it’s still not a fully mature development stack, it’s close, but it’s far from becoming the next java.
Java isn’t a perfect language, I never said it was. I’m standing by my comment that it’s better than 90% of the languages out there.
This is the kind of bizarre rhetoric I've come to expect from a Java dev so badly addled with Java-brain-rot that they don't even know how to write their own name anymore.
Rust and Java aren’t competing outside of Silicon Valley and Big Tech,
Keep telling yourself that but I'm not the only one here saying Lemmy and Rust has a lot more chance at success. Parts of Mozilla are written in Rust with a view to replacing all of the codebase in it. Parts of Linux and Linux drivers are being built in Rust. Small programs like Exa (ls replacement) in Linux are written in Rust. Google replaced Java with Go.
Rust, Go and others are taking over. People have seen the light. Those of us with enough cognitive function left in tact are making moves to languages that matter and away from Java.
You're right Java will always be around just like COBOL. In about two mainframes managed by two COBOL devs in the entire world.
It's sad to see you like this. Arguing for your own abuse and misery at the hands of a language that doesn't care about you.
If you say the function should only recieve one argument and returns always boolean. It is predictable to only allow the wanted args and forces you to return a boolean.
For example in a less predictable programming language e.g. Python: I can do all above but python does not stop anyone to put more or less arguments to a function, or a developer not adding typehints or not complying to them and return a string instead of a boolean.
But i had it wrong rust is similar to java on that part.
But still it is a lot more popular and easier to start with. So there will be a lot more contributor to sublinks than lemmy ever had.
Well in that sense Rust is even more predictable than Java. In Java you can always get back exception that bubbled up the stack. Rust function would in that case return Result that you need to handle somehow before getting the value.
That i dont understand? How can it be a result that i need to handle? If its not correct than java will throw an error. ( As expected, shit in shit out )
It's a great and probably the best error system I've seen, instead of just throwing errors and having bulky try catch statements and such there's just a result type.
Say you have a function that returns a boolean in which something could error, the function would return a Result and that's it. Calling the function you can choose to do anything you want with that possible Error, including ignoring it or logging or anything you could want.
You always get a Result. On that result you can call result.unwrap() (give me the bool or crash) or result.unwrap_or_default() (give me bool or false if there was error) or any other way you can think of. The point is that Rust won't let you get value out of that Result until you somehow didn't handle possible failure. If function does not return Result and returns just value directly, you (as a function caller) are guaranteed to always get a value, you can rely on there not being a failure that the function didn't handle internally.
If function does not return Result and returns just value directly, you (as a function caller) are guaranteed to always get a value, you can rely on there not being a failure that the function didn’t handle internally.
The difference being where you handle the error?
It sounds to me like Java works in kinda the same way. You either use throws Exception and require the caller to handle the exception when it occurs, or you handle it yourself and return whatever makes sense when that happens (or whatever you want to do before you do a return). The main difference being how the error is delivered.
Yeah I suppose ignoring unchecked exceptions, it's pretty similar situation, although the guarantees are a bit stronger in Rust IMO as the fallibility is always in the function signature.
Ergonomically I personally like Result more than exceptions. You can work with it like with any other enum including things like result.ok() which gives you Option. (similar to java Optional I think) There is some syntactic sugar like the ? operator, that will just let you bubble the error up the stack (assuming the return type of the function is also Result) - ie: maybe_do_something()?. But it really is just Enum, so you can do Enum-y things with it:
// similar to try-catch, but you can do this with any Enum
if let Ok(value) = maybe_do_something() {
println!("Value is {}", value)
}
// Call closure on Ok variant, return 0 if any of the two function fails
let some_number = maybe_number()
.and_then(|number| process_number_perhaps(number)) // this can also fail
.unwrap_or(0);
In that sense it's very similar to java's Optional if it could also carry the Exception value and if it was mandatory for any fallible function.
Also (this is besides the point) Result in Rust is just compile-time "zero cost" abstraction. It does not actually compile to any code in the binary. I'm not familiar with Java, but I think at least the unchecked exceptions introduce runtime cost?
That's a kinda terrible way to do it compared to letting it bubble up to the global error handler.
You can also use optional in java if you want a similar pattern but that only makes sense for stuff where it's not guaranteed that you get back the data you want such as db or web fetch
You can bubble up the Error with ?operator. It just has to be explicit (function that wants to use ? must return Result) so that the code up the stack is aware that it will receive Result which might be Err. The function also has defined Error type, so you know exactly which errors you might receive. (So you're not surprised by unexpected exception type from somewhere deep in the call stack. Not sure about Java, but in Python that is quite a pain)
Edit: To provide an example for the mentioned db fetch. Typically your query function would return Result(Option). (So Err if there was error, Ok(None) if there was no error, but query returned no results and Ok(Some(results)) if there were results)
This is pretty nice to work with, because you can distinguish between "error" and "no resurts" if you want, but you can also decide to handle these same way with:
So I have the option to handle the error if it's something I can handle and then the error handling isn't standing in my way. There are no try-catch blocks, I just declare what to (not) do with the error. Or I can decide it's better handled up the stack:
query()?
.iter().map(|item| do_thing(item))
This would be similar to exception bubbling up, but my function has to explicitly return Result and you can see in the code where the "exception" is bubbled up rather than bubbling up due to absence of any handler. In terms predictability I personally find this more predictable.
match result {
Ok(bool_name) => whatever,
Err(error_type) => whatever,
}
if let Ok(bool_name) = result {
whatever
}
if result.is_ok() {
whatever
}
let whatever = result.unwrap_or_default();
let whatever = result?;
And there's many other awesome ways to use a Result including turning it into an Option or unwrapping it unsafely. I recommend you just search "Rust book" on your search engine and browse it. Here's the docs to the Result enum.
It's probably got the best library/tooling ecosystem of any language out there. Certainly dwarfs Rust in that regard. Easier to find devs. Reasonably efficient thou not as much as Rust and typically less memory efficient.
It's a perfectly good suggestion for a project like Lemmy. I'd reach for Java or Go before Rust for a project like this but you know, that's just me.