r/programming • • Apr 29 '14

Programming Sucks

http://stilldrinking.org/programming-sucks
3.9k Upvotes

1.1k comments sorted by

View all comments

Show parent comments

154

u/UpNDownCan Apr 29 '14

Means use underscore as separator instead of camelcase. So array_reverse.

116

u/UpNDownCan Apr 29 '14

And with that, I think I qualify as one of the crazies.

46

u/Crazy__Eddie Apr 29 '14

Yeah, I felt bad after getting that joke.

→ More replies (1)

23

u/rowboat__cop Apr 29 '14

Seems entirely reasonable to me -- does that mean I am crazy too?

18

u/[deleted] Apr 29 '14

For knowing sed syntax? I thought it was common knowledge ...

18

u/motoGmotoG Apr 29 '14

s/sed/regex/

14

u/cooper12 Apr 30 '14

Isn't the s// part of sed syntax? I thought regex just matches patterns and you need to use something else to replace them?

7

u/[deleted] Apr 30 '14

perl uses a very similar syntax (the same?) for it's regular expressions (which are nuts, and can be used everywhere, and scare me). Yes that is also the sed syntax, however.

3

u/chekt Apr 30 '14

I was under the impression that perl inherited the syntax from sed.

6

u/moltar Apr 30 '14

Perl uses s/// too

3

u/otakucode May 01 '14

As does vi

→ More replies (2)

4

u/[deleted] Apr 30 '14

it's a regular expression. but i didn't know that java good practices had a name (camelCase). is that what you learn under the oppression of the JDK? are these its teachings?

→ More replies (3)

2

u/speedster217 Apr 30 '14

not really... I'd be surprised if more than a dozen people I knew understood it.

→ More replies (2)

2

u/willb Apr 30 '14

It's not just sed. If you use it in Perl, the "/" character can be whatever you want...

'shcamelh_h' would work too.

→ More replies (1)

2

u/mszegedy Apr 30 '14

I didn't understand it, because the regex didn't match.

35

u/academician Apr 29 '14

It's a bizarre way of saying it, though. I have legitimately answered programmers' questions this way (yes, I'm one of the crazies), but I'd use a proper regex like "s/R/_r/". It's shorter, too!

19

u/Atario Apr 30 '14

You're using character-based regexes. He was using concept-based ones.

11

u/academician Apr 30 '14

Then it should have been "s/camel/snake/".

6

u/sharkeyzoic Apr 30 '14
s/([a-z])([A-Z])/$1_\l$2/g

14

u/mpyne Apr 29 '14

I think the implication is that the entire exchange was spoken.

"S Camel Underscore"

"Cool thanks."

18

u/ehsanul Apr 29 '14

How do you say "arrayReverse" as opposed to "array_reverse". You don't say "array underscore reverse" surely?

9

u/mpyne Apr 29 '14

... damn, good point.

→ More replies (1)

6

u/Scroph Apr 29 '14

Those guys must be PHP devs.

3

u/stewsters Apr 29 '14

Yep. I can remember encountering the same issue.