Hearing stuff like this makes me cringe. I uses to subscribe to the
holy OOP stuff but no longer. I have found that the longer you program
the better your become at knowing when to make the trade off for getting
something done vs wasting time on looking for the most elegant,
flexible, portable solution. Out in the real work when shipping in a
timely manner is more important I don't see why a simple tool can't be
added. It's just another tool for gods sakes, one that many experts
have used and still use today to get things done.
Why should I have to write interfaces or factory objects for something I
know at compile time? Why do I need to write and maintain more code just
so OOP purists can feel good about themselves? Why should I have to use
runtime if statements and hope the compiler strips my code out? The
Java way is to throw more hardware at it when it comes down to it and we
are on a hardware limited platform.
Leigh
On 5/21/2010 5:50 AM, Tomáš Hubálek wrote:
On 20 kvě, 16:12, Leigh McRae<[email protected]> wrote:
On 5/19/2010 11:49 PM, Xavier Ducrohet wrote:
First the OP didn't talk about using a preprocessor for xml. I would
agree that that would be odd and there are better tools for that. Still
a preprocessor could be used to conditionally include a resource by id.
How about I give you some concrete examples and you can help me see the
light?
----------------------------------------
Example 1
----------------------------------------
//#if BETA
if ( hasBetaExpired() )
System.exit( 0 )
//#endif
----------------------------------------
Example 2
----------------------------------------
public final class Assert
{
public static final void RIP( final String msg )
{
//#if BETA
sendReport( msg );
//#endif
System.exit( 0 );
}}
----------------------------------------
Example 3
----------------------------------------
public class Debug
{
void Println( String msg )
{
//#if !RELEASE
Log.d( TAG, msg );
//#endif
}}
----------------------------------------
Example 4
----------------------------------------
//#if PLATFORM_BLACKBERRY
//@ omega = (float)MathUtilities.acos( cosom );
//#else
omega = (float)java.lang.Math.acos( cosom );
//#endif
----------------------------------------
Example 5
----------------------------------------
public static final float VecToHeading( float x, float y )
{
//#if PLATFORM_BLACKBERRY
//@ float fAngle = ((float)Fixed32.atand2( (int)(x * 65536.0f), (int)(y
* 65536.0f) )) / 65536.0f;
//#else
float fAngle = ((float)Math.atan2( x, y )) *
57.295779513082320876798154814105f;
//#endif
if ( fAngle< 0.0f )
return fAngle + 360.0f;
return fAngle;
}
Leigh,
have you ever heard about design patterns? Eg. strategy IMHO can solve
all your requests.
Tom
--
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