2

I'm currently working on a game and wanted to add some scripting support. Due to trying to keep the entire codebase in managed c# (Excluding Monogame), I am using a custom language for the scripting (No managed only implementations of Lua exist...except AluminumLua which is incomplete).

In such a language, basic provisions would need to exist. These would include:

  • Objects / Properties / Variables
  • floats and strings
  • Functions
  • Conditionals
  • Loops

Am I missing any major parts of a basic object oriented language?

EDIT: As comments have pointed out, I would be far better finishing the incomplete implementation of Lua for C# rather than designing my own language...which is what I am going to do. However, I am still curious what the properties of an object oriented language are. So, what properties does an OO language have?

Some definitions of object orientation (again, decided in the comments):

Combining the state of an object with it's behavior.

An object oriented language is is a method of combining the state of an object (it's properties) with behavior (functions).

Object orientation is defining data (like a C struct) and providing specific methods to interact with it (the function ChangeValue), rather than give the person using that code the ability to change any part, including 'internal' components.

Object orientation is just a way to sort the data (that will be represented in binary) more clearly to a programmer and protecting against incorrect use (e.g. setting a char instead of a byte into a function).

closed as too broad by GlenH7, user40980, gnat, Bart van Ingen Schenau, ChrisF Sep 5 '14 at 8:36

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    First, define object oriented... – user40980 Sep 5 '14 at 0:35
  • 3
    Add as much as you are willing to support in your game. Starting small and growing the language will be easier to manage. – Bernard Sep 5 '14 at 0:35
  • 1
    I think it would be easier to complete the partial implementation of Lua than to build your own language. Did you check for a Javascript interpreter for your environment? – kevin cline Sep 5 '14 at 1:46
  • 1
    @MichaelT Would you please define object oriented for us ? – Tulains Córdova Sep 5 '14 at 2:53
  • 2
    @user61852 snort I'm not even going to try. C2.com Object Oriented Programming is a good read. The best minimal definition on that page is probably 'combining state with behavior' but that just sounds a bit too hand wavery for me. I've seen people argue that $lang is OO and not OO and that some definition is or is not proper because it includes excludes some other feature that they consider to be key to OO. Nobody agrees on what OO is and Defs of OO – user40980 Sep 5 '14 at 3:05
1

The core idea behind object-oriented programming is the encapsulation and information hiding of data and functions that operate on that data within objects. Rather than building an open data structure (think traditional C struct) and passing a pointer around to functions, you put the functions in the structure and call those functions directly.

Everything else builds on these core concepts, but if I had to name the bare minimum that makes an OO language, encapsulation and information hiding are it.

  • encapsulation means some structure contains data and functions: they are contained by the object.

  • Information hiding is the idea that an object's data is not directly accessible on the outside. It must be manipulated or used via its functions.

There are other features that are not core OO concepts but extend them in a way that is useful and are often included:

  • Inheritance: an object may extend another object, inheriting its data and functions and providing new ones. This is tied to the Liskov substitution principle where a subclass must be able to take the place of a superclass. The idea here is that by extending a superclass, a class can define additional behavior or even change the superclass implementation as long as it adheres to the contract of its interface.

  • Polymorphism: related to inheritance, where subclasses have different behavior in accordance with a common interface. The idea is that (at least with static polymorphism, commonly found in Java, C# and C++) if you need an object that does something, you can take an object with a given interface and expect different behavior based on its implementation and you don't care what the implementation is.

Many languages add more and more features, but these are the basics.

-4

properties of object oriented language are:

--> encapsulation --> abstraction --> Inheritance --> polymorphism

Main Thing is Object and Classes

Any thing in Object oriented language converted into Objects

  • is this only your opinion or you can back it up somehow? – gnat Sep 5 '14 at 6:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.