At 2/7/14 09:35 PM, kkots wrote:
index - universal ID of the phrase, which can be used to refer to it from within constructors of other objects that are being created.
You should call that a GUID (Globally Unique Identifier) then, as the word "index" doesn't accurately convey what the value is representing. Unless I am misunderstanding you and the identifier used there is not unique, in which case GUID would not be a good choice.
If you were to instead store these blocks of data in an array you wouldn't need to manually write out those values since the index of the array would be there for you.
At 2/7/14 09:35 PM, kkots wrote:
lines - this is a bit silly, but this is the number of lines of text which the message occupies.
It would make more sense, and be a lot easier and more extensible, to write a function that counts them for you. However, I don't know what you're doing with that value, so it's possible you don't actually need it.
At 2/7/14 09:35 PM, kkots wrote:
1) Is it human-readable? How easy do you think is it to manually edit?
If it were me I wouldn't worry about making it human-readable, and instead make an editor that simplifies changing the data. I would also be storing it as JSON in a separate file, and load it into the application at compile-time.
At 2/7/14 09:35 PM, kkots wrote:
2) Is this good coding practice?
To be blunt: no it's not. You should be making classes to store all of this information in, and just keep the most primitive data (e.g. the text) stored in a separate file. You want things to be easy to change (e.g. add new features, or add more information), and right now what you're doing is not easy to change.
At 2/7/14 09:35 PM, kkots wrote:
4) How can this be improved to be more maintainable and more following good OOP standards?
You could use XML like slugrail suggested, but I find it needlessly verbose and complicated, and would instead use JSON. Since ActionScript is just a dialect of ECMAScript you will immediately be comfortable with JSON's syntax.
Also there's no such thing as a standard way to do OOP. It's just a paradigm, other examples of paradigms being procedural or functional. However, there are good OOP practices, which will involve effective use of inheritance and polymorphism, among other things. A good start would be to use classes and proper functions for everything.