Hera Sanju
Hera Sanju

I want to share, and the world!

How to do a perfect projection of real world understanding in the software field

When we talk about philosophy, it doesn't seem to have much to do with programming. And how does this nebulous realm of lofty abstract thinking relate to writing code, an operation closer to logic and mathematics?



We say that any programming language and design idea is a projection of the author's understanding of the real world into the software domain. Let's start with one of the most common concepts in programming: object orientation.



Object-orientation originally originated as a metaphor for the human cell.



Programming.Reddit is really good stuff and should be on every programmer's must-read list. One of my favorite things about it is that it not only has current topics, but also leads you to a lot of historical but more meaningful writing. Alan Kay on OO is one such piece. It is a private email correspondence, dated July 2003.



It is probably controversial to say that Turing Award winner (2003) Alan Kay is the father of object-oriented programming, because the first recognized OO language was Simula, invented by two other Turing Award winners (2001), Ole-Johan Dahl and Kristen Nygaard, so Wikipedia refers to all three as the fathers of OO. But consider that the name object-oriented programming was invented by Alan Kay.



Rewind to 1966, when Kay was a graduate student at the University of Utah, studying under Turing Award winner (1988) Ivan Sutherland, influenced by the design of Sketchpad, Simula, ARPAnet, and the Burroughs B5000 (a uniquely designed mainframe, introduced in 1961, which implemented the first virtual machines). Sometime in 1967, when asked what he was doing, Kay replied, "It's object-oriented programming". Kay recalls that the original concept of OO came from four parts.


1, objects are like cells in biology, or a computer in a network, only able to communicate through messages (so the concept of messages appeared early, but it took a long time for it to actually be available in programming languages.)


2. I wanted to remove the data ([Liu Jiang's note] this may refer to the encapsulation of data, since one of the design features of the B5000 is to disable unauthorized access to data). the B5000 achieves this through its incredible hardware architecture. I realized that the cell/computer metaphor had the potential to achieve this, and that the "<-" symbol could simply indicate the message. (This took me a long time, because I actually thought of all these symbols as names of functions and processes.)


3. My mathematical background made me realize that each object can have many operations, and many series of operations, which can be very useful. The term "polymorphism" was introduced very late (I think by Peter Wegner) and is not so reasonable, because it actually comes from the function terminology system, and I was thinking about more than just functions. I invented the term "genericity" to refer to the generic behavior of quasi-algebraic forms.


I didn't like the inheritance of Simula I or Simula 67 (although I think Nygaard and Dahl are great thinkers and designers). So I decided to hold off on inheritance as a built-in feature until I had a better understanding.



My first experiments with this architecture were modifications of van Wijngaarten and Wirth's "Generalization of Algol" and Wirth's Euler, both of which are similar to LISP but have a more traditional and better readable syntax. I didn't quite understand LISP's quirky meta-language concepts at the time, but got similar ideas for extensible languages from other sources, including Irons' IMP.



Dave Fisher's thesis was done in McCarthy style, and his ideas about extensible control structures were very helpful to me. Another big influence at this time was Carl Hewitt's PLANNER.



The original Smalltalk version came from these sources. For later versions of Smalltalk, history has criticized them for regressing back to the old Simula ways and not implementing safer extension mechanisms that are available everywhere possible.



When asked about the meaning of object-oriented programming, Alan Kay replied



I'm not against types, but I don't know of any type system that doesn't have big problems, so I still like dynamic typing.



To me, object-oriented programming just means messaging, local retention and protection and hiding of state-processes, and extreme late- binding of all things). All this is possible in Smalltalk and LISP. There may be other systems, but I don't know.



Alan Kay explains further the rather confusing "local preservation of state processing" sentence above, but it's still hard to understand. The general idea seems to be that there are two paths to object orientation, the more niche data-free (bio/net non-data-procedure route) that he supports, and the more mainstream ADT.



Each cell is an independent unit for processing information, and the cells interact with each other through neurons, and then multiple neurons are combined to achieve complex organ functions through this simple structure. The best expression of this idea is the Erlang language.



"If we now look back at where the idea of object-orientation came from, if we measure the current use of state inheritance and object-orientation by the properties of Smalltalk-80, which is based on a message-passing mechanism, we wonder if we have gone down the wrong path." This was an open question posed to Joe Armstrong, an early developer of the Erlang language, and Ralph Johnson, a long-time researcher in the areas of Smalltalk, object-oriented programming, and patterns, in an interview at QCon 2010 in London. Ralph Johnson's quote reads



The truth is that it happens all the time, you have a good idea, and you put it out there, but for most people it always seems radical. A lot of people don't want to accept the theory wholesale, they always adopt parts of it so that you see a lot of similar things coming out.



Even Smalltalk, which is held up by many as the paradigm of object-oriented languages, is just pushing infinitely closer to the idea of object-orientation. dr. Johnson raises two specific problems for Smalltalk.



I think Smalltalk has made a fundamental mistake. I think it's very difficult to get people who don't program in Smalltalk to understand Smalltalk, but if you're programming and debugging with Samlltalk, you're debugging the whole system. And in Smalltalk you can get any object you want from the image. But you can't keep track of versions of old and new objects ... and complexity is always a problem. You build a system, only a few people can maintain it, and Smalltalk doesn't always work very well.



In fact, putting everything (your application classes, development and debugging tools and libraries) in an "image" has always been a problem for Smalltalk, even for admirers of the language. But that hasn't stopped people from building large, mission-critical systems, such as the Cargill Lynx project, a global grain trading system that supports more than 1,500 users, has more than 150 sites across the United States, and has been running for more than a decade. Over the lifetime of the Lynx project, more than one hundred programmers have developed and maintained it, with full version control, robustness testing and debugging. Mega-projects like Lynx do not eliminate Ralph Johnson's skepticism, and they certainly do not deny that Smalltalk is a flawed object-oriented implementation. They simply offer their perspectives from different perspectives.



The question of what features make a language object-oriented was extensively and vigorously debated in the 1990s. The same debate was sparked after Joe Armstrong 's thesis advisor was quoted in an interview at the QCon conference in London as saying



I started wondering what object-oriented programming really was, and I don't think Erlang is object-oriented, it's a functional programming language. Then my thesis advisor said: "You are wrong, Erlang is fully object-oriented". He said that object-oriented languages are not actually de-object-oriented. I was thinking, although I'm not sure if I can believe this statement, that Erlang might be the only object-oriented language at this point because Erlang has the three principles of object-oriented programming: message passing based mechanism, object separation and polymorphism.



Dr. Armstrong said he was not convinced by his mentor's arguments, but seemed to think that Erlang "may be the only object-oriented language." In addition to the three previously mentioned features, single inheritance and dynamic typing are also cited as "absolute requirements" for object-oriented languages. *In this interview, Johnson says



In this interview, both Dr. Johnson and Dr. Armstrong stated that object-oriented thinking was and still is very important, and Dr. Armstrong spent time analyzing how Erlang attempts to implement object-oriented ideas and features of the language. Dr. Johnson spent more time critiquing previous attempts to implement object-oriented This is a bit odd, since he has long been an advocate of Smalltalk and object-oriented thinking (Dr. Johnson's co-authored book on design patterns includes object orientation in its title), but Ralph Johnson's arguments are not isolated.



Dave Thomas is another person with similar views on object-oriented and Smalltalk. His team created the first "Goodies Packs" for Digitalk's Method (the first Smalltalk application for the PC), of which he was the founder and CEO, and their work eventually became IBM's Dr. Thomas is quoted as saying "Object-Orientation is a mistake" and "I am a national sinner. " These descriptions are certainly intended for dramatic effect, but they also point out the "mistakes" in Smalltalk's implementation of the object idea - for example, the focus on state and the lack of a good concurrency model and messaging mechanism in the class and image-based language.



Alan Kay, who first coined the term "object-oriented", invented the important Smalltalk language with Dan Ingalls and others who worked with him at Xerox PARC. In a recent interview with Computerworld Australia, he said.



I did coin the phrase (and it seems like a poor choice now because it doesn't emphasize the importance of messaging). Some of these ideas still exist (in several systems). Considering that all valid VM's communication can interact via messages, we can actually build a more comprehensive theoretical foundation. Such a foundation would provide better scalability and is a virtual version of my research community, ARPA-IPTO (Information Processing Technology Office of the U.S. Department of Defense Research Agency), which has started to build large-scale networks with strong "algebraic" properties (similar to polymorphism)... ... However, I am not a fan of Smalltalk, although it is still better than most other programming systems (I don't like any of them, and so far I don't think they are suitable for solving real programming problems, either for the system or for the end user).



The recent criticism of Smalltalk reminds me of the line repeated in the old coaster song, where Charlie Brown sings, "(Why does everyone take it personally)." Of course, Johnson, Armstrong, Kay and Thomas aren't "targeting me (Smalltalk)". In interviews at QCon London, other relatively low-key critics suggested that, as Dr. Johnson said, good ideas always "seem radical to most people," so to what extent can they be implemented in any programming language?



This is likely because programming languages cannot describe object-oriented ideas directly through definitions and structures. In an interview with Computerworld Australia, Dr. Kay pointed out that



For me, one of the benefits of adopting real object semantics is that they are "real computers all the way down (RCATWD)" - meaning that real objects retain the full ability to describe anything. In the old way, although you can get data and processes quickly, they are not computers, and the ability to delay optimization and analyze whether certain behaviors make sense is suddenly lost. In other words, there are always real objects that retain the ability to simulate what you want and send it to the surrounding environment ...... And RCATWD also provides perfect protection in both directions. We were able to understand this idea from the hardware model of the Web (probably the only truly object-oriented system at work). You simply accept the conventions of the message format, and you get the extensibility of the language for free. My idea in the 70's was that we work together on the Internet and do personal computing, which is a very nice scalable design, and that we could also build virtual networks with virtual machines, cache through hardware machines, etc. The very bad thing is that these ideas have not been implemented.

If 'real objects' were RCATWD, then it would be possible to use programming languages to implement the intrinsic properties of each object in the most appropriate way, which would give a new meaning to 'multilingual programming'.



Thus, it can be said that this is the philosophy of object-oriented programming.



Scratch is already recognized as the best choice in the field of programming for young children, and it has spawned many training institutions in China that are repackaged and upgraded around Scratch. the basic philosophy of Scratch is detailed in the book "Lifelong Kindergarten", and the core part of it lies in its proposed 4Ps, namely Project, Passion, Peer and Play. The design of the entire Scratch system is built around the 4Ps, fully reflecting its design philosophy.



ALL RIGHTS RESERVED 版权声明

喜欢我的文章吗?
别忘了给点支持与赞赏,让我知道创作的路上有你陪伴。

加载中…

发布评论