On Aug 2, 10:30 pm, Frank Weiss <fewe...@gmail.com> wrote:
> This thread is a little like schadenfreude to me. A lot of it is about
> taste - of which arguing about is of little use. I just saw some Java
> code where every closing brace is commented with "// end of if", "//
> end of for", "// end of method", etc. Yech!. That, to me, is worth
> arguing about!

Nah, I prefer this topic. I can kill that one in 30 seconds in
Emacs. :=)
Or give me a minute, and I could probably get 'find' and 'sed' to do
it on an entire tree.

Then just teach them to use an editor other than Notepad.exe.

> Would it be that hard for the determined developer to add a
> preprocessor hook into the SDK build script - even on Eclipse? Come on
> folks, this is open source code! Even Atlassian lets you modify the
> Jira and Confluence source code!

It is not hard at all. No need for source code. The techniques aren't
even Android-specific. In fact, they'll even work on your NDK C++
code.

> My $0.02 is that even if javac did have a preprocessor, few "real"
> Java programmers would deign to use it. Nonetheless, I'm sure there
> are a few cases where a preprocessor is Just The Right Way To Program.

I don't claim otherwise -- just that in nearly 15 intensive years of
Java programming, one has never been demonstrated to me.

I don't expect to find one, either, because code generation is a more
powerful technique, that allows you to tailor the solution to your
problem. Many of the supposed needs that have been presented to my
have fallen to code generation as a superior alternative.

I'll also add that Java provides an alternative that C++ does not make
easy -- post-processing. While it's possible to post-process C/C++,
it's no longer in a platform-independent form. Post-processing Java
class files is quite feasible. And Android makes use of the technique,
in fact, to target a completely different VM with a totally different
architecture.

A related technique is direct generation of the .class files. Still
another is generation of the classes directly at run time -- I have
made use of this technique myself. It won't work in Android because it
doesn't directly execute .class files, but the technique works quite
well. And there's also code that post-process class files at load
time.

Say, post-processing would work for inserting __LINE__ and __FILE__
and __METHOD and __CLASS values with no runtime method calls! The
information is available, so long as it's not been turned off, or
removed in a post-processing step.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to