Programming as a career

Message Bookmarked
Bookmark Removed
Not all messages are displayed: show all messages (802 of them)

yeah it's not side by side, just vertical, but that must be the default option because I've never changed anything on it, didn't even know there was a side-by-side diff tbh

even the birds in the trees seemed to whisper "get fucked" (bovarism), Saturday, 9 April 2022 13:49 (two years ago) link

this youtube channel is pretty hilarious

https://www.youtube.com/watch?v=Uo3cL4nrGOk

https://www.youtube.com/watch?v=bXzTXD_OJo0

Punster McPunisher, Saturday, 9 April 2022 20:56 (two years ago) link

I quite like reviewing in Github by pressing . to open the VSCode online editor - it’s much easier to see what‘s going on in a PR IMO.

Chewshabadoo, Sunday, 10 April 2022 15:50 (two years ago) link

this youtube channel is pretty hilarious

favourite lines are from the C++ dev: "runtime error detection is the programmer's responsibility", "we need to see the compiler as...enemy"

TWELVE Michelob stars?!? (seandalai), Sunday, 10 April 2022 22:08 (two years ago) link

two months pass...


names = ("name1", "name2")\
if os.environ['ENV'].lower() == 'test' else ("name1",)

python code it is, readable if yoda you are.

koogs, Wednesday, 15 June 2022 12:32 (one year ago) link

I'll have chicken if it's cheap, otherwise I'll have chips.

The linebreak seems unnecessary. Oh no it's over 80 characters long, aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaargh!

dear confusion the catastrophe waitress (ledge), Wednesday, 15 June 2022 13:49 (one year ago) link


i'll have chicken and chips
if it's cheap else i'll have chicken

then-if-else, as nobody calls them

koogs, Wednesday, 15 June 2022 14:12 (one year ago) link

eh, i don't think `a if cond else b` is significantly more/less readable than any other ternary syntax, e.g. `cond ? a : b`.

𝔠𝔞𝔢𝔨 (caek), Wednesday, 15 June 2022 16:16 (one year ago) link

I dislike the original because I like the default condition first and having test as the default is uh, safer but not what I'd do

mh, Wednesday, 15 June 2022 16:22 (one year ago) link

I think if/then/else syntax has absolutely trained developers of a certain age (e.g., me) to expect to see the condition first; that Python excerpt reads like someone said "my code would flow much better if it was arranged like German verbs or Spanish adjectives" and I'm getting irrationally angry about it (also I have never looked at or written Python code in my life).

castanuts (DJP), Wednesday, 15 June 2022 16:33 (one year ago) link

the ?: is odd because of the use of only punctuation. and how do you nest them? it's probably ok if the bits are short, or indented correctly


thing = (v_one == v_two)
? same
: different

with 'a if cond else b' there's more chance that the condition is further to the right than i like, and => easier to miss. i guess he moved the if onto the second line to make it clearer, but made it worse - it looks like another, badly indented, statement,

> developers of a certain age

it me

> having test as the default is uh, safer

i may've flipped the logic whilst anonymising it for posting

actually, i guess this would work


thing = safe_default
if (rare condition)
thing = special case
end

which looks a lot like the original but is in fact the opposite. maybe that's my issue with it

koogs, Wednesday, 15 June 2022 17:00 (one year ago) link

this is baffling to me.

i don't think appeals to english word order make sense when talking about programming languages 1. this is not applescript 2. plenty of programmers are not native english speakers. 3. english word order is very flexible.

but to the extent they do: "x is y if condition, otherwise it's z" doesn't seem like non-english word order at all. it's idiomatic english.

if the argument is that this is unintuitive (hard to read?) for non-python programmers, i think that applies more to ternary operator syntax in every language that uses random punctuation like ? and :

if you really want a ternary one-liner with the condition first a la js, replace ? with "and" and : with "or", i.e. x = condition and y or z. this obviously sucks, but no more than random punctuation.

𝔠𝔞𝔢𝔨 (caek), Wednesday, 15 June 2022 17:27 (one year ago) link

koogs i feel like your complaint is with ternary, not with the python syntax for ternary.

𝔠𝔞𝔢𝔨 (caek), Wednesday, 15 June 2022 17:28 (one year ago) link

I think it's not english word order, it's just convention and the programming languages/syntax I'm used to using.
I was looking at some python a coworker wrote and it was obviously written by someone used to C#. It's just idiomatic. I'd say over half of scanning over code and thinking you know what's going on is down to convention and not enforced language structure

that said,
the ?: is odd because of the use of only punctuation. and how do you nest them?
I got so used to parsing these in my brain that it'd disgusting. Mostly due to coworkers doing
var x = condition ? condition 2 ? a : b : c

I haven't done that or read through that in a few years so please clown me if I botched it

mh, Wednesday, 15 June 2022 17:41 (one year ago) link

fwiw you are only truly a savage if you start doing one convention in a project that completely uses another (while others are still working on it) or if you just do your conditionals a bunch of different ways for no conceivable reason

mh, Wednesday, 15 June 2022 17:42 (one year ago) link

it's more to do with putting the important information first.

let thing = "some value" if (whatever)

this is an assignment. oh, but it's conditional. i would've preferred to know that first. i basically want to read as little as possible of the line before i can decide whether it's important or not.

throw massive exception (argh!) if appropriate (oh...)

koogs, Wednesday, 15 June 2022 17:49 (one year ago) link

var x = condition ? condition 2 ? a : b : c

yeah my reaction to this is mostly: if you think ternaries in python are bad, wait until you see how people use them in practice in js.

throw massive exception (argh!) if appropriate (oh...)

i get your point but fwiw you can't throw in a ternary.

𝔠𝔞𝔢𝔨 (caek), Wednesday, 15 June 2022 18:18 (one year ago) link

code review today (please excuse clumsy anonymising)


...
.withXXXXXXXXXXXXStartTime(OffsetDateTime.parse((somethingInfo.getXXXXXXXXXXXXStartTime() == null) ? XXXXXXXXXXXXX_START_TIME : DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'").withZone(ZoneId.of("UTC")).format(Instant.EPOCH.plus(somethingInfo.getXXXXXXXXXXXXStartTime()))))
...

kids today with their 300 character-wide monitors

koogs, Thursday, 16 June 2022 16:59 (one year ago) link

yeeeikes

𝔠𝔞𝔢𝔨 (caek), Thursday, 16 June 2022 17:27 (one year ago) link

> if you think ternaries in python are bad, wait until you see how people use them in practice in js.

or java...

koogs, Thursday, 16 June 2022 17:34 (one year ago) link

koogs, when did you start maintaining my old code from a decade ago

mh, Thursday, 16 June 2022 18:24 (one year ago) link

actually, more like fifteen years ago. me old

mh, Thursday, 16 June 2022 18:25 (one year ago) link

Is there a data science thread? I’ve found myself managing some data scientist on a pretty cool project but I am completely out of my league. I work in geography (English major here!) and I’ve been on the job for awhile so I can at least act as an SME but these kids are doing some insane stuff.

Heez, Thursday, 16 June 2022 20:25 (one year ago) link

we should start a real one. we’ve just been bouncing between this one and caek’s corner iirc

mh, Thursday, 16 June 2022 21:03 (one year ago) link

in my review i suggested moving the 300 character line of code into a separate method and calling that instead.

he duly copied the line verbatim into another method, so there's now a new method with a single 300 character line in it...

koogs, Friday, 17 June 2022 10:36 (one year ago) link

Programmers gonna literal.

Chewshabadoo, Friday, 17 June 2022 10:48 (one year ago) link

lmao

castanuts (DJP), Friday, 17 June 2022 14:52 (one year ago) link

Classic!

Jimmy Jimmy Loves Mary-Anne Mary-Anne (James Redd and the Blecchs), Friday, 17 June 2022 14:55 (one year ago) link

I don't think I've ever typed this out before but one thing I haven't forgotten over many years is someone once saying about someone else "he really is an automaton."

Jimmy Jimmy Loves Mary-Anne Mary-Anne (James Redd and the Blecchs), Friday, 17 June 2022 14:56 (one year ago) link

regexp help. need at least 1 of A B and C, in order

9A9B9C
9A9B
9A9C
9B9C
9A
9B
9C
are all ok (where 9 is any digit). blank is not

so far i have

/^(9A9B9C|9A9B|9A9C|9B9C|9A|9B|9C)$/

which reduces down to

/^(9A(9B9C|9B|9C|)|9B(9C|)|9C)$/

there's slightly more to it than this but this is the crux

koogs, Monday, 20 June 2022 16:08 (one year ago) link

no reason it has to be one line, of course.

koogs, Monday, 20 June 2022 16:30 (one year ago) link

since we got on Java 8 there's been like a competition to see who can make the most convoluted lambda expression possible, I hate it cuz these are so hard to debug

our transfer objects go like 6 layers deep. yeah a bunch of nested if loops looks like crap but you can at least step through it and easily make changes. we have a new developer on one of them now, I can only imagine how much he'd struggle if I did things the way everyone else was

frogbs, Monday, 20 June 2022 17:46 (one year ago) link

Koogs, I’m not great at regex but I find the editor at regexr.com quite useful- lots of user submitted patterns too that can be lifted and adapted

she started dancing to that (Finefinemusic), Monday, 20 June 2022 18:31 (one year ago) link

i don't think we'll ever use more than one of A, B or C, so it'd just be 9b;ABCd; if i had my way.

(will that work?)

koogs, Monday, 20 June 2022 20:24 (one year ago) link

no.


9[ABC]

koogs, Monday, 20 June 2022 20:25 (one year ago) link

lol java 8, they’re on 17 now bruv

(8 is fine, I crack up that they finally did a version release strategy but it’s a major number so often)

mh, Tuesday, 21 June 2022 01:30 (one year ago) link

last 3 components i worked on here were 2014 vintage and needed Java 8, wouldn't compile under (our default) Java 11. i didn't upgrade them.

Been downhill all the way with Java since they introduced lambdas.

koogs, Tuesday, 21 June 2022 01:37 (one year ago) link

beginners mindset, you’re worse than a weird .net bro now

mh, Tuesday, 21 June 2022 01:40 (one year ago) link

That sounds like a very difficult thing to do in regex, but fairly simple in regular code.

o. nate, Tuesday, 21 June 2022 17:29 (one year ago) link

lol java 8, they’re on 17 now bruv

yea we recently upgraded to 11, idk when we'll ever get to 17. i mean what's the point

frogbs, Tuesday, 21 June 2022 17:47 (one year ago) link

I think I'd just do /^(9A)*(9B)*(9C)*$/ and check not empty/null separately tbh?

I'm assuming that checking for empty string is like one brief, readable line despite my suspicions about Java. I might not be understanding the requirements correctly though and my regexping is rusty.

(tbh I am rustier than ever at programming in general, which I was never good at, and I feel like my days at my current job are numbered because my brain seems to have died and we're implementing a new system I don't understand or care about understanding at all. Sort of feel I should completely give up on making a living doing anything tech-related but can't think of what else I might possibly do. I remember saying all this before, almost exactly half my lifetime ago at the start of my non-career, and probably on this thread several times since then...)

(Current job is in theory part scripting and part support, and the support part expands to fill 99.9% of the time. That's what support jobs are like, right? But also I let it do so, because I always put off any tasks which require
1. concentration/flow/clear-headed thought/forward planning
2. the perceptivity to think of all the possible disastrous problems and guard against them
3. the calmness not to stress yrself to death thinking about what examples of 2 you've forgotten and how much of the database it might delete and how your coworkers will hate you and the boss will thunder down the hall going "WHICH IDIOT LET THIS HAPPEN", again)

a passing spacecadet, Tuesday, 21 June 2022 18:31 (one year ago) link

I think I'd just do /^(9A)*(9B)*(9C)*$/ and check not empty/null separately tbh?

This works from what I can tell, and the only suggestion I'd make is to not bother with capturing them if that's needed:

/^(?:9A)*(?:9B)*(?:9C)*$/

Antifa Lockhart (Leee), Tuesday, 21 June 2022 18:43 (one year ago) link

it's ruby, but that doesn't matter.

i went with readability in the end, listed all the valid combinations in separate lines. you can golf these things but there's a point where concise becomes curt and that's everything i don't like.

but wouldn't /^(9A)*(9B)*(9C)*$/ allow 9A9A9A9A? i can only have at most one of each. replacing the *s (0 or more) with ?s (0 or 1) should do. then, yes, just need to catch "" separately

koogs, Tuesday, 21 June 2022 20:46 (one year ago) link

as for fuckups, we have two components, A (currently on version 367) and B (currently on version 317) and i managed to deploy version 317 of component A to LIVE and didn't notice for an ENTIRE DAY. this is public facing stuff, 10s of thousands of users and not a single bug report or alert. so either nothing important has happened in those last 50 versions or all the built-in redundancy works.

(i've added checks so it won't happen again - it'll now look up the version itself)

koogs, Tuesday, 21 June 2022 20:55 (one year ago) link

but wouldn't /^(9A)*(9B)*(9C)*$/ allow 9A9A9A9A? i can only have at most one of each.

Sorry, yes, it would - I misread "at least 1 of A, B and C" to mean that repeats were OK as long as A-B-C were still in order.

Probably something to be said with listing the valid combinations separately for readability, though. As long as it doesn't result in such a massive list nobody will ever read the whole thing...

a passing spacecadet, Tuesday, 21 June 2022 21:20 (one year ago) link

maybe i'm missing something but isn't it just A.*B.*C
haven't done regex in ages

adam t. (abanana), Friday, 24 June 2022 17:01 (one year ago) link

never mind

adam t. (abanana), Friday, 24 June 2022 17:04 (one year ago) link

two months pass...

maybe i should do more regex? tried for a programming job for the first time in over a decade, flubbed a coding task where it required a "\w" but I put in a "*". fun but stressful.

formerly abanana (dat), Wednesday, 24 August 2022 04:40 (one year ago) link

i love writing regexes--they're like a fun puzzle imo. regex101.com is a good tool for writing/debugging

diamonddave85 (diamonddave85), Wednesday, 24 August 2022 14:46 (one year ago) link

but \w / \W seems designed to confuse

koogs, Wednesday, 24 August 2022 15:26 (one year ago) link


You must be logged in to post. Please either login here, or if you are not registered, you may register here.