Game game = new Game();

Game game = new Game();

Attached: shiteatinggrin.jpg (724x483, 100K)

10/10 nothing can go wrong here

I love these relevant threads!

Better than all the freetard threads with countless interjection pastas and mac vs linux shitslinging

leave

> Better than
Crap with peanuts is still crap.

redundancy isn't bad when programming


probably less than 10-15% of your dev time is spent writing code, the other 85-90% is analyzing, debugging and testing

Should be singleton or you will create games withing games.

Game::new();

Someone say new Game?

Attached: 9E2EF7A5-EF46-48B7-9C20-6F5B6A9172CD.jpg (1024x576, 72K)

Game game = new Game();

This but unironically

>Should be singleton
Nothing wrong with being able to run multiple instances of a game within the same VM.

Attached: aoba.jpg (1200x681, 61K)

>Should be singleton
You dense motherfucker
NOTHING should EVER be a singleton

>implying php indian monkeys now about classes or oop in general
Its Game.init()

Game game = new GameBeanFactory().generateNewGameBean().newGame();

auto game = new Game();

class Game implements Runnable{
World world;
Game(){
Thread t=new Thread(this);
world = new World();
world.init();
t.start();
}
public void run(){
while(true){
world.update();
world.render();
try{
Thread.sleep(1);
}catch(Exception ex){ex.printStackTrace();}
}

}
}

I was speaking about starting new game inside a game. But multiple instances of game in same jvm would be just as bad. Unless you have no non final static variables, singletons with state, etc

>I have no experience in developement
>what is patterns? Can I eat it?
fuck off kid.

>Unless you have no non final static variables, singletons with state, etc
You can still have that where it makes sense, such as for actual shared data. No need to make non-static constants, for instance.

Ain't got gaaaaaaames

Attached: Chad.jpg (320x240, 7K)

>I have no experience in developement
>what is patterns? Can I eat it?
Not him, but singleton is an anti-pattern. It's a convoluted way of introducing global state while pretending it's not really global state.

Unfortunately, because its one of the first patterns in pretty much every design patterns book, and because it's easy to grasp, newbs like you tend to overuse the shit out of it.

Want a single instance of a class? Don't instantiate it more than once, then. Nothing should ever use singleton.

theres nothing wrong with global state

Attached: 1475985800011.gif (500x400, 1.51M)

this: 99% of OOP usage is pointless

i love nene she is perfect and a good programmer

New old = new Old;

val game = Game()

Or

val game:Game = Game()

Is this the new Unity Phone Games Development General?

>t. never wrote a multithreaded program in his life

Should be injecting that dependency mr poo in the loo.

C++ is the perfect case of "it's not because you can that you should".

just use semaphores

multithreading is for faggots

I love Nene (season 2)

it's actually an intermediate programming concept, but it sets the men apart from the boys aka codemonkey imposters and webdevs.

void* game = malloc(sizeof(game))

>implementing a fucking semaphore just so you can arbitrarily use a global variable
Please, put your signature on every piece of software you write, so I know to never run it on my machines.

what if you really need that global variable?
for example let's say a multithreaded program that checks for duplicate files, and i need a counter to keep track of how many duplicates there are.

Game game = new Game();

Why assign to a void pointer if you know sizeof game?

for(var games=[],i=0;i

int main(int argc, char* argv[]){
init_game();
run_game();
}
void init_game(){
while(not_enough(METS)){
add_object(new Met());
}
}

STOOOPP AAAAAAH I FUCKING HATE THIS LANGUAGE EVERY DAY AT WORK IS PURE HELL I HAVE TO WORK WITH FUCKING POO IN LOO MEME BEAN COWORKERS AAAAAAAAAAAAAAAAA

Attached: 1530089442882.gif (394x383, 15K)

>let's say a multithreaded program that checks for duplicate files, and i need a counter to keep track of how many duplicates there are
You'd find a way to do it without using a global variable, """let's say""", you'd sort a portion of a filesystem with every thread, then merge each pair of threads and their lists together into a single thread, until you end up with one thread and one sorted list of duplicates. You wouldn't lose much of the performance and you'll avoid problems with using a global variable.

You lost me, I just meant to say what if there's a global counter?
Are you so bent on avoiding semaphores that you're willing to come up with a new program structure?

>Are you so bent on avoiding semaphores that you're willing to come up with a new program structure?
Yes, but that's not the point, you're attacking a strawman.

You were the one who implied there is AN ABSOLUTE NEED for global variables in many cases. That is simply not true. And in the rare exceptional cases where you absolutely HAVE to use global variables in any shape or form, it's best to use a semaphore based on a hardware instruction such as test-and-set, and it's best to leave the implementation for the kernel.

Using software semaphores is just bad manners.

Just testing, ignore me
normal line
space-idented line

so you're saying redundant code is easier to analyze?

Faggot op = new Faggot();

Not him
In Java's case, certainly. I think it's beyond retarded to use implicit typing because what you name a variable doesn't matter at all. When you limit yourself to implicit typing, you are forced to extrapolate an object's type based solely on the context that it is used in rather than what it was instantiated as.

me too bump

Game game = AbstractGameSingletonFactory.getOrCreateGame()

Eloquent in its brevity.

The OP isn't a valid C++ expression, you absolute moron.

report them

Attached: qvx46.jpg (500x334, 80K)

Game game = new New Game;

why not?

new Game();

>not using a DI framework
Pajeet trash…

ok this one hurts

this: 99% of OOP usage is pointless

Attached: 1c.jpg (1240x580, 33K)

Class MobileGame extends PCGame implements Diablo :)

no, singleton is a pattern

while(!anal_prolapse){
butt_rape(op);
}else{
asshole_swelling ++;
}

game := NewGame()

if ( TheGame.Lost == true)
{ console.writeline ( "you just lost the game" ); }

#include
#include

int main(int argc, char *char[]) {
struct Game * g;
g = malloc(sizeof(struct Game));
runGame(&g);
}