gross update
so it turns out that GROSS, as implemented currently, is still a little awkward to use. i ended up getting rid of a lot of "Slimy sqlS", as I no longer needed to worry about INSERT vs UPDATE and formatting all those fields correctly. there's still a couple problems though:
- you still need a wrapper class to wrap up the GROSS proxy object and provide get/set methods for each field, and so on
- SELECTing is still a manual process, meaning you have to manually escape things, make sure syntax is ok, etc. this isn't that bad of a problem, since you can pretty much boil things down to one method that executes sql passed in by other methods. it's still a little ad-hoc and not that pretty. and, you have to have one of these in each of your wrapper classes. that's gotta go.
- this is actually more like 2.1- the manual selecting means there's all sorts of things to update if you change or add a field in the database. luckily GROSS helps you a bit out by making the change automagic for all inserts and updates- just update the interface.
gross helps with part of the problem, creates new ickiness, and ignores a large part of the problem. not to worry, i have a few ideas which i'm not sure are realistic or not, but i'm going to see how it goes. assuming i find some time lying around somewhere...
get rid of those yucky wrapper classes
it's kindof annoying having to do this, after defining a separate interface that defines the fields in the database:
public class Blah {
private GrossClass item;
...
public String getName() {
return item.getValue("name")
}
public String setName() { ... }
...
}
even though stuff like this is sometimes par for the course in java, it'd be nice to be able to say something more like this, eliminating the interface+wrapper class combo:
public class Blah {
@StringField(length=100, default="") private String name;
public String getName() { return name; }
public void setName(String n) { name = n; }
...
}
i'm not sure how annotations (that funky @ syntax) works, but that's where the Internet comes in; i'm confident it won't let me down. we still end up with our get / set methods, but rather than wrapping things up and being altogether quite clunky about things, it's actually pretty cleanly done. this is my first goal..here's hoping it's not an impossible one :P
get rid of ALL those slimy sqlS
points 2 and 3 will require gross to start taking over interactions with the database for you. not an unwelcome offer, right? i'll see what i can do about this one. let's tackle things one at a time, k?