Free To Feel

Heading to entrepreneur.

Joshua Chi

Code Smell

There is a code smell list that we can then as a reference.

In computer programming, code smell is any symptom in the source code of a computer program that indicates something may be wrong. It generally indicates that the code should be refactored or the overall design should be reexamined. The term appears to have been coined by Kent Beck on WardsWiki. Usage of the term increased after it was featured in Refactoring. Improving the Design of Existing Code.

Interesting Discussion about 'What are Code Smells? What is the best way to correct them?'.

A question is flying on my head:

class Person{
 var $name;
 var $age;

function calculateEmployeeAverageAge($employee){

calculateEmployeeAverageAge(new Person());

If there is a function like 'calculateEmployeeAverageAge', is it a code smell? I have met this before in our own product code. I mean the function must know much about the Person structure. But actually, we didn't want to a function rely on too much outside. I always avoid this way in my application. But the guy said 'Methods with a ridiculous (e.g. 7+) amount of parameters. This usually means that there should be a new class introduced (which, when passed, is called an indirect parameter.)' in this discussion.

comments powered by Disqus