Object Oriented Language
I’ve spent the last few days working through some beginner’s tutorials about creating applications and games using ActionScript. It has put my mind in an object oriented state, as I’ve been grappling with the concept both while writing code and during a lot of the time I am not at my computer. I took a Java programming course back a few years ago back in Buffalo and I remember getting as enthralled with the concept as I am now, so it is nice to revisit.
There is no really clear definition readily available for object oriented programming, only things like:
“A style of programming that defines data as objects with attributes and methods that are applied to those objects, and which can be inherited by other objects.”
In example, I’ve been thinking about creating a simple program available through a webpage that can be used to save recipes from a user’s input and give the recipe a standard format to be displayed in a separate webpage. Say, as a quick sketch, the first screen of the program has text boxes, ten or so, to allow a user to enter in ingredients, and perhaps some other boxes to allow for amount, and pulldown menus to choose measurement type (tsp, tbsp, oz..). I’ve just made scrambled eggs for the first time (they were awesome!), and so I’d put in:
- Eggs
- Butter
- Pepper
- Salt
What I want the program to do is take each one and save them for use later. I would be able write a single function, an object within the code, and call that function for each ingredient. Instead of giving each box its own code, I can just invoke the one instance I wrote, as an object.
Simple concept, but it actually it gets really complicated when there are a ton of objects being called, with multiple pages calling other pages that call other pages, it becomes a bit harder to follow.
Language can be viewed in a similar way. Single words represent tables of definitions with only certain definitions invoked through context. Generally we try to stick to single definitions, and ambiguity is beaten out of writing. We use adjectives, possession and structure to clarify objects in a sentence. If you’re talking about multiples of the same noun, for instance, you’d clarify that it is his or her vehicle, or the silver vehicle, etc.. For nouns, it isn’t a problem, usually.
“She saw Julia walking into the building while talking on her phone.”
In this case, a section of the sentence is ambiguous, as we don’t know who is talking on the phone. There are many ways to clarify this, which is pretty nifty.
The phrase though, “while talking on her phone,” is itself a sort of object. Within it are five base objects, the five words, but also higherobjects, the combinations of those words in the particular combination, which in turn, get combined to form the whole phrase, the highestobject here (though, that will then be attached to the sentence in a few possible positions). ‘While,’ defined as a conjunction, acts as the bridge to the other parts of the sentence, but also demands a certain structure from the other words and also sets the tone. ‘And’ would be an alternative and may actually clarify the sentence a little more (though it sounds a bit off, “walking into the building and talking on her phone”). ‘While’ requires something to be happening, in this case talking. In contrast, ‘and,’ is not as limited and could be followed by a noun in other situations. For this sentence, what would follow ‘and,’ would be limited by what went before ‘and,’ as consistency in lists is desired. ‘Talking,’ requires a preposition, something like ‘on, at, to, into’ in order to make sense, and so, the two, ‘talking on,’ get grouped together before the whole phrase is constructed. The same goes for ‘her phone,’ but in this case, her, as a possessive requires something to own. ‘Phone’ needs something before it, an article of possessive noun.
More later.
–
variables strings arrays