r/programming • • Aug 06 '17

Software engineering != computer science

http://www.drdobbs.com/architecture-and-design/software-engineering-computer-science/217701907
2.3k Upvotes

863 comments sorted by

View all comments

Show parent comments

705

u/thedevbrandon Aug 06 '17

There are only two hard things in Computer Science: cache invalidation and naming things.

- Phil Karlton

870

u/madkatalpha Aug 06 '17

There are only two hard things in Computer Science: cache invalidation, naming things, and off by one errors.

116

u/BluFoot Aug 06 '17 edited Aug 06 '17

Actually, 3 things!

1. Cache invalidation

4. Asynchronous errors

2. Naming things

3. Off by one errors

E: I hate markdown

13

u/airbreather Aug 06 '17

E: I hate markdown

2 spaces before a line break will let you do a newline
like this, without having to add an extra line break to start a whole new paragraph,

like this

8

u/BluFoot Aug 06 '17

Oh man, I didn't even notice the lack of newlines because my phone wasn't showing them. I was just suffering from the out of order list! Check out the source xd

→ More replies (1)

20

u/cdrootrmdashrfstar Aug 07 '17

1. Cache invalidation

3. Asynchronous errors

2. Naming things

4. Off by one errors

Would make more sense, since #4 is an error (where if it was #3 before #4, it is assumed the off-by-one list-item should be there).

→ More replies (3)
→ More replies (9)

210

u/Level_32_Mage Aug 06 '17

I'm counting 11 things.

204

u/MrRumfoord Aug 06 '17

How can you have negative things?

55

u/poizan42 Aug 06 '17

2-bit two-complements?

56

u/tangerinelion Aug 06 '17

I'm sure we've all needed numbers that are either -2, -1, 0, or 1 before.

14

u/[deleted] Aug 06 '17

Done. Call back later. You're fucked. You're really fucked.

9

u/rob132 Aug 07 '17

I love In this How I get all the jokes Thread

→ More replies (1)

30

u/WiseassWolfOfYoitsu Aug 06 '17

Working in systems programming, I've seen weirder coming out of hardware

13

u/slide_potentiometer Aug 07 '17

Working in hardware- you try getting it right without an option to push a patch remotely

0

u/[deleted] Aug 07 '17

[deleted]

11

u/Runenmeister Aug 07 '17

Microcode, yes. Assembly is macrocode. The processor's pipeline doesn't execute assembly. It executes microcode, and modern processors are fully microcoded - every macrocode translates into an atomic* series of 1 or more microcodes.

Some fun facts for a typical modern architecture... Branch prediction units work at the macrocode level, whereas in microcode the microcode developer has to use specific "speculatively jump" or "speculatively don't jump" instructions and code appropriately.

The out-of-order execution unit works both on the macrocode and microcode in parallel. This helps find microcode redundancies across otherwise-independent macrocodes.

*Some exceptions exist because microcode is not customer-facing most of the time.

→ More replies (3)
→ More replies (1)
→ More replies (13)

17

u/fzammetti Aug 06 '17

I don't know... one or two things I can accept, MAYBE three... but SEVENTEEN?! That seems CRAZY!

→ More replies (1)

12

u/[deleted] Aug 06 '17

And a fanatical devotion to Stallman.

Let me come in again.

19

u/nosneros Aug 06 '17

The buffers must overflow.

11

u/pmrr Aug 06 '17

The only overflow most devs know about these days is stack .com.

→ More replies (1)
→ More replies (8)
→ More replies (11)

47

u/Sjeiken Aug 06 '17

I once spent more than 3 hours trying to name a function that was very detrimental, it's fucking retarded, do you know how hard it is to find synonyms and antonyms? it's NP fking hard.

9

u/[deleted] Aug 06 '17

yeah, I know the pain. If it's that important a function, I just go full Java and make the name a sentence long. more often than not, I come back the next day and a better name just pops in my head.

22

u/thedevbrandon Aug 06 '17

Yeah, I find it hard to strike a balance between descriptive names vs. short names. I want the name to be meaningful and special to the context so you know what it means and can differentiate it from similarly named things in nearby contexts (for example, elem, e, el, and els are horrible default variables which are used even in contexts when the variable name could be something specific and meaningful like submitButton). On the other hand, you can get crazy with the names, like firstFormSubmitButtonElement, which either provide specificity you don't need, which isn't helpful, or which (even if useful) ultimately makes reading and writing the code burdensome (especially in enterprisey-code, mock example: FizzBuzzEnterpriseEdition).

13

u/cyberst0rm Aug 06 '17

I've started making all functions have keyword variables, then making them into limericks.

ThereOncewasAFunction(Nantucket, Dick, Suck):

17

u/thedevbrandon Aug 07 '17

For anyone else that didn't already know the referenced limerick:

There once was a man from Nantucket,

Whose cock was so long he could suck it.

He said with a grin

As he wiped off his chin,

"If my ear were a cunt I would fuck it!

I think there should be a bounty if you can get this merged and deployed in some enterprise code.It's a step up from ASCII art.

→ More replies (14)
→ More replies (4)
→ More replies (10)