Hardcore Java
The two fatal flaws with this book are that it suffers from a lack of cohesion and focus on its audience and that it doesn't present anything new. That the book doesn't present anything new isn't bad if its goal is to summarize, clarify, and educate the novice. But this book doesn't even work for novices because the author has misidentified his audience. At times he writes for the intermediate programmer, at other times he writes for beginners. The confusion over the audience causes the book to leave novices and experts unsatisfied in equal parts.
Detailed Review
Simmons goal is to write a book that helps "transform a [Java] developer from the intermediate level to a true guru." It is his contention that there is a distinct lack of books that target the intermediate to advanced programmer -- his shining exception is the book Secrets of the C++ Masters by Jeff Alger. While I tend to agree with his assessment, I think that he fails for the following reasons: he doesn't stay true to the audience he has chosen and he doesn't say anything particularly new about the topics he covers.
Rather than provide a review of the book as a whole, I'm going to focus on a few chapters and describe what I thought worked and what I thought didn't work. I chose chapters where I thought the author really had an opportunity to distinguish this book from other similar books. At the end of the chapter reviews I provide an overview of the book.
Chapter 1: Java in Review
In this chapter the author sets the stage for the following chapters by providing an overview of the Java concepts that the reader is expected to be familiar with.
The Good:
Assertions are one of the things that a good software engineer should understand and use. It shows good judgement on the author's part to put them at the beginning of the book so the reader can benefit from the author's impressions.
I also found his discussion of initialization to be insightful and interesting. I thought I had a pretty solid understanding of the subject but I was surprised to learn that a field can be initialized by what amounts to an inline method. The author cautions that this technique shouldn't be used often, but he gives a compelling example of when it can be used. It's definitely a trick I'm going to keep in my toolkit.
The Bad:
The first problem is that none of the material in this chapter is necessary for understanding the other parts of the book. Most of it could be reduced to footnotes or sidebars if the author felt it necessary to clarify subsequent topics, but to spend time explaining the importance of the default clause in a conditional is a waste of the reader's time. There's an old saying, "Tell me and I'll forget, show me and I may remember, involve me and I'll understand." The author of a technical book needs to make a significant effort to involve the reader. If involving the reader isn't possible for some reason, the author should, at the very least, show the reader rather than simply enumerating principles divorced from a learning context. Simmons should show us how to use assertions by using them. He does a great job of this with his ubiquitious use of final. I'm less certain of how well he does with his other core concepts. I could go back to the book and look it up, but if I need to do that, it means he's already failed.
The other problem with this chapter is that the author assumes the stance that the reader is a C++ programmer approaching Java. He asserts, "To understand the advanced concepts of the Java language, there are a few core concepts that you must have firmly in mind. Without these concepts, much of this book will not make a lot of sense. The concepts of pointers in Java, its class hierarchy, and RTTI (runtime type identification) are three of the most important on this list." This list might be important for a C or C++ programmer moving to Java (which is a position I'll hazard a guess that the author found himself) but it's marginally useful for anyone else. Allow me to summarize: Java has no pointers, all objects inherit from java.lang.Object, and you can interrogate an object to determine its type at runtime. 'Nuff said.
Unfortunately, this is a theme that runs throughout the book. The author seems to assume that his audience has a C++ background and he either differentiates between the things that Java has that C++ doesn't (e.g., pointers) or he introduces bits from his C++ background that are also in Java (e.g., the ternary operator). The reason for this, I believe, is that the author has failed to separate himself sufficiently from his audience. That's to say, he's writing the book that he would have liked to have read when he was starting his Java career. This isn't a bad thing if you're sufficiently like Robert Simmons, Jr. to warrant that kind of advice, but if you're not, his exposition is going to be hit or miss.
Chapter 5: Exceptional Code
This chapter covers the use and misuse of exceptions in Java. It provides a summary of the different types of exceptions and provides some guidelines for good coding practices.
The Good:
Exceptions are an important part of Java and are misunderstood by a fair chunk of Java developers. The author recognizes this and attempts to provide an introduction to exceptions and show some of the common exception anti-idioms. His discussion on the necessity of the atomicity of transactions was valuable and clear. He shows what happens in the rare instances when a transaction fails midstream and isn't rolled back. He then provides good advice on how to write code to prevent this sort of thing from happening.
The Bad:
This is a short chapter and that's unfortunate because the topic of exceptions is rich and worth much investigation. This chapter provided an excellent opportunity for Simmons to display some virtuosity and say something significant about the subject. If nothing else, he could have elaborated on the relative merits of checked exceptions vs. unchecked exceptions; a topic that has been the subject of Holy Wars in the Java/C# community. Unfortunately, all he really mustered was an, "unchecked exceptions are Java's way of not cluttering up your code with too many 'throws' clauses." (paraphrased, but see the end of section 5.1.1)
The author seems to have some good intuitions around the use and misuse of exceptions, but rather than clearly delineating the issues and sharing his insight with the reader, he sets up a couple of toy examples that show the syntax of exception handling and waffles around the issue of when to use checked exceptions and when to use unchecked exceptions. There is little enough spoken about exception handling that this might be sufficient if Joshua Bloch hadn't already provided a solid grounding in exceptions with Effective Java. But since he has, I had hoped for some new insights, which Simmons failed to provide.
Chapters 9 & 10: Practical Reflection and Proxies
These chapters provide an introduction to Java's capabilities for introspection of types and objects, as well as describing the new JDK 1.4 DynamicProxy class. Simmons also gives some examples of how to write proxies--dynamic and static.
The Good:
In choosing to cover Java's introspection facilities, the author demonstrates that he recognizes the importance of metaprogramming as a qualification of Java expertise. It's on par with things like writing classloaders or grokking bytecode and it separates the gurus from the merely competent. If nothing else, it gives Java programmers the opportunity to do the things that smug lisp weenies are always nattering on about.
The author gives a good overview of how reflection works in Java as well as providing some examples. He also distinguishes between static proxies (like the Proxy pattern in Design Patterns) and the nifty dynamic proxy part of JDK 1.4 and shows how to use these proxies and provides some demonstrations of how they can be used.
The Bad:
As with much of the book, the examples aren't particularly compelling and Simmons doesn't take the opportunity to take the reader to the next level and show him some sweet metaprogramming. Reflection and proxies aren't complicated conceptually, and the syntax is fairly straightforward. He could have gotten the implementation details out of the way and then provided examples from the field. The JMock guys are doing some nice work in generating mock objects for unit testing with dynamic proxy and the Nanning guys have a nice aspect-oriented programming framework that uses reflection and proxies. This is the kind of work that's being done with metaprogramming and confining the discussion to toy examples is discouraging.
Overall:
The Good:
The author has a good conversational style and seems like the kind of guy that you'd enjoy working with--friendly, knowledgable, and genuinely enthusiastic about his subject. The book has plenty of interesting material. The use of final is a great way of turning logic errors into compiler errors. A knowledge of metaprogramming is becoming more important every day, and bringing metaprogramming to test-driven development is an idea with considerable merit.
Someone new to Java could use this book as a sampler of some important ideas in the practice of Java programming and explore the topics in greater depth at a later point.
The Bad:
This book suffers because the author identified his audience and stated his goal and then didn't follow the path he laid out. As a result, the author winds up disappointing all readers. The novice will find that the author glosses over topics that are clearly over their heads, while the expert will be bored by the level of detail that the author devotes to relatively simple topics.
Additionally, the examples are so simple that a newcomer to Java will not have trouble following them, but someone who has used Java for more than half-a-dozen months will find them uninteresting and unchallenging. The author should have taken the opportunity to really explore the space.
Conclusion:
While this book covered some interesting and high level java topics, it covered them shallowly and its content was presented inconsistently to readers of varying levels of expertise. The author needed to stick with his audience, choose topics that fit well together, and challenge the reader. That said, I don't lay the blame entirely on the author. His editor should have made the book tighter, more compelling, and more focused on its central thesis: helping intermediate Java programmers become expert Java programmers. The technical reviewers, who are presumably experts, should have provided the feedback that Simmons needed to raise the bar.
The book would be more appropriately titled, Robert Simmons, Jr. Shares Some Cool Things from Projects He Has Worked On. I think the best thing for this book would have been for the author to cull each chapter down to one quarter of its existing size and then publish them separately as magazine articles.
Alternate Sources:
The Java Programming Language, 3ed and Effective Java together cover nearly everything in this book in much greater detail and with better authority. Ken Arnold and James Gosling are two of three authors for the first book, and Joshua Bloch, author of the java.util.Collections classes is the author of the second. If you've mastered the material in these two books, you're an expert, full stop. Unfortunately, these books don't really cover reflection and proxies. If you're an intermediate java programmer and you want a good overview of proxies and metaprogramming in Java, I recommend the source code for Nanning, a lightweight aspect-oriented programming framework for Java.
Alex Garrett is a contract programmer who mostly works with Java. For a while, he was the acquisitions editor for Manning Publications, which inclines him to be a smug publishing weenie. You can purchase Hardcore Java from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, carefully read the book review guidelines, then visit the submission page.
Anything that people feel the need to go out of their way to label "hardcore" isn't.
It was in an ad for Starbucks. I didn't believe it then either.
Once computers become easy to use and fast, we won't need to resort to java.
By that I mean coffee.
...on OnJava - they're excerpts from the book.
These excerpts are pretty good - he talks thru some scoping issues that can be tricky. OuterClass.this.foo and all that sort of thing.
The Army reading list
Hardcore java is when you bomb the Microsoft headquarters for inventing C#.
This is America, damnit. Speak Spanish!
"Hardcore is implementing coroutines in assembly language or creating a full-fledged OO system in 6K."
Didn't the word, or phrase originate from porn? Or was it in use before that? It certanly pre-dates assembly language.
Offtopic, Inflammatory, Inappropriate, Illegal, or Offensive comments might be moderated up.
I'll just wait a couple of weeks and download the text from Limewire. I'll simply type "hardcore" in the searchbox and... ... ow.
-- forget
Hardcore is implementing coroutines in assembly language or creating a full-fledged OO system in 6K.
No, hardcore is running another car into the ditch and killing the driver because they changed lanes without signalling.
Or showing off your giant swastika tattoo to a black panthers meeting.
Hardcore is doing coke off the blade of a knife while you make some chickenhead toss your salad as you cruise the strip in your dropped down caddy.
That's hardcore, motherfucker.
It has nothing to do with Java whatsoever.
I don't need no instructions to know how to rock!!!!
The two books that he recomended look good on Amazon (they both reviewed well). I find it interesting the both of the books are from the same publisher. (note that I am not a amazon partner) The Java(TM) Programming Language (3rd Edition)
Effective Java Programming Language Guide
Nanning
The grass is only greener, if you don't take care of your own lawn.
Despite the obvious flame, the presence of the word 'swastika' I have to say that the parent is much more 'funny' than flamebait.
two fatal flaws with this book are that it suffers from a lack of cohesion and focus
OK, a lot of tech books lack focus when trying to cover a lot of new material.
it doesn't present anything new.
oh.
--Tsiangkun
Enter the coffee cure. "With the enema you can bring out the sad cells or--whatever it is--even stronger." At one point, Jackson says she needed an enema two days in a row to cleanse some particularly pesky sad cells. - e!online
Isn't that when your applet jumps out of its sandbox and gets all cozy and promiscuous with local apps?
Click here or a puppy gets stomped!
"Hardcore is implementing coroutines in assembly language or creating a full-fledged OO system in 6K."
I can see it now. The scene: A dark alley, after dusk. A geek wearing scotch-taped glasses and with a Zaurus in his pocket confronts a group of large, scary men.
Geek: "I'm hardcore, man! I implemented a fully-fledged object oriented system in six kilobytes of code! I even talked to a girl once!"
Thug 1: "Let's beat Professor Einstein here up."
Geek: "You can't touch me, knave! I'm hardcore!"
(the beating commences...)
Geek: "Ow! OWWW! Linus protect meeeee!"
Honey, I shrunk the Cygwin
Hardcore Java might not be as h4r6c0r3 as assembly, but that doesn't mean that the title should be ignored or that there is simply no such thing as "hardcore" java.
Harcore Java to me means writing Class Loaders or Security Managers, bypassing encapsulation or field and method visibility with reflection, choosing the right garbage collector for high performance server-side applications, dissecting the binary class file format, creating post-compilation class "enhancers" like JDO uses, etc.
These are things that are beyond your typical Java novice, and I would expect some mention of some of these level of topics in any java book labeled "hardcore".
So far from ignoring the title, if this book is more for novices than experts, I'd say the title might be misleading. But if I ignore the first few sentences of your review I might find it less biased and more useful.
Nothing could be easier to understand than finite state machines. The only trick is that you can't do as much with them. It doesn't make them hardcore.
That is like saying hardcore is writing an english novel using only one vowel. There are a lot of novels you couldn't write that way.
I'm probably being overly simplistic (I'm very interested in the examples of practical reflection and proxies, two features I've not found a use for yet and also were not on the exam), but that's my view in a nutshell.
-Rob
Marriage doesn't have to suck!
Hardcore would be writing a virtual machine (and write in in machine code) to run on the new processor that would emulate the old one.
I wouldn't think so. Living without OO, I am perfectly fine.
Allow me to summarize: Java has no pointers
If Java has no pointers what's going on here:
int[] array, array2;
array = new int[1];
array[0] = 5;
array2 = array;
array2[0] = 12;
System.out.println("" + array[0]);
I see Sun have released Java runtimes for AMD64, and wonder what the performance is like compared to plain 32-bit intel, MHz for MHz.
There should be a decent improvement running in 64-bit mode, both for the VM and the code it's running, or?
"Hardcore Java" would be the best name for an internet cafe ever. It works on so many levels...
That's like saying "Don't look down"
writing Java that runs as fast as "C".
There is no such thing as hardcore java.
I'm not sure if the book's hardcore, but the review sure is. A note to Alex Garrett, I don't have two hours to read a review (of only four chapters no less).
> Book Reviews: Hardcore Java
:)
I'm personally waiting for "Hardcore sex in diving suit" book review. Would be fun to read.
- Arwen, I'm your father, Agent Smith.
- Well, you're just Smith, but my father is Aerosmith!
Computers are finite state machines. Complex ones, but they still are.
-----------
WAP software
writing an english novel that must read aloud very slowly.
I'll see your flip-flop and raise you a C compiler. We'll see who gets done faster :P
Okay, I'm wrong. I_LOVE_POCKY is hardcore.
In the future, I would want to not be isolated from my friends in the Space Station.
I bought the book hoping for material that I could present in an Advanced Object Oriented Design class. I was disappointed.
It's long been said that there are real men and quiche eaters.
Legend has it the Seymour Cray actually toggled the first operating system for the CDC7600 in on the front panel from memory when it was first powered on. Needless to say, Seymour Cray is a Real Programmer.
Assuming that "Real Men" and "Hardcore" are synonymous, and given that Java falls firmly in to the Quiche Eating category, can you really say you can have Hardcore Quiche?
What's next: "AOL for Powerusers"?
And in true Slashdot revisionism, you have been downscored.
I say to them: "YOU CAN'T HANDLE THE TRUTH".
Mono is free and open source. So is DotGNU. Rotor is made by MS themselves, free and "shared source". And the Microsoft Official .Net SDK is free as in beer as well, and free to distribute with any programs you make with it.
With all these free implementations, and Lots of free Open Source IDEs out there for it, implying that C# development costs money is pretty much the dumbest argument you can make against it.
Unless you have a really good reason (such as writing an IDE), don't do this:
bypassing encapsulation or field and method visibility with reflection
this:
dissecting the binary class file format
or this:
creating post-compilation class "enhancers" like JDO uses
Using the reflection libraries to get around visibility means you're just begging for a maintenance headache in the future.
Dissecting the class file format to see how a particular compiler translated your code can be a useful technique, but you can't depend on the output being the same when you use different compilers on different platforms.
Modifying class files after compilation is also a good way to give yourself a lot of headaches when things go wrong. It becomes very difficult to determine the cause of any problems. If you need to build classes like this, you should either generate Java code and compile that (like most JSP compilers), or use aspect-oriented programming tools like AspectJ.
How can something without pointers be hardcore? It's li
Aborted.
Offtopic, but screw it.
Confirmed at http://www.jmsnews.com - good resource for JMS postings.
With the talk of a new B5 project well on the way... this sucks.
JMS's posting suggested there will be a fundraiser established soon for Richard Biggs' kids. I'm not rich but I can spare $5 and would love to show my support.
All the best to his family - I (luckily) can't begin to fathom their loss.
uninstalled from my comp and in liquid form in my coffee cup
There are no atheists when recovering from tape backup.
By CSS, you mean style sheets? Useful for front-end work, but what about the other parts of a system? In any powerful system, won't there be some real program (maybe one written in Java?) producing that XML you're displaying?
Browse a few job sites, and do a search for "Java". I think it's safe to say that Java's not about to disappear for some time yet...
That's all I've got to say about that.
It's kind of funny how in a Theory of Computation course one learns about finite state machines, then context-free grammars and push-down automata, and finally about Turing machines, only to go full-circle and realize that computers are simply huge finite state machines (mainly, I think, due to their limited memory as opposed to the unlimited tapes of Turing machines).
What's wrong with "Advanced Java"?
Coroutines in assembly is trivial, one processor I worked with (the 1802, NASA's favorite processor for the '70s and '80s) uses coroutines as the basic calling mechainism. It doesn't support subroutines: you have to implement them using coroutines.
/* you are not meant to understand this. */
Hardcore isn't even implementing coroutines portably in 48 lines of Forth, as I did for a control system in the '80s. Anything you can't at least prototype in 48 lines of Forth is probably something you don't understand well enough to do anyway.
No...
Hardcore is implementing coroutines in C using clever tricks with the subroutine calling conventions, and then building a paradigm-beating operating system like UNIX on top of it.
Oh, I gave the punchline away.
I like how most of the people defining hardcore programming in this forum probably don't write code.
"DRM is like violence: if it doesn't work, use more."
On the topic of writing books using only one letter, there have been a few books written without the use of one letter: the letter E. Among others, La Disparition, a French novel by Georges Perec, is E-less. This book, remarkably, has been translated (by Gilbert Adair) into English. The translation, titled A Void, also E-less. Now that's hardcore.
Killing yourself while on IRC.
But is it hardcore to the extreme?
Well... I didn't say they were smart ideas, but hardcore has never meant prudent to me.
:)
Also, using assembly means you're just begging for a maintenance headache as well.
It's all in why you're doing what you're doing. For some stuff you might need to get hardcore (oooh, how extreme
When I was writing applets back in the 1.0 days I had to do some crazy hacks to get around Microsoft incompatibilities, or to implement double buffering or transparent widgets. Some of the hacks included changing Sun's source, recompiling and using bugs in the security manager of Netscape and IE to load new AWT base classes. Not very smart you might say, and certainly not very maintainable, but it worked, and when 1.1 came out I didn't need my hacks anymore.
Some of JDO's techniques wouldn't be possible if it weren't for binary class enhancers. The class file format is very well documents and can handle metadata for fields and methods. JDO adds metadata to the class that enables OR mappings, and lets you use managed object just like any other.
And, as a matter of fact, you can count on the format of the class file to be the same regardless of the compiler. It's a specified format.
- Write and compile Direct X based 3D code to win32 (for video games, physics sim etc.) - Write and compile code for 68K asm, ARM etc, for various types of portable devices (much cleaner source than C/C++) - Write very fast and efficient server side apps to run on Mac OS X. But I'm sure its much more fun and easier to slander Java than do something useful with it. I'll resuming coding now... Mark
Nonsense! You just need to find a suitable encoding.
(Yes, that was a joke. A lame one, but still a joke.)
HAND.
If this ain't enough to wake you up in the morning : Hardcore Java! The extra caffeine kick.
Bitten Apples are still better than dirty Windows...
... but I thought the whole point of Java is that it doesn't expose itself to the programmer.
It has a form designer and everything
Well sort of... They have hardware interrupts which really complicates things. Not to mention that for nearly all intents and purposes, they have enough memory to be treated as a TM.
I gave 3 other examples of free C# compilers.
Whether or not pointer arithmetic is allowed is irrelevant.
...) -- which means that pointers are not special in this regard.
A pointer is a reference is a pointer. They both embody the notion of pointing to (or equivalently referencing) something. The fact that the C/C++ type system is broken and lets you do stupid things with pointers is irrelevant. C/C++ also lets you typecast any random struct to an int (note: not pointers to
HAND.
Your argument only supports the notion that Java references and C/C++ pointers are not the same. That, however, is rather obvious since Java and C/C++ are not the same.
HAND.
The operating system (the proper terminology would probably be "monitor") for the CDC 6x00 computers was manually disassembled into symbolic assembler from the octal code Cray and his team wrote for it. According to folklore, they had a strong dislike of anything to do with programming. Another thing I've recently learned about Cray is that he designed the Cray 1 and several subsequent models as a semicircle of cabinets because he liked to meditate in the alcove they formed. If nothing else, Seymour Cray was the prototypical eccentric genius.
In the great CONS chain of life, you can either be the CAR or be in the CDR.
I hope the book actually talked about the JDK 1.4 dynamic proxy class java.lang.reflect.Proxy, because people will be unhappy if they look for DynamicProxy, which doesn't exist.
Now, don't get me started on TSRs....
I think it's all this beer they make me drink. ;-)
Now, FORTH,... if only...
Stick Men
<looks around> I don't see any slander here.
Why are you so insecure about your language of choice? If it's really all you make it out to be, what does it matter if a few twirps on some message board disparage it? Not to mention you've gotten defensive even before the insults have started flying...
Very, very odd behavior, I think.
All physical computers are equivalent to finite state machines, due to the fact that their memory is not infinite.
A computer with 64 megs of RAM along with 8 32-bit registers has a total of 536871168 bits of memory. Hence, such a machine can take on a finite number of states, namely: 2^536871168 states.
It's a collossal number of states, but the fact is, all computers with finite memory are finite state machines.
Me gets yur book, me invites me mates round, and believe me - it ain't hardcore. They was well headcase.
Where's the xJAVAx tattoo then? Object oriented till death!
Dynamic Proxy has been in Java since 1.3
See the docs for 1.3:
dynamic proxy docs
I've finally had it: until slashdot gets article moderation, I am not coming back.
First he claims that anonymous inner classes are not 'mainstream Java syntax'. Huh? He's got a fairly awkward definition of mainstream if that's the case.
Second he rejects anonymous inner classes for GUI event handling, instead recommending making the the containing class implement XXXListener. I'll accept that they're two competing idioms, but his only argument is that his way is more readable. I think there's serious room for disagreement there (especially as the whole point of the anonymous inner class idiom is to keep the event handling code close to the control code.)
I always figured that "Hardcore" Java would mean Java interfacing in some sort of really dirty way.
Like with COM.
That green slime had it coming.
A reference is not the same thing as a pointer. A pointer is one way to implement a reference, and judging by Java's error messages it's how most implementations have implemented them (it may be required in the spec for all I know).
Then again, pointers aren't even in the original spec for C++, you were just supposed to use references. That never caught on among compiler writers, though.
All's true that is mistrusted
Hm, maybe. I don't know. They look cluttered to me, especially in a language where blocks aren't the done thing. In Ruby, it's common to see blocks being invoked:but to see an anonymous inner class created in Java looks sort-of-blockish-but-not-really.
> keep the event handling code
> close to the control code.
I don't know. Almost every time I make an anonymous inner class for a JButton I end up extracting it to a nested class so I can also use it for a JMenuItem. But, to each his own...
The Army reading list
Blocks aren't the done thing? What on Earth do you mean by that? Most Java programmers use loops rather than tail recursion.
A counterexample
Mock me if you will, but there was once a book called Hardcore Visual Basic. It was one of the few intelligent books written on the subject. I'm not a big VB fan, but I can appreciate how it once was a great RAD tool. I wished all of Microsoft's VB-like documentation looked like this. It was rigorous and concise.
I remember all of the laughs I got when I went around the office asking if anyone had ever heard of a VB book written for C++ programmers. Of course, my smart-ass smirk probably didn't help. Ironically, I found out that a good dose of the Win32 API in C++ and a 20-minute tutorial from a fellow colleague would have probably been the best route. Still, half of VB's problem is Microsoft's overall tendency to suck the brain out of the developer's head. While this might be okay for an end-user, I can't recommend doing this to developers.
"It was the best of times; it was the worst of times."
Like everything else in life, there's nothing wrong with bragging if you can do it. Sure, we mock such cliché verbiage, like the line above. Dickens' can pull off such an overdramatic line. I can't. I can't make a 1000 page tome interesting. Tolstoy could. So, if a book is hardcore, let it be. If it isn't, it will make a mockery of itself.
The cruel irony
Apparently the author got so sick of Microsoft ruining a perfectly good thing, he decided to stop coding VB altogether. You can see a copy of his vented frustrations here. His fellow VB coders mocked him for trying to get a language to do more than it was supposed to. If that ain't hardcore, I don't know what is. I think he's writing Java code now.
What do you mean my sig is repetitive? What do you mean my sig is repetitive? What do you mean....
Yes, coroutines in assembly are trivial. But then, unlike the kids around here, we're experienced programmers. Hehe.
-russ
Don't piss off The Angry Economist
My personal favourite of hard-core java things, though, is replacing default Object class that comes with JDK with your own. It was presented in the best java performance tuning available, and was rather interesting thing to do. Author just added bit more debugging, and overriding things in Object may be useful for that... you can be sure you get to debug ALL constructors your app ever invokes, even system classes' constructors.
And I'm not saying replacing java.lang.Object is a generally useful practice, or even too smart, most of the time. Yet it's definitely hard core.
I like paying taxes. With them I buy civilization -- Oliver Wendell Holmes
Some parts that contribute to my bad review:
Oreilly has a good track record for their books, but this one made me think they'll give anyone a book deal.
I think I meant blocks in the sense of passing a bit of code into a method. I mean, usually in Java if you're going to pass around behavior you use a reference to an object... an anonymous inner class looks kind of like you're just passing in a block of code.
The Army reading list
> make the enclosing class
> implement ActionListener?
Heh, you're right, that's a bit hideous. Always the problem making examples, I guess - you've got to keep it kind of short or folks lose interest, so you make some compromises...
The Army reading list
- Write and compile code for 68K asm, ARM etc, for various types of portable devices (much cleaner source than C/C++)
Do you still run it in a virtual machine? If so, you are not compiling for portable devices.
Don't take me wrong; I'm not here to bash Java, I'd just like to clarify you always compile it into JVM bytecodes, not into processor-specific opcodes.
lol
The google cache link is below
Google cache
PDF Critique
OReilly book page with sample chapter.
Dissecting the class file format to see how a particular compiler translated your code can be a useful technique, but you can't depend on the output being the same when you use different compilers on different platforms I can't understand why this(Dissecting the class file format) should be a problem.All classes must follow the java class file format (which is a Sun standard available at javasoft.com),so no matter which compiler you use the classes produced are in the same format(for example the magic number for a class file is "CAFEBABE" in Hex. If this were not so , diffrent jvm implementations would be unable to run the class files, thus , invalidating one of the design principles of Sun to make Java a write once run anywhere language.
Allow me to summarize: Java has no pointers
Er, yes, it does.
Any object reference in Java is a pointer; it's why the exception is called a NullPointerException. Once one understands this, one can discard wrong-headed notions such as "Java has pass by reference", which are all too common, and all too wrong.
Java's pointers might not have pointer arithmetic (which seems to be why people claim them to be something other than pointers), but the key feature of a pointer is that it's an indirection, not that it can perform certain kinds of arithmetic. And Java's pointers are exactly that; they're pointers into the garbage-collected heap.
However, if you introduce a simple re-ordering technique to read the state of the finite machine in a different way, you have an infinite machine from a finite machine by induction.
The state of the finite machine is only the state it is observed to be in, after all.
spankalee says:
"Well... I didn't say they were smart ideas, but hardcore has never meant prudent to me."
Exactly. If you're hacking the formalism of a language and you're a reasonable practitioner of that language, my experience is that you're doing it because of some nasty constraint in the OS, the problem, or for some political reason.
Back in the JDK1.2.2 days, I had to implement an web-based autoupdate system for a Java app that required the ability to update the JDK on the fly, and then restart the app on the new JDK from the old JDK. The reason for doing things this way was because the bosses demanded that all updates, even ones for a new JDK, involve no user interaction. Blanket constraints like "no user interaction allowed" are things that can make system design and implementation go hardcore pretty quickly under the right (or wrong) circumstances.
"The plural of anecdote is not data" -- Bruce Schneier
Sweet! I, for one, have been DYING to see Java take it right up its...
What? Not that kind of 'hardcore'? Damn.
Doug
i remember, this guy used to troll the eclipse.org newsgroups. not only was was arrogant and combative about everything, and when it came time for him to put up or shut up, his code stank! check out this thread to get an example of some of his discourse:
e ch nology/msg00654.html
http://dev.eclipse.org/newslists/news.eclipse.t
i had the 'privilege' of looking at some of his code, and not only did it have basic logic errors and would it have broken everyone else's code, but he just didn't 'get' basic concepts, like the usage of anonymous inner classes for event handling code. it's like he read all the stuff he talked about in a book but never actually wrote a program. i would bet that he certainly never collaborated on a project. i wouldn't trust him to program his way out of a for loop.
i remember him boasting at the time about how he had a book coming out, and i honestly thought he was some twelve-year-old making it up. that's how he was acting. i can't believe this guy slipped through the cracks of some publisher, even O'reilly.
Almost every time I make an anonymous inner class for a JButton I end up extracting it to a nested class so I can also use it for a JMenuItem
You've heard of AbstractAction, right? That allows for exactly what you want, only its a part of Swing, so other people will understand what you're doing, and you wont have to re-invent the wheel (or the Action interface, in your case).
Anyway, it's been there since the dawn of Swing (I think, anyway at least since 1.3), so there's really no excuse to not use it.
From the Gentoo desktop of Luke Harman
> AbstractAction
:-)
Hm.... I guess I don't understand. You're suggesting subclassing AbstractAction, right? That sounds fine to me; it's just that if I subclass it with an anonymous inner class, I will probably need to refactor that anonymous inner class to a nested class later. Of course, it'll still subclass AbstractAction.
I'm suprised anyone is still reading this thread
The Army reading list