⇧ 設定ミスとか気付きにくそう...
オブジェクト指向の定義を調べてみた
Wikipediaさんによりますと、
Object-oriented or object-orientation is a software engineering concept, in which concepts are represented as "objects". Object-oriented topics include:
⇧ オブジェクト指向は「objects」として表されるって仰っていて、
In computer science, an object can be a variable, a data structure, a function, or a method. As regions of memory, they contain value and are referenced by identifiers.
In the object-oriented programming paradigm, object can be a combination of variables, functions, and data structures; in particular in class-based variations of the paradigm it refers to a particular instance of a class.
⇧ う~む、いまいち、よう分からんけど、「オブジェクト指向〇〇」という形で、「オブジェクト指向」には領域が複数あるっぽい。
何の領域における「オブジェクト指向」の話なのかは、事前に確認しておかないと訳の分からないことになりそうね...
プログラミング言語の領域では、
Object-based languages
An important distinction in programming languages is the difference between an object-oriented language and an object-based language. A language is usually considered object-based if it includes the basic capabilities for an object: identity, properties, and attributes. A language is considered object-oriented if it is object-based and also has the capability of polymorphism, inheritance, encapsulation, and, possibly, composition.
⇧ 上記によりますと、
- Object-oriented language
- polymorphism
- inheritance
- encapsulation
- possibly composition
- Object-based languages
- object
- identity
- properties
- attributes
- object
⇧ のような特性で定義されており、
⇧ の4つを利用していることが「オブジェクト指向言語」ということになるっぽい。
上記の4つの特性を利用している場合は、「オブジェクト指向」と言って良いということになるんでしょうかね?
上記の4つの特性の内、1つでも使われていたら、それは「オブジェクト指向」を利用していると言って良いと仮定してみると、知らず知らずのうちに「オブジェクト指向」を利用していることもありそうということですね。
そして、Javaを使っている場合、フレームワークとか使ってたら確実に「オブジェクト指向」を利用していることになるってことな気がする。
まぁ、そもそもが、Javaの標準APIが「オブジェクト指向」を利用してるっぽいから、Javaで開発する場合は「オブジェクト指向」を利用していくのが自然な気もするかな。
Javaは互換性を考慮してるって話だし、互換性の切り捨てをしない限り「オブジェクト指向」から抜け出せなさそうではありそう。
2023年2月25日(土)時点のWikipediaの情報だと、
Many of the most widely used programming languages (such as C++, Java, Python, etc.) are multi-paradigm and they support object-oriented programming to a greater or lesser degree, typically in combination with imperative, procedural programming.
Significant object-oriented languages include: Ada, ActionScript, C++, Common Lisp, C#, Dart, Eiffel, Fortran 2003, Haxe, Java, JavaScript, Kotlin, logo, MATLAB, Objective-C, Object Pascal, Perl, PHP, Python, R, Raku, Ruby, Scala, SIMSCRIPT, Simula, Smalltalk, Swift, Vala and Visual Basic.NET.
⇧ 上記が「オブジェクト指向言語」と認識されてるっぽい。
ちなみに、Rustはと言うと、
Rustはマルチパラダイムプログラミング言語であり、手続き型プログラミング、オブジェクト指向プログラミング、関数型プログラミングなどの実装手法をサポートしている。
⇧ Javaと同様、マルチパラダイムのプログラミング言語らしいので「オブジェクト指向」を利用してるケースも有り得るっぽい。
話が脱線しましたが、「ドメイン駆動設計(DDD:Domain Driven Design)」の概念とかも考慮すると、「オブジェクト指向プログラミング」の代替が思いつかんな...
いまのところ「オブジェクト指向」を利用せざるを得ないかな...
2023年3月1日(水)追記:↓ ここから
「関数型」で「ドメイン駆動設計(DDD:Domain Driven Design)」を試みてる方がおられました。
⇧ 開発するシステムの規模によっては「関数型」でもいけるんかな?
2023年3月1日(水)追記:↑ ここまで
毎度モヤモヤ感が半端ない...
今回はこのへんで。