Discord
Login
Community
DARK THEME

Interpreted vs Compiled? Object vs Class? What's best?

Depends on your application. For Game Engines?

Interpreted vs Compiled

Compilation is considered faster execution. You have better access to graphics libraries, hardware acceleration. But development is slower, but a good IDE and fast machine can overcome that. Compiled languages tend to stricter, more complex with steeper learning curve. The languages have been around a while and may have grown feature-rich over time, think C++. To do some things in a compiled language, complexity is necessary.

Interpreted languages today aren't necessary slower, with just-in-time compilation. They have clear programming conveniences/advantages over compiled: variables can be type-less, declared on usage, have easy visibility, hold any value/object/function of variables. There can be high-level procedural abstractions. Yet this ease can cause problems on large projects. Without the restriction of declaring in advance with types, clarity may suffer. Trying to determine where you introduced a variable, global or local, and what it's allowed to hold, can be hard with code you wrote before. You code may get mysterious

Is there languages which can be either interpreted or compiled? Yes. Google Dart is one.

Object vs Class

In the beginning, there was Smalltalk, Objects, and Alan Kay. Everything in the language is an object. But it really only works in an interpreter. Objects are higher level things, they don't fit well into a fixed amount of memory which is what a compiler wants to work with. So compiled languages use classes, as they are predefined as to storage space. Classes have their advantages, and inheritance is a good thing. Still you can do anything with Objects you can do with Class, but not visa-versa.

Conclusion

It's faster to develop games, and game engines as well, in a interpreted language with a feature-rich environment such as we have with microStudio. But if you plan a big, complex project you might keep in mind that at some point, you might want to port it to a stricter compiled language. So write good code.

Well you kinda answered the question already

But if you want a language that is easy to use for faster development and prototyping and code that changes can be tested immediately without recompilation, with easier debugging as errors are reported line-by-line when they occur, and more portable, then use interpreted.

If you want generally faster, complex but make amazing games, use compiled.

And use both Object and Classes in a language it is better and has more advantages!

So yeah it depends like you said, good job!

mrderry, amazing question, I will love to answer, and Tiberius, you are correct, however you missed some spots in the hole, so I will answer the question myself:

This is a classic set of questions that addresses the basic "how" and "what" of programming. Everyone has their own opinions, but I will show you my idea.

  • Interpreted vs. Compiled refers to how the computer translates your code into something it can run.
  • Object vs. Class refers to what you are building within your code, especially in Object-Oriented Programming.
  • "What's Best?" is the tricky part because in software, the answer is almost always "it depends."

Here is a breakdown of all three so you know what is best for you.


1. Interpreted vs. Compiled

Computers only understand machine code, which consists of 0s and 1s. "High-level" languages like Python, C++, or JavaScript must be translated into machine code to function. The difference lies in when that translation happens.

Compiled Languages (The Translator)

A compiled language translates the entire program into machine code before you run it. It creates a standalone executable file, like a .exe on Windows.

  • Examples: C, C++, Rust, Go.
  • Analogy: You translate an entire book from English to Spanish and print it. If you want to change one sentence, you need to reprint the whole book.

Interpreted Languages (The Interpreter)

An interpreted language translates the code line-by-line while the program is running.

  • Examples: Python, JavaScript, PHP, Ruby.
  • Analogy: A simultaneous translator listens to a speech and translates it sentence-by-sentence in real-time. If the speaker changes a sentence, the translator immediately conveys the new sentence.

Comparison Table

Feature Compiled Interpreted
Speed Faster. The translation is done ahead of time. Slower. The computer translates while running.
Errors Catches errors early. It won't compile if there are syntax mistakes. Catches errors late. It crashes only when it encounters a bad line.
Flexibility Rigid. You must recompile after every change. Flexible. You can change code and run it right away.
Portability Lower. You need specific versions for Windows, Mac, etc. Higher. The code runs wherever the interpreter is installed.

Note: Many modern languages, like Java and C#, are hybrids. They compile code into an intermediate format, called "Bytecode," which is then interpreted by a Virtual Machine. This balances speed and portability.


2. Class vs. Object

In Object-Oriented Programming (OOP), code is organized around "things" (objects) instead of just actions. Classes and Objects are the two sides of this concept.

The Class (The Blueprint)

A Class is a template or definition. It describes what data something should have and what it should do, but it doesn't yet exist as a concrete thing in memory.

  • Analogy: The architectural blueprint for a house. It shows where the walls go, but you can't live in it.

The Object (The Instance)

An Object is a concrete instance created from the class. It occupies space in the computer's memory and contains actual data values.

  • Analogy: The actual house built from the blueprint. You can live in it, paint the walls, and park a car in the garage.

Example

  • Class: Car (Defines that all cars have a color, a model, and can drive).
  • Object A: A specific Red Toyota Camry.
  • Object B: A specific Blue Ford Mustang.

Both Object A and Object B are created from the Car Class.


3. What is Best?

There is no single "best" option. It depends entirely on your goals, ideas,and what you want to code your project in.

Interpreted vs. Compiled: Which is best?

  • Choose Compiled (C++, Rust, Go) if:

  • Performance is critical: You are building a high-end video game, a real-time trading engine, or an operating system.

  • Resource constraints: You are coding for a tiny microchip or embedded systems.

  • Choose Interpreted (Python, JavaScript) if:

  • Development speed is critical: You want to write code quickly, test it instantly, and prototype fast, like in Data Science or Web Development.

  • Ease of use: You are a beginner or need to write a simple script to automate a task.

Object vs. Class: Which is best?

This is a trick question! (in my opinion) You cannot choose between them. You need both.

Why?

  • You cannot have an Object without a Class to define it.
  • You cannot use a Class effectively until you turn it into an Object.
  • Exceptions: Some functional programming languages, like Haskell or Lisp, avoid this framework entirely, preferring functions over objects. But in OOP (Java, Python, C#), Class and Object are inseparable partners.

Summary

This is based on my coding/programming experience, I have coded in all sorts of coding languages in many ways, but here is the summary of the words

  1. Compiled = Translates everything before running (Fast execution, slower development).
  2. Interpreted = Translates while running (Slower execution, faster development).
  3. Class = The Blueprint (The idea of a thing).
  4. Object = The House (The actual thing).

Thank you Kira1 for such a well organized and comprehensive answer! (thanks Tiberius2 as well). I did ask this question to solicit opinions; to create a discussion for discussion's sake. The questions are really academic (and maybe you only care if you are/been to academy).

The question of compiled or interpreted is usually answered when your employer says "use this language" and so you use that language because generally computer languages are doing the same things only differently. However the question of class vs object is more interesting and something, as the author of the code, you get to choose.

In response to your first Why? item:

  • You cannot have an Object without a Class to define it.

But you can in microScript and Objective Pascal. For example in microScript:

something = object
  var1 = 0
  incr = function()
    var1 += 1
  end
end

Yet this creates only one instance, you would have to repeat the code for each instance of you object. So there is prototyping; you create the prototype then create the object from that. So a Class is the prototype.

In compiled languages like C++, the instance that you create from a prototype is stuck with only the properties (variables and functions) that are defined in the class. In interpreted languages, you can extend them on the fly (because they are objects) and that is very handy.

Also in compiled languages, variables typed to hold a certain class instance can only hold that instance or a subclass (derived or inherited class). In interpreted, everything is an object (more or less) and there is not strict type checking, so it doesn't matter.

Still you are entirely correct: when available, it's best to use both classes and objects. In microScript I use an object like a class when I only need one of them and I would prefer that variable and functions exist in their own namespace. Otherwise I go for class; still sometimes I use a class anyways as there isn't much difference in the code.

On a passing note: Javascript is kind of different (and weird to me), class prototypes are really functions. If you call them, it's a function. If you new them, it's a object instance. I thought that was cool at first but I had problems with it later. That's when I switched to Google's Dart as an alternative to javascript.

mrderry your right about JavaScript, it is the weirdest and strangest language ever I swear, it is great but very strange, I have an idea of creating a compiler in microScript but I don't think it is possible.

Post a reply

Progress

Status

Preview
Cancel
Post
Validate your e-mail address to participate in the community