>>58835638
most sun technologies were godtier
>>58835638
I like it because your code will work on every platform without many changes
>>58835638
Because how else would you code Enterprise FizzBuzz™?interface FizzBuzzable {
public int value();
public String doFizzBuzz();
}
final class FizzBuzzableNumber implements FizzBuzzable {
private final int num;
public FizzBuzzableNumber(int n) {
this.num = n;
}
public final int value() {
return this.num;
}
public final String doFizzBuzz() {
return new Integer(this.num).toString();
}
}
abstract class DivisibleNumber implements FizzBuzzable {
protected final FizzBuzzable original;
public DivisibleNumber(FizzBuzzable origin) {
this.original = origin;
}
public final int value() {
return this.original.value();
}
public final String doFizzBuzz() {
String fizzBuzzed = new String("");
if (this.isDivisible()) {
fizzBuzzed += this.fizzBuzzing();
} else {
fizzBuzzed += this.original.doFizzBuzz();
}
return fizzBuzzed;
}
protected abstract boolean isDivisible();
protected abstract String fizzBuzzing();
}
final class NumberDivisibleByThree extends DivisibleNumber {
public NumberDivisibleByThree(FizzBuzzable origin) {
super(origin);
}
protected final String fizzBuzzing() {
return "Fizz";
}
protected final boolean isDivisible() {
return ((this.value() % 3) == 0);
}
}
final class NumberDivisibleByFive extends DivisibleNumber {
public NumberDivisibleByFive(FizzBuzzable origin) {
super(origin);
}
protected final String fizzBuzzing() {
return "Buzz";
}
protected final boolean isDivisible() {
return ((this.value() % 5) == 0);
}
}
final class NumberDivisibleByThreeAndFive extends DivisibleNumber {
public NumberDivisibleByThreeAndFive (FizzBuzzable origin) {
super(origin);
}
protected final String fizzBuzzing() {
return "Fizz Buzz";
}
protected final boolean isDivisible() {
return (((this.value() % 3) + (this.value() % 5)) == 0);
}
}
>>58835755
But wait, there's more!public class Main {
public static void main(String[] args) {
for (int i = 1; i <= 100; ++i) {
System.out.print(
new NumberDivisibleByThreeAndFive(
new NumberDivisibleByFive(
new NumberDivisibleByThree(
new FizzBuzzableNumber(i)
)
)
).doFizzBuzz()
);
if (i < 100) System.out.print(", ");
}
}
}
>>58835755
>>58835765
>no AbstractFizzBuzzableFactory
>no DivisibleStrategyProviderImpl
do you even enterprise ?
>>58835755
>>58835765
Thanks anons. I needed the laugh.
>>58835827
Feel free to refactor for further enterprise, anon.
>>58835638
2017 C++ still memory unsafe,no modules,no package mananger.
Java still compile code 20 years ago.
Python get disaster on 2 to 3 transition.
Java make big projects.
JVM becomes host dozens new languages.
Java ecosystem is gigant.
>>58836184
Where can I get some brain fluid?
I don't like strict typing. Is something wrong with me?
>>58836398
yes.
>>58835755
>no XML comments anywhere
>multiple objects in one file
>methods before attributes
>magic numbers instead of constants
you're fired!
>>58837143
>no XML comments anywhere
I-I was limited to 2,000 characters, a-anon...
>multiple objects in one file
>methods before attributes
>magic numbers instead of constants
I-I'm so s-sorry...
t. pajeet
>>58835638
Java is a patent trap
>>58837249
H-haha no, nice paranoia y-you got there, but no, I can assure you, I work at S- I-I mean with Sun technologies, have worked, for a while, a-and I can assure y-you that we - uh... they would never sue anyone for ever using Java haha nice try though shill.
it's the C# of the non M$ world. No thanks, Jeff.
public class Main {
public static void main(String[] args) {
Rectangle a = new Rectangle(3,4);
}
}
public class Rectangle {
private final Integer width;
private final Integer height;
public Rectangle(Integer width,Integer height) {
this.width = width;
this.height = height;
}
public Integer circumference() {
return width * width + height * height;
}
public Integer area() {
return width * height;
}
public Double diagonal() {
return Math.sqrt(circumference());
}
public Boolean overlaps(Rectangle other) {
return width >= other.width && height >= other.height;
}
}
Rate my coding style please.
>>58837665
http://laufer.cs.luc.edu/teaching/313/handouts/practice-midterm
>>58837734
>the length of the rectangle along the x axis is given by xlength
That's called width.
>>58836398
Yes.
Verbose shit.
>>58837793
The guy's German.
>>58835638
*cough* Android *cough*
>>58837665
>no accessors
>no hashcode, equals, toString override
>no default constructor
>final attributes not in caps
>failed overlaps implementation
4/10 pls stick to lua for now
>>58835638
How else would you develop for phones without spending a few hundred?
>>58835755
fizz buzz woof
>>58836398
Yes.
>>58836398
No.
It puts the poo in the loo.
And it takes up gratuitous amounts of RAM for no good reason.