I originally was all go to separate the view and code using the
source prop in a script tag. What i didn't like about this was that
it was a loose link. Code behind makes this a more solid link but
after experimenting with that also i've found I end up with some many
files open it begins to turn into a negative.
I've settled on putting code in a script block. For me it makes
things more manageable and I really don't see the problem with having
the functionality for that component inside it (just like all the
classes in the framework (i.e. they don't have an AS class for the
functionality, and then an AS class extending that which creates the
view items)).
cheers
Tink
On 8 Feb 2007, at 21:20, Ralf Bokelberg wrote:
What is your reasoning to use code behind? Why would you want to
double every class and add an additional inheritance layer just to
separate Mxml from ActionScript? Why would you want to declare
every component you are using twice, once in AS and the second time
in Mxml? Is it to separate presentation from functionality?
Generally this is a good idea, but i think it is important where to
draw the line between the two. When you think of traditional
systems with a template engine as the presentation layer, the
templates also contain some code to build the presentation, while
the functionality is implemented by plain classes. Now if we
translate this thinking to Mxml and ActionScript, we should leave
all the code we need to build the presentation inside the Mxml
files and factor out the real functionality into classes. So i'd
say, there is nothing wrong with ActionScript in Mxml files as long
as it is strictly presenation related.
Cheers
Ralf.
On 2/8/07, Mike Anderson <[EMAIL PROTECTED]> wrote:
Hello All,
Could some of you more savvy coders, please take a moment of your
valuable time and throw some words of wisdom out there regarding
CodeBehind?
Since I love using Packages and Classes, it feels very natural for
me to
use this method.
BUT, based on where things are going with Flex, is this considered
to be
a "good programming practice"?
I would love to know sooner versus later, so that I don't have to back
and redo a bunch of coding. I am a REAL stickler when it comes to good
coding practices.
Thanks in advance for your time on this,
Mike
--
Ralf Bokelberg <[EMAIL PROTECTED]>
Flex & Flash Consultant based in Cologne/Germany
Phone +49 (0) 221 530 15 35