Java One - day 4 (last one)
09/05/08 17:50 Filed in: Java
Keynote
- Visual VM - nice program for looking at heap, threads, profile.- Javascript suport in Netbeans is cool.
More "Effective Java"
- Wildcard types: Producer extends, Consumer super.void pushAll(Collection<? extends E> src);
void popAll(Collection<? super E> dst);
Do not use wildcards in return values.
Users should not have to think about wildcards to use your API.
Look at collections for good patterns.
Enum types
- Use the enum value as fields.
- Bit fields are obsolete. Brittle, printed values are cryptic, limited to 32/64 bits - use EnumSet - NICE: EnumSet.of(Style.BOLD, Style.ITALIC). These are very efficient as they are translated into bits under the cover. That's COOL.
- EnumMap for holding a map of enums.
- Do not use ordinal in your function in the Enums.
- Use enums to do singletons.
- Emulate extensible enums with interfaces.
private static class FieldHolder {
static final Fieldtype field = computeField();
}
public static getField() {
return FieldHolder.field;
}
- Double checke idiom works now with the volatile keyword. If you want to use it, look it up and be sure that you look it up and do it _exactly_ as presented. Do cut&paste for this code! The order of setting variables, the use of local variables and so on is important for performance.
A JavaFX™ Script Programming Language Tutorial
- Data types - String, boolean, Integer and Number (Double), and Object.- Bind model elements to UI elements - update model and view updates.
... and the lecture was very boring I fell asleep. But before that...
... I didn't like what I saw - I found the script code to be ugly, too deeply indented and not very readable. I'll stick with Swing.
Top 10 Patterns for Scaling Out Java™ Technology-Based Applications
- Gotchas: Predictable latency: Garbage Collection, Thread switches, Network I/O, Switches and routers.- Gotchas: Read consistency - clusters and read.
- Gotchas: Durability - synchronous replication, disks, sans, transaction logging, durable message cues.
- Cost: Latency, shared access between each writer, coordinating readers and writing.
This presentation was really good. The slides sum it up very well. The idea is that you will need to partition your application by routing if you are going to scale. To make it reliable you need to replicate data somehow. Well worth to look at the slides.
JVM™ Challenges and Directions in the Multicore Era
- The languages, the tools and the programming community at large are not ready for large concurrent programs.In sum - we need to see what can be done here.
|