Programming as a career

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

go on holiday for a week (i say holiday but it was the same sofa, different laptop) and they rewrite all your code...

worst is this. i think i saw it first in perl but this is ruby, moving the condition after the action... my eyes see the call to error, and don't see the condition because who puts the condition on the end?


// Object must not have a thing
error("Something is wrong with {object}") unless thing.nil?

(also in real life the message is longer so the condition is much further over to the right)

(it used to say


// Object must not have a thing
if ! thing.nil?
error("Something is wrong with {object}")
end

which is much more english-like and preferable)

rubocop prefers the former for conditions with single lines. i think rubocop is mostly bad and the way we do whatever it says even if it's patently worse annoys me.

happy programmers' day btw, 256th day of the year...

koogs, Monday, 13 September 2021 11:55 (two years ago) link

(Gah! code mangled because bbcode complained like 6 times in a row. doesn't seem to like hashes or single quotes or something)

koogs, Monday, 13 September 2021 11:55 (two years ago) link

ha. that is weird. but i've never used ruby.

since it's programmer's day, i guess it's only good and proper that i make publicly aware my biggest pet peeve: not just lack of documentation but wrong documentation!

i'm going over this c# codebase and it's lightly sprinkled with comments here and there and some of it references outdated or blocks of code found elsewhere, lol

happy programmers' day!

Punster McPunisher, Monday, 13 September 2021 16:03 (two years ago) link

I've been doing Ruby for 5-6 years now and the modifier syntax is actually pretty easy for me to read at this point.

Also, Rubocop hates this syntax:


if !...

Carte Blanchett (Leee), Monday, 13 September 2021 17:58 (two years ago) link

tbh, i kinda hate that syntax, it's very easy to overlook the ! especially if there's no space following

post-conditions make more sense if the action is the default rather than the exception

do_something() unless it_is_the_weekend

i might have mentioned this before but in a previous job someone wrapped virtually every line of code in a method called log_error()

log_error(perfectly_good_call());
log_error(no_problems_here());
log_error(this_works_fine());

it would only log if the call returned an error but it confused the hell out of me.

koogs, Monday, 13 September 2021 19:35 (two years ago) link

this is one of the things i like about (python) decorators. they make that kind of wrapping more easily ignored by everyone else.

π” π”žπ”’π”¨ (caek), Monday, 13 September 2021 19:57 (two years ago) link

it's a weird thing to have baked into your linter, but i guess whatever is making ruby simpler must butt heads with testing for false, as it can be counterintuitive?

Punster McPunisher, Monday, 13 September 2021 22:05 (two years ago) link

Well I think that there are two reasons:

1. Sometimes people will write this:


if !...
else
end

2. Ruby has unless (which I personally hate), and the out-of-the-box linter favors using it to

if !
.

Carte Blanchett (Leee), Monday, 13 September 2021 22:31 (two years ago) link

two months pass...

my friend sent me a screenshot of some code he had to pick up for maintenance at work and the first line was

String number;

off to a good start

mh, Tuesday, 16 November 2021 14:32 (two years ago) link

I actually spend a lot of my time working on a system that was built from the ground up in Java by someone who must've been entirely self-taught, because the formatting and code style she used was unlike anything I've seen. She did wind up making her own int, String, and boolean objects and I feel like I have to answer once a week "what is an EsInt?"

frogbs, Tuesday, 16 November 2021 14:40 (two years ago) link

xp

haha, at least it wasn't String n;

Chicks and Ducks and Geese better scurry (Ste), Tuesday, 16 November 2021 15:17 (two years ago) link

oh cos it's a string. this is why i'm not a programmer too.

Chicks and Ducks and Geese better scurry (Ste), Tuesday, 16 November 2021 15:18 (two years ago) link

there are a million reasons why you’d put something numeric in a string but don’t name it number ffs

mh, Tuesday, 16 November 2021 15:31 (two years ago) link

I enjoyed this

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

talkin' about his flat tire (DJP), Tuesday, 16 November 2021 21:18 (two years ago) link

The QA tester is doing a great job of QA testing there!

more difficult than I look (Aimless), Tuesday, 16 November 2021 21:22 (two years ago) link

ha. it's either like that star trek video or a machine/robot spitting out line after line of detailed information super fast

i'm currently dealing with an insane amount of misspellings everywhere from strings/variables to text/messages we output to the user. when i train our users i actually need to refer to some of the text and, for the sake of simplicity, i need to use the really bad grammar. it's horrible!

Punster McPunisher, Wednesday, 17 November 2021 05:06 (two years ago) link

can't run that ruby script that worked fine last week because someone has removed the gems it uses from the repository (ok, probably security related, but still a forced update, and it's never only one gem)

can't install aws stacks because someone has changed the script to use poetry to control dependencies now and not whatever we used before. and bumped the required versions of *both* ruby and python to versions released less than a month ago.

hours installing those, and the required pips and gems over a slow 3g connection (still not finished). and all i wanted to do was add *one* value to an aws stack.

koogs, Thursday, 18 November 2021 12:40 (two years ago) link

i consider myself somewhat of an expert at "getting things to build" and i've had so many problems trying to get python shit to work that i don't even bother anymore

diamonddave85​​ (diamonddave85), Thursday, 18 November 2021 18:37 (two years ago) link

somewhat related: https://drewdevault.com/2021/11/16/Cash-for-leftpad.html

diamonddave85​​ (diamonddave85), Thursday, 18 November 2021 18:38 (two years ago) link

two weeks pass...

so, thirty lines of java, which can throw exceptions in 5 different places within it. i did have try-catch around each one but it was ridiculous (and half as long again) so instead i put one try catch around the entire lot and it was much neater.

only i got moaned at in the code review that the block was too long.

the internet is no help. stack overflow suggests putting each bit of code that can throw exceptions into a different method which gains you NOTHING as far as i can see - the method will still throw the exception, still needs handling in the caller. and needs overhead with passing parameters.

also, "don't log and rethrow" was another comment. i guess that's so it doesn't get logged in the child and again in the parent. but when unit testing you don't see the parent's logging. so i'm leaving that, at least until the project is mor than 20% done.

koogs, Monday, 13 December 2021 17:38 (two years ago) link

i wonder if any of those companies that offer me jobs on linked-in that start at twice my current salary have such code reviews?

(nah, my imposter syndrome is already bad enough)

koogs, Monday, 13 December 2021 17:49 (two years ago) link

Will never understand religious adherence to coding guidelines. Also I hate the term "code smell".

big online yam retailer (ledge), Monday, 13 December 2021 17:51 (two years ago) link

I'm surprised exceptions are still handled the same way 22 years after I learned them. such an ugly mess.

adam t. (abanana), Monday, 13 December 2021 18:05 (two years ago) link

just put `throws Exception` on every method and let the spring's global handler deal with it

diamonddave85​​ (diamonddave85), Tuesday, 14 December 2021 01:38 (two years ago) link

two weeks pass...

You guys should look at Mike Nesmith's FB post from April 3. Made me LLOL. #OneInstructionPerClockCycle

Me IRL, U URL (James Redd and the Blecchs), Friday, 31 December 2021 16:36 (two years ago) link

> career: team lead pushing to get us all promotions. but that entails writing 300 words each on things like "Flexibility" and "Influencing" ... i really can't be bothered.

reader: didn't do this, didn't get a promotion, but did get the equiv payrise! (and paid in jan, but backdated to sept!). was the last thing the previous dept boss did before he left for sunnier climes, although it had been in the works for a while apparently. i think they are desperate to keep people.

doesn't stop the person above me keeping my things in review for ever over perfectly good design decisions. week's worth of code, 3 weeks in review and it's got so toxic that i can't bear to look at his latest suggestions.

(basically i encapsulated the logic in two static methods in another class with known inputs and outputs, keeping the parent class and *all the parent's tests* boilerplate. he wants the logic in the parent class where it means the parent class and the testing will be different for every future version of this code (it's a microservice, we'll reuse it). and the logic will go into predicate classes, which are generally 20 lines of code to call one if...)

koogs, Thursday, 6 January 2022 14:37 (two years ago) link

three months pass...

people who insist on doing cosmetic refactors in the middle of fixing review comments. make the diff twice as confusing, drag the review process out a bit more.

github's new 3-panel diff is terrible, they've added the file tree as a leftmost column meaning there's even less width for the other two. everything is truncated or wrapped. i'm guessing their designers all have 4k screens.

koogs, Friday, 8 April 2022 13:27 (two years ago) link

i have two 27-inch monitors and i find those aren't enough. we all work from home but another dev i work with tells me he has a huge curved monitor and every time he screen-shares he has to change the resolution so things won't be so tiny on the other person's screen

on another note, i took a sick day today because the last two weeks have been so incredibly busy i hardly had time to eat

Punster McPunisher, Friday, 8 April 2022 18:04 (two years ago) link

Fortunately you can collapse that file tree sidebar, and it'll remember that preference.

Pomelo Anthony (Leee), Friday, 8 April 2022 19:42 (two years ago) link

people with those massive curved monitors seem like they hate their computers whenever they're on hangouts

π” π”žπ”’π”¨ (caek), Friday, 8 April 2022 21:52 (two years ago) link

wait what's the 3 panel diff, I only have the file tree (which I actually welcome, find it really useful) and the file changes

even the birds in the trees seemed to whisper "get fucked" (bovarism), Friday, 8 April 2022 23:11 (two years ago) link

my monitor is like 22" or something and that seems plenty. the one at work is ridiculous, like 32" or more and people do have trouble with those when sharing on zoom because nobody can read anything

even the birds in the trees seemed to whisper "get fucked" (bovarism), Friday, 8 April 2022 23:11 (two years ago) link

> wait what's the 3 panel diff...?

it's literally the three panels you go on to describe! it used to be only the two files side by side (which was narrow enough) but the file tree now takes a third of the screen.

oh, maybe you're using the combined diff, not the side by side version, there's an option

and i hadn't spotted the slightly cryptic button to hide the file tree, so that might help, thanks

no external monitor just the one built into 15" laptop

koogs, Saturday, 9 April 2022 02:51 (two years ago) link

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


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