There are no good code bases, only less bad ones.
No Stupid Questions
No such thing. Ask away!
!nostupidquestions is a community dedicated to being helpful and answering each others' questions on various topics.
The rules for posting and commenting, besides the rules defined here for lemmy.world, are as follows:
Rules (interactive)
Rule 1- All posts must be legitimate questions. All post titles must include a question.
All posts must be legitimate questions, and all post titles must include a question. Questions that are joke or trolling questions, memes, song lyrics as title, etc. are not allowed here. See Rule 6 for all exceptions.
Rule 2- Your question subject cannot be illegal or NSFW material.
Your question subject cannot be illegal or NSFW material. You will be warned first, banned second.
Rule 3- Do not seek mental, medical and professional help here.
Do not seek mental, medical and professional help here. Breaking this rule will not get you or your post removed, but it will put you at risk, and possibly in danger.
Rule 4- No self promotion or upvote-farming of any kind.
That's it.
Rule 5- No baiting or sealioning or promoting an agenda.
Questions which, instead of being of an innocuous nature, are specifically intended (based on reports and in the opinion of our crack moderation team) to bait users into ideological wars on charged political topics will be removed and the authors warned - or banned - depending on severity.
Rule 6- Regarding META posts and joke questions.
Provided it is about the community itself, you may post non-question posts using the [META] tag on your post title.
On fridays, you are allowed to post meme and troll questions, on the condition that it's in text format only, and conforms with our other rules. These posts MUST include the [NSQ Friday] tag in their title.
If you post a serious question on friday and are looking only for legitimate answers, then please include the [Serious] tag on your post. Irrelevant replies will then be removed by moderators.
Rule 7- You can't intentionally annoy, mock, or harass other members.
If you intentionally annoy, mock, harass, or discriminate against any individual member, you will be removed.
Likewise, if you are a member, sympathiser or a resemblant of a movement that is known to largely hate, mock, discriminate against, and/or want to take lives of a group of people, and you were provably vocal about your hate, then you will be banned on sight.
Rule 8- All comments should try to stay relevant to their parent content.
Rule 9- Reposts from other platforms are not allowed.
Let everyone have their own content.
Rule 10- Majority of bots aren't allowed to participate here.
Credits
Our breathtaking icon was bestowed upon us by @Cevilia!
The greatest banner of all time: by @TheOneWithTheHair!
The only valid measurement of code quality: WTFs/minute
Is Lemmy less bad or more bad than a typical open source project?
From some comments I've read, it's at least in better shape than kbin? A few people expressed interest in helping with that project and then went running for the hills after reading through the code.
It’s probably not the only reason, but Rust is a much more attractive language/platform for devs to work with than PHP. (Source: https://survey.stackoverflow.co/2023/#section-admired-and-desired-programming-scripting-and-markup-languages)
It’s also more scalable, because it’s a compiled multi-threaded technology, while PHP is interpreted and mono-threaded.
Mother. Of. God. Did they really write Kbin in PHP?
I may be talking shit because I'm not a PHP coder, but the times I've seen it, it was a nightmare.
Which... makes sense. The creator of doesn't like coding.
I actually hate programming, but I love solving problems. I really don't like programming. I built this tool to program less so that I could just reuse code. PHP is about as exciting as your toothbrush.
So PHP it born out of a dislike of coding. In turn the documentation is all over the place and inconsistent.
Makes sense. And JavaScript is born out of a dislike of coders🤣
To be fair, PHP has slowly been getting it's shit together since PHP 7, and 8 seems to be in a reasonably great shape compared to the horrors of 5.6
It has become really solid over time.
But it will always be a mono-threaded and interpreted technology, and therefore never a good choice for a high-scale solution like a Fediverse application.
That’s PHP for ya
I read from one admin that a Lemmy instance is a lot easier to set up and maintain than a kbin instance. It's initially more complicated to set up and updates are just a super headache to deal with. That sounds like a showstopper. I mean kbin is not going to get too far if it's that difficult to run and maintain an instance, no matter how good or bad the code.
From a user perspective kbin has a really nice looking interface, though Lemmy has more features. I'd like to see kbin do well. It's younger than Lemmy so it's going to be behind, but hopefully the overhead in running an instance can be resolved.
The best code base is the repo I just created and haven't committed anything to.
Wait, so the answer is, “it depends?” 🌎👨🚀🔫👨🚀
No the answer is that it is written in a modern language, is in its infancy and needs a lot of work to be really great, but it's based on a certified protocol ActivityPub, that Mastodon and other "fediverse" systems use. It's going to be really great, eventually.
"It depends" is a reference to an inside joke between developers. I agree with you that it could be really great, whether or not a code base is "good" or "bad" is just a complicated and highly subjective question to answer
Yup, code is bad, more code is worse. And unparseable specialist code is a technical debt.
If you think four years of technical debt is a lot, wait until you hear about Microsoft Windows.
I couldn’t imagine.
Well it's written in Rust. Doesn't that make it automatically awesome and fast?
"It's webscale"
Everyone knows relational databases don't scale because they use joins.
As long as the backend is stateless, it can be scaled to handle huge amount of users, at least in theory. IMO the main issue right now with Lemmy deployment is pictrs
not being stateless. It uses a filesystem-based internal database called sled
. Not only this make pictrs not stateless, you can't even run multiple replica of pictrs in the same host because sled would crash if the database file lock is already acquired by another replica. Someone with some rust skill should consider donating their time to add postgresql support to pictrs soon, which will greatly help making Lemmy scalable. Too bad I know nothing about rust.
An interesting choice of solution there for image hosting... I would have thought they would have gone with a simple proxy through to an object store like S3, GCS, Wasabi, insert other clone here. Or even picked an off the shelf BLOB capable system for self hosting like Mongo or Cassandra. Then your image hosting becomes stateless as you just give each image a flake ID, pop it in the storage system and give back a shortened URL. I'm sure they had their reasons though :-)
It’s decent, but it isn’t scalable, at least not yet.
Right now the entire Lemmy backend is one big “monolith”. One app does everything from logins and signups to posting and commenting. This makes it a little harder to scale, and I wouldn’t be surprised to see it split out into multiple micro services sooner rather than later so some of the bigger instances can scale better.
I’d love to know where the higher level dev stuff is being discussed and if they’ve made a decision on why or why not microservices.
There’s no reason that a monolith can’t scale. In fact you scale a monolith the same way you scale micro services.
The real reason to use micro services is because you can have individual teams own a small set of services. Lemmy isn’t built by a huge corporation though so that doesn’t really make sense.
I disagree that it being a monolith is immediately a problem, but also
In fact you scale a monolith the same way you scale micro services.
This is just not true. With microservices, it is easy to scale out individual services to multiple instances as demand requires them. Hosting a fleet of entire Lemmy instances is far more expensive than just small slices of it that may require the additional processing power.
What microservices would you split Lemmy into? The database, image hosting and the UI are already separate.
You definitely can't scale a monolith the same way you can scale a micro service
Microservices aren't a silver bullet. There's likely quite a lot that can be done until we need to split some parts out, and once that happens I expect that federation would be the thing to split out as that's one of the more "active" parts of the app compared to logins and whatnot.
Microservices can oftentimes cause more performance issue than they solve, as soon as they need to start talking to each other. Here's someone with more experience than me explaining how it often goes wrong.
There's nothing stopping you from putting a load balancer and running multiple instances of a monolith connected to one database. Then the database will also become a bottleneck, but that would still happen with microservices.
It's fine. Nothing impressive about it but nothing horrifying about it. Could use better testing and better documentation, it's pretty weak on both fronts. It's a pretty young/immature code base, hard to have much tech debt yet. Not like its core dependencies can be a decade out of date. But it's easy to navigate and understand,relatively speaking.
Could use better testing and better documentation
I've seen one dev talk about documentation and it's admittedly weak, but they're pretty impacted by everything else. It's on the burner and they'll work on it at some point.
I have a friend that's a lot more technical than me and he said that Lemmy's codebase is kinda messy and relies on libraries that are still in beta and have not been tested well in the real world (since Rust is a relatively new language). This was a few months ago though, I'm not sure how much things changed since it's been getting a lot more support and rewrote the front-end. The good news is it'll get a lot better as more developers contribute to it.
I think a lot of people assume that because it's written in Rust that means it has to be super stable but that really isn't the case.
I think it will improve as more people get involved. The fundamentals seem to work fine. Haven't looked at the repository yet but I am planning to do so and see whether I can make a (small) contribution somewhere. Probably in the form of cleaning up some technical debt.
Someone mentioned they had started out using websockets instead of http. I guess they’ve since migrated, but that design choice makes me wonder about the qualifications of the devs to make that kind of choice.
Websocket was deprecated with 0.18.0 which is the latest official release, but a lot of instances are on the release candidate for 0.18.1. because of some major improvements. My login instance is on that one which is great for me because I'm using a desktop browser and it looks way nicer. A lot of fixes too.
Websocket is easier to implement so that's probably why they started with it. It has heavy overhead and doesn't scale well so that's the down side. It wasn't trivial for them to move to http. Websocket was probably a better starting point for them at the time, but they did realize its shortcomings and deprecate it in time to support growth. I don't know if I'd hold that against them.
We need to rewrite it in Rust.
oah!!1
I'm porting it to COBOL so that 2 other people will know how to contribute.
Rust, babyyyyy
It's probably decent, but it is also worth noting that Lemmy was never really expecting the massive explosion of activity it currently has quite so soon.
The current code base was probably good for a small number of users/instances, but everything isn't doing quite as well now that there are thousands, or even tens of thousands rattling about the place.
If you think four years of technical debt is a lot, wait until you hear about Microsoft Windows.