programming.dev

Thcdenton, to programmer_humor in ifn't
davidgro,

Ding ding ding ding ding ding…

GBU_28, to programmer_humor in Merge then review

Let the users do the testing

ArmoredThirteen,

Oh hey a fellow game dev, how long you been in the industry?

jubilationtcornpone, to programmer_humor in Infinite Loop

Project A: Has 6 different implementations of the same complex business logic.

Project B: Has one implementation of the complex business logic… But it’s ALL in one function with 17 arguments and 1288 lines of code.

“The toast always lands the buttered side down.”

QuazarOmega,

Project B is just called neural network

CanadaPlus,

Actually, I bet you could implement that in less. You should be able to legibly get several weights in one line.

QuazarOmega,

You have my interest! (Mainly because I don’t know the first thing about implementing neutral networks)

CanadaPlus, (edited )

At the simplest, it takes in a vector of floating-point numbers, multiplies them with other similar vectors (the “weights”), sums each one, applies a RELU* the the result, and then uses those values as a vector for another layer with it’s own weights (or gives output). The magic is in the weights.

This operation is a simple matrix-by-vector product followed by pairwise RELU, if you know what that means.

In Haskell, something like:

layer layerInput layerWeights = map relu $ map sum $ map (zipWith (*) layerInput) layerWeights

foldl layer modelInput modelWeights

Where modelWeights is [[[Float]]], and so layer has type [Float] -> [[Float]] -> [Float].

  • RELU: if i>0 then i else 0. It could also be another nonlinear function, but RELU is obviously fast and works about as well as anything else. There’s interesting theoretical work on certain really weird functions, though.

Less simple, it might have a set pattern of zero weights which can be ignored, allowing fast implementation with a bunch of smaller vectors, or have pairwise multiplication steps, like in the Transformer. Aaand that’s about it, all the rest is stuff that was figured out by trail and error like encoding, and the math behind how to train the weights. Now you know.

Assuming you use hex values for 32-bit weights, you could write a line with 4 no problem:

wgt35 = [0x1234FCAB, 0x1234FCAB, 0x1234FCAB, 0x1234FCAB];

And, you can sometimes get away with half-precision floats.

QuazarOmega,

That’s cool, though honestly I haven’t fully understood, but that’s probably because I don’t know Haskell, that line looked like complete gibberish to me lol. At least I think I got the gist of things on a high level, I’m always curious to understand but never dare to dive deep (holds self from making deep learning joke). Much appriciated btw!

CanadaPlus,

Yeah, maybe somebody can translate for you. I considered using something else, but it was already long and I didn’t feel like writing out multiple loops.

No worries. It’s neat how much such a comparatively simple concept can do, with enough data to work from. Circa-2010 I thought it would never work, lol.

Hack3900, to programmer_humor in GTA 5 Java Coffee shop

The void function seems to return an int

infinitepcg,

I wonder how often someone walks in and tells them about the mistake. Do the baristas have a standard response?

aniki,

“Sorry, I only write vegan react…and python.”

KingJalopy,
@KingJalopy@lemm.ee avatar

It’s a video game so I’m guessing they do have a standard response

SzethFriendOfNimi,
@SzethFriendOfNimi@lemmy.world avatar

Yes, but maybe there’s some magic going on so that the lack of a type assigns some value that results in void?

gsfraley, (edited )

Oof, and there’s only ten lines of code, too. And they look very purposefully written out.

AeonFelis, to programmer_humor in Infinite Loop

After so many years in this company, lots of the unmaintainable code I have to deal with is either my own fault, or the fault of someone I used to work with but and now they left and I’m the one who has to apologize for their code.

If I move to a different company, 100% of the unmaintainable code I’ll have to deal with there will be someone else’s fault.

owen,

In the industry we call this responsibility load balancing

SpaceCowboy,
@SpaceCowboy@lemmy.ca avatar

And managers don’t like it when you explain that the code is a unmanageable mess because they put a deadline on every goddamn thing and never pay off technical debt.

At a new place you can honestly say “the code is kinda a mess, it needs a bunch of work” and the manager can just assume it was because the last guy didn’t know what he was doing and not because of their own shitty management.

soggy_kitty,

To be honest, sometimes shit code is 100% the Devs fault. I’ve witnessed it happen with other teams in my own company.

Let’s just say it was unavoidable to report it

SpaceCowboy,
@SpaceCowboy@lemmy.ca avatar

Management could implement a code review process to avoid this.

Software development isn’t a brand new field anymore. Most problems are well known and therefore have well known solutions. So it pretty much always comes down to management not wanting to implement the known solutions to the problems because its easier to blame the devs.

potemkinhr, to piracy in Special Ubisoft announcement
@potemkinhr@lemmy.ml avatar

Ubisoft won’t own my money too!

werefreeatlast,

*Either

0x0, to programmer_humor in ifn't

I propose a new, more threatening kind of control flow.


<span style="color:#323232;">do {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} or else {
</span><span style="color:#323232;">  /* you don't want to find out */
</span><span style="color:#323232;">}
</span>
Strawberry,

this is just a menacing try/catch!

gex,

Some C++ style guides suggest the following naming convention for functions that crash on any error


<span style="color:#323232;">OpenFileOrDie()
</span>
yum13241,

Now what about GZDoom’s GoAwayAndDie();?

xmunk,

PHP has the always wonderful (and perfectly functional) syntax of

logUserIn() or die();

msage,

Or Perl

evatronic,

Where do you think PHP stole it from?

msage,

Bash?

frezik, (edited )

Perl also has unless() for the very purpose in OP, which is a more sensible choice.

Oh, and if you need to reinforce your belief that Perl is a mess, the single-quote character can be used as a package separator instead of “::”. This was set in the 90s when nobody was quite sure of the right syntax for package separators, so it borrowed “::” from C++ and the single quote from Ada (I think).

That means the ifn’t() in OP can be interpreted as calling the t() function on the ifn package.

The “::” separator is vastly preferred, though. Single quotes run havoc on syntax highlighting text editors (since they can also be used for strings). About the only time I’ve seen it used is a joke module, Acme::don’t.

Kissaki,

Personally, I like to call catched exception variables up, so for a rethrow I can throw up;.

Vorthas,
@Vorthas@programming.dev avatar

One of the modules in a project I’m working on is called VulkanOrDie which always makes me crack up when I see it in the compilation messages.

OpenStars,
@OpenStars@startrek.website avatar

It’s funnier when you try to SysCallAndDie() :-P

(that’s a real thing in perl btw - I guess that function didn’t get the memo)

OpenStars,
@OpenStars@startrek.website avatar

You just made me a offer I can’t refuse. I go now to sleep with the fishes…

Mesa,
@Mesa@programming.dev avatar

The better try-catch. More intuitive if you ask me.

moody,

It_would_be_a_shame_if(condition)

rothaine,

<span style="color:#323232;">do {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} do hast {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">}
</span>
0x0,

<span style="color:#323232;">do {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} do hast {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">} do hast mich {
</span><span style="color:#323232;">  /* something */
</span><span style="color:#323232;">}
</span>
jadelord,

It exists, kind of. Python has this construct


<span style="color:#323232;">for item in iterable:
</span><span style="color:#323232;">    ...
</span><span style="color:#323232;">else:
</span><span style="color:#323232;">     ...
</span>

which always puzzles me, since it depends on a break statement execution. I always have to look it up when the else block is executed.

Facebones, to piracy in Special Ubisoft announcement

Watch out you’re gonna hurt the feels of late Stage Capitalism stans

Kichae,

Developers deserve to be paid for their work!

Also, wages in games is low, but if you wanted to be paid more for your work, you should find another job!

averyminya,

That’s a tricky one. Wages in games don’t have to be low necessarily, it’s just corporations that make that more common.

Luck is a big factor, but look at the dev of Lethal Company. Wages in games is huge for them!

Oh shoot I-i mean,

You wouldn’t download a game.

Hiro8811, to programmer_humor in Programming: The Horror Game

But I have an LCD display

pkill,

non-AMOLED devices spreading misinfo by enabling dark mode by default on low battery and it’s consequences…

Hiro8811,

Low battery mode on…computers?

Omega_Jimes,

Yeah. Some folk use portable computers on top of their laps. It’s weird :/

fsr1967, to programmer_humor in Programming: The Horror Game

laughs in IntelliJ multi cursor mode

executivechimp,
@executivechimp@discuss.tchncs.de avatar

What’s the joke? VSCode has multi cursor.

fsr1967,

With multiple cursors, we can see more of the dungeon, uh, I mean code.

Eonandahalf, (edited )
fsr1967,

If you have multiple similar lines, you can perform the same editing on them all at once.

Maalus,

It does get its uses. Mostly editing similar lines, multiple methods at the same time, etc. Makes you look like a ninja too

SolarMech, to programmer_humor in Infinite Loop

Learning to deal with “unmaintanable” codebases is a pretty good skill. It taught me good documentation and refactoring manners. It’s only a problem for you if management does not accept that their velocity has gone down as a result of tech debt pilling up.

Code should scream it’s intent (business-wise) so as to be self-documenting as much as possible As much as possible is not 100%, so add comments when needed. Comments should be assumed to be relevant when written, at best. Git comment should be linked to your work ticket so that we can figure out why the hell you would do that, when looking at the code file itself. I swear some people seem to think we only read them in PRs (we don’t). Overall concepts used everyday, if they need to be reexplained, should probably be written down (at least today’s version). Tests are documentation. Often the only up to date one?

Smoogs,

I’ve known influential assholes who poopood commentating as if it’s only a superficial job.

I hate those people.

Venator, to programmer_humor in Infinite Loop

Sometimes a fresh pair of eyes on a code base can reveal some opportunities for big improvements in maintainability 😜

MajorHavoc,

Ahahhahhahha. Ha…ha. Ahem.

Sorry. The idea that any of the opportunities for improvement at my last “job A” code base might need “revealed” struck me as really funny.

Venator,

Sometimes there’s an opportunity to delete it and start again 😜

tkk13909,

Looks like we found the hr employee! Get 'im Bois!

Venator,

Lol, nah I’m a developer.

gregorum, (edited )

Sometimes it takes a new dev coming in for management to give the greenlight for a major overhaul. It’s shitty, but it’s true.

prof, to programmer_humor in Infinite Loop
@prof@infosec.pub avatar

Recently switched jobs from maintaining a 15 year old Windows Forms .NET Framework legacy codebase.

At the new job we stick to Clean Architecture, use unit and integration tests, have a code generation tool, actually make nice use of generics and use dependency injection. Also agile processes, automatic build tools, whatever. The difference is night and day and I’m so glad my ex boss fired me because I told him he’s an asshole and his codebase is shit.

LeafOnTheWind,

My first job out of college I have been able to see a steady improvement in the codebase. A little while ago I had to go back to an old tag and was horrified with what it used to be and impressed how much it improved.

marcos, to programmer_humor in Infinite Loop

As long as their salary keeps increasing, I’d say go for it!

dan, to programmer_humor in GoOn
@dan@upvote.au avatar

This reminds me of something I saw online maybe 20 years ago now. Someone created a torrent with a name like “every IP address ever (hacking tool)” and uploaded it to Suprnova, which ended up having thousands of people seeding it. It was just a text file with every IPv4 from 0.0.0.0 to 255.255.255.255 😂

coloredgrayscale,

Heard about that too! Is there an updated version for ipv6?

  • All
  • Subscribed
  • Moderated
  • Favorites
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 22134264 bytes) in /var/www/kbin/kbin/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php on line 174

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10262376 bytes) in /var/www/kbin/kbin/vendor/symfony/error-handler/ErrorRenderer/HtmlErrorRenderer.php on line 339