Incase it doesn’t show up:

142 points

“Give it six months”

It only needed 3!

permalink
report
reply
93 points
*
56 points

Particularly unexpected, because 3! = 6.

permalink
report
parent
reply
29 points

That’s because C++ is such a high performance language, it gets things done faster

permalink
report
parent
reply
3 points
permalink
report
parent
reply
2 points

7m - 4m = 3m

permalink
report
parent
reply
4 points

My bad. I was going off OP first comment at 8 months and not the reply at 7 months.

I came back to be like actually no, but then I was like oh I’m the dumb dumb.

permalink
report
parent
reply
64 points
*

Disclaimer: I actually like C++ the language, I’m reasonably comfortable with it and enjoy it as an upgrade from C. I don’t use much OOP stuff as I’m writing a game using the flecs ECS. So things like abstract classes are mostly absent from my codebase.

What has been driving me up the wall the last month has been build systems and dependencies: don’t get me wrong; meson is great but the problem is not everyone uses meson. All I want to do is add some library built with cmake as a dependency without needing to rewrite the build system or install it on my OS. Apparently that is too much to ask!

I’m seriously considering dropping everything and jumping to Rust because of Cargo. Yes I’ve tried setting up conan but not having much fun since the recipes are all third party and out of date anyways

permalink
report
reply
33 points

Rust’s cargo is great, I’d say it would be best to make the switch sooner rather than later once your code base is established. The build system and tooling alone is a great reason to switch

permalink
report
parent
reply
18 points

What sucks is I’ve been working on this hobby project for nearly 4 years now. It started in C#, moved to C, now C++. It’s at the stage where a lot of basic functionality has been implemented, with the largest component, the Vulkan based renderer being maybe 1/4 implemented. The core game stuff is ECS based and flecs has a rust binding so migrating that will be easy. Renderer will just become even further from completion. I’m worried that there will be new problems that are maybe more inhibiting, but this is meant to be a fun project and build systems aren’t fun. It’s a difficult balance and I’m not the only person involved, the other person isn’t as convinced by cargo as they haven’t spent days working on the build system

permalink
report
parent
reply
14 points
*

I’m a gameplay programmer who have worked with Unity and Unreal and I’ve experiment with Rust for gamedev(though only for hobby projects) and for regular code. My conclusions so far is that Rust sucks for gameplay code, for most other things it’s kinda nice.

The biggest reason is that it’s much harder to write prototype code to test out an idea to see if it’s feasible and feels/looks good enough. I don’t want to be forced to fully plan out my code and deal with borrowing issues before I even have an idea of if this is a good path or not.

I would say though that because you are using ECS stuff it is at least plausible to do in Rust but at least for my coding/development style it still isn’t a good fit.

permalink
report
parent
reply
1 point

Story by a game dev who gave up on Rust after 3 years https://loglog.games/blog/leaving-rust-gamedev/

permalink
report
parent
reply
10 points

I’m seriously considering dropping everything and jumping to Rust because of Cargo.

Well if you’re into game dev, ECS and Rust, there’s like a 99% chance you know of it, but just in case you don’t: We have bevy, now with an extra full-time dev (Alice, who’d been working hard at it for years, I think she’s a bigger contributor than the author himself at this point lol)

permalink
report
parent
reply
4 points

I’ve been keeping an eye on bevy, it looks really cool. I’ll probably make something with it one day when their ECS gets support for entity relationships (which appears to be in the pipeline). A really cool project though, basically looks like everything I’ve wanted out of a C++ engine which I can’t really use due to build system mixing.

permalink
report
parent
reply
3 points

Brackeys started a series on Godot recently. If you are writing a smaller game GDscript looks attractive and far simpler.

permalink
report
parent
reply
3 points

They’re mucking it about a little though, like that post when checking if types don’t match ‘! value is type’ can now be ‘value is not type’ which is more readable but not as logical in terms of the language.

permalink
report
parent
reply
2 points

Being a Python simp, I find GDscript just different enough to nag. There’s a lot of QoL stuff they don’t have and aren’t (currently) looking to add in order to keep the language simple. Honestly has me looking to use C# instead.

permalink
report
parent
reply
1 point

Being a Python simp, I find GDscript just different enough to nag. There’s a lot of QoL stuff they don’t have and aren’t (currently) looking to add in order to keep the language simple. Honestly has me looking to use C# instead.

permalink
report
parent
reply
0 points

So things like abstract classes are mostly absent from my codebase.

I believe the consensus nowadays is that abstract classes should be avoided like the plague even in languages like Java and C#.

permalink
report
parent
reply
13 points

I have not heard this consensus. Definitely inheritance where the base class holds data or multiple inheritance, but I thought abstract was still ok. Why is it bad?

permalink
report
parent
reply
6 points

In 99% of the cases, inheritance can easily be replaced with composition and/or interfaces. Abstract classes tend to cause hard dependencies that are tough to work with.

I’m not sure why you would use abstract classes without data. Just use interfaces.

permalink
report
parent
reply
35 points

After you’ve done some languages, they all look the same. Yes, some have interesting features like the indent-based blocking of Python, and I’ll have to look up if the new language has “else if”, “elsif”, “elif”, or whatever, but als long as it is coming from the family of ALGOL-like languages, it does not matter much. You’ll learn the basic functions needed to get around, and off you go.

Just a few weeks ago, I started learning Python. Yes, this indenting takes some time to get used to. My son does Python for about a year now - he started with it at university. Maybe ten days after I started learning, I invited him to have a look at my first Python program. I have no idea what he expected. A “Hello, World” with a few extra features, maybe? Definitely not the 2.5k lines app I had written in my spare time, with GUI, databases, harvesting data from a web site with caching, and creating PDF files with optimized layout for the data I processed. In the end, it was just another programming language.

permalink
report
reply
23 points

I guess you’ve never seen some of the 10-page template errors C++ compilers will generate. I don’t think anything prepares you for that.

permalink
report
parent
reply
7 points

I’ve seen way worse. Imagine a project that uses C preprocessor structures to make a C-compiler provide a kind-of C++. Macros that are pages long, and if you forget a single bracket anywhere, your ten pages look like a romance novel.

Or VHDL synthesis messages. You’ve got no real control over them, 99.9% of the warnings are completely irrelevant, but one line in a 50k lines output could hint at a problem - if you only found it.

So far, the output of C or C++ compilers (except for the above-mentioned project) has not been a problem or me, but I’m doing this for about 40 years now, so I’ve got a bit of experience.

permalink
report
parent
reply
7 points

Yep, sadly I’ve been exposed to a few such codebases before. I certainly learned a lot about how NOT to design a project.

You’ve been at it longer than I have, but I’ve already had coworkers look at me like I’m a wizard for decoding their error message. You do get a feel for where the important parts of the error actually are over time. So much scrolling though…

permalink
report
parent
reply
1 point

I had to do a module programming in VHDL for my EE degree.

Every time I see it mentioned anywhere I have a compulsion to scream: FUCK VHDL AND ITS FUCKING ERRORS! NO YOUR ANALYSIS & SYNTHESIS IS UNSUCCESSFUL!

I did not pursue a career in electronics…

permalink
report
parent
reply
0 points
*

I’ve not had those while working with concurrent programs with c++ for over a year. Pointers, QT programming, non-qt backend programming, coding an engine to work with computer vision runners (openvino mostly), image management (more pointers)… Idk, this is gonna sound rude but just code better? Most of my errors were segfaults, I have had to plug the debugger and/or tons of prints and I made it work.

If you want to see giant error logs, check pyspark errors. But even those have the relevant line of info and then all the rest of the garbage info that no one really needs, like any other language.

permalink
report
parent
reply
3 points

It really depends what you’re doing. The last big project I did with C++ templates was using them to make a lot of compile-time guarantees about concurrency locks so they don’t need to be checked at runtime (thus trading my development time for faster performance). I was able to hide the majority of the templates from users of the library, and spent extra time writing custom static_assert messages.

C++ templates are in fact a compile-time turing complete language, as crazy as that sounds.

permalink
report
parent
reply
5 points

Yeah this only really applies to Algol style imperative languages. Dependent types and say stack languages like idris and apl are dramatically different in their underlying axioms.

permalink
report
parent
reply
3 points

Indeed. I have done languages like Prolog and Forth, too, and have actually written a bit in APL ages ago. Yes, they are different, but in the end, it just adds a little bit of complexity. The underlying algorithms are universal, just the methods and structures to achieve them differ. Actually, the first programming language I have written was a simplified Forth derivate - in 6510 Assembler.

permalink
report
parent
reply
3 points

I didn’t even know about the Python indentation thing until I was practically done learning it! I’m just used to copying whatever indentation scheme my coworkers are using, for consistency.

permalink
report
parent
reply
2 points
*

Definitely not the 2.5k lines app

MVC can be a great experience, especially with python dictionaries.

permalink
report
parent
reply
3 points

Learning how to get models and views together took some time, but after the second refactoring that week I managed to have neat objects for each MVC with clean interfaces. My biggest source in the app defines a requester with three columns of lists: a global category, then parts from that category, and finally the available colors for that part. Each of those views is an object, their interacting logic is an object, and finally the actual requester is an object, and this makes thing easy to handle.

permalink
report
parent
reply
1 point

Great!

permalink
report
parent
reply
2 points

I’m interested in specifically what your first program did?

Like what data is it harvesting and how is it showing that in PDFs or should I say why?

permalink
report
parent
reply
1 point

The software gets data from a website named bricklink.com, where one can buy and sell LEGO bricks and sets.

The main view holds a list of bricks I’ve selected from the large range available. In a requester to add parts, I can select a certain brick from the list of existing bricks by first chosing a category (e.g. “Bricks”) in the leftmost column, then chosing it’s shape (e.g. “Brick 2x4”) in the middle one, and then selecting the color (of the known existing colors for this brick, e.g. “Black”) in the right column. On all three selections I can multi-select and sort, which allows me to select e.g. a number of different Bricks, then sort the last view by color, and multiselect those bricks in the color I need. OK’ing the requester add the part(s) to my list.

The list that shows all the properties (including when this part was in production, how much a single brick of it weighs, as well as mold codes and article numbers). From there, I can choose some bricks (usually 15 in a go) to print, which produces a PDF with 15 labels on a double-sided A4-paper with cut-marks on one side. I cut them along the cut marks and put them into the bag with the coresponding part. This is quite helpful, if you consider a box with bags all containing e.g. black parts and bad lighting conditions in the storage room. Alternatively, I can print a double-sided paper with four larger cards to cut, which I laminate and use for marking boxes when I have larger amounts of one brick shape and color.

I can (and do) export those bricks to an export folder as CSV once I’ve printed the labels. In a future version of the software, I will be able to take a bag or box of parts from my collection, select it in my software via it’s article number, and derive an approximate count by weighing them (therefor the parts weight) to get an approximate inventory.

permalink
report
parent
reply
2 points

Hey, thanks for explaining the project for me. That sounds fascinating, is it public? Not that I want to steal it, I never got into Lego, just would like to see exactly how it works.

It also begs the question of how much Lego you actually have lol.

I’ve been thinking of building Lego when I’m sad but it seems so expensive.

permalink
report
parent
reply
35 points

Jokes aside, I struggle more with abominations like JavaScript and even Python.

permalink
report
reply
24 points

Do you have a minute for our lord and savoir TypeScript?

permalink
report
parent
reply
12 points

As long as it can distinguish between int and uint - yesss!

permalink
report
parent
reply
19 points
*

TypeScript is still built on JavaScript, all numbers are IEEE-754 doubles 🙃

Edit: Actually I lied, there are BigInts which are arbitrarily precise integers but I don’t think there’s a way to make them unsigned. There also might be a byte-array object that stores uint8 values but I’m not completely sure if I’m remembering that correctly.

permalink
report
parent
reply
12 points

Python has its quirks, but it’s much much cleaner than js or c++, not fair to drag it down with them imo

permalink
report
parent
reply
10 points

I think the thing with C++ is they have tried to maintain backward compatibility from Day 1. You can take a C++ program from the 80s (or heck, even a straight up C program), and there’s a good chance it will compile as-is, which is rather astonishing considering modern C++ feels like a different language.

But I think this is what leads to a lot of the complexity as it stands? By contrast, I started Python in the Python 2 era, and when they switched to 3, I was like “Wow, did they just break hello world?” It’s a different philosophy and has its trade-offs. By reinventing itself, it can get rid of the legacy cruft that never worked well or required hacky workarounds, but old code will not simply run under the new interpreter. You have to hope your migration tools are up to the task.

permalink
report
parent
reply
4 points

even a straight up C program

C++ is not a superset of C.

permalink
report
parent
reply
2 points

The terse indexing and index manipulation gets a bit Perl-ish and write-only to me. But other than that I agree.

permalink
report
parent
reply
5 points

Yeah JavaScript is a bit weird, semicolons being optional and compulsory at the same time: I remember trying to build an electron example ~5yrs ago and it didn’t work unless I put in the semicolons which the developers omitted.

Python is just glorified shell scripting. Libraries like numpy are cool but I don’t like the indentation crap, I’m getting used to it because University likes it.

permalink
report
parent
reply
2 points

but I don’t like the indentation crap

Do you not use indentation in other languages?

permalink
report
parent
reply

Yes but it’s difficult in a long program to tell which scope you are in or where one ends. I don’t know what is so unfriendly about { and }, my editor can highlight pairs of them, it’s just nicer to work with.

permalink
report
parent
reply
1 point

Python is just glorified shell scripting

Absolutely not, python is an actual programming language with sane error handling and arbitrarily nestable data structures.

I don’t like the indentation crap

Don’t be so superficial. When learning something, go with the flow and try to work with the design choices, not against them.

Python simply writes a bit differently: you do e.g. more function definitions and list comprehensions.

permalink
report
parent
reply

Yeah I meant for that to be a bit inflammatory. I actually don’t mind python apart from the execution speed, but the indentation I find makes it more difficult to read stuff that is extremely nested. I use it mostly for creating plots and basic stuff for my science degree but for any serious project I wouldn’t consider it

permalink
report
parent
reply
33 points

C is dangerous like your uncle who drinks and smokes. Y’wanna make a weedwhacker-powered skateboard? Bitchin’! Nail that fucker on there good, she’ll be right. Get a bunch of C folks together and they’ll avoid all the stupid easy ways to kill somebody, in service to building something properly dangerous. They’ll raise the stakes from “accident” to “disaster.” Whether or not it works, it’s gonna blow people away.

C++ is dangerous like a quiet librarian who knows exactly which forbidden tomes you’re looking for. He and his… associates… will gladly share all the dark magic you know how to ask about. They’ll assure you, oh no no no, the power cosmic would never turn someone inside-out, without sufficient warning. They don’t question why a loving god would allow the powers you crave. They will show you which runes to carve, and then, they will hand you the knife.

permalink
report
reply

Programmer Humor

!programmerhumor@lemmy.ml

Create post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.

Community stats

  • 3.7K

    Monthly active users

  • 1.5K

    Posts

  • 35K

    Comments