Programming thread

  • Want to keep track of this thread?
    Accounts can bookmark posts, watch threads for updates, and jump back to where you stopped reading.
    Create account
Something funny I realized after posting was that the else block still wasn't necessary in their version with the break since control flow would still divert before the append. The fact this wasn't readily obvious to me nor the author speaks to the subpar quality of the code. All "features" of a function should be obvious at a glance.
yes this code has layers of horribleness to it
@Creative Username Please stop replying to everyone.
i fucking love :reply: i will :reply: anybody i want here there is nothing you can do to stop me
i will :reply: you now to assert my dominance
When you phrase it that specific way, it makes me think there's one of those "software engineering principles" run amok here. Probably something with a stupid name like "ROO" (Return Only Once) or "Gregory's Iron Law".
i have actually seen guidance against multiple returns citing the flawed reasoning that it is like a goto or something
this sounds nice until you run into a situation like this, where people following this rule will do insane shit with flag variables trying to emulate the actual control flow they need
I don't think I've used else since learning how to write guard clauses years ago, and I'm not even sure what you'd use it for besides that.
sometimes you really do need to evaluate a predicate and then evaluate expression a if it is true or expression b if it is false
if-then-else expressions are perfect here
 
By the way, do you guys notice much start-and-stop in your motivation to get your own projects done? Doing this stuff as a day job is a nice carrot and stick to force consistency, I'm sure, but when it comes to stuff at home, I find my consistency to be wavering a bit, a week goes to waste here, a few days there, then you come back rusty and merely pick at it for a few days without hitting your stride, that kind of dance. It makes me worry sometimes in spite of what I think I want, whether I love this stuff enough to be great at it.
 
I find my consistency to be wavering a bit, a week goes to waste here, a few days there, then you come back rusty and merely pick at it for a few days without hitting your stride, that kind of dance
As far as scheduling things go, I'm not the most consistent, but I've had a kind of writer's block on one project for some months now. I've done other things in the interim so it's not a big deal. But I have other projects that I haven't made any progress in for years. Some that are deprecated experiments now. It's whatever. If you're meant to be doing it, you'll keep doing it. The question's always one of scope. How much can you get done well, and how quickly? All things the same, I'm pretty slow, but projects that I make do something that works.
 
By the way, do you guys notice much start-and-stop in your motivation to get your own projects done? Doing this stuff as a day job is a nice carrot and stick to force consistency, I'm sure, but when it comes to stuff at home, I find my consistency to be wavering a bit, a week goes to waste here, a few days there, then you come back rusty and merely pick at it for a few days without hitting your stride, that kind of dance. It makes me worry sometimes in spite of what I think I want, whether I love this stuff enough to be great at it.
Consider making use of the Ballmer peak
 
do you guys notice much start-and-stop in your motivation to get your own projects done?
yes i'm mostly stop (:_(
It makes me worry sometimes in spite of what I think I want, whether I love this stuff enough to be great at it.
does it really matter if you're great at it? just do it when you can, and have fun doing it
by doing that you will likely end up better at it than most people
 
Really hard to hit it precisely though. I've tried it a few times and usually overshoot, then I am sleepy and just go to bed instead.
I rarely drink these days but have definitely succeeded in hitting the Ballmer peak (or maybe the Hemingway peak) for ordinary writing so it should work for coding too. Just take occasional sips, well spaced-out, and you can get there.
 
By the way, do you guys notice much start-and-stop in your motivation to get your own projects done? Doing this stuff as a day job is a nice carrot and stick to force consistency, I'm sure, but when it comes to stuff at home, I find my consistency to be wavering a bit, a week goes to waste here, a few days there, then you come back rusty and merely pick at it for a few days without hitting your stride, that kind of dance. It makes me worry sometimes in spite of what I think I want, whether I love this stuff enough to be great at it.
Yeah, I have a "2 week Minecraft phase", but for everything... And it's more like 1 week :(
 
By the way, do you guys notice much start-and-stop in your motivation to get your own projects done? Doing this stuff as a day job is a nice carrot and stick to force consistency, I'm sure, but when it comes to stuff at home, I find my consistency to be wavering a bit, a week goes to waste here, a few days there, then you come back rusty and merely pick at it for a few days without hitting your stride, that kind of dance. It makes me worry sometimes in spite of what I think I want, whether I love this stuff enough to be great at it.
"I have 20 projects on the back burner but I have a good feeling about #21" is a meme for a reason. It's virtually ubiquitous among basically any creative effort, especially programming.
 
After having a look at several Emacs configuration frameworks (mainly Prelude), I've decided to follow advice I saw on le Reddit and instead write my own Emacs configuration from scratch. I will be learning from System Crafters videos, starting here:
Wish me luck
 
Gentlemen of the programming thread, I have returned with an update on my C project. I am revamping my project away from working with raw pointers and learning to wrap it up in a nice little data structure with appropriate trackers for size and capacity. Ya tah. In doing so, I broke something else in the project, first on Linux, now on Windows. So I'm ripping that part out and rewriting that bit of code. Let the good times roll. It's really nice to see a project come together, from the first faltering steps to hammering out the details and annoying bugs.
 
Last edited:
> be me
>day one at programming class in university
> pajeet professor sarr
> not a good start.jpeg
> pajeet professor calls c++ a high level programing language like python
> Starts praising Java
I have a lot of violent ideas that can barely contain. They all need to be deported or turn into dog food i dont give a fuck.
 
What's even the point of Java anymore? For casual script, people use python. For anything serious, there are just better languages. Why, oh why, does Java continue to exist?
Java's purpose was to be so slow and bloated to sell more Sun Microsystems hardware. It was sort of designed as a successor to C++ with a "run anywhere" focus. At the time you still had multiple Unix systems competing so it was sort of a justifiable idea. It sucked, of course. These days if you're not keeping old Java crap running there's no real reason to use it. And, I guess, Android.
 
It was sort of designed as a successor to C++ with a "run anywhere" focus.
And if you want to see that notion done well, learn C#/.NET. I was dismissive about dotNET from working with it professionally, but when Ryujinx built faster and with fewer headaches than Yuzu on Linux, I started to like it. (And be sure to look into the ExpandoObject which allows you to think of .NET objects almost as flexibly as JSON.)

If you must use the Java ecosystem, I hear Kotlin is the way to go these days. Java itself is far too long in the tooth to have much worth today. There are two reasons Java is not dead: industrial server software and Android.
 
I've decided to follow advice I saw on le Reddit and instead write my own Emacs configuration from scratch.
emacs is really user-friendly about configuration, you can hit M-x customize and set things up in a ui without having to touch a single line of elisp
it writes to a special structure in your .emacs and you can look at it and take things out of it and configure things with raw elisp if you want (and customize will recognize that it has been changed outside of customize and play nice with your shit)
That is the correct, non-appropriated definition of a high-level language, though. Low-level used to mean assembly (which is still the barest step up from machine code) while high-level meant anything with an interpreter/compiler. C++ is a lot closer to Python than it is to x86.
the definition of "high-level language" is very vague
generally it is "anything higher than assembly" but in certain contexts it means "language as abstract as mine or more so" and it's just one of the ways that phrase is used
always be aware of which definition of "high-level" you're using to not cause retarded bullshit to happen, and make sure to be specific if there's a certain language feature you're thinking of instead of just saying "high-level"
What's even the point of Java anymore? For casual script, people use python. For anything serious, there are just better languages. Why, oh why, does Java continue to exist?
java is a very average programming language
while many people absolutely hate it for just how mediocre it is, it can still be used to do lots of real work at the end of the day
a lot of classic gripes people have about java have been ameliorated over the years with recent java versions

also, i think one of the greatest spiritual successors to the original vision of the jvm is webassembly, for better or for worse
 
emacs is really user-friendly about configuration, you can hit M-x customize and set things up in a ui without having to touch a single line of elisp
it writes to a special structure in your .emacs and you can look at it and take things out of it and configure things with raw elisp if you want (and customize will recognize that it has been changed outside of customize and play nice with your shit)
I should look through M-x customize for ideas but that won't be enough. After wavering on whether I really wanted to proceed with my Emacs journey at all yesterday, I now have the beginnings of a working init.el. I won't be including my configuration here as it is entered into le GitHub along with my real name in the log but I have set up various things like doom-themes (still vacillating on what theme I want), xclip to make the system clipboard work in terminal Emacs and stuffing auto save #files_like_this# into /tmp. It's just been not quite two days and, though what I am doing right now might seem inchoate one day, I already have nearly everything in my ~/.vimrc working in Emacs.
 
I think I might have Stockholm Syndrome - I understand peoples' criticisms of languages like C++, and I understand what they mean when they say that all the exploitative logical workaround bullshit is merely coping and saving face for not having tools and abstractions strong enough to handle those use cases, but some part of me, at least so far, kinda likes the workaroundy bullshit. It's sort of a logic puzzle, you know? Stuff like CRTP letting me fool the compiler into essentially having support for pure virtual variables and stuff like that is fun because it's sorta unintuitive and takes some derivation.

I think programming is the most fun when I feel like I'm coming up with my own solution, or when I have some sort of concept that seems like it should work even if it's not obvious, and regardless of the specified intent of anything involved, the content of the pieces when finagled the right way happens to work just the way you want it to. Maybe that's cringe, maybe that's cope, I dunno. I like feeling clever. I definitely can't tell anyone who thinks "the language just isn't powerful enough" that they're wrong, though. It could be that once I've jumped through all the hoops and seen all the tricks before, it'll lose it's luster and I'll just want something that spares me the bullshit.
 
Last edited:
Back
Top Bottom