← Home ← Back to /g/

Thread 106145572

101 posts 24 images /g/
Anonymous No.106145572 [Report] >>106145607
/dpt/ daily programming thread
The general is very dead lately
How are you guys?

>working on stuff, IRL business + IRL business software + software mostly with LLMs
>still unemployed, of course
Anonymous No.106145581 [Report] >>106145665 >>106145694 >>106148462 >>106150070
Was the fascination with "dependency injection" the reason most young soft. engs. ended up thinking OO was shit and has no use at all?

Classes can still be useful, though they are heavily overused.
Anonymous No.106145607 [Report]
>>106145572 (OP)
at least link the previous thread
prev >>106108612
Anonymous No.106145665 [Report] >>106145712 >>106148462 >>106150056
>>106145581
No.. inheritance is the reason why people think OOP is shit.
Anonymous No.106145694 [Report] >>106145817 >>106148424
>>106145581
"dependency injection" is literally just calling a function properly instead of having globals everywhere.
OO turned to shit because of grifters who pretended all you have to do is accurately model the problem domain and the code writes itself (turns out a lot of the time it doesn't even help, as logical as it might sound at first). Just another bit of retardation in the chain that led to vibe coding.
Just remember that object oriented programming is supposed to be about the objects, not the classes. Nobody ever called it class oriented programming but they sure do act like it a lot of the time.
Anonymous No.106145712 [Report] >>106145729 >>106145795 >>106145829
>>106145665
nta but im honestly surprized
i thought its because of the actually useless shit that falls under the umbrella of "clean code" encapsulation and such, ownership, side effects, yadda yadda yadda
inheritance is actually pretty comfy in my opinion
Anonymous No.106145729 [Report] >>106149507
>>106145712
>umbrella of "clean code" encapsulation and such, ownership, side effects,
You have no idea what you are talking about.
Anonymous No.106145743 [Report] >>106145790
how do you get over your desire of being perfect and the most intelligent person
Anonymous No.106145790 [Report] >>106145843
>>106145743
You just become one and then you go do something else.
Anonymous No.106145795 [Report] >>106145822 >>106149507
>>106145712
>you have object B
>it's a chain, C < B < A
>A calls method that was actually overridden in C
>have to jump through hoops to figure out what the hell happened
No.
Anonymous No.106145817 [Report] >>106146063
>>106145694
you seem to be thinking of OO as a modeling tool, but not all problems lend themselves to being efficiently modeled as objects.

I read some of "multi-paradigm design in C++" so now I'm a genius
Anonymous No.106145822 [Report] >>106146063
>>106145795
also if they are virtual (and sometimes not) debugging it is a fuckin' nightmare

just prefer free functions (algorithms) like papa Klaus Iglberger says to
Anonymous No.106145829 [Report] >>106149507
>>106145712
>inheritance is actually pretty comfy in my opinion
inheritance is mental retardation
https://en.wikipedia.org/wiki/Draft:C3_linearization
Anonymous No.106145843 [Report] >>106148676
>>106145790
how do you be motivated enough to become one
Anonymous No.106145911 [Report]
>>106140741
You need __attribute__((naked)) otherwise the prologue and epilogue will be generated which will fuck up your code if you want to mess with the stack
Anonymous No.106146058 [Report] >>106146164 >>106146192
What about the best LLM local models for programming? I'm thinking about setting up a LLM and then piping it to VS Code with Roo
Anonymous No.106146063 [Report] >>106148437
>>106145817
No, I'm thinking of OO as it was sold to people, which is as a modeling tool.
When you use it properly, it isn't actually shit like the young soft engs think.
>>106145822
C++ is literally the only programming language where they ever might not be virtual, and when they aren't virtual they're fucking pointless since you have all the information you need at code-writing time to just call the function directly.
Anonymous No.106146164 [Report]
>>106146058
here we go again
Anonymous No.106146184 [Report] >>106147365
Is boost::asio::thread_pool decent?
Anonymous No.106146192 [Report] >>106146305
>>106146058
download cursor, use it.
Anonymous No.106146284 [Report]
I want to have anal sex with Angela Yu.
Anonymous No.106146305 [Report] >>106146721
>>106146192
Cursor costs money
Anonymous No.106146433 [Report] >>106147418 >>106147966
>Have a great idea for a new fun program for myself
>Design the basics, get into coding the fundamental parts of the program
>Get distracted on sidequest stuff for future proofing
>Get so lost in the weeds that base level features are abandoned
>Lose the fun of the program
>Leave it half finished
Thank god I don't do this at my actual job, but man it sucks.
Anonymous No.106146721 [Report]
>>106146305
you can plug in grok to it, you can probably plug in your own LLM too
Anonymous No.106146731 [Report] >>106159120
Are there any Linux distros with an LLM built-in yet? Shit makes using Linux sooo much better.
Anonymous No.106147365 [Report]
>>106146184
it requires bringing in boost so no, but there's a non-boost version of asio which is maintained alongside the boost version
it's at least well tested and probably robust
though there's more modern and more specific thread pool libraries
like facebook's libunifex is based on the executors proposal so their thread pools are closer to what the "standard" way of doing it is going to be
Anonymous No.106147393 [Report]
>finally come across one of those "just code C++ like it's C" projects
holy fuck, this is so bad it's unreal. morons who advocate for this should kys immediately.
Anonymous No.106147418 [Report]
>>106146433
it's fine, if your $HOME/projects/abandoned/ doesn't have at least 20 subdirs, you're not a real programmer.
Anonymous No.106147966 [Report]
>>106146433
Same issue, but when my mind goes blank after closing /g/ and youtube tabs, I somehow open the editor and make some progress or even fix an issue without knowing what I am doing.
Anonymous No.106148357 [Report] >>106157683
I just spent hours trying to figure out why a program wasn't working, looking up and down the code to try and figure it out. Turns out the problem was that in one of the data files it was "en_uk" instead of "en_UK" and I didn't pick it up until I used a text diff to figure out what the fuck was going on.
Program works perfectly fine now, it wasn't my shit c code.
Anonymous No.106148424 [Report]
>>106145694
>all you have to do is accurately model the problem domain and the code writes itself (turns out a lot of the time it doesn't even help, as logical as it might sound at first)
sounds like someone failed to properly model the problem domain

>Just another bit of retardation in the chain that led to vibe coding
now that's just coping

>Just remember that object oriented programming is supposed to be about the objects, not the classes
i can agree with this
Anonymous No.106148437 [Report]
>>106146063
>When you use it properly, it isn't actually shit like the young soft engs think.
they think it is shit, because they are unable to understand it. Probbably writing procedural code split into different classes and think thats oop.
Anonymous No.106148462 [Report] >>106148494
>>106145581
>>106145665
People dislike OOP, because it sounds easy conceptually, then they try it and discover it isn't as easy as they thought. Then, instead of confronting their own skill issue, they pretend that OOP itself is in some way broken, when in reality, they have a skill issue. The objections to OOP are mostly Dunning-Kruger delusions.
Anonymous No.106148494 [Report] >>106148576
>>106148462
Good morning saaar. Please do the needful and implement DesignatedShittingStreetSingletonFactory.
Anonymous No.106148576 [Report]
>>106148494
case in point
Anonymous No.106148676 [Report]
>>106145843
if you are not one already then you ngmi
Anonymous No.106149224 [Report]
Being good at OOP just means barely using it and designing everything around interfaces so I still think it stands to reason that OOP just isn't a very good paradigm.
AoC 2024, Day 1 No.106149396 [Report] >>106149480
Visiting Advent of Code 2024 out of boredom....
Golfing Haskell is barely fun anymore.

import Data.List
import Text.Printf

so = (.).fmap
(.:.) = (.).(.)
(.:..) = (.).flip (.)

main :: IO ()
main = parse >>= \[a,b] -> do
let sh f = (sum .:. f) a b
let p = sh .:.. printf "%s: %d\n"

p "Silver" $
zipWith $ abs .:. (-)
p "Gold" $
flip intersect.nub

parse :: IO [[Int]]
parse = so sort transpose.
so (so read words) lines
<$> readFile "ins.txt"
Anonymous No.106149480 [Report] >>106149636
>>106149396
>code boobs
Anonymous No.106149507 [Report] >>106149530 >>106155727
>>106145729

>encapsulation
yes. if you follow that youre supposed to have a god-class which contains all your program.
pretty fucking retarded as things go
>ownership
intellectual masturbation.
>no side effects
but then how do you fucking achieve encapsulation?
oop is so fuking retarded

>>106145795
>no, lets have 36.000 different variants of an object
>BECAUSE WE CAN
if you get filtered by inheritance probably you shouldnt be programming

>>106145829
solution for codemonkey mental retardation
also its a mechanism to resolve conflict, not a substitute for inheritance


as usual
people who disagree with me are completely uninformed about the subject
Anonymous No.106149530 [Report] >>106149563
>>106149507
You have no idea what you are talking about.
Anonymous No.106149563 [Report] >>106156436
>>106149530
i accept your concession
Anonymous No.106149605 [Report] >>106149626 >>106149934 >>106150294 >>106151008 >>106154256
Im thinking about learning a functional language. But I dont know which one to pick. I know C and Python. I was thinking lisp or haskell?
Anonymous No.106149626 [Report]
>>106149605
Lisp is not a pure functional language. Learn Haskell.
Anonymous No.106149635 [Report] >>106150262
>>106149621
Anonymous No.106149636 [Report]
>>106149480
>(.:.) = (.).(.)
dik n bob sir
Anonymous No.106149934 [Report] >>106151008 >>106154256
>>106149605
>I was thinking lisp or haskell?
All normal functional programmers use ML.
Anonymous No.106150034 [Report] >>106150377
I want to build a locally hosted project to manage small business personnels info like
>name/age/sex/marital status
>salary/work hours/sick leaves
>images of their IDs/ faces
I don't really mind if it's AI/vibe coded, since it's just personal use and not a production thing and better tha using google sheets.
i was thinking of webui interacting with some database and using static html/css/js?
It it reasonable?
Ai need a little bit og guidance to these things, so what's your advice on that?
I was thinking of using flask + MySQL is that good idea? or there are better options?
Anonymous No.106150056 [Report] >>106150267 >>106150293 >>106150296
>>106145665
No... inheritance being the first thing new programmers learn about OOP is the reason they dislike OOP. It's been taught wrong since the 90s.
Anonymous No.106150070 [Report]
>>106145581
DI is just good programming even if you're doing it manually.
Anonymous No.106150262 [Report]
>>106149635
epubs are just zip files full of HTML.
The actual content of the book is in <p> tags in said HTML.
Making it display in a snake way would involve writing your own HTML renderer since you have to know the layout of the <p> tag to know where the lines break and when to start reversing stuff.
Anonymous No.106150267 [Report]
>>106150056
actually the wrong thing about teaching is always starting with procedural programming, then giving the students procedural-specific problems to solve, then present them only select bits used within OOP (without really teaching or even explaining object orientation as a concept) and telling them to shoehorn the """OOP"""" bits into the same procedural-specific problems they had already solved

but yes, it's been taught wrong
Anonymous No.106150293 [Report] >>106151004
>>106150056
No. People start to dislike OOP when they get a job and see this.
Anonymous No.106150294 [Report]
>>106149605
haskell is cool, I also like clojure
Anonymous No.106150296 [Report] >>106150329 >>106151046
>>106150056
>It's been taught wrong since the 90s.
Did you watch that OOP talk Casey gave. Inheritance is like the main thing the original OOP guys wanted it to be about and how they introduced it in all their papers.

Again, the modern "good" way to write OOP seems to be to just eschew OOP as much as possible.
Anonymous No.106150329 [Report] >>106150365
>>106150296
The best way to write OOP is just to take encapsulation and ditch everything else, especially design patterns.
Typeclasses > inheritance based polymorphism anyway
Anonymous No.106150365 [Report]
>>106150329
aka not use OOP at all. Glad we agree.
Anonymous No.106150377 [Report] >>106150424
>>106150034
yeah, LLMs can probably oneshot stuff like that if you're specific enough in your prompt
just don't put slop with PII on the public web
Anonymous No.106150415 [Report]
Freelancing on crypto discord groups to pay the bills so I can write Rust in my free time

Right now I am writing a tool that helps a jeet buy the token supply before others so he can dump on them

The rust project is a discord erotic roleplay bot
Anonymous No.106150424 [Report] >>106156486
>>106150377
>public web
kek.
Don't worry, this is completely local and personal use only.
The data is arranged in google sheets but it's just stupid doing images in a spreadsheet.
Got any idea on what to use?
Anonymous No.106150964 [Report]
fucking hell is it really this fucking grim these days?
is "vibe coding" bullshit really that common?
everything is so fucked
Anonymous No.106151004 [Report] >>106151098
>>106150293
the whole point is you literally don't care about any of those but the business logic
Anonymous No.106151008 [Report]
>>106149605
ATS.
>>106149934
Based.
Anonymous No.106151046 [Report]
>>106150296
>Again, the modern "good" way
>just eschew OOP as much as possible.
that's neither modern (unless you think the last 20 years is "modern"), nor good
this approach is the root of at least half of all problems with "OOP" that people have
Anonymous No.106151053 [Report]
I havent touched my emulator since i bonked my cabeza and frankly I don't feel like finishing it, it would benefit me more to focus on either embedded or just fuck around with circuits
t. EE zoomer
Anonymous No.106151098 [Report] >>106151720
>>106151004
You don't care until something breaks and shit hits the fan.
Anonymous No.106151720 [Report] >>106156545
>>106151098
name one thing in your project that was broken actually inside of Spring, Hibernate or Tomcat that you had to fix yourself manually and not just update the bugged library
Anonymous No.106152311 [Report] >>106152351 >>106152996 >>106154214
I'm trying to distance myself completely from AI for a year and grind real, real hard to make sure I'm ready to start working and not get instabooted once I get a job.

Do you guys have any suggestions for daily challenges etc that I can do each day on top of my course work?
Anonymous No.106152351 [Report] >>106152379
>>106152311
grow up
Anonymous No.106152379 [Report]
>>106152351
Yeah that's what im doing. Im removing the training wheels
Anonymous No.106152996 [Report] >>106153230
>>106152311
>Do you guys have any suggestions for daily challenges etc that I can do each day on top of my course work?
Doing hobby projects.
Anonymous No.106153230 [Report]
>>106152996
Good point. Ill build my portfolio while getting in some daily training
Anonymous No.106153653 [Report]
Made a lil shadertoy.
Anonymous No.106154214 [Report]
>>106152311
>daily challenges

The kind of goals you complete as a software engineer are measured in weeks, or months, not days. As always, the answer is to work on a project that solves an actual problem. Decide what problem the project will be solved, limit the number of features to the things you can reasonably do in a pre-alotted amount of time, and then do it. The important thing for finishing the project is *scope control* - if you keep on adding features, you'll never finish. Good software engineers know what they *shouldn't* code
Anonymous No.106154256 [Report] >>106154277 >>106154416
>>106149605
>>106149934
Ocaml has really good docs. If you've never done FP before, their getting started guide will tell you everything you need to know. Only problem with Ocaml is they don't have any good first party editing tools (no good integrations with common editors or IDEs), so you'll likely be stuck just editing text files and debugging them with a command line REPL or printing logs. Some people prefer this, though, and don't have any use for IDEs, breakpoints, variable monitoring, etc.
Anonymous No.106154277 [Report]
>>106154256
NTA
if you want to learn FP you can use F# as a stepping stone to learn Haskell
F# doesn't have good modules like OCaml though
Anonymous No.106154416 [Report]
>>106154256
>they don't have any good first party editing tools (no good integrations with common editors or IDEs)
The Emacs support is great if you use it.
>Ocaml has really good docs.
For the language itself, yeah, but most library docs are "just read the auto-generated interface bro :)"

I'd say OCaml is a pain if you aren't familiar with ML. F# is much easier and people document their shit *way* more.
F# eventually starts sucking once you see how it's gimped by .NET, but it's super comfy at the start.
Anonymous No.106154652 [Report] >>106155035
Is AI able to manage a C project better or worse than C++ or C# or Python?

Because it very quickly gets too complex and error-prone with the AI generating C++, which is a damn shame. The C++ it writes is fucking shit too.

Since the ML researchers use/used Python so much I presume it would do well with that, but I'm trying to build something for performance and I need both C and C++ library code. Just curious about generating C projects.
Anonymous No.106155035 [Report]
>>106154652
>Putting raw pointers and undefined behaviour in the hands of an LLM
No, no, anon
Please do proceed
Anonymous No.106155496 [Report]
This is difficult to explain but I fixed an issue with my track rendering. There is a possibility for degenerate polygons to be calculated (left edge to the right of the right edge etc) due to rounding errors. I could brute force it to look good by drawing 3 versions of the polygon to untwist twisted bowties however this made it look TOO good and I was missing the shitty cracks in the model in the original game. I figured it out though, had a bug where I was only calling the regular quad rendering function and not the one that splits it into tris if it's concave and that function itself was borked. Anyways. Now it looks exactly as shitty as the original and my autism is satisfied.
Anonymous No.106155727 [Report] >>106156248
>>106149507
Inheritance is a forced meme.
Smalltalk-72 didn't have it. It was an experiment for Smalltalk-80.
Anonymous No.106156107 [Report]
Testing framebuffer performance
Anonymous No.106156248 [Report] >>106156707
>>106155727
>extreme late-bindinds
but why?
Anonymous No.106156436 [Report] >>106156953
>>106149563
You sound like you're trying to blame others for being filtered by OO. Maybe that's not what you're trying to say in your head, but that's how it's coming across to the rest of us.

Encapsulation is literally just "group these things together so they can be managed as single conceptual thing by the rest of the program". Building higher level abstractions is how you go from making small programs to making bigger ones, or at least how you do it without going crazy.
If you want side-effect free, you just return a new one instead of modifying the thing you've got. That's literally all you need to do; anyone thing you need anything else has just lost the plot.
Anonymous No.106156486 [Report] >>106159951
>>106150424
>Got any idea on what to use?
For storing a bunch of images with metadata? Database is a good good plan, keeping the image data in BLOB columns. (It sucks a lot less than a filesystem for anything other than a very small number of images.)
I'd go with SQLite as it is very good at this sort of thing, but MySQL wouldn't be a terrible choice if it's set up right. If you know one but not the other, that's a fine reason to pick that one.
Anonymous No.106156545 [Report]
>>106151720
Spring Boot is a devil to debug when it goes wrong and stops loading the components you need. But once you've got it working, it's really quite reliable.
Never cared for Hibernate, but that's because I prefer to just write SQL and write the binding code myself. It's not that difficult unless you're being dumb with what data to fetch out of the DB.
I remember trying to debug Tomcat years ago when it was leaking memory (due to self-referential thread locals preventing disposal of the classloader; this was in Java 7 when permgen exhaustion was a big issue) but that stuff now seems fixed.
Anonymous No.106156707 [Report]
>>106156248
If object A decides to send a message to B and A also decides that B is a StringTrimmer that has a method that takes a String and returns a String, then B can't alter its behaviour and you are determining its form.
To Kay, objects are like organic cells: you tell a cell of arbitrary form something (via chemicals) and it's up to them to manage their state and do whatever they want in response.
Late binding is key.
Anonymous No.106156953 [Report]
>>106156436
>Encapsulation is literally just "group these things together so they can be managed as single conceptual thing by the rest of the program".
the important point is that the encapsulated object has its internal state and logic out of scope of external objects, only providing a public interface for other objects to interact through

if it were possible to change state directly instead of through the interface, the whole abstraction of that object could be broken
Anonymous No.106157683 [Report]
>>106148357
I believe in you anon
Anonymous No.106158581 [Report] >>106158686 >>106158972 >>106159211
Having a real fucking hard time to understand many things about C.

I've written C many times before, except I've always had huge tech debt in regards of stuff like Cmake, Makefiles, and other stuff like clangd and its compile_commands.json
I can't really make it click together and I'm not sure what am I doing nor what to tackle first.

Can someone guide me in the right direction?
Anonymous No.106158686 [Report]
>>106158581
too broad and too generic
Anonymous No.106158972 [Report]
>>106158581
Yes, Grok writes my cmakelists.txt files for me.

I hesitate to suggest it normally, because then you can just ask the AI. You won't be able to tell if the answer is bs though. Come back here when you're done.

Also, find a popular open source github project that uses cmake and examine the cmakelists.txt (the outer one), it should have inner ones for sub-projects and test projects, etc.
Anonymous No.106159120 [Report]
>>106146731
nope, but they are easy to install after the fact, look up llama.cpp tutorials
Anonymous No.106159211 [Report] >>106159252
>>106158581
are you doing something more complex than just consuming a couple translation units all with the same config or using a single version of a library with a single ABI always located in the same place regardless of system?
then that's when you start thinking about things like cmake or makefiles

cmake is a meta build system for portably creating platform specific build tool files like makefiles
though these days that basically just boils down to creating the build files for ninja (which is basically a high speed super minimal portable make not meant for human usage) unless you specifically need msbuild files in case of some weird visual studio thing
instead of shoving everything into one compiler invocation and then expecting the compiler to properly handle dispatching everything, build tools automate scheduling and invoking the different steps of compilation while also handling things like avoiding rebuilding unchanged files or parallel task invocation

cmake is terrible but it handles things like compiler feature checking, dependency resolution, platform config, launching some build utilities, compiler compat, handling multiple build configurations for release/debug/etc., installation, compiling for a different architecture than your current one, and other shit in the most widely supported manner
even if you don't want to use it fucktons of other projects do which means in order to consume a lot of libraries you have to use cmake's dependency resolution which handles cmake install configs and paths
and the only real way to learn it is to read and write a lot of cmakefiles
no one writes good cmake code, but try to use properties and generators as opposed to just setting variables to values

you should be using an IDE/editor with C++ support that implicitly handles managing clangd and generating and feeding it compile_commands.json like qtcreator, you shouldn't even need to touch the language server directly at all unless you're doing something fucky
Anonymous No.106159247 [Report] >>106159453
https://www.youtube.com/watch?v=15_-hgsX2V0
>Coded it on my phone, in my spare time, with Tmux and Vim
i wish i was as powerful as this man
Anonymous No.106159252 [Report]
>>106159211
>C++ support
*C family language support
if you use something with proper language server support, which i think is most of them aside from garbage like code::blocks even stuff like CUDA or OpenCL or ObjectiveC should just work implicitly without ever having to touch clangd, .clangd config files, or compile_commands.json
Anonymous No.106159453 [Report] >>106159483
>>106159247
use case for a server built like a virus?
Anonymous No.106159483 [Report] >>106159496
>>106159453
>built like a virus
wut
Anonymous No.106159496 [Report] >>106159575
>>106159483
single file that can run on multiple OSes and architectures
Anonymous No.106159575 [Report]
>>106159496
that's a good thing tho
Anonymous No.106159951 [Report]
>>106156486
So storing images as BLOB is a good idea?
AI slopa keep saying it bad.