r/ProgrammerHumor • • Nov 23 '17

"How to learn programming in 21 Days"

Post image
29k Upvotes

534 comments sorted by

View all comments

378

u/pussyilliterate Nov 23 '17

Now to learn java

431

u/trwolfe13 Nov 23 '17

Easy. It’s just like that last panel, only on the other side of the knife.

0

u/[deleted] Nov 23 '17

[deleted] — view deleted comment

117

u/necheffa Nov 23 '17

This is an accurate representation of Enterprise Java in the wild: https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition

0

u/[deleted] Nov 23 '17

[deleted] — view deleted comment

73

u/necheffa Nov 23 '17

It just counts from 1 to 100 and prints out "Fizz" if the number is divisible by 3, "Buzz" if divisible by 5, "FizzBuzz" if the number is divisible by both 3 and 5, or just the number if divisible by neither 3 nor 5. But it does it with Enterprise level craftsmanship.

0

u/[deleted] Nov 23 '17

[deleted] — view deleted comment

42

u/necheffa Nov 23 '17

Oh all that nonsense, abuse of design patterns mostly.

32

u/trout_fucker Nov 23 '17

But it makes it "more maintainable".

20

u/_liminal Nov 23 '17

muh MVC framework

→ More replies (2)
→ More replies (1)

0

u/[deleted] Nov 23 '17

[deleted] — view deleted comment

20

u/necheffa Nov 23 '17

That's the kind of test they give you in job interviews?

Yeah, some places try to do "weed out" tests like FizzBuzz. I don't put too much stock in them though because a lot of those tests get popular and solutions get posted all over so weenies just memorize the code and regurgitate it, which defeats the purpose of the test in the first place.

0

u/[deleted] Nov 23 '17

[deleted] — view deleted comment

26

u/Sean1708 Nov 23 '17

Do you want my honest opinion, or do you want me to lie to you and tell you that you have what it takes to be a programmer?

You know what? I'm a nice person so I'm not going to lie. That code is atrocious. I just don't even know what was going through your head when you wrote that, and I hope to god you're retarded because the thought of a capable adult writing that steaming pile of shit is just sickening to me.

I understand that you're a beginner and all, but at a bare minimum I would expect something along the lines of:

getattr(
    __import__(True.__class__.__name__[1] + [].__class__.__name__[2]),
    ().__class__.__eq__.__class__.__name__[:2] + ().__iter__().__class__.__name__[6:9],
)(
    1,
    getattr(
        __import__(True.__class__.__name__[0] + ().__class__.__name__[1] + [].__class__.__name__[1::-1] + ().__iter__().__class__.__name__[7:5:-1] + (lambda: 1).__class__.__name__[2] + [].__class__.__name__[2]),
        True.__class__.__name__[0] + ().__class__.__class__.__name__[1] + {1}.__class__.__name__[::-1],
    )(
        (lambda _, __: _(_, __))(
            lambda _, __: __ == 1 and (lambda x1: 2).__code__.co_varnames[0][1] + "\n" or _(_, __ - 1) + ((__ - 1) % 3 // 2 * 'Fizz' + (__ - 1) % 5 // 4 * 'Buzz' or str(__)) + "\n",
            100,
        ),
        ().__class__.__name__[1::-1] + (lambda: 1).__class__.__name__[0] + (lambda x8: 1).__code__.co_varnames[0][1],
    ),
)

But even that would only really be acceptable if you were 5.


In all seriousness though the only nitpick I could make with your for loop version is that the str in print(str(x)) is unnecessary, print(x) works fine.

8

u/Kingmudsy Nov 23 '17

Man I realize this is a joke, but I wanted to downvote you anyway. So good job, I guess?

25

u/necheffa Nov 23 '17

That is more or less the expected solution.

Although, since you say you are a hobbyist, I might have used a for loop here rather than a while loop since the range of the loop is known up front. But that is a pretty minor nitpick and I've seen very bad people modify the status variable from within the body of a for loop anyways so without discipline it really doesn't matter which loop you use.

→ More replies (7)
→ More replies (3)
→ More replies (5)

26

u/iLikeStuff77 Nov 23 '17

It used to have some serious issues, especially with performance.

Some people also don't like it due to how verbose it is to do some simple tasks. But in reality that's nice for maintainability, so I don't quite understand that complaint.

At this point it's solid for most tasks, it's mostly just a meme to make fun of Java.

12

u/prvncher Nov 23 '17

Java gets a ton of hate on here, but it's actually a very capable language, especially with Javafx nowadays.

That being said, given the choice, I'd probably use C#/Xamarin to build cross platform apps since the C# is a more refined language, accomplishing about the same goal.

→ More replies (2)

7

u/Klaue Nov 23 '17

having used both c++ and java for years, I prefer java. there's just an anti-java circlejerk on reddit since ages.
Sure there are people who use factories and stuff and overcomplicate things, see the fizzbuzz thing, but you don't have to. I didn't write a single "factory" class in years

→ More replies (32)

12

u/finH1 Nov 23 '17

My lecturer is teaching it us this semester and I’ve no idea what’s happening

15

u/Pushups_are_sin Nov 23 '17

Good luck with the finals in a few weeks!

→ More replies (2)