# Chapter 5 - Disadvantage of repeating parameter name in function name

**URL:** <https://forums.kodeco.com/t/chapter-5-disadvantage-of-repeating-parameter-name-in-function-name/173157>\
**Category:** Dart Apprentice\
**Created:** [June 14, 2022, 1:17pm UTC](https://forums.kodeco.com/t/chapter-5-disadvantage-of-repeating-parameter-name-in-function-name/173157 "2022-06-14T13:17:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ellery](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ellery/32/110937_2.png) [@ellery](https://forums.kodeco.com/u/ellery)\
**Post date:** [June 14, 2022, 1:17pm UTC](https://forums.kodeco.com/t/chapter-5-disadvantage-of-repeating-parameter-name-in-function-name/173157/1 "2022-06-14T13:17:58Z")

</div>

Hi the recommended naming convention for function:  
Don’t repeat parameter names in the function name. For example, use `cube(int number)` instead of `cubeNumber(int number)`, or `printStudent(String name)` instead of `printStudentName(String name)`.

Is there any disadvantage in doing so? Or why we want to do that?

---

<div class="post-metadata">

**Author:** ![robertomachorro](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/robertomachorro/32/111603_2.png) [@robertomachorro](https://forums.kodeco.com/u/robertomachorro)\
**Post date:** [June 14, 2022, 6:22pm UTC](https://forums.kodeco.com/t/chapter-5-disadvantage-of-repeating-parameter-name-in-function-name/173157/2 "2022-06-14T18:22:02Z")

</div>

@suragch any suggestions?

---

<div class="post-metadata">

**Author:** ![suragch](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/suragch/32/109020_2.png) [@suragch](https://forums.kodeco.com/u/suragch)\
**Post date:** [June 20, 2022, 3:41pm UTC](https://forums.kodeco.com/t/chapter-5-disadvantage-of-repeating-parameter-name-in-function-name/173157/3 "2022-06-20T15:41:51Z")

</div>

Let me start by saying that’s it’s not wrong to repeat the parameter name in the function name. However, there are a few reasons to prefer not repeating:

- All other things being equal, short names are easier to read than long names. Long function names are good when they are descriptive, but redundant information doesn’t convey additional information. Since Dart supports named parameters, it’s easy to make this information visible to the reader. Languages like C, C++ and Java don’t have named parameters so it might be better to include the parameter name in the function name when programming in these languages.
- Longer function names make it more likely that a given line of code will have to likewrap when formatted. Code that linewraps is generally harder to read that code that appears on a single line.

As a general rule, choose the function name that is the most readable.

---

<div class="post-metadata">

**Author:** ![ellery](https://assets.chunter.kodeco.com/user_avatar/forums.kodeco.com/ellery/32/110937_2.png) [@ellery](https://forums.kodeco.com/u/ellery)\
**Post date:** [June 23, 2022, 9:58am UTC](https://forums.kodeco.com/t/chapter-5-disadvantage-of-repeating-parameter-name-in-function-name/173157/4 "2022-06-23T09:58:07Z")

</div>

Thank you, very clear explanation.
