I laughed when I read your first line. Fair enough on your part but you
need to balance how much time you spend with making the most elegant,
portable, manageable etc and just getting it done.
On 5/1/2010 9:56 PM, Bob Kerns wrote:
I stop just short of being dogmatic about #1! That is, I stop short of
saying "you're wrong!" -- but I do urge you (and others) to think long
and hard about it -- and be open to the possibility that later thought
an experience may show a better way. That's been my experience, and my
experience is pretty broad and deep -- but not universal.
Generally, I find that the run-time decisions involved can be made
once, in a compatibility module, at a trivial cost. This also avoids
polluting your code with lots of conditionalizations -- a problem for
either runtime or preprocessor-time conditionalization.
If there are key pieces that simply must have a pre-computed
expression, and you can't afford a method call (benchmark, don't
assume!), then I would go for limited code generation. Code generation
can do everything that preprocessing can do -- but it has more clearly
defined scope and effects. Actually, it's a much more powerful
technique.
My technique for building multiple app versions from a single Android
Eclipse project does involve something you might term preprocessing,
kind of. The one java file which gets massaged is R.java, which gets
the package changed. So you could consider that post processing a
generated file! But that's just because I don't have control over the
generator -- and I think I may have a solution. If so, that'll be one
more instance of the pattern -- you think you need a preprocessor, but
eventually, you figure out there's a better way.
Re #3 -- it's possible to set up one Eclipse project to use Java code
from another. However, I'm really hesitant to even try to explain it,
since there are variants and even I find it confusing -- and then you
have to make it compatible with your non-IDE build. So generally do it
with ant, like it sounds like you're about to do. Just to be sure to
properly set the the ant build task up properly, telling it what
sources should trigger the build and what outputs to refresh. If you
do that, then everything will be rebuilt properly, and you won't have
to rebuild excessively.
Re #4 -- yes, mostly it's user config, a list of projects, various
cached data, etc. etc. There are some settings that may affect the
building of the project -- these are mostly defaults, that can be set
per-project. It's good practice to do that -- except then if you have
a lot of projects that work together, then you have the problem of
coordinating changes in the project settings. An example would be Java
language version settings, or enabling/disabling compiler warnings.
I sympathize with the difficult transition. I've been using the Emacs
command set since before it was Emacs (and was written in ITS Teco),
and it was a long time before I found IDEs to add sufficient value to
be worth it. That's one reason I was never a heavy NetBeans user
(though NetBeans has progressed since then as well).
But Eclipse really does bring a lot of value to Java programming, with
its deeper understanding of the code. You'll find its support for
other programming languages to be disappointing -- C++ for example. In
part, that's because C++ syntax and semantics are just too
complicated, and then you have the preprocessor...but there are better
tools for C++.
On May 1, 8:06 am, Leigh McRae<[email protected]> wrote:
Thank you for the well thought out response, I got some good tips out of it.
1) I just can't agree with this one and apparently Sun doesn't either as
they added the preprocessor support. The thing is that for a j2se
project you could use interfaces and other run-time solutions and throw
more hardware at it. For a phone you are already hardware limited and
don't want to pay for anything at run-time that can be determined at
compile time.
2) Great. I will have to invest more time looking into this.
3) Score again. This wasn't an editing outside of Eclipse problem. The
problem is with two Eclipse projects sharing some common code. I edit it
in one project and the other one doesn't get refreshed even if it's
opened in the same workspace. So thanks for the tip as this will help.
Still I wish I could put all my code in one tree and make a BlackBerry
project and Android project that just filters parts of the code. I
looked into this was unable to grok the help/examples for this.
4) I never even considered that a project could be outside of a
workspace. Cool. I will try that. It's all the .metadata stuff that I
was at odds with. So it's per user config and nothing to do with the
project?
Being an ex Emacs user that decided to just start using what everyone
else uses, I am very open to Eclipse but it's been a hard one to swallow
:) Thanks for some good tips to make it more palatable
Leigh
On 5/1/2010 12:40 AM, Bob Kerns wrote:
Sigh, Google Groups just silently trashed my pending reply... I'll try
to recreate.
--
Leigh McRae
www.lonedwarfgames.com
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en