62
submitted 8 months ago by hairinmybellybutt to c/[email protected]
top 11 comments
sorted by: hot top controversial new old
[-] DarthFrodo 20 points 8 months ago

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 21 points 8 months ago

typical OOP progaganda

[-] [email protected] 6 points 8 months ago

also const correctness in languages that support that concept

[-] alokir 6 points 8 months ago

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

[-] [email protected] 3 points 8 months 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

[-] [email protected] 4 points 8 months ago

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

[-] [email protected] 2 points 8 months ago

I'm convinced that Java programmers need to write setters and getters to meet their KPI target.

[-] [email protected] 2 points 8 months ago

I am triggered

[-] [email protected] 1 points 7 months 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

[-] [email protected] 1 points 3 months ago

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

[-] bi_tux -2 points 7 months ago

Every IT profesor, ever

this post was submitted on 02 Jul 2023
62 points (90.8% liked)

Programmer Humor

9828 readers
83 users here now

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

Rules:

founded 4 years ago
MODERATORS