This is a glass

489 points · 61 comments · view on lemmy.world

61 Comments

ImgurRefugee114@reddthat.com · 73 pts · 34d (4 replies)

It's not a glass, it's the

hydrationContainerManagerObjectFactory

Not to be confused with the

hydrationContainerManagerTypeFactory

Which is the template

Valmond@lemmy.dbzer0.com · 29 pts · 34d

You forgot the AbstractHydrationManager

Viceversa@lemmy.world · 11 pts · 34d (1 reply)

Do developers still code in such a manner?

jaybone@lemmy.zip · 16 pts · 34d

Some of those patterns were actually good design, until everyone went overboard with them. Now the pendulum has swung the complete opposite way and there’s a ton of duplicate code often generated from actual templates.

unwarlikeExtortion@lemmy.ml · 2 pts · 33d

you mean

glass Glass;

which is almost worse than stringing together random fancy words.

(Edit: added backticks for that nice mono font)

Ftumch@lemmy.today · 40 pts · 34d (3 replies)

That's not a good comment. What it is should be clear from the naming and context. A good comment explains the why when that is not obvious:

// This glass is at 50% capacity because we don't want it to overflow if it rains
one_old_coder@piefed.social · 15 pts · 34d (2 replies)

And in 5 years you will wonder why the glass is under the rain because someone didn't put that in the specifications.

xthexder@l.sw0.com · 3 pts · 34d

Inevitably whatever is under the glass gets wet anyway... because it's raining.

hakunawazo@lemmy.world · 1 pts · 33d

A software tester walks into a bar

Runs into a bar.
Crawls into a bar.
Dances into a bar.
Flies into a bar.
Jumps into a bar.

And orders:

a beer.
2 beers.
0 beers.
99999999 beers.
a lizard in a beer glass.
-1 beer.
"qwertyuiop" beers.
Testing complete.

A real customer walks into the bar and asks where the bathroom is.

The bar goes up in flames.

Kolanaki@pawb.social · 37 pts · 34d (9 replies)

Unless it is in a vacuum, the glass is full.

50% water, 50% gas mixture.

rockerface@lemmy.cafe · 42 pts · 34d

Topologist: The glass is full of glass. Everything else is on the outside.

rmuk@feddit.uk · 6 pts · 33d

I can't believe no-one else has posted this yet.

Relevant xkcd: https://what-if.xkcd.com/6/

Also, relevant xkcd video: https://youtu.be/0EytSWiKrFg

surewhynotlem@lemmy.world · 4 pts · 34d (6 replies)

If it were a vacuum the water would quickly boil away with any remaining turning to ice.

cenzorrll@piefed.ca · 2 pts · 34d (5 replies)

It wouldn't freeze unless you drop the temperature as well.

jerkface@lemmy.ca · 12 pts · 34d (3 replies)

The phase transition from liquid to gas absorbs all the thermal energy in the remaining liquid and causes its temperature to drop to freezing point. You are familiar with this effect if you have used a tank of compressed gas; the tank gets cold as you release the gas and you might see condensation on the tank up to the liquid level.

But then the remaining ice in the glass sublimates anyway.

PattyMcB@lemmy.world · 5 pts · 34d (2 replies)

Who are you who are so wise in the ways of science?

Tlaloc_Temporal@lemmy.ca · 2 pts · 33d (1 reply)

Just some jerkface.

PattyMcB@lemmy.world · 2 pts · 33d

Username checks out

cockmushroom@reddthat.com · 1 pts · 28d

Who told you about hot vacuums? That was a secret!

FuglyDuck@lemmy.world · 26 pts · 34d (1 reply)

Opportunist... "It's an empty glass. I drank it while you were arguing."

jason@discuss.online · 7 pts · 34d

Scientist.. "it's half empty because the water is slowly evaporating."

Avicenna@programming.dev · 22 pts · 34d (4 replies)

//don't remove this comment or else

greedytacothief@lemmy.dbzer0.com · 17 pts · 34d

Load bearing comment

KokusnussRitter@discuss.tchncs.de · 7 pts · 34d (2 replies)

//what if I remove this comment and else?

AstroLightz@lemmy.world · 5 pts · 34d (1 reply)

//Then line 368 that checks if the comment exists will fail and will be sad

KokusnussRitter@discuss.tchncs.de · 1 pts · 33d

No :(

BorgDrone@feddit.nl · 22 pts · 34d (3 replies)

Engineer: this glass is twice as big as it needs to be.

saxrussell@slrpnk.net · 3 pts · 34d

Ha, sorry just saw your post! 😆 Wise minds and such… 😉

LovableSidekick@lemmy.world · 1 pts · 33d

- comedian Gallagher

XLE@piefed.social · 1 pts · 34d
[ removed ]
Racoonwithbenefits@lemmy.zip · 20 pts · 34d (2 replies)
[ removed ]
OwOarchist@pawb.social · 6 pts · 34d (1 reply)

Comment would be whether glass is being emptied or filled

What if it's neither (and unknown which it was previously), and the glass is just sitting there?

jaybone@lemmy.zip · 5 pts · 34d

IllegalStateException

socsa@piefed.social · 18 pts · 33d

Senior engineer: the glass is self documenting.

RustySharp@programming.dev · 11 pts · 34d (10 replies)

The current legacy code I'm dealing with is full of these:

// TODO: Class description here to satisfy linter

Valmond@lemmy.dbzer0.com · 7 pts · 34d (8 replies)

// I'm paid by the line

OwOarchist@pawb.social · 4 pts · 34d (5 replies)
"""
only one line for your comment?
fucking amateur
this comment uses five lines
"""
xthexder@l.sw0.com · 5 pts · 34d (4 replies)
/*
 * this five line comment
 * is formatted C plus plus
 * and is a haiku
 */
jerkface@lemmy.ca · 3 pts · 34d (3 replies)

A haiku has to use elements of the natural world in a symbolic manner.

RustySharp@programming.dev · 3 pts · 33d

elements of the natural world in a symbolic manner

What about elements of HTML? It also has symbols.

xthexder@l.sw0.com · 3 pts · 34d (1 reply)

Eh, my bad. I figured that was somewhat optional given it's English and already kind of an adaptation. Fixing it is more effort than I'm willing to put in tho

The whole Wikipedia page on English Haiku makes it seem like there's a lot of room for interpretation

OwOarchist@pawb.social · 2 pts · 33d

I figured that was somewhat optional

It is somewhat optional.

While there are certain elements that are traditionally included in a 'proper' haiku, those elements are not universal, even in very old, traditional haiku. @jerkface@lemmy.ca is being too harsh and speaking too absolutely here. A non-traditional haiku is still a haiku.

-- Your friendly neighborhood literature major.

Jankatarch@lemmy.world · 3 pts · 33d

That sounds horribe, actually.

staircase@programming.dev · 1 pts · 33d
[ removed ]
one_old_coder@piefed.social · 2 pts · 34d

Don't you have stuff like // NOLINTNEXTLINE to explicitely disable some lints?

SnotFlickerman@lemmy.blahaj.zone · 11 pts · 34d (2 replies)
// This is a Glass class
class Glass {
     filled(halfFull,  halfEmpty) {
         this.halfFull;
         this.halfEmpty;
         }
}
jaybone@lemmy.zip · 3 pts · 34d (1 reply)

What the hell kind of glass is this?

cockmushroom@reddthat.com · 1 pts · 28d

Quantum, obviously

UpperBroccoli@lemmy.blahaj.zone · 10 pts · 33d
/**
 * @brief This is the coffee cup class
 * 
 * This class describes a cup or mug that neatly integrates a
 * container for vectors of cCoffee instances with a fully
 * functional handle to carry the cup or mug around. Used for 
 * pretty much everything.
 */
class cTallGlass : public cGlass {
dan@upvote.au · 8 pts · 34d (1 reply)

AI loves inserting comments like this.

Either that or 20-line comments documenting the bugs in the old code, what this code does differently, and the exact implementation.

Comments describing the exact implementation become stale very quickly. Comments shouldn't explain what the code does (eg "add two to rowCount"); they should explain why it does it (eg "include header and footer row in count too"). Extra details are what the commit message is for, and history is what source control is for.

I call it out in a lot of my code reviews ("code looks good but clean up the AI slop comments before landing") but a lot of other developers don't care as much about code and documentation quality.

partofthevoice@lemmy.zip · 1 pts · 33d
[ removed ]
Shalien@piefed.projetretro.io · 5 pts · 34d (3 replies)

//This a glass // To get the quantity and type of content use
// glass->qty : float
// glass->content : glass_content

LeFrog@discuss.tchncs.de · 5 pts · 34d (1 reply)
if glass.empty?
  make_sad_noise
else
  homi.hydrate(glass.qty)
end
rbn@sopuli.xyz · 3 pts · 34d

You should check against homi.healthyCapacity first unless you want to drown them.

red_tomato@lemmy.world · 4 pts · 34d

How can you be so sure other readers will understand floating point numbers? Better include the entire IEEE 754 standard just in case.

amio@lemmy.world · 5 pts · 34d
Glass _glass = new Glass(); //make variable glass of type glass and make a new glass
///<captainusefuldoc>Gets the glass</captainusefuldoc>
Glass getGlass() => _glass; //get the glass in _glass
akunohana@piefed.blahaj.zone · 5 pts · 34d

IT support chatbot when the client asks how to get an empty/full glass to display: You're absolutely right! I couldn't have said it better myself: This is a glass. 😊🥛

TheMightyCat@ani.social · 5 pts · 33d
// This might be a glass
Glass* glass = dynamic_cast<Glass*>(container);
Codpiece@feddit.uk · 5 pts · 34d

You guys are getting code comments???

saxrussell@slrpnk.net · 5 pts · 34d

Engineer: The glass is too big!

kalapala@sopuli.xyz · 5 pts · 34d

Commented out glass is certainly a problem (if it's not only a comment) as the instance of object is created elsewhere but there's some more problems in the code:

-Software tester removes the glass but the water still stands there in the shape of the glass.

-QA tries to pour the water in to the glass but water doesn't register and the glass doesn't fill.

-Performance testing notes that rendering the glass needs some optimization since the glass doesn't fill over 50% before being out of memory.

-Junior programmer can't get the glass to run since the liquids library wasn't locked down and got an incompatible update.

-Automation testing results in to a crash with a screenshot and logs that point out that glass frontend use the old version of the glass backend API leading the glass to freeze.

-External testing points out that there's a bug in the glass but they can't identify it.

WanderingThoughts@europe.pub · 3 pts · 34d

Marketing: the glass is perfectly dimensioned to transport that amount of water without spilling anything! Buy yours now for a discount! Terms and conditions may apply.

sunbeam60@feddit.uk · 2 pts · 33d

Feel like we’re missing an overflow joke here!

Or something like: // initialise a glass using max water value as indicator that glass is unused

observes_depths@aussie.zone · 1 pts · 33d

Capacity = 0.5

Jankatarch@lemmy.world · 1 pts · 33d

Birb: How the fuck is water doing that °v°