Results 31 to 42 of 42
Thread: OOP vs Procedural
-
March 29th, 2010, 05:27 AM #31
A class should have its own file. That is best practise and will also help to find things faster (you don't have to scroll to find a class).
I wouldn't consider it be true OOP because with one big file there would be no reusablility of classes.
Private helper classes may be an exeption of this.
-
March 29th, 2010, 01:33 PM #3259Registered User
posts
-
March 30th, 2010, 02:00 AM #3359Registered User
postsSo I started transforming my code to true OOP where each class is in its own .as but have ran into a problem. There is a variable that is passed from the main function to the class which I did. But now I need to pass it back from the class to the main function. How do I do that?
-
March 30th, 2010, 02:03 AM #34
If you have classes that are just used by one class and aren't really reusable, I'd just use a private class in the same file.
Proud Montanadian
We tolerate living and breathing. And niches.
Name Brand Watches
Maybe getTimer() or TweenMax is the answer to your problem . . .
-
March 30th, 2010, 02:09 AM #3559Registered User
postsWell here is what I am doing. So I have my main document for a game. In the game the character can walk around and interact with characters in the game. When he interacts with a character, a conversation pops up. The content of the conversation changes depending on which character he interacts with. So before I just had it in the same file, but I am trying to learn how to do things with OOP. So now I am trying to create a class for this conversation function.
-
March 30th, 2010, 02:32 PM #3659Registered User
postsI figure out how to interact with the variables from the main classes in the other classes. I just have to declera it as public in the main document and then call it in the class like this:
MovieClip(parent).variable
-
June 22nd, 2010, 12:23 AM #3731Registered User
postsDunno if it has been posted already, but here it goes.
Good OOP = Reusable code = Cool.
I guess you could reuse good procedural code, but not without copy pasting.
-
November 23rd, 2010, 03:11 PM #3878Registered User
postsI think the most important aspect of OOP is that it encapsulates the variables, functions and make it clear about its scope (public, protected, private).
To pass any variable back from an object to another, use getter:
PHP Code://variables
private var velocity:Vector2 = new Vector2(50, 50);
//...more code above
public function getVelocity():Vector2{
return velocity;
}
//...more code below
-
August 23rd, 2011, 03:35 PM #391Registered User
postshi thank you for information about oop vs procedual.
-
November 3rd, 2011, 02:35 AM #4013Drupal Web Development
postsI am totally agree with you. It's all about your interest, how much you take. But OOP is the best to get on...good luck
Get an Instant Drupal solution for all your Web Development work done at the earliest. http://www.neerjasoftwares.com
-
November 6th, 2011, 04:02 AM #415Registered User
postsI think OOP is good option.
-
January 11th, 2013, 02:18 AM #425Registered User
postsWell, I can't say much, I work on a daily basis with 100% OOP code (yay for C#)
but it seems to be leaning twoard the preferred method of programming, I think its easier, I like it much more than procedural personallyAll is well


Reply With Quote

Bookmarks