Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Question for Eric Elliot: Inheritance, Polymorphism and Lambda functions

 
Greenhorn
Posts: 2
Eclipse IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Eric - looking at the table of contents for the pre-release version of your book, I see you are covering (what I consider) more advanced topics such as Polymorphism and Lambda functions. In other materials I've read, there seems to be some different opinions on how these are to be implemented properly in JavaScript. Would you care to comment on your approach to these topics in this book?

Also, would you recommend the pre-release eBook is available now or wait for the final version in October?

Thanks!
 
author
Posts: 20
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Hi Eric - looking at the table of contents for the pre-release version of your book, I see you are covering (what I consider) more advanced topics such as Polymorphism and Lambda functions. In other materials I've read, there seems to be some different opinions on how these are to be implemented properly in JavaScript. Would you care to comment on your approach to these topics in this book?

Also, would you recommend the pre-release eBook is available now or wait for the final version in October?

Thanks!



I'm not aware that there's a whole lot of current controversy about lambda functions. They exist in JavaScript, and you can't really get very far without using them or encountering them. (A lambda in JavaScript is just a function expression that gets passed or exported to other functions. For example, all callbacks are lambdas. All higher-order functions use or export lambdas).

As for polymorphism, there are many different kinds of polymorphism. I am aware of controversy over object polymorphism, but I primarily focus on function polymorphism in the book -- specifically, the more common parameter type polymorphism that you'll find in things like jQuery. The main jQuery function can take a number of different types as input. For example, strings can represent CSS selectors or tag names. Pass a function, and it acts like a shortcut for $(document).ready();

Some people think that you shouldn't use that kind of polymorphism at all -- if you really want to do things like that, they should be different methods. Those people are entitled to their opinion, and I don't have a strong opinion to the contrary, but it's hard to argue with the success of jQuery.

- Eric
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic