Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Doom Mathematic
Sep 2, 2008

pokeyman posted:

that describes basically everything in programming

Sure, but sometimes it's more obvious up front.

Adbot
ADBOT LOVES YOU

Doom Mathematic
Sep 2, 2008

Sapozhnik posted:

Outsider: I want to do Reasonable Task in Python

Pythonist: Oh, use Thing

Other Pythonist: no don't use Thing, it's deprecated. Use Butt. Well, except Butt isn't ready and does not support all of Thing's use cases. But you still should not use Thing.

Other Other Pythonist: Actually Butt has some design problems so you should use Fart instead. We definitely got it right this time and it is very aesthetically offensive to me that you are still using a thing from last Tuesday. We have absolutely no adult supervision whatsoever.

If that isn't just Python in a nutshell.

"There should be one, and preferably only one, obvious way to do it."

Doom Mathematic
Sep 2, 2008

cinci zoo sniper posted:

speaking of, let me repost something from accidental python thread

I'm pretty sure a third of those are just Pokémon.

Doom Mathematic
Sep 2, 2008

mystes posted:

In DB film noir, the client never really wants to know where the deadlock is.


CRIP EATIN BREAD posted:

It's the mutex! *slap* It's the query! *slap* It's the mutex! *slap* it's the query! *slap* It's the mutex AND the query!

Doom Mathematic
Sep 2, 2008

Soricidus posted:

they aren’t enough

I generally wear industrial ear defenders, with earplugs underneath on a bad day, and I’m thinking of investing in some blinkers to reduce visual distractions

Wasn't some tech startup actually selling those? I forget if it was a parody or not because satire is dead.

E: https://panasonic.net/design/flf/works/wear-space/

Doom Mathematic fucked around with this message at 20:31 on Jun 4, 2019

Doom Mathematic
Sep 2, 2008
JSON numbers are arbitrary-precision finite floats.

Doom Mathematic
Sep 2, 2008

CRIP EATIN BREAD posted:

HTTP has headers just make the content-type send the correct encoding and then don't worry about it.

What encoding are the headers in?

Doom Mathematic
Sep 2, 2008

The Fool posted:

I literally only identify people by their avatar.

:ninja:

Doom Mathematic
Sep 2, 2008
The only true value should be true and the only false value should be false. Everything else should be a compile-time type error.

Doom Mathematic
Sep 2, 2008

Finster Dexter posted:

cjs: Without being a huge throbbing dick about it, how do I tell junior dev to "just loving google it" when I get slack messages like "how do I disable cors in .net core for local development??"

"I don't know offhand. Try Google."

Doom Mathematic
Sep 2, 2008

Plorkyeran posted:

it's sort of like the advice to make arrays one element bigger than you need to "fix" off-by-one errors

Oof, when I read this in Code Complete it was like a jump scare. I had no idea this notion had actually been seen fit to print, versus just being some antique mailing list legend. Half of your off-by-one errors are now off-by-two errors. Half of your off-by-one errors are now working code, purely because two off-by-one errors are magically coincidentally canceling each other out. All of your working code is now riddled with off-by-one errors! The mind reels.

I see it got removed for the second edition of the book, but wow.

Doom Mathematic
Sep 2, 2008

pseudorandom posted:

Edit: Did javascript create the concept of an Off-By 0.000000000001 error?

No, just popularized it.

Doom Mathematic
Sep 2, 2008
If it's all equally "important" then implicitly you can do the tasks in any order you prefer. I would start with the low-difficulty, high-value ones.

Doom Mathematic
Sep 2, 2008
There isn't a formal standard for how any part of a JSON document should be interpreted. Or an XML document, for that matter.

Doom Mathematic
Sep 2, 2008
JSON numbers are arbitrary-precision finite floats. It is admittedly kind of ridiculous how many parsers and serializers assume otherwise.

Doom Mathematic
Sep 2, 2008

Bloody posted:

the complete specification of the json number is:


given that C std and Java std do not contain arbitrary-precision finite floats as a type, that seems like a poorly-founded conclusion

Well, you can treat them otherwise if you like, but you'll lose information that way.

Doom Mathematic
Sep 2, 2008

Ciaphas posted:

cjs: reading this makes me feel like i'm under attack
C++ code:
int hFree(void ***map, int handle)
{
	int		*mp;
	int		len;

	a_assert(map);
	mp = &((*(int**)map)[-H_OFFSET]);
	a_assert(mp[H_LEN] >= H_INCR);

	// ...
}

This is the work of what's known as a three-star programmer.

Doom Mathematic
Sep 2, 2008

Blinkz0rz posted:

clever solutions to any problem are terrible because they increase the cognitive load on everyone else who reads it afterwards

write code for humans

And while we're at it, Mel Kaye was a terrible programmer.

Doom Mathematic
Sep 2, 2008
Adding everybody here to my .yosposignore file.

gonadic io posted:

one company I worked for hired contractors and then spent a lot of time pouring over every PR suggesting spacing and character changes. they were like "'we've not experienced this level of ... intensity in PRs before*. bikeshedding at its worst

e: cool new cto came in and immediately implemented mandatory scalafmt and holy poo poo it made everything 100x as good. i was just a dumb junior at the time learning all the wrong lessons until that guy arrived

Yeah this is the real gain of automatic formatting tools. It just cuts straight through all of that garbage. It doesn't even really matter what the format is as long as we can just point to it as authoritative and move on with our lives.

Doom Mathematic
Sep 2, 2008
The most glaring problem with Clean Code is that Martin's code is just terrible.

Java code:
public class GuessStatisticsMessage {
  private String number;
  private String verb;
  private String pluralModifier;

  public String make(char candidate, int count) {
    createPluralDependentMessageParts(count);
     return String.format(
       "There %s %s %s%s", 
       verb, number, candidate, pluralModifier );
  }

  private void createPluralDependentMessageParts(int count) {
    if (count == 0) {
      thereAreNoLetters();
    } else if (count == 1) {
      thereIsOneLetter();
    } else {
      thereAreManyLetters(count);
    }
  }

  private void thereAreManyLetters(int count) {
    number = Integer.toString(count);
    verb = "are";
    pluralModifier = "s";
  }

  private void thereIsOneLetter() {
    number = "1";
    verb = "is";
    pluralModifier = "";
  }

  private void thereAreNoLetters() {
    number = "no";
    verb = "are";
    pluralModifier = "s";
  }
}
Then, in the next chapter, he starts explaining that it's bad for functions to have side effects??

Doom Mathematic
Sep 2, 2008

Blinkz0rz posted:

another one of the product teams at my company that's pretty large has a "cloud stability" team that's a rotation and works on the technical debt of scaling their product in the cloud. it's not an easy rotation but a few of the folks i've talked to about it really like it

I can see that working if the rotation is long enough. We had a system where it was like, a day. You spent most of the day trying to remember how any of it worked, and the rest of the day unable to even begin trying to understand any of the complex outstanding tickets. At the end of the day you were free to forget about it for another few months.

It was not very effective. We have a permanent team for that job now.

Doom Mathematic
Sep 2, 2008
I don't know, last year they started small but towards the end the daily challenge was more like "read and implement this 10-page spec".

Doom Mathematic
Sep 2, 2008

CRIP EATIN BREAD posted:

advent of code is for people who cant get jobs programming but want to feel what its like to maybe be a part of it

It would be amazing if programming jobs were like Advent of Code. Tiny, fixed-sized, rigorously specified, closed problems with singular correct answers.

Doom Mathematic
Sep 2, 2008

Oneiros posted:

can you imagine a manager ever giving a spec as well written as the typical advent of code problem?

I mean, if you can provide a spec as detailed as the typical Advent of Code problem, you probably know the answer to the problem already and you're just testing. Taking a vaguely posed problem and translating it into specific parameters for programming is a big part of this job.

Doom Mathematic
Sep 2, 2008
A centbimeter is 1/128th of a meter.

Doom Mathematic
Sep 2, 2008

Nomnom Cookie posted:

time is u64 milliseconds since TAI epoch

Doom Mathematic
Sep 2, 2008
Time is the number of whole solar days since midday Universal Time on Monday January 1, 4713 BCE minus 2,400,000.5.

Doom Mathematic
Sep 2, 2008

The Fool posted:

it's ok, to get those salaries you have to live in the shittiest cities on earth

Yeah, my question was going to be at what level of salary does the human feces in the street disappear?

Doom Mathematic
Sep 2, 2008

MrMoo posted:

Ooh, pretty, $25,000 TV from LG:



Oh nice, TVs finally support transparent PNGs.

Doom Mathematic
Sep 2, 2008
"2 Undecimber 2020"

Doom Mathematic
Sep 2, 2008

Achmed Jones posted:

see also i18n for internationalization, a11y for accessibility, etc.

it's a pretty stupid naming trend but it caught on and doesn't hurt anything except my "old man yells at govcloud" bits so 🤷‍♀️

The irony is that "a11y"'s obtuseness makes it relatively inaccessible compared to "accessibility".

Doom Mathematic
Sep 2, 2008

prisoner of waffles posted:

YOSPOS, Oof. 'S a Probatably Odious Snipe.

Doom Mathematic
Sep 2, 2008
It is so much easier when all of those potential nitpicks are gone.

Doom Mathematic
Sep 2, 2008

RPATDO_LAMD posted:

does it actually have special handling for that?
i'd think most json parsers would just silently ignore extra keys as long as nobody explicitly asks for them
one of the "benefits" of not supporting actual schemas i guess

If you are using a JSON schema then yes the extra key can (and should) cause an error.

Doom Mathematic
Sep 2, 2008

MononcQc posted:

https://twitter.com/gergelyorosz/status/1247132806041546754

microservices are dead now that uber are moving away from them!!

SOA??

Doom Mathematic
Sep 2, 2008

elite_garbage_man posted:

what problem was xml designed to solve?

I believe, SGML.

Doom Mathematic
Sep 2, 2008

CRIP EATIN BREAD posted:

filebeat -> kafka -> custom java app -> sqs -> another custom java app -> new kafka cluster -> logstash -> sqs -> logstash -> elasticsearch

That's a hell of an act. What do you call it?

Doom Mathematic
Sep 2, 2008

Sapozhnik posted:

Use symbols if you really work with douchebags

code:
const dontTouchThisYouAsshole = Symbol();

class Foo {
    [dontTouchThisYouAsshole]() {
        console.log("foo");
    }
}

const foo = new Foo();

foo[dontTouchThisYouAsshole]();
If you don't export the dontTouchThisYouAsshole variable from your module or IIFE or whatever (lol if you're still using these) then there's no way to call the method whose name is (the value of this anonymous Symbol object)

Hell with it, this is the terrible programming thread

JavaScript code:
const foo = new Foo();

const thePoop = Object.getOwnPropertySymbols(Foo.prototype)[0];

foo[thePoop](); // 'foo'

Doom Mathematic
Sep 2, 2008
Friends, this is the terrible programming thread. It is a safe space for terrible programmers*, programs* and programming languages* alike.

* all of them

Adbot
ADBOT LOVES YOU

Doom Mathematic
Sep 2, 2008
Actually, the syntax highlighting there did not work very well.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply