this post was submitted on 05 Apr 2024
219 points (98.2% liked)

Programmer Humor

32410 readers
360 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
top 12 comments
sorted by: hot top controversial new old
[–] [email protected] 32 points 7 months ago (1 children)

Code monkey think maybe Manager want to write Godamned login page himself

[–] [email protected] 20 points 7 months ago

Code Monkey not say it out loud
Code Monkey not crazy, just proud

[–] [email protected] 23 points 7 months ago

remember kids, scope creep kills things.

it killed my startup 👍

[–] [email protected] 10 points 7 months ago (1 children)

I just got home from a 12 hour day of work. This has been my entire week.

Help.

[–] [email protected] 7 points 7 months ago

Delete it all,

admin:admin

but fail the first attempt no matter what

Sekurity

[–] [email protected] 10 points 7 months ago (1 children)

I love this scene. Taught me what "yak shaving" is and helps me explain it to other people.

[–] [email protected] 3 points 7 months ago (1 children)
[–] [email protected] 9 points 7 months ago* (last edited 7 months ago) (1 children)

Starting with a simple idea that could theoretically be completed by a simple task, but as you implement it, reality complicates and sends you off on many deviations from the original straight and narrow path.

Yak shaving could be required and unknown at the beginning, or it could be a lack of discipline leading to scope creep - often it's both

The famous Malcolm in the middle scene for ref: https://youtu.be/AbSehcT19u0?si=Pchmbf3509l1CbeQ - but the term was originally coined from elsewhere: https://en.m.wiktionary.org/wiki/yak_shaving

[–] [email protected] 5 points 7 months ago* (last edited 7 months ago)

Oh no, I got the meaning of the idiom from context. I was asking about the actual phrase Yak shaving. Where did that part come from? So thanks for the second link. Not quite as interesting as I was hoping.

[–] [email protected] 8 points 7 months ago* (last edited 7 months ago)

The real lesson here is don't re-invent the wheel. There are plenty of companies that have fully fleshed out auth/login solutions for you already. I never cease to be amazed with how many companies insist on building shit that already exists and come up with an obviously far shittier implementation.

[–] [email protected] 2 points 7 months ago

I’m Hedgehog, the poor senior dev who was assigned to review Hal’s code.

Panel 1: ✅ (PR Approved) LGTM but you’re missing the styling from the mock-ups, should be easy to add.

Panel 2: ❌ (Changes requested)

Nit: Hal, your PR failed in CI. You should have used const instead of let. Did you forget to run the linter before pushing?

Also, the useState hook isn’t doing anything. If it doesn’t need to, just leave it as an uncontrolled component. I didn’t look at the surrounding code but this is part of a form, right? If not then it should be receiving the setter/value as props.

Panel 3: ✅ LGTM, ship it.

❌ Actually wait, you still have that do-nothing state code in there. Either get rid of it or do something with it.

Panel 4: ❌ Hal, I don’t like where this is going.

Panel 5: (during stand-up) I reviewed Hal's PR and just had a couple pieces of feedback. Shouldn’t take long, right, Hal?

Panel 6: ❌ WTF, Hal. <InputField /> is literally just passing through props to input, so you don’t need it.

Also, Hal, I recommend you look into the Styled Components library. It might better fit your needs here. You could rewrite the LoginComponent as a styled input. Of course, if you do that you should refactor the existing places where you’re using style sheets to use styled components and themes instead.

You also still have the do-nothing useState hook for some reason. Seriously, Hal, get rid of it.

This is how I’d write this without bringing in Styled Components, but if you use it make sure to test it first:

import React from ‘react’;
export const LoginForm = (props: React.ComponentPropsWithoutRef<‘input’>) => (
  <input
    {...props}
    className={`border rounded-md p-2 focus:outline-none focus:border-blue-500 ${props.className || ‘‘}`}
  />
);
[–] [email protected] 2 points 7 months ago

Should have been "Hal, did you center the div?"

Also, Hal shoulda just used an UI library!