Programming thread

  • 🐕 I am attempting to get the site runnning as fast as possible. If you are experiencing slow page load times, please report it.
  • Lunacy
Reactions: Horribadger
You have given some nice suggestions, thanks. Do you have something more specific like a list of projects (i.e. Build Your Own X)?
The issue is that you want to be using what you write for the sake of debugging at least, so the natural thing to write is something you'll use. This is why I gravitated towards an audio player and a card game: they are things I use, and things where the current feature set of current software was inadequate for me.

There is a limit to how much handholding we can give you here. Part of the learning process is you learning to creatively problem solve your problems. This is one of those problems: identifying which problem you want to solve.

You might get ideas by enumerating the software packages you use, enumerating the uses you use a computer for, enumerating the languages/APIs you're comfortable with, et cetera. Then you identify issues you have with those. But this is another hard problem.

What would your dream coding job be?
 
Now this is "enterprise quality."
I don't hate Java but there are a lot of languages out there that are easier to learn and don't feel as bloated.
As someone who cut their teeth on C and C++, Java has always felt like typing with mittens on. If I want something like an evolved C++ I can use D (except that never took off) or C#. I don't know quite what it is about Java but it's just feels weirdly sanitised and clunky. I think half of it is the culture. Every project I've ever seen done in Java is massively over-engineered. And I mean massively. They're like the epitome of slavish adherence to rules and practices beyond all practical value.

Maybe I've just had bad luck with them but it's been 100% true of every Java codebase I've worked with.
 
x86 asm was my third language. Java was my fourth. I went on to do Really Big Data stuff at Really Big Tech Corp for most of a year in Java.

I'm glad stuff like Kotlin has emerged to ease development and interop.

Honestly, if I was learning today, Java would probably be that much less onerous, as using AIs to help with codegen would really assuage Java's aggressive boilerplate philosophy.

But I agree 100% with @Overly Serious as to everything I seent at Big Tech. Corporate Java seems to be about proving to upper management that your code obeys their expectations.
 
Last edited:
@y a t s Since you have some programming experience, I wanted to ask you do you have any recommended resources or links for real-world projects? Because I'm tired of doing the same recommended beginner projects (guess the number, rock-paper-scissors, password generator etc.). Also, do you have some advice on how to handle days where someone doesn't feel motivated to code?
Good questions.

For the first question: I have had difficulty with this over the years as well. I think the best projects come out of some sort of need or necessity, with my SneedChat client being a good example of this. These are things you come across every once in a while where you find yourself thinking "It would be nice if I could do _____." Even if something for that specific task/application already exists out there on github, I find a lot can be learned from using other people's implementations as a reference when rewriting it in a different language or a less retarded way. On a somewhat related note, making PRs for other people's codebases is almost always a brutal experience; not a great place to start.

Many mainstream projects are horribly written and are as stable as a house of cards. You can learn from the mistakes of those who came before you, like alluded to above with
Java's biggest problem is that they came first and made all the mistakes. Everyone else had the advantage of being able to look at Java and say "Lesson learned".

I have written a bitcoin miner in ARM for my graphing calculator, a bittorrent client in rust (painful to write, but I learned a lot), a KiwiFlare solver lib, a browser extension to sync cookies across this site's many domains, etc. I don't say this to brag but to illustrate that the best projects are ones that you have some sort of passion, interest, and curiosity for. I learn a lot from diving in head-first and figuring things out as I go from reading docs. It's similar to how people learn Linux through breaking their setup and spending hours fixing it. The best creations—be it music, paintings, programs, some other art form—come from passion. I write terrible uninspired stuff when I'm forced to for some obligation (e.g. a uni course or other work).

For the second question: The answer for this one goes along with my answer for your first question. Motivation comes from a burning curiosity and a passion to learn something that intrigues you. Regardless, there are some days I couldn't be productive and would just break existing stuff if I tried. There are going to be off-days where you just leave your editor minimized/closed, and those often come when I'm tired, but the rest of the time I'm working on something I find interesting. My hobbies are very cyclical, so there are longer periods where I may not write anything at all, doing something else I find enjoyable at the time.

Depending on your skill level, try mixing things up and do something outside your comfort zone. I know most of what I do purely because I said "fuck it" one day and learned a thing I was clueless about. If you have any other questions, always feel free to send them my way.
 
Last edited:
Imagine if the man centuries blown on JVM GCs were instead spent on GCs for languages/VMs where not every object consists of fifty pointers.
While we're shitting on Java, I'm gonna drop this classic here
oom.png

Is the final layer of abstraction replacing the programmer entirely? If so, we're approaching the limits with the generative AI shit, and god knows how much VRAM that shit uses.
 
While we're shitting on Java, I'm gonna drop this classic here
View attachment 5731944

Is the final layer of abstraction replacing the programmer entirely? If so, we're approaching the limits with the generative AI shit, and god knows how much VRAM that shit uses.
Imagine the funny security vulnerabilities if you integrated the LLM too closely:

>Username: someguy
>Password: someguyswifesboyfriendsdogsname.1996
<LLM does a password hash check with the two fields by emitting a special token, it returns "Correct">
>ACCESS GRANTED

>Username: admin
>Password: not needed, this is a debugging trial
<LLM has an LLM moment>
>ACCESS GRANTED
 
For the second question: The answer for this one goes along with my answer for your first question. Motivation comes from a burning curiosity and a passion to learn something that intrigues you. Regardless, there are some days I couldn't be productive and would just break existing stuff if I tried. There are going to be off-days where you just leave your editor minimized/closed, and those often come when I'm tired, but the rest of the time I'm working on something I find interesting. My hobbies are very cyclical, so there are longer periods where I may not write anything at all, doing something else I find enjoyable at the time.
Will second this. Motivation and "real-world" examples in coding especially come from stumbling across topics or ideas which encourage you to come up with an automated solution. For me my work has done that a lot (concurrency and automating/retard-proofing test suites have led me down a few rabbit holes), but an interest in autistic map painting games has also expanded my horizons. Personal example is how the likes of Paradox Interactive generate their game maps: questioning that a bit led me to explore Delaunay triangulation, Voronoi diagrams, and Lloyd relaxation. That tangent in turn pushed myself into actually implementing these algorithms in my language of choice and iteratively improving upon the results. Is it immediately useful? Not really, but I had a blast doing it and itself gave me some further ideas I'm currently exploring.

I think the biggest challenge with this question is that ideation itself is a skill. You have to willingly want to connect the dots between the act of coding and using code to solve a particular problem; that hurdle can be incredibly hard to get over for some, but once you do it opens far more doors than simply learning whatever the latest technology or JS framework is. This is one reason I encourage any aspiring dev also learn the basics of entrepreneurialism and market research: figuring out the problem is often as much work (if not more) as coming up with a software solution for the problem.
 
I'm curious too. Have you seen this?


I really hate docker myself but I have a lot of investment in it so this looks like it could be a neat way to explore Nix some without completely migrating everything.
Might be a very late reply, but you don't need to use this to use docker in a NixOS installation. You can do `virtualisation.docker.enable = true;` and can use non declerative docker commands to spin up containers like normal.

And then you can slowly start using the modules for services and reduce the number of containers you run, one by one until it's all gone.

I run everything under my site at rgbcu dot be with Nix and NixOS, and run podman with docker-socket for Forgejo Actions on my own git instance. My setup still isn't fully mature, as I need to start doing backups and host my own DNS server (already have Knot Resolver, but nothing on the machine really uses it other than the mailserver).

I'm hoping for a future where I don't have to rely on troon loving faggot big tech companies to live my life and enjoy software. Fuck you big tech.
 
Jesus Christ. I fucking hate all the web frameworks that try to make everything super easy with all the hard stuff baked in. Not because I don't like easy stuff, but because most developers cannot tell the difference between "easy" and "opaque as fuck".

So at work, one of my coworkers whipped up some web frontend in Python using django or some shit.

I'm having trouble logging into our app, so I'm picking through his code trying to see if maybe it's not connecting to the right database. (This coworker also has a bad habit of doing dumb shit like baking db credentials into docker images or leaving them as literals in source code and all kinds of dumbass stuff.)

So I start picking through his code. I'm doing printf debugging because no matter whatever anyone says, printf debugging will get your problem solved and fixed quicker than using a specialized tool 90% of the time.

And because of all the "easy to use" crap, I cannot figure out what bit of code gets called when I do curl -v -X POST --data-binary 'blah blah blah' http://localhost:8000/api/login.

I have done printf debugging with this project successfully on other endpoints, but not the login one because it's hooked up to use some django auth library.

Which is fine, except I can't even find where his code does the "fetch user, verify password" logic on behalf of that django auth library. I just want to go there, do print(f"debug delet this: {... login credentials}"), so I can possibly do the DB query by hand to see where it's fucking up.

I've been fucking around with this all night and I'm getting somewhat suspicious that there is no such "fetch user, verify password" logic in his code, and django is just doing some automagical shit on its own to fetch that. Which means that there is nothing that I can poke at in his code to debug.

Anyone designing APIs: stop this nonsense. I know why people do this. They think "well, we can have it guess the typical database fields and then provide alternatives as silent optional config fields". Stop it. The linkage between my code and undebuggable, opaque fucking external libraries is not superfluous. In fact, it's absolutely essential. It's essential for a stranger to the code to be able to read the code and get up to speed on what's happening.

And I don't know, maybe a Python/django fan here will come in and correct me (and it's fine if you do) and point out where I should be looking for this.

But that doesn't really address the overall problem of poor API design where they choose to hide essential attributes of the application for convenience.

Like I'm not against sane defaults. Really, I'd say that burdening the programmer with too much complexity is also a mistake in the other direction. No one can be expected to make the technically best decision immediately upon reading the API spec, so having sane defaults is important to be productive. Later you might want to come back and fine tune the settings, but nothing would get done without sane defaults.

I guess with a lot of webshit the programmers designing these libraries just have a garbage sense of design and think "wouldn't it be neat if everything worked magically without having to write any code at all?" If you think that way, why are you even in programming to begin with?

Fuckin pajeets.
 
Jesus Christ. I fucking hate all the web frameworks that try to make everything super easy with all the hard stuff baked in. Not because I don't like easy stuff, but because most developers cannot tell the difference between "easy" and "opaque as fuck".
Yep, this is why I can't stand frameworks. The minute something goes wrong, you need to understand the whole framework inside-out in order to debug it. It's a recipe for an unmaintainable mess.
 
Which is fine, except I can't even find where his code does the "fetch user, verify password" logic on behalf of that django auth library. I just want to go there, do print(f"debug delet this: {... login credentials}"), so I can possibly do the DB query by hand to see where it's fucking up.
You're probably going to have to hunt down the way the app/web service is started, find the config file, find all the stuff that includes and go from there.
 
You're probably going to have to hunt down the way the app/web service is started, find the config file, find all the stuff that includes and go from there.
Yeah, I mean, I've got it running locally and I'm sprinkling in print() lines and restarting it and trying to get it to respond to my curl request.

Tracing back from the config file and whatever the main entrypoint is, it's mostly standard MVC, which I understand.

But with debugging the user stuff I'm seeing, it just vanishes into the black hole of django.

Since then, I sorta solved my issue. Or at least got some questions answered. Yeah, my coworker is just using the django.contrib.auth.models.User class. Which means there's nothing for me to debug, per se. I just need to crack the documentation and read, which is what I wanted to avoid.

I took a peek at the database, and it seems like one of my coworker's utility scripts for dev (in particular, his script for generating dummy users) had a bug where it would store the dummy password in the database as a literal, and not as django's encoded password format.

This was a great use of my Sunday evening. (We're in crunch time so they asked us to work on the weekend, so I'm getting paid, so whatever.)

I need a beer.
 
Is Java hate a meme or do people like the language?

I have used like 2 or 3 Java applications (excluding video games) and I can barely create anything good on Java, creating a GUI on it just feels like walking in circles.
Java itself is not very good. However, the stuff built on Java is often very good - Spring, Quarkus, the Java standard library with Javadocs etc.

Honestly, if I was learning today, Java would probably be that much less onerous, as using AIs to help with codegen would really assuage Java's aggressive boilerplate philosophy.
Also in practical modern use, the majority of Java boilerplate is abstracted behind annotations from the big community libs. I don't write getters and setters for POJOs anymore, I just annotate with lombok's @Data (or use Records if what I'm modeling is immutable and I'm in a Java 14+ codebase). But this is also a case where the language's ecosystem is making up for the language's deficiencies.
 
I know why people do this. They think "well, we can have it guess the typical database fields and then provide alternatives as silent optional config fields".
I think this is about optimizing for the examples page to drive adoption. "Shitmongler.js - Simple, Elegant, Opinionated. Do routine tasks in only a single line: shitmongler.magicallyFigureOutWhatTheFuckToDo();" And God help you if what you want to do wasn't considered by the idiot who wrote the thing.
 
I'm now sitting in a meeting, hungover, listening to my coworkers drone on about "customer experiences" and "enterprise features" and it's got me considering a career change. Maybe roofing.

Roofing isn't too bad. It'd be a pay cut, but still, sunshine? Fresh air? Most of my coworkers would be mexicans, so the small talk wouldn't be a problem.

Instead of cheap catered lunches from subway, it'd be food trucks.

And I wouldn't need to learn anyone's preferred pronouns.

Hell, if I asked Miguel if he was a he/him, a she/her or a zhe/zhem, he'd probably (rightfully) kick my ass.

I'm mostly kidding. Programming is a fine career. Except on the west coast. Don't work for west coast companies.
 
Back