I don't think you need to call it procedural. Just call it the basic
building blocks that they will need for OOP (or procedural, for that
matter).
There's not that much difference, really, between OOP and procedural. OOP
just encapsulates chunks of procedural code and its data.
This is the correct answer. OOP probably isn't a bad framework in which
to teach these things, but when you start teaching you may be surprised
by how many students have a hard time grasping concepts that may seem
simple to you, even as simple as the relationship between a class and an
instance. You will also see students who blur through the work and get
bored five minutes after each class starts... but they aren't the ones
we're worried about.
So rather than engage in an argument as to whether OOP or procedural is
"better", we're basically asking: Do the additional distractions of OOP
justify the payoff from learning it up front? If you're teaching fellow
geeks, then yes. If you're teaching people with a more casual interest
in programming, or (shudder) people who are required to take the class,
you may want to keep it script-simple. Compare:
var foo:Number = 1;
var bar:Number = 2;
trace(foo + bar);
vs.
class Cat
{
private var age:Number;
public function setAge(age:Number):Void {this.age = age;}
public function getAge():Number {return age;}
}
var whiskers:Cat = new Cat();
whiskers.setAge(1);
var patches:Cat = new Cat();
patches.setAge(2);
trace(whiskers.getAge() + patches.getAge());
Is it so unrealistic to suggest that the second example, while having a
pleasant real-world basis, involves many more steps and logical leaps
for an absolute beginner to understand?
Maybe this is a strawman... I guess you could start with how getters and
setters work in the first place, and use that to explain
functions/methods. It just seems like a bit too much drapery to start
out with.
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com