Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OOP vs procedural in run-time

I have very simple question I cant find answer anywhere on the internet.

So, my question is, in procedural programming, code is in code section, which goes into Read Only memory area. Variables are either on stack or heap.

But OOP says that object are created in memory. So, does it mean even functions are written into R/W memory area?

And, does Os have to have some inbuilt OOP programs support? For example if OS doesent allowed to read instruction outside Read only code section. Thanks.

like image 660
B.Gen.Jack.O.Neill Avatar asked Nov 07 '10 22:11

B.Gen.Jack.O.Neill


People also ask

Is procedural faster than OOP?

Procedural programming languages are not as faster as object-oriented. The object-oriented programming languages are faster and more effective. Procedural uses procedures, modules, procedure calls. Object-oriented uses objects, classes, messages.

Is OOP slower than procedural?

program size: OOP will mean more lines of code than procedural projects. Performance: OOP programs are normally slower than procedural programs.

What is runtime in OOP?

Runtime is a piece of code that implements portions of a programming language's execution model. In doing this, it allows the program to interact with the computing resources it needs to work. Runtimes are often integral parts of the programming language and don't need to be installed separately.

Should I use OOP or procedural?

Object-oriented programming is based on the real world. Procedural programming is used for designing medium-sized programs. Object-oriented programming is used for designing large and complex programs. Procedural programming uses the concept of procedure abstraction.


1 Answers

Generally, both OOP and procedural programming are abstractions which exist only at the source-code level. Once a program is compiled into executable machine-code, these abstractions cease to exist. So whether or not a particular language is OOP or procedural has no bearing on what regions of memory it uses, or where instructions are placed during execution.

The OS itself usually doesn't know or care whether a particular executable was written in an OOP or procedural language. It only cares that the executable uses binary op-codes compatible with its native instruction set, and that the executable has an ABI (binary interface) that it understands.

like image 193
Charles Salvia Avatar answered Sep 20 '22 03:09

Charles Salvia