Path: csiph.com!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: When to use dynamic binding over dynamic dispatch? Date: Tue, 3 May 2016 21:23:07 -0400 Organization: Aioe.org NNTP Server Lines: 30 Message-ID: References: NNTP-Posting-Host: ANasIS7Js9OyLQwgloeBLQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:34238 On 5/2/2016 9:08 PM, cdalten@gmail.com wrote: > From what I understand, dynamic binding implies dynamic dispatch. So the question is, when do you use one over the other? As other have already pointed put then these terms are not well defined for Java. But if we use common programming definitions then: dynamic binding = lookup of method by name at runtime dynamic dispatch = virtual methods polymorphism Java does not have real language support for dynamic binding (with the definition above). It is only possible via reflection. All methods unless declared static or final are virtual in Java, so dynamic dispatch is used all the time. I can not think of any situation where I would have a natural choice between the two (with the above definition). Sometimes an alternate definition is used for dynamic binding: dynamic binding = synonym for dynamic dispatch But the question does not make much sense with that definition either. Arne