I have been hearing about how C is a non-object-oriented language and how java is an object-oriented language. I was wondering what the difference was?
相关问题
- Delete Messages from a Topic in Apache Kafka
- how to define constructor for Python's new Nam
- Jackson Deserialization not calling deserialize on
- Multiple sockets for clients to connect to
- How to maintain order of key-value in DataFrame sa
Object-Oriented Language is where you think in terms of objects. However, this takes lot of skills. You cannot take some C-code and stuff it into an object and call it OOP. Key concepts of OOP are inheritance, encapsulation and dynamic binding.
A program can be conceptually organised in two ways,around its code or data. The first approach is called as process-oriented model.The second approach is called as object oriented model.
I'll give you the most simple and intuitive answer you can get.
(Considering Java is an object-oriented language and C is a procedural language)
Object-Oriented Language
Procedural Language
OOP makes it easier to break down one big problem into smaller self contained parts. You can then create something more complex by combining these parts.
The object-oriented programming paradigm tells you to encapsulate state variables in entities called 'objects' which communicate via message passing, most often implemented as functions with a 'special'
this
orself
argument.An object-oriented programming language is a language designed to make using the oo paradigm easy. Its semantics and syntax are geared towards this goal. Inheritance (either class-based or prototypal) and subtype polymorphism are important techniques which make the abstract concept of oo feasible in practice.
Apart from trying to characterize a language as having a particular paradigm at its core, you might find this paper from William R. Cook useful: On understanding data abstraction, revisited. There's a draft version available. It explores the difference between abstract data types and objects -- a distinction that, after years of absorption in various programming languages, I could no longer see.
I found the paper by way of Guy Steele's recent essay, Why Object-Oriented Languages Need Tail Calls.