I highly suggest reading Practices of an Agile Developer
http://www.pragprog.com/titles/pad/practices-of-an-agile-developer
Use KISS. Stay DRY. Code less. Code smart (code S-Mart).
Use smart shortcuts when they're available to you. Implicit boolean
coercion is one such shortcut, among many
Ugh, then you go and use an if statement without brackets, and on the same
line to boot! I for one, would not want to maintain your code.
This is in jest of course. I am not going to say doing things shorthand is
wrong, but there are some very valid merits to not doing the shorthand
methods.
On
Ugh, then you go and use an if statement without brackets, and on the same
line to boot! I for one, would not want to maintain your code.
Hey, you're just lucky he's not using the ternary operator! After all,
that would be the simplest approach.
Dave Watts, CTO, Fig Leaf Software
On Tue, Aug 18, 2009 at 4:20 PM, Dave Wattsdwa...@figleaf.com wrote:
Again, I'm not saying there's anything wrong with implicit Boolean
evaluation, I just think it's a mistake to believe it's inherently
superior to an explicit, slightly longer Boolean expression, to the
point of telling
I didn't see a reponse from Ash. Yet another email lost to the ether. :(
Dave Watts wrote:
And as much as I like Ash, I'm not sure I want to take coding advice
from the guy who couldn't remember klaatu barada nikto - maybe he
was too enamored of shortcuts?
Dave Watts, CTO, Fig Leaf Software
That was supposed to be a winky, not a frowny.
Steven Sacks wrote:
I didn't see a reponse from Ash. Yet another email lost to the ether. :(
Dave Watts wrote:
And as much as I like Ash, I'm not sure I want to take coding advice
from the guy who couldn't remember klaatu barada nikto - maybe
Dave, come on. Take a stand on the issue. Stop straddling the fence.
Pick a side. Im or Ex?
I'm not about writing cryptic PERL-like statements, but writing != null is a
waste of time. It's obviously a null comparison (by nature of it being an
instance). Calling it out as such is redundant.
Back when I was using AS2 and Javascript || operator was useful to me.
I was so glad when AS3 brought default parameters.
var value:String = foo || bar;
-- Keith H --
www.keith-hair.net
Steven Sacks wrote:
Dave, come on. Take a stand on the issue. Stop straddling the fence.
Pick a side.
Dave, come on. Take a stand on the issue. Stop straddling the fence.
Pick a side. Im or Ex?
I think you're missing the point. You're asking a pacifist which army
he should join. I really don't have a strong opinion either way.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig
The reason you're comfortable straddling the fence is because you don't
experience the pain or discomfort associated with a picket sticking into your
crotch. Why would that be? ;)
How do YOU code? Do you use implicit or explicit?
Dave Watts wrote:
I think you're missing the point. You're
The reason you're comfortable straddling the fence is because you don't
experience the pain or discomfort associated with a picket sticking into
your crotch. Why would that be? ;)
Because I used to be in the military, where you routinely get screwed
on a daily basis. BOHICA.
How do YOU
Dave Watts wrote:
snip
It really depends on the language. Since I'm moving (more or less)
from Java to AS3, more or less, I'm usually using explicit expressions
because that's what people do in Java. On the other hand, in the
ColdFusion code I've written, I usually use implicit Boolean
A good CODER must go beyond a good CODE be fast when needed. That's MHO, and
It gets clear when we compare the number of lines we use to express
ourselves.
Leandro Ferreira
Sent from Brasília, Brazilian Federal District, Brazil
On Tue, Aug 18, 2009 at 18:17, Paul Andrews p...@ipauland.com
I think you're right, but I saw one guy here at work writing something like
this for readability he said!
if (value != null) {
;
} else if (value == null) {
;
}
From: Paul Andrews p...@ipauland.com
Reply-To: Flash Coders List flashcoders@chattyfig.figleaf.com
Date: Tue, 18 Aug 2009
We might want to change the subjet line.
Our ACElash-friend must have gotten scared from the responses on his
question
how he should do a parent.addchild(self) :)
Anyways in my perception a long list of if elses is not always my ideal
of readable code.
time to suspend i...@toolshop.de I'd say
i...@toolshop.de wrote:
Wir haben vom 10.08.2009 - 21.08.2009 Betriebsferien.
Alle Anfragen werden wir danach umgehend beantworten.
Vielen Dank für Ihr Verständnis.
###
We are closed for vacation from Aug 10, 2009 until
I think you're right, but I saw one guy here at work writing something like
this for readability he said!
if (value != null) {
;
} else if (value == null) {
;
}
There's a difference between verbose and just plain dumb.
Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
Fig
Can I get a copy of this thread in paperback? You can not find this
stuff anywhere else in the world. I was actually going to ask where I
could get some info on coding best practices and go buy a book, but I
am glad I saved my money.
;)
Karl
Sent from losPhone
On Aug 18, 2009, at 4:58
2009/8/19 Leandro Ferreira dur...@gmail.com:
A good CODER must go beyond a good CODE be fast when needed. That's MHO, and
It gets clear when we compare the number of lines we use to express
ourselves.
Indeed. And you unintentionally help to illustrate the point. Paul's
post, though long, is
Writing readable code writing less code.
That is what it comes down to. Most coders can understand both of the
following:
if(myObj){;}
and
if(myObj != null){;}
I would opt for the latter method always, as otherwise you are relying on
renderer specific logic to handle the conversion, as
That's plain bad english, I assure you :)A good CODER must go beyond a good
CODE and be fast when needed.
Leandro Ferreira
On Tue, Aug 18, 2009 at 22:02, Peter B pete...@googlemail.com wrote:
2009/8/19 Leandro Ferreira dur...@gmail.com:
A good CODER must go beyond a good CODE be fast
Taka,
When you're done building your Straw Man, you let me know and I'll happily
continue the discussion with you.
Cheers,
Steven
Taka Kojima wrote:
Writing readable code writing less code.
That is what it comes down to. Most coders can understand both of the
following:
if(myObj){;}
Whoohoo, a lot of explicit coders here :D
Steven Sacks wrote:
Taka,
When you're done building your Straw Man, you let me know and I'll
happily continue the discussion with you.
Cheers,
Steven
Taka Kojima wrote:
Writing readable code writing less code.
That is what it comes down to.
Hello :)
Use an argument in the constructor of you class to passed-in the parent
reference of your display
public function MyDisplay( target:DisplayObjectContainer = null )
{
if ( target != null )
{
target.addChild( this ) ;
}
}
PS : your code isn't valid in the constructor
ekameleon, you are the man! so sweet.
Thanks
On Mon, Aug 17, 2009 at 1:54 PM, ekameleon ekamel...@gmail.com wrote:
Hello :)
Use an argument in the constructor of you class to passed-in the parent
reference of your display
public function MyDisplay( target:DisplayObjectContainer = null )
{
I don't understand why you would not want to write a single line of code in the
class where it would provide the most clarity, and instead write MORE code in
another class obscuring the behavior that is going on. In other words, you're
writing more code to write the same code. You're going to
why?
BTW, Ekameleon, you should use
if (target)
Instead of
if (target != null)
___
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Hello :)
i prefere use (target != null) ;) question of visibility and to keep the
default value of the argument in the constructor.
EKA+ :)
2009/8/17 Steven Sacks flash...@stevensacks.net
I don't understand why you would not want to write a single line of code in
the class where it would
BTW, Ekameleon, you should use
if (target)
Instead of
if (target != null)
Lots of people hate implicit Boolean conversion, and see it as a sin
against God and nature. I'm not one of those people, but I think it's
a mistake to say that implicit Boolean conversion is superior and
everyone
if (Boolean)
Everything inside an if statement is automatically coerced into a Boolean.
Either it is or it isn't.
It's not more clear to write != null because an if statement cannot possibly be
anything other than true or false. In this case, null or not null. Writing it
out is redundant
Dave Watts wrote:
Lots of people hate implicit Boolean conversion, and see it as a sin
against God and nature. I'm not one of those people, but I think it's
a mistake to say that implicit Boolean conversion is superior and
everyone should use it.
Code bloat is one of the seven deadly sins
Code bloat is one of the seven deadly sins (gluttony).
This is why we all name our variables things like x, y, etc instead of
giving them recognizable names, right?
And gluttony, really? I'm not going to EAT my code. Luxuria is a
better fit, even though we actually call it lust nowadays.
Dave
if someone handed me some code and the worst thing that they had done is
wrote expressions long-handed, I would consider myself extremely lucky.
lets get over ourselves...
greg
On Mon, Aug 17, 2009 at 5:44 PM, Dave Watts dwa...@figleaf.com wrote:
Code bloat is one of the seven deadly sins
It's called artistic license. ;)
And you are eating code, through your eyes and brain. :)
Dave Watts wrote:
Code bloat is one of the seven deadly sins (gluttony).
This is why we all name our variables things like x, y, etc instead of
giving them recognizable names, right?
And gluttony,
And you are eating code, through your eyes and brain. :)
... and I must therefore excrete code from my fingertips. And the
usefulness of this metaphor reaches a disgusting end.
All that said, my point was simply that opinions differ on whether
implicit Boolean conversion is good or bad, no
James Gosling got his Doctorate in CS in 1983.
Programming has changed quite a bit since then.
new old
;)
Dave Watts wrote:
And you are eating code, through your eyes and brain. :)
... and I must therefore excrete code from my fingertips. And the
usefulness of this metaphor reaches a
James Gosling got his Doctorate in CS in 1983.
When did you get yours? Same time I got mine (never)?
Programming has changed quite a bit since then.
new old
That must be why ActionScript moved from a prototype-based,
loosely-typed language to a class-based, strongly-typed language,
right?
Steven,
Maybe its just me but...
Just doing a Boolean check on DisplayObjects always put my scripts in
high risk of runtime errors.
Especially in the case of cleanup operations.
Sometimes I might have a function that attempts removing a DisplayObject
that has not been added to the stage or
Here's the best way to write that. No try catch required.
if (myDO myDO.parent) myDO.parent.removeChild(myDO);
Keith H wrote:
Steven,
Maybe its just me but...
Just doing a Boolean check on DisplayObjects always put my scripts in
high risk of runtime errors.
Especially in the case of
(myDO) (myDO.stage) ( myDO.parent.removeChild(myDO) )
;)
Latcho
Keith H wrote:
Steven,
Maybe its just me but...
Just doing a Boolean check on DisplayObjects always put my scripts in
high risk of runtime errors.
Especially in the case of cleanup operations.
Sometimes I might have a
Thanks.
That is a better way to write the check. (Clever! you escaped from using
null once again LOL)
BTW I just put the try/catch there to demonstrate error.
-- Keith H --
www.keith-hair.net
Steven Sacks wrote:
Here's the best way to write that. No try catch required.
if (myDO
41 matches
Mail list logo