Programming as a career

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

it's not always insane to overtest simple code because:

1. tests are incredibly valuable if/when you refactor/add features later
2. the easiest time to write tests is when the implementation is on your mental stack, not months later, and definitely not if someone else did the implementation.

*that* is insane though.

π” π”žπ”’π”¨ (caek), Friday, 10 July 2020 18:46 (five years ago)

It’s definitely perverse to write a wrong implementation just because it passes your first stab on a test

Actually I think I’m going to throw up

all cats are beautiful (silby), Friday, 10 July 2020 18:52 (five years ago)

Like does this guy ever want to get anything done in his life

all cats are beautiful (silby), Friday, 10 July 2020 18:53 (five years ago)

If this is the kind of mind that TDD produces then TDD is bad for your mind

all cats are beautiful (silby), Friday, 10 July 2020 18:54 (five years ago)

these two chapters of dive into python (nominally about unit testing but not really) actually make me like TDD

https://diveinto.org/python3/unit-testing.html
https://diveinto.org/python3/refactoring.html

π” π”žπ”’π”¨ (caek), Friday, 10 July 2020 18:57 (five years ago)

In koogs's example, I think that the way to DRY it up would be to write a method like

has_flag
that would be defined as

flag1 || flag2

Then in the calling function stub/mock has_flag.

Agreed on both caek's latest two points, and point 2 is particularly why I advocate a TDD (or TDD-lite?) approach.

As to the "dictionary" definition of TDD, that's why I never call myself a strict follower; I do feel that using testing as a framework for development is incredibly valuable, especially with setup and tear-down, and as a prompt for writing modular code.

AxoLOLtl (Leee), Friday, 10 July 2020 18:58 (five years ago)

(oh, irl the flags weren't parameters, they were flags in another structure and this second structure was mocked and passed in


test1
when(mockObj.getflag1()).doreturn(true)
retval = test(structure, mockObj)
...
test2
when(mockObj.getflag2()).doreturn(true)
retval = test(structure, mockObj)

so not possible to combine them, sorry

in fact i cheated by checking in two failing tests at the same time, which is apparently verboten, just to try and cut down the number of iterations
)

koogs, Friday, 10 July 2020 19:08 (five years ago)

the other 95% is doing bookkeeping with resources like databases and external services and god knows what, setting up mock everything just to test that stuff feels tautological and maddening. I just can’t

+ ui interaction, and otm.

neith moon (ledge), Friday, 10 July 2020 19:59 (five years ago)

i mean i've tried (not v hard) and failed (for various reasons, that being one) to get tdd or any kind of testing culture implemented at our company. and I'm ok with that.

neith moon (ledge), Friday, 10 July 2020 20:04 (five years ago)

tdd seems a reach for a company that does not have a testing culture

π” π”žπ”’π”¨ (caek), Friday, 10 July 2020 20:09 (five years ago)

i'm jealous of all of you

Two Meter Peter (Ste), Friday, 10 July 2020 20:19 (five years ago)

xp yeah true, baby steps, but i can't even see how to do those as it doesn't seem worth testing the small bits of fuctionality that haven't got db or ui interaction all over them.

neith moon (ledge), Friday, 10 July 2020 20:19 (five years ago)

i don't have any major issue with TDD as a philosophy, but pairing with a TDD pedant like koogs described sounds like my own personal hell

the portentous pepper (govern yourself accordingly), Saturday, 11 July 2020 11:31 (five years ago)

i'm not arguing against testing in any sense, but projecting your own orthodoxy onto a pairing partner kinda defeats the purpose of pairing imo!

the portentous pepper (govern yourself accordingly), Saturday, 11 July 2020 11:36 (five years ago)

Absolute psycho replies to this one

my favorite reason to write software is money

— Abby Fuller (@abbyfuller) July 10, 2020

π” π”žπ”’π”¨ (caek), Saturday, 11 July 2020 21:10 (five years ago)

Ugh, I’ll take your word for it. She’s right of course.

all cats are beautiful (silby), Saturday, 11 July 2020 21:10 (five years ago)

galaxy brain:

and this should be the only reason. money is the best way to transform ideas to value and benefit all in the end. other reasons like freedom, morale or noble purpose can't last long enough and may lead to the opposite.

— Andrew Zhu (@xhinker) July 11, 2020

neith moon (ledge), Sunday, 12 July 2020 06:57 (five years ago)

Wow

all cats are beautiful (silby), Sunday, 12 July 2020 07:10 (five years ago)

God, fuck programmers

all cats are beautiful (silby), Sunday, 12 July 2020 07:11 (five years ago)

We’re not all bad.

Mr. Snrub, Sunday, 12 July 2020 13:17 (five years ago)

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

Lipstick O.G. (James Redd and the Blecchs), Sunday, 12 July 2020 13:36 (five years ago)

All bad including me

all cats are beautiful (silby), Sunday, 12 July 2020 13:42 (five years ago)

Every line of code is a brick in the edifice of fascism, or something.

all cats are beautiful (silby), Sunday, 12 July 2020 13:43 (five years ago)

The best code is no code at all

Lipstick O.G. (James Redd and the Blecchs), Sunday, 12 July 2020 13:46 (five years ago)

Bob Marley

Lipstick O.G. (James Redd and the Blecchs), Sunday, 12 July 2020 13:47 (five years ago)

Or Vonnegut

Lipstick O.G. (James Redd and the Blecchs), Sunday, 12 July 2020 13:48 (five years ago)

Giving a talk on that exact thesis in a couple weeks

all cats are beautiful (silby), Sunday, 12 July 2020 13:52 (five years ago)

gotta love unit tests with inputs such as


new byte[] { 0x27, 00, 00, 00, (byte) 0xFF, (byte) 0b11_0_1_0_0_1_0 }

koogs, Sunday, 12 July 2020 16:06 (five years ago)

(this actually my forte, have been extracting bits from bytes since i had a zx81)

koogs, Sunday, 12 July 2020 16:08 (five years ago)

DEAD BEEF BAD FOOD

Lipstick O.G. (James Redd and the Blecchs), Sunday, 12 July 2020 16:49 (five years ago)

I've got a great poke for Jet Set Willy.

Being cheap is expensive (snoball), Sunday, 12 July 2020 17:03 (five years ago)

Lol

Isolde mein Herz zum Junker (James Redd and the Blecchs), Tuesday, 14 July 2020 17:36 (five years ago)

Don’t know if it’s a religion thing but why do some people hate to do a git rebase and then do a fast-forward merge.

Isolde mein Herz zum Junker (James Redd and the Blecchs), Tuesday, 14 July 2020 17:38 (five years ago)

we banned merge commits on our project because of one guy

π” π”žπ”’π”¨ (caek), Tuesday, 14 July 2020 17:39 (five years ago)

Not surprised. Did the graph look like the one shone here in The Problem? https://mtyurt.net/post/git-using-advanced-rebase-features-for-a-clean-repository.html

Isolde mein Herz zum Junker (James Redd and the Blecchs), Tuesday, 14 July 2020 18:36 (five years ago)

Can you lock out all merges? We have fast-forward-only some branches but then I recently noticed that some of the more unenlightened just merge that branch into theirs and then they can fast-forward this merged melange back.

Isolde mein Herz zum Junker (James Redd and the Blecchs), Tuesday, 14 July 2020 18:38 (five years ago)

I missed out on the TDD conversation but I wanted to mention that my one experience pairing with a TDD disciple involved watching her create a bunch of tests that were logically incorrect, getting them to pass, and missing giant pieces of logic that interconnected subsystems of the module we were working on and actively mocking other pieces of functionality we were supposed to be testing, so technically we wrote passing code according to the tests but, because the tests weren't actually right, the whole thing was super buggy and caused a bunch of later rework.

I know this isn't the fault of TDD per se but it did play into a lot of my preconceived notions against it.

Re: merge commits, I don't see why anyone should care what I do on my feature branch as long as I squash-merge into the main branch.

shout-out to his family (DJP), Tuesday, 14 July 2020 18:49 (five years ago)

Yeah we don’t care what you do on feature branches but main (nee master) is ff only enforced via our code review thing (gerrit). What this means in practice is you hit β€œmerge” and gerrit rebased your change into the tip of main then merged by ff. if there’s a conflict you have to resolve it and resubmit the review. We used to let people do that without running the tests but the number of people who committed the string β€œ>>>>>>>>>” was getting out of hand so it has to at least build after a manually resolved merge conflict.

π” π”žπ”’π”¨ (caek), Tuesday, 14 July 2020 18:55 (five years ago)

Doowatchyalike, just don't create a twelve-lane merge superhighway and then (DEAD) BEEF when your merges ultimately break down.

Isolde mein Herz zum Junker (James Redd and the Blecchs), Wednesday, 15 July 2020 13:55 (five years ago)

https://www.destroyallsoftware.com/blog/2017/the-biggest-and-weirdest-commits-in-linux-kernel-git-history

all cats are beautiful (silby), Wednesday, 15 July 2020 15:17 (five years ago)

Thanks.

Also, I misspelled Doowutchyalike.

Isolde mein Herz zum Junker (James Redd and the Blecchs), Wednesday, 15 July 2020 17:49 (five years ago)

It's pulled, and it's fine, but there's clearly a balance between "octopus merges are fine" and "Christ, that's not an octopus, that's a Cthulhu merge".

brimstead, Wednesday, 15 July 2020 18:20 (five years ago)

I would just like to take a moment to say javascript sucks and lodash sucks and _.times REALLY sucks

Why does every fucking thing have to be a function, how about you () => juggle(myBalls)

shout-out to his family (DJP), Wednesday, 15 July 2020 18:48 (five years ago)

Not only does it all have to be a function but there’s a strong convention that functions be anonymous whenever possible because fuck the reader, right?

π” π”žπ”’π”¨ (caek), Wednesday, 15 July 2020 19:10 (five years ago)

Isn’t most of lodash in es whatever these days though?

π” π”žπ”’π”¨ (caek), Wednesday, 15 July 2020 19:11 (five years ago)

our linting rules haven't been updated yet to favor the native implementations, why because fuck everything and everyone

shout-out to his family (DJP), Wednesday, 15 July 2020 19:12 (five years ago)

imo this is what happens when you let Perl aficionados design everything

shout-out to his family (DJP), Wednesday, 15 July 2020 19:13 (five years ago)

Don't worry, Dan, it will be updated just as soon as Perl6 is production.

Isolde mein Herz zum Junker (James Redd and the Blecchs), Wednesday, 15 July 2020 19:23 (five years ago)

Why does every fucking thing have to be a function, how about you () => juggle(myBalls)

juggle(this.nuts)

cherry blossom, Wednesday, 15 July 2020 19:26 (five years ago)

everything being a function is good not bad tbh

all cats are beautiful (silby), Wednesday, 15 July 2020 21:17 (five years ago)


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