Code smells: too many parameters, too many attributes (was: pylint -- should I just ignore it sometimes?)
- From: Ben Finney <ben+python@xxxxxxxxxxxxxxx>
- Date: Wed, 20 Oct 2010 12:09:35 +1100
Seebs <usenet-nospam@xxxxxxxxx> writes:
I'm pretty much mystified by a claim that something with seven
instance attributes is "too complicated".
It's a code smell. Many discrete attributes is a sign that the design
can be improved by combining related attributes into a complex type.
It's pretty much the same smell, with the same range of solutions, as
too many parameters for a function.
<URL:http://www.c2.com/cgi/wiki?TooManyParameters>
<URL:http://www.refactoring.com/catalog/introduceParameterObject.html>
--
\ “Science is a way of trying not to fool yourself. The first |
`\ principle is that you must not fool yourself, and you are the |
_o__) easiest person to fool.” —Richard P. Feynman, 1964 |
Ben Finney
.
- Follow-Ups:
- References:
- pylint -- should I just ignore it sometimes?
- From: Seebs
- Re: pylint -- should I just ignore it sometimes?
- From: Martin P. Hellwig
- Re: pylint -- should I just ignore it sometimes?
- From: Seebs
- pylint -- should I just ignore it sometimes?
- Prev by Date: Re: OO and game design questions
- Next by Date: Re: merge list of tuples with list
- Previous by thread: Re: pylint -- should I just ignore it sometimes?
- Next by thread: Re: Code smells: too many parameters, too many attributes (was: pylint -- should I just ignore it sometimes?)
- Index(es):