Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 929017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:06:09+00:00 2026-05-15T20:06:09+00:00

I am a long time OO programmer and a functional programming newbie. From my

  • 0

I am a long time OO programmer and a functional programming newbie. From my little exposure algebraic data types only look like a special case of inheritance to me where you only have one level hierarchy and the super class cannot be extended outside the module.

So my (potentially dumb) question is: If ADTs are just that, a special case of inheritance (again this assumption may be wrong; please correct me in that case), then why does inheritance gets all the criticism and ADTs get all the praise?

Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T20:06:09+00:00Added an answer on May 15, 2026 at 8:06 pm

    I think that ADTs are complementary to inheritance. Both of them allow you to create extensible code, but the way the extensibility works is different:

    • ADTs make it easy to add new functionality for working with existing types
      • You can easily add new function that works with ADT, which has a fixed set of cases
      • On the other hand, adding new case requires modifying all functions
    • Inheritance makes it easy to add new types when you have fixed functionality
      • You can easily create inherited class and implement fixed set of virtual functions
      • On the other hand, adding a new virtual function requires modifying all inherited classes

    Both object-oriented world and functional world developed their ways to allow the other type of extensibility. In Haskell, you can use typeclasses, in ML/OCaml, people would use dictionary of functions or maybe (?) functors to get the inhertiance-style extensibility. On the other hand, in OOP, people use the Visitor pattern, which is essentially a way to get something like ADTs.

    The usual programming patterns are different in OOP and FP, so when you’re programming in a functional language, you’re writing the code in a way that requires the functional-style extensibility more often (and similarly in OOP). In practice, I think it is great to have a language that allows you to use both of the styles depending on the problem you’re trying to solve.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 530k
  • Answers 529k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You need bracketing: execute ( @exec_str ) May 16, 2026 at 11:26 pm
  • Editorial Team
    Editorial Team added an answer SELECT column_1, COUNT(*) FROM records GROUP BY column_1 ORDER BY… May 16, 2026 at 11:26 pm
  • Editorial Team
    Editorial Team added an answer You could check the $(window).width() and do a little math… May 16, 2026 at 11:26 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

A long time ago, I bought a data structures book off the bargain table
For a long time now, we've held our data within the project's repository. We
I am almost embarrassed to ask this question, but as a long time C
Long time lurker, first time poster. I'm making a ServerConnection module to make it
relatively long-time PHP user here. I could install XAMPP in my sleep at this
After long time of searching the best upload technique I've decided to go with
A long time ago I used to use or die in my PHP code.
A long time ago, I saw someone encapsulate their entire JavaScript block with code
How can the following simple implementation of sum be faster? private long sum( int
K I'm a self taught programmer and been so for a couple of years.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.