this post was submitted on 02 Jul 2023
30 points (89.5% liked)

Programmer Humor

32461 readers
641 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
top 10 comments
sorted by: hot top controversial new old
[–] DarthFrodo@lemmy.world 14 points 1 year ago (2 children)

The neat thing is, you can add stuff like range checks and logging for getters and setters without changing every call. Separation of concerns is also vital in larger projects.

[–] hairinmybellybutt@lemmy.world 8 points 1 year ago

typical OOP progaganda

[–] jazz@lemm.ee 1 points 1 year ago

also const correctness in languages that support that concept

[–] alokir@lemmy.world 4 points 1 year ago (1 children)

Wait until you hear about the concept of properties in languages like Javascript, C#, Kotlin and many others.

[–] relevants@feddit.de 2 points 1 year ago

At least for Kotlin it's literally just syntactic sugar for getter and setter methods. I really like them, don't get me wrong, but it's just the bottom approach masquerading as the top approach

[–] watermelonsushi@lemmy.fmhy.ml 1 points 1 year ago

I love dart's approach to getter and setter methods... They let you define methods labelled explicitly as "get" or "set" methods that you can call without writing the parentheses. So the call looks like accessing a member variable, but internally it can handle additional functionality like logging or validation or whatever you want. So the syntax would look like the first example in the meme, but with all the benefits of the second example. I wish more languages would incorporate this

Imagine not using a language with setters and getter built in lol

[–] metarmask@sh.itjust.works 1 points 1 year ago

That's not a new way to change data, it's reading it.

[–] lntl@lemmy.sdf.org 1 points 1 year ago

I am triggered

[–] bi_tux@lemmy.world -2 points 1 year ago

Every IT profesor, ever