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 6101799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:32:27+00:00 2026-05-23T13:32:27+00:00

I recently watched Douglas Crockford’s JavaScript presentations , where he raves about JavaScript prototype

  • 0

I recently watched Douglas Crockford’s JavaScript presentations, where he raves about JavaScript prototype inheritance as if it is the best thing since sliced white bread. Considering Crockford’s reputation, it may very well be.

Can someone please tell me what is the downside of JavaScript prototype inheritance? (compared to class inheritance in C# or Java, for example)

  • 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-23T13:32:28+00:00Added an answer on May 23, 2026 at 1:32 pm

    Things I miss when sub-classing an existing object in Javascript vs. inheriting from a class in C++:

    1. No standard (built-into-the-language) way of writing it that looks the same no matter which developer wrote it.
    2. Writing your code doesn’t naturally produce an interface definition the way the class header file does in C++.
    3. There’s no standard way to do protected and private member variables or methods. There are some conventions for some things, but again different developers do it differently.
    4. There’s no compiler step to tell you when you’ve made foolish typing mistakes in your definition.
    5. There’s no type-safety when you want it.

    Don’t get me wrong, there are a zillion advantages to the way javascript prototype inheritance works vs C++, but these are some of the places where I find javascript works less smoothly.

    4 and 5 are not strictly related to prototype inheritance, but they come into play when you have a significant sized project with many modules, many classes and lots of files and you wish to refactor some classes. In C++, you can change the classes, change as many callers as you can find and then let the compiler find all the remaining references for you that need fixing. If you’ve added parameters, changed types, changed method names, moved methods,etc… the compiler will show you were you need to fix things.

    In Javascript, there is no easy way to discover all possible pieces of code that need to be changed without literally executing every possible code path to see if you’ve missed something or made some typo. While this is a general disadvantage of javascript, I’ve found it particularly comes into play when refactoring existing classes in a significant-sized project. I’ve come near the end of a release cycle in a significant-sized JS project and decided that I should NOT do any refactoring to fix a problem (even though that was the better solution) because the risk of not finding all possible ramifications of that change was much higher in JS than C++.

    So, consequently, I find it’s riskier to make some types of OO-related changes in a JS project.

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

Sidebar

Related Questions

I recently watched this youtube tutorial on the Null Object design pattern. Even though
Recently I tried CodeSmith templates for NHibernate. As many of you might watched, there
I'm trying to unit test a custom action result. I recently watched Jimmy Bogard's
Recently i watched a tutorial from youtube ( http://www.youtube.com/watch?v=8mwKq7_JlS8 ) The boy is typing
I watched this webcast recently, and I got the sense that a lot of
I recently installed the add-on DownThemAll into my firefox and as I watched it
Recently I've started hearing about POJOs (Plain Old Java Objects). I googled it, but
I recently watched the 'Network Apps for the iPhone OS' videos for WWDC 2010
I recently watched Dav Glass' talk on YUI and node , and the server-side
I recently started learning Ruby and Ruby on Rails, and have watched a plethora

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.