There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

ClassifiedPancake , in How programmers comment their code

At work we let Typescript and descriptive naming document our code. Only when something is a workaround or otherwise weird will we add comments. So far it has worked great for us.

ClassifiedPancake , in Site: "I don't feel so good...."

Rotate <body> veeeeeeery slowly

marcos , in Average CSS

Well, that’s what you get for using classes like “white” and “lime”.

dajoho ,

Exactly this. Bootstrap killed the css star.

bricklove , in How programmers comment their code

I got a media failed to load error at first and thought that was the joke

ArchRecord ,

Both jokes can be true 😅

KillingTimeItself , in How programmers comment their code

this is why i very varely comment with descriptive comments. If you’re reading my code and don’t understand what it is, even with how shit it is, you have no business reading whatever fucking crackpot shit im writing.

potustheplant ,

You must be fun to work with.

KillingTimeItself ,

you say this like im the type of person to write code with other people.

potustheplant ,

Doesn’t matter. Even if it’s your code, you might revisit something you made months or a year after doing it and having comments will speed up your work. It’s a very basic good practice.

KillingTimeItself ,

i do have comments, for some things, but there are a lot of “commenting” standards that are just shit. I find i don’t care what the actual piece of code is doing, i care more about it’s place in the rest of the code, and i’d much rather have “anti comments” instead.

Holzkohlen , in Average CSS

I hate all webdev beyond using raw HTML, CSS and Javascript to make your own crappy website

nikaaa ,
MonkderVierte , in Average CSS
Peter_Arbeitsloser ,

Isn’t cascading styles the whole point of Cascading Style Sheets?

_stranger_ ,

You absolute fool. You must never utter its full name, lest you summon its wrath!

wizzor ,

I don’t get it, isn’t this a pretty normal way of using media queries. Granted you’re more likely to see the widths defined in px.

ByteOnBikes ,

Shhh… The poster doesn’t understand CSS and we shouldn’t embarrass them in a community with memes

wizzor ,

My imposter syndrome kicked in full swing. I was ready to learn a CSS best practice and feel uncomfortable about it for the rest off the day.

MonkderVierte ,

Nowadays we do responsive webdesign instead of micromanaging widths.

usernamefactory ,

This is technically responsive, but I think you have a fair criticism. A single rule like this would be much more maintainable:


<span style="color:#323232;">#content .grid-container {
</span><span style="color:#323232;">	width: 90vw;
</span><span style="color:#323232;">	min-width: 12rem;
</span><span style="color:#323232;">	max-width: 75rem;
</span><span style="color:#323232;">	padding: 2rem 0 1rem;
</span><span style="color:#323232;">}
</span>

Obviously, media rules have their place, but not for something that’s consistantly a full width container like this seems to be.

fnmain , in How programmers comment their code
bjoern_tantau , in Average CSS
@bjoern_tantau@swg-empire.de avatar

People learning CSS through shitty frameworks:

nikaaa , in How programmers comment their code

Good code is self-explanatory. You should only comment your code if it does something unexpectedly complicated.

That being said, it’s always a good idea to write a manual, about how to use the code. Don’t document how it works, because those who can code will understand it anyways, and those who can’t, have no need to understand it.

photonic_sorcerer ,
@photonic_sorcerer@lemmy.dbzer0.com avatar

Regardless, comments do speed up understanding.

BorgDrone ,

Good code is self-explanatory. You should only comment your code if it does something unexpectedly complicated.

The code shows what is being done. The comments should explain the why.

independantiste ,
@independantiste@sh.itjust.works avatar

Yes. This 1000x. I hate it at work when I come across code that was written 3 years ago that has literally no traces of why it’s there and a quick summary of what it does. Especially because that code is always the most abbreviated spaghetti you’ve ever seen. People should stop thinking (their) code documents itself because 99.999% of programmers cannot do it right.

I really like the Google way of coding: assume the person reading the code is the most 1337 programmer ever, BUT that this person knows absolutely nothing about the project

BorgDrone ,

Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.

dan ,
@dan@upvote.au avatar

This is something a lot of people don’t seem to understand. Even if code is self-explanatory, I want to know why it was designed that way.

I’ve fixed bugs where the fix was only a one line change, but it was extremely difficult to figure out, so I left a 10ish line comment above it explaining why it has to be done that way.

potustheplant ,

Hard disagree. It’s a lot easier and faster to understand a function that is prefaced with a small line of text explaining what it does rather than trying to figure it out yourself.

It’s not about whether you can understand the code or not, it’s about efficiency and clarity.

Aux ,

Hard disagree - that’s just dumb:


<span style="color:#323232;">// Calculates tax
</span><span style="color:#323232;">function calculateTax() { }
</span>
uis ,

Hard disagree - that’s very helpful:


<span style="color:#323232;">// Calculates Personal Income Tax by formula from section 1.2.3 of tax code. Other taxes like VAT are not calculated.
</span><span style="color:#323232;">function calculateTax() { }
</span>
potustheplant ,

This guy gets it.

Aux ,

If it calculates personal income tax, just call calculatePersonalIncomeTax.

uis ,

Why not calculatePersonalIncomeTax123 then?

Aux ,

Yeah, why not?

usernamefactory ,

I’m a new developer. Is that referring to page 123 of the in-house documentation? Version 12.3 of the code? I have no clue.

You’d have to call it something like calculatePersonalIncomeTaxPerTaxCodeSection1_2_3, but I get exhausted just looking at that. There comes a point where the cognitive work of reading crazy long camel case names is more trouble than it’s worth.

An explanation of what specification a function was written to implement is a perfectly appropriate comment. Could be improved by a direct link where possible. But it’s worth noting what that comment isn’t doing - specifying any implementation details. For that, I really can just read the code.

plecks ,

Is that state, federal, or combined?

Aux ,

Add a flag.

weststadtgesicht ,

If done right, the “what it does” is in the method name. If your method is too complicated to summarize in its name, chances are good you should split it up or extract parts of it.

Aurelius ,
@Aurelius@lemmy.world avatar

Yeah, just 15 seconds and jot down a comment. Whenever I’m even hesitant, I just leave a comment. Doesn’t hurt anything and it can always be removed if not needed

Easier to remove later rather than add it after the fact

TORFdot0 ,

This is true, but it’s easier and faster to parse plain English and so if I don’t adequately comment my code the first time. I will be commenting it when I have to return to it for whatever reason. Honestly the second round of commenting is more verbose and clearer than the function x does y style of comments I tend to make when coding the first time

tiredofsametab ,

Asinine business logic can still make some things very hard to read and digest no matter how well-planned and well-written it is (particularly if it is rushed by the business meaning that engineers don't have time to do it well). As such, there are places where code can't/won't be self-documenting to a useful degree.

independantiste , in Average CSS
@independantiste@sh.itjust.works avatar

At first I only noticed the indent. Wtf

bleistift2 , in Average CSS

The author should be killed for indentation alone.

mosiacmango ,

I know, right? Needs more tab.

afox ,

We are witnessing a hate crime.

FlyingSquid , in Mcafee accidentally made users call the devs of SQLite and complain.
@FlyingSquid@lemmy.world avatar

I used to tell people that John McAfee always exited a room by jumping through a window while yelling, “MCAFEE RULES!” Which he didn’t, but maybe he did? Anyway, I miss that crazy motherfucker. Sometimes nuts make the world more fun.

Buddahriffic ,

He was an interesting one but not a good one.

bloubz , in Average CSS

I guess the class matches the color of the background (applied on a parent element), and the text is the opposite color?

Ephera ,

My guess would be that they initially named the classes like the colors and then decided to swap those two colors.

bloubz ,

Pretty good guess

communism ,
@communism@lemmy.ml avatar

Lime text with a white background or vice versa sounds horrifying and illegible

aeronmelon , in Average CSS

“Some coders just want to watch the word burn get colored white and/or lime.”

And if you delete one or the other, or condense the code into a single command, the whole site breaks.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • lifeLocal
  • goranko
  • All magazines