Forum for ideas
Someone recently asked me if had a forum to include suggestions for articles to add.
Does anyone have
Does anyone have
- a forum to work well with blogger.
- suggestions for articles.
Sorry, no idea about a forum for blogger.
ReplyDeleteNevertheless, I have some ideas to discuss about:
- Classloader(s): a key feature of Java that few want to know. Furthermore, there's a lot of misunderstanding with the classpath at compile time (and the subsequent question: "why it's not working in production if it compiles and it passes all the tests in my local machine?"
- Loggers: a key feature for all the programming languages that is horrible in Java. Even worst, there're a lot of alternatives, but it's not clear which to use: log4j, commons-logging, SL4J...
@Javier, Those are good suggestions.
ReplyDeleteClassLoaders
The tricky thing about discussing ClassLoaders is that many of the problems are specific to a ClassLoader used a particular container. However, some of the common problems would be worth discussing.
Loggers
The most obvious Logger to use would be the built in Logger. Its not the best, but unless you have a reason to go elsewhere, its what you should consider first. A review/comparison of loggers would be useful.
I write my own GC-less, asynchronous logger as all the implementations create garbage, sometimes quite a bit. ;)
I would be interested about hearing how to optimize data transfer from one machine to another. (Diffs to objects etc)
ReplyDeleteI'm not sure if you've covered this or not, binary object serialization would be interesting as well [allong with ways to compress the existing result]
@steven, I have touched on the topic of binary serialization but an article which brings it all together would be worth doing. Two solutions worth looking are hessian and protobufs. Once you understand how these work you can look at greater compression, but this is likely to need to be application specific.
ReplyDeleteAny thought on the object diff pattern/idea?
ReplyDeleteYou wouldn't exactly want to send an entire list of objects, however you might want to send a diff of a list. [apps: maybe for synchronization etc]
I had no idea about binary webservices [thats rather awesome]. Personally, I've been considering a rant about the lack of movement in webservices [and their tools/frameworks] to use other formats (yaml, google bufs, etc)
-steven
http://theexceptioncatcher.com
@steven, The binary services can still produce human readable text, with performance close to that of binary formats. What makes them different is that use a restricted subset of text e.g. ASCII only, simplified CSV or very basic XML. All these are compatible for regular text, but make assumption which make the code much faster but also much more sensitive to subtle changes in input data. e.g. CSV is faster/more efficient if you assume no field contains a comma or a newline. In some contexts this is a fair assumption.
ReplyDelete@Peter, thanks for the response.
ReplyDeleteI'm looking forward to seeing articles for all the ideas ;)
Besides, another good topic is IO.
It comes with a lot of misunderstanding, or even bad performance due to a bad programming (regarding loggers, I made one that blocked the log files, thus they couldn't be deleted in Unix environments until the program was stopped. I didn't realize because it didn't happen in Windows, where I was administrator)
In fact, I've found a lot of articles about other JVM languages that claim to be better than Java because it's easier with them to write/read to/from a file.
@Javier, For most scripting languages it is much easier to read/write/append to files because the language has support for files directly.
ReplyDeleteJava tends to a be a minimalist language and relies on its libraries (which are extensive) to make things easier. This is because its much easier to develop libraries (esp as a third party) than develop language features.
http://java-source.net/
Using the Apache Commons FileUtils can make using files easier. e.g.
for(String line: FileUtils.readLines(file)) {
}
FileUtils.writeStringToFile(file, text);
http://commons.apache.org/io/api-1.4/org/apache/commons/io/FileUtils.html
I have been using UNIX for over 20 years and I have never had a problem deleting log files so your problem sounds curious.
Regarding this topic, I've read a post from dzone: http://t.co/kwXOfGUa
ReplyDeleteWhat I'm interested in is what he didn't mention in his post, the difficulties behind managing IO apis for writting/reading files.
Regarding Java IO, I remember the explanation from the book "Thinking in Java". To summarize, Java adopted a generic and extensible OO approach to read/write from/to any imaginable source.
Flexibility always comes with the price of complexity. But I'm used to coding with these libraries, and I'd rather them to the easy-to-use from other language. They have a lot of assumptions and they are narrowed to log to files.
My problem was very simple. I kept open a file descriptor in the form of some kind of outputStream in a static reference for the entire life of the application.
The referenced files could be deleted in Unix because the application wad started always by the root user [...] In windows I wasn't administrator and it was impossible to delete the log files while the program was running.
We changed the log by log4j and it is no longer a problem.
It's better to not reinvent the wheel, because you're likely to make it squared ;)