30 karma · joined Nov 26, 2014 (12y ago) · 14 submissions
comment 6y ago · link · parent
comment 7y ago · link · parent
https://www.seattletimes.com/nation-world/chaser-border-coll...
comment 11y ago · link · parent
APIs are not a one-size-fits-all problem, and while general trends and paradigms are a nice thing to have, developers should not be restricted by whatever is the hottest buzzword today.
A nice and clean API will always be pleasant to use, and this has nothing to do with RESTful awesomeness or SOAP verbosity.
comment 11y ago · link · parent
comment 11y ago · link · parent
- constructors, private fields, methods, addressing the "separations of concerns" - how about Enum.valueOf(enumClass, text.toUpperCase()) to avoid the "classic shadow array of string literals"?
Here is an example of what can be achieved by Java enums
enum Type {
ANIMAL(null),
MAMMAL(ANIMAL),
DOG(MAMMAL) {
public void makeNoise() {
System.out.println("Woof");
}
},
CAT(MAMMAL) {
public void makeNoise() {
System.out.println("Meow");
}
};
private Type parent;
Type(Type parent) {
this.parent = parent;
}
public boolean isA(Type type) {
if(this == type) return true;
if(parent != null) return parent.isA(type);
return false;
}
public void makeNoise() { }
}
assert Type.DOG.isA(Type.MAMMAL) == true;
assert Type.CAT.isA(Type.DOG) == false;
Type.CAT.makeNoise(); // "Meow"comment 11y ago · link · parent
1. parsed on server startup for setting up persistence, business rules, REST endpoints etc
2. transformed by XSLT to a) produce nice HTML documentation, including DOT class diagrams b) generate Java source code c) validate declaration integrity and cross-referencing
With the right XSDs, IDE support is excellent (auto complete for everything). Take the time to learn it, apply it according to your needs, and reap the benefits- in the long run, maintenance work is down by an order of magnitude.