>tfw working with pajeets

class myClass () {
private:
int x;
int y;
int z;
int d;
int e;
int f;
int g;
int h;

public:
int getX() {
return x;
}
int getY() {
return y;
}
int getZ() {
return z;
}
int getD() {
return d;
}
int getE() {
return e;
}
int getF() {
return f;
}
int getG() {
return g;
}
int getH() {
return h;
}
};


Why do people still do this?

Attached: suffocating cat.jpg (634x457, 52K)

Other urls found in this thread:

yegor256.com/2014/09/16/getters-and-setters-are-evil.html
twitter.com/SFWRedditImages

what's the point of this? i can't think like pajeet.

what's wrong with this?

God, I'm so glad C# doesn't have this problem.

What's the context

more like working with C++

getters and setters are not OOP. Educate yourself.
yegor256.com/2014/09/16/getters-and-setters-are-evil.html

What's wrong with that?

Get methods is literally cuckold programming.

Attached: Cuck loli.png (372x539, 321K)

That's why you don't get paid. At least the pajeets make a few shekels slaving away in their Microshacks.

Nothing

Low quality bait

>all he ultimately ends doing is renaming getBall() to take(), or getWeight() to weight()
For such strong initial statements I expected something less hilariously trivial as arguing about the name of the method.

because eclipse and intellij both autogenerate code that looks like that

the method names should just be name of the member you are trying to get x(), y(), etc.

he's right though, they're useful, but the class is cucking you

This guy is fucking retarded and so are you. Getters have nothing to do with OOP, their point is bottlenecking access to data and to relieve the user from having to know how the data is manipulated until it gets to them

public class myClass()
{
public int x {get; private set;}
public int y {get; private set;}
public int z {get; private set;}
public int d {get; private set;}
public int e {get; private set;}
public int f {get; private set;}
public int g {get; private set;}
public int h {get; private set;}
}

based and c#pilled

based

cringe

yikes

Attached: 🅱️OI.jpg (491x258, 16K)

>their point is bottlenecking access to data and to relieve the user from having to know how the data is manipulated until it gets to them

99% of access methods I see at work are literally just encapsulated private member variables.

tl;dr:
>let's pretend object-oriented paradigm can and should reflect physical world
>you can't "set" a ball to a real dog, you see
>therefore, dog.setBall() and dog.getBall() are bad
>dog.take() and dog.give() are good, and totally not still a getter and a setter

Pic related is the guy's painting. Unsurprisingly, turns out he's a literal cuck.

Attached: ukrcuck.png (616x494, 157K)

Getters and setters are there BECAUSE they work with pajeets and code gets split up because of managers. Chances are, the person you're working with will screw up your variables and possibly break your logic. Getters/setters protect you from bad programmers

#ifndef GETTERSETTER_H_
#define GETTERSETTER_H_

#define OBJ_WRAPPERTYPE_EXTENSION __TYPE
#define OBJ_GETTER_NAME_EXTENSION _Get
#define OBJ_SETTER_NAME_EXTENSION _Set

#define MACRO_CONCAT(A, B) MACRO_CONCAT_(A, B)
#define MACRO_CONCAT_(A, B) A ## B

#endif //GETTERSETTER_H_

#ifndef OBJ_TYPE
#error "OBJ_TYPE must be defined!"
#endif

#ifndef OBJ_NAME
#error "OBJ_NAME must be defined!"
#endif

struct {
OBJ_TYPE _obj;
} OBJ_NAME;

#if defined(OBJ_CUSTOM_GETTER)
OBJ_TYPE MACRO_CONCAT(OBJ_NAME, OBJ_GETTER_NAME_EXTENSION) ();
#undef OBJ_CUSTOM_GETTER
#elif !defined(OBJ_NO_GETTER)
OBJ_TYPE MACRO_CONCAT(OBJ_NAME, OBJ_GETTER_NAME_EXTENSION) () { return OBJ_NAME._obj; }
#endif

#if defined(OBJ_CUSTOM_SETTER)
OBJ_TYPE MACRO_CONCAT(OBJ_NAME, OBJ_SETTER_NAME_EXTENSION) (OBJ_TYPE obj);
#undef OBJ_CUSTOM_SETTER
#elif !defined(OBJ_NO_SETTER)
OBJ_TYPE MACRO_CONCAT(OBJ_NAME, OBJ_SETTER_NAME_EXTENSION) (OBJ_TYPE obj) { OBJ_NAME._obj = obj; }
#endif

#undef OBJ_TYPE
#undef OBJ_NAME

#ifdef OBJ_NO_GETTER
#undef OBJ_NO_GETTER
#endif

#ifdef OBJ_NO_SETTER
#undef OBJ_NO_SETTER
#endif

It lets you allow read access to a variable and disallow write access. It also makes for an easy place to put a breakpoint to see what all is messing with a variable.

Java!

public class MyClass
{
@Getter private int x;
@Getter private int y;
@Getter private int z;
@Getter private int d;
@Getter private int e;
@Getter private int f;
@Getter private int g;
@Getter private int h;
}