Is Everything an Object?
You might be familiar with the phrase, ''Everything is an object.'' But is it? See how two studied and published developers think about objects.
Join the DZone community and get the full member experience.Join For Free
I have been reading two great books, Object Thinking by David West and Clean Code by Robert C. Martin. In these two great books, the authors mention the phrase: “Everything is an object.” What caught my attention was that both express very different thoughts about this phrase. In his book, David West affirms that everything is an object and is a prerequisite if you want to be part of the object thinking culture. On the other hand, in his book, Robert C. Martin, says: “Mature programmers knows that the idea that everything is an object is a myth. Sometimes you really do want simple data structures with procedures operating on them”.
A bit of background of these two gentlemen. Robert C. Martin has written many books on software development, agile methodologies, and object oriented design and has founded Object Mentor, which is a company for mentoring and consulting on object oriented technologies. David West, Ph.D., is a consultant, educator and trainer in object oriented technologies. He founded and directed the Object Lab at the University of St. Thomas and cofounded the original Object Technology User Group.
I thought, "How can this be possible?" It's such a stark difference from two very experienced people in the same field. You might be thinking the same I’m thinking… Object Thinking is a book with examples written in Smalltalk while Clean Code is a book with examples written in Java. In addition, based on some research on the web (and this might not be correct) it seems that Robert C. Martin’s experience is based on C++/Java. This says a lot about their opinions. Are their minds are modeled differently due to diferent experiences in the past? Is it harder to see everything as an object if you came from Object Oriented languages like C++ ?
Well… just to mention a small thing, the way you create an object in C++ is using the keyword new, while in Smalltalk you send the message new to a class (which is also an object. Of course, everything is an object). Big difference.
After dropping these notes here, I continued reading David West’s book and I found this paragraph: “Claiming that there are clear criteria for determining whether software is object oriented is not the same as saying all software should be object oriented. Expecting a device driver implemented with 100 lines of assembly language to reflect full object thinking is probably pointless.”
Right! It seems we finally have an agreement… and I’m convinced that they would agree if they discussed the topic. However, even while they might agree on this, they (both) assign to the phrase “everything is an object” in very different way.
If I take both toughts, I would say that mature programmers knows when to apply object oriented thought and when not.
Opinions expressed by DZone contributors are their own.
Step Into Serverless Computing
Building the World's Most Resilient To-Do List Application With Node.js, K8s, and Distributed SQL
Which Is Better for IoT: Azure RTOS or FreeRTOS?
Building a Robust Data Engineering Pipeline in the Streaming Media Industry: An Insider’s Perspective