5 ms·
That's a good post. The same thing he describes with Java, with the UML and the "abstraction" quest, happen on big .NET projects. C# is a fine language if tha
by mattculbreth 19y ago
That's a good post. The same thing he describes with Java, with the UML and the "abstraction" quest, happen on big .NET projects. C# is a fine language if that's your thing, but boy look out for the UML architects and the patterns. You'll have a tough time doing things like, "I just want to display a person's name on the screen" without getting into adapters, visitors, etc.
- aston 19y agoThe downside is obviously the prolixity. The upside, of course, is that if you ever want to slightly deviate from the default implementation in another language, it's a huge pain. If you notice you're doing the same image transformation multiple times, take the few hours (or few minutes with a Google search) it takes to get something put together that works exactly as you want it. Whenever I'm writing in a language with lots of libraries, I find myself compromising on functionality for the sake of convenience. And it's not as if Java isn't giving you more flexibility. How do I tweak that Python code to make the image load faster? Can I get Bicubic interpolation on the resize? How well do those image objects integrate with other parts of python, i.e. are they basically just special objects for this library or could they be used in other ways later? As a person who doesn't mind writing code and whose IDE autogenerates a lot of boilerplate anyway, I think I'll take the 100 line hit so I know what's going on.
- paul 19y agoi.thumbnail([220, 133], Image.BICUBIC) Having everyone rewrite those 100 lines is really inexcusable. Throwing in a few convenience functions to make the common case simple would not detract from the "flexibility" one bit. It shows that they gave zero thought to what people will actually do with the library. BTW, want to take a stab at writing the "save at different quality level" code? (since you don't mind writing lots of code) You can post your solution here.
- aston 19y agoI didn't mean to detract from your original point. I think you're right, it's good to have good libraries. I was just pointing out that there are some advantages to the way Java normally works. Anyway, as Java's such a popular language, you can get away with copying other people's 100 lines if you really need to. A quick Google search turned up an image scaler outright. By the way, I think it's kind of unfair for you to link to the interface definitions rather than some implementation for Java. java.awt.Image is probably just as inscrutable, but at least it does something. edit: While I'm at it, one point that I didn't quite make clear, but should be noted is that Image in Java is used all over the place, so its interface is going to be pretty much targeted at not missing any possible use case. If you're interested in a narrow-scoped pixel image application, why not use some Java image processing library? Sun's got one: http://java.sun.com/javase/technologies/desktop/media/jai/ http://java.sun.com/javase/technologies/desktop/media/jai/
- bootload 19y ago'... you can get away with copying other people's 100 lines if you really need to ...' Owch! that will come back to bite you. Wouldn't it be better to re-write, re-factor to reduce complexity and get cleaner code? '... think it's kind of unfair for you to link to the interface definitions rather than some implementation ...' because it's the interface that we are stuck with & have to work with '... If you're interested in a narrow-scoped pixel image application, why not use some Java image processing library? ...' because it's not COSHER & I do not want to be locked into using non-free software ~ http://wearcam.org/cosher.htm http://wearcam.org/cosher.htm
- aston 19y ago"because it's the interface that we are stuck with & have to work with" is blatantly wrong. You can use anything you want to manipulate images; don't feel bound to using the standard Java Image class. To my knowledge, there's no standard python image class, so there's not even a comparison here. As to your other points, I'm not sure why you assume copying code leads to that code being bloated or unclean. Bad assumption. Personal preference on the latter point, though it's pretty easy to find open sourced libraries.
- mdakin 19y agoPython gives you both upsides (the easy typical case AND the custom arbitrary C/C++ code case). Granted one needs to know C/C++ and not Java. If whatever operation you need is not already implemented by a Python module you can just write those 100 lines of fast C++ code and then call it from Python. As far as knowing what's going on in general you can always look at the Python source code.
- davidw 19y agoOne of my favorite API's is Tcl's socket API. The simple case is really simple: set sk [open news.ycombinator.com 80] And you're in business. If you want to do more complex things, you can then operate on that socket, fiddling with all the options (blocking/non blocking, buffering, etc...). The lesson is: make the obvious thing really easy, and give the user a means to access advanced functionality without requiring it.
- bootload 19y ago'... but boy look out for the UML architects and the patterns ...' Matt don't let the Architect Astronauts scare you ~ http://www.joelonsoftware.com/articles/fog0000000018.html http://www.joelonsoftware.com/articles/fog0000000018.html