Unable to load image

[GitHub] FizzBuzz Enterprise Edition: A no-nonsense implementation of FizzBuzz made by serious businessmen for serious business purposes

https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
Enterprise software marks a special high-grade class of software that makes careful use of relevant software architecture design principles too build particularly customizable and extensible solutions too real problems. This project is an example of how the popular FizzBuzz game might be built were it subject too the high quality standards of enterprise software.

trans lives matter ![](/i/chud/supportjews.webp)

18
Jump in the discussion.

No email address required.

I don't think I have a bigger pet peeve than when people do this

		this.doFizzBuzz(TestConstants.INT_1, TestConstants._1_);
		this.doFizzBuzz(TestConstants.INT_2, TestConstants._1_2_);
		this.doFizzBuzz(TestConstants.INT_3, TestConstants._1_2_FIZZ);
		this.doFizzBuzz(TestConstants.INT_4, TestConstants._1_2_FIZZ_4);
		this.doFizzBuzz(TestConstants.INT_5, TestConstants._1_2_FIZZ_4_BUZZ);
		this.doFizzBuzz(TestConstants.INT_6, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ);
		this.doFizzBuzz(TestConstants.INT_7, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7);
		this.doFizzBuzz(TestConstants.INT_8, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8);
		this.doFizzBuzz(TestConstants.INT_9, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ);
		this.doFizzBuzz(TestConstants.INT_10, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ);
		this.doFizzBuzz(TestConstants.INT_11, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ_11);
		this.doFizzBuzz(TestConstants.INT_12, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ_11_FIZZ);
		this.doFizzBuzz(TestConstants.INT_13, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ_11_FIZZ_13);
		this.doFizzBuzz(TestConstants.INT_14, TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ_11_FIZZ_13_14);
		this.doFizzBuzz(TestConstants.INT_15,
				TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ_11_FIZZ_13_14_FIZZ_BUZZ);
		this.doFizzBuzz(TestConstants.INT_16,
				TestConstants._1_2_FIZZ_4_BUZZ_FIZZ_7_8_FIZZ_BUZZ_11_FIZZ_13_14_FIZZ_BUZZ_16);

WHY? Are you expecting the value of INT_1 to change? is there some additional value or clarity that comes from refactoring it into a variable?

yes I am aware that this is a meme but I see people do this all the time because they are coding cucks. if someone tells me to do this i will tell them to fuck off because I am an alpha male

Jump in the discussion.

No email address required.

TestConstants.INT_10

wait so that is 10 always? :marseyxd:

static final int INT_12 = 12;

omg it is lmaooooooo

Jump in the discussion.

No email address required.

lol yeah. it's sadly a common pattern in corporations because review-buzzards ask people to do it so it doesn't look like they are useless

Jump in the discussion.

No email address required.

Why even use constants like this? Is there any use case?

Jump in the discussion.

No email address required.

well, there is an old adage in programming not to have "magic numbers" or "magic strings". For instance, it's less readable to have

Portal.login(api_key="00000-000000-000000-00000")

than

JEFF_API_KEY = "00000-000000-000000-00000"

Portal.login(api_key=JEFF_API_KEY)

this is nice because it is immediately obvious what "00000-000000-000000-00000" is. Also, it's easy to change it if something happens. Finally, of course, if you use this value in multiple places, that reduces the likelihood of a copying failure (i updated it one place but not another place).

Another good use of cosntants is something like this

BATCH_SIZE = 10

batches = ceil(len(input)/BATCH_SIZE)
for i in range(batches):
    first_index = i*BATCH_SIZE
    process(input[first_index:first_index+BATCH_SIZE-1])

Nice, neat, simple. The problem comes when management hears this. They hear "never ever ever use a literal value under any circumstances ever".

There are some circumstances where the value is just the value because that's how it works. For instance

def get_half(input):
    return int(input/2)

"Review Buzzards" see this and see that there is a literal 2 in the function. So they leave a comment like

NIT: Make this into a constant value.

so your beautiful function becomes

DIVISOR = 2

def get_half(input):
    return int(input/DIVISOR)

that's definitely bad, but it can get worse. DIVISOR, at least, has a meaning that explains the purpose of the number two. Some inexperienced (pajeet) programmers do this

INT_2 = 2

def get_half(input):
    return int(input/INT_2)

So to answer the question of "why": To keep middle management types employed and software engineers doing busywork.

Jump in the discussion.

No email address required.

Lmaooo I am almost convinced to write the advent code like this from next puzzle onwards

Jump in the discussion.

No email address required.

Honestly not a bad pattern - although, probably a bit tedious, lol!

Jump in the discussion.

No email address required.

I meant the divide/2 line the rucksack priority is acually a good usecase

Jump in the discussion.

No email address required.

omg, my first job out of college had these. Legitimately shit like

#define ZERO 0
#define ONE 1
#define TWO 2
#define THREE 3

up to twenty

I purged that shit.

Jump in the discussion.

No email address required.

WHAT ABOUT THE CODING STANDARDS YOU FRICK

Jump in the discussion.

No email address required.

I do remember some fricking moron going "if you take these out then there's just '15' in the code and nobody will know what it is" like motherlover IT JUST SAID "FIFTEEN BEFORE"

frick I'm glad that's a past job

Jump in the discussion.

No email address required.

:soycry: what the frick is '15' supposed to mean

:!chad: 15

Jump in the discussion.

No email address required.

... 
#define THIRTEEN 13
#define FOURTEEN 14
#define FIFTEEN 14
#define SIXTEEN 16
... 

:marseytroublemaker:

Jump in the discussion.

No email address required.

Link copied to clipboard
Action successful!
Error, please refresh the page and try again.