DZone
Java Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Java Zone > Can We Have OOP Without Classes?

Can We Have OOP Without Classes?

Popular MVB Yegor Bugayenko discusses whether classes are really needed for object orientation.

Yegor Bugayenko user avatar by
Yegor Bugayenko
·
Sep. 22, 16 · Java Zone · Opinion
Like (18)
Save
Tweet
11.37K Views

Join the DZone community and get the full member experience.

Join For Free

I interviewed David West, the author of the Object Thinking book, a few weeks ago, and he said that classes were not meant to be in object-oriented programming at all. He actually said that earlier; I just didn't understand him then. The more I've thought about this, the more it appears obvious that we indeed do not need classes.

Battleship Potemkin (1925) by Sergei M. Eisenstein
Battleship Potemkin (1925) by Sergei M. Eisenstein

Here is a prototype.

Let's say we have only types and objects. First, we define a type:

type Book {
  void print();
}

Then we create an object (pay attention; we don't "instantiate"):

Book b1 = create Book("Object Thinking") {
  String title;
  Book(String t) {
    this.title = t;
  }
  public void print() {
    print("My title: " + this.title);
  }
}

Then we create another object, which will behave similarly to the one we already have but with different constructor arguments. We copy an existing one:

Book b2 = copy b1("Elegant Objects");

Libraries will deliver us objects, which we can copy.

That's it.

No implementation inheritance and no static methods, of course. Only subtyping.

Why not?

Object-oriented programming

Published at DZone with permission of Yegor Bugayenko. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Is Your Code DRY or WET?
  • Building an E-Commerce API Using Nestjs, SQLite, and TypeORM
  • Are Foreign Keys Unscalable?
  • Python 101: Equality vs. Identity

Comments

Java Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo