[ 
https://issues.apache.org/jira/browse/QPID-4015?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Justin Ross updated QPID-4015:
------------------------------
    Labels: patch  (was: )

> qpid.packer.Packer implements abstract methods incorrectly.
> -----------------------------------------------------------
>
>                 Key: QPID-4015
>                 URL: https://issues.apache.org/jira/browse/QPID-4015
>             Project: Qpid
>          Issue Type: Improvement
>          Components: Python Client
>            Reporter: Tim Sally
>            Priority: Minor
>              Labels: patch
>         Attachments: 
> 0001-Use-abstract-base-class-to-implement-qpid.packer.Pac.patch
>
>
> qpid.packer.Packer implements abstract methods incorrectly. Specifically, it 
> uses the method suggested [here|http://norvig.com/python-iaq.html]. When an 
> abstract method is called, the invalid name _abstract_ results in a NameError 
> exception. The merits of this approach, along with the other most common 
> approaches, are summarized in the table below
> ||Method||||Stops Execution||Stops Execution at Object Creation||Sensible 
> Exception Name||
> |_abstract_ keyword|yes|no|no|
> |raise NotImplementedError|yes|no|yes|
> |Abstract Base Classes|yes|yes|yes|
> Using _abstract_ is not preferable because a NameError does not make 
> immediately clear what is going on. Raising a _NotImplementedError_ exception 
> is a great alternative because the exception name is logical. However, even 
> better is the use of Abstract Base Classes (ABCs). ABCs raise an exception at 
> object instantiation, whereas the other two methods do not result in an 
> exception until an abstract method is called.
> As an example, consider qpid.codec010.Codec. It is not immediately clear this 
> class should not be used. And indeed, it is not used anywhere. Rather, 
> qpid.codec010.StringCodec is the only class in qpid.codec010 meant to be used 
> directly. Using an abstract base class prevents qpid.codec010.Codec objects 
> from being created.  



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to