From 31bc0ed0e8ce7c6de15c2d32172c53fdefae6b19 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 11 Feb 2022 23:24:09 +0630 Subject: [PATCH 01/19] added 'naming a function' --- concepts/functions/introduction.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/concepts/functions/introduction.md b/concepts/functions/introduction.md index 5af190ad18..5a382b03f7 100644 --- a/concepts/functions/introduction.md +++ b/concepts/functions/introduction.md @@ -121,3 +121,9 @@ const obj = { [concept-callbacks]: /tracks/javascript/concepts/callbacks [concept-arrays]: /tracks/javascript/concepts/arrays [mdn-primitives]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive + +## Naming A Function + Naming name is as important as writing codes. It is important to be clear and precise. Consider the following recommendations when you name your function. + - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade + - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. The longer the name is, the harder it get to remember and the more space it take on the computer scree + - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. \ No newline at end of file From ce6e818e02c546b97d73411a3e6e53be69c9d63c Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 11 Feb 2022 23:33:32 +0630 Subject: [PATCH 02/19] add 'naming function' section --- concepts/functions/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/concepts/functions/introduction.md b/concepts/functions/introduction.md index 5a382b03f7..76a318a4e9 100644 --- a/concepts/functions/introduction.md +++ b/concepts/functions/introduction.md @@ -126,4 +126,4 @@ const obj = { Naming name is as important as writing codes. It is important to be clear and precise. Consider the following recommendations when you name your function. - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. The longer the name is, the harder it get to remember and the more space it take on the computer scree - - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. \ No newline at end of file + - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. From 9bbcfee4956ee981dd078714c846f4e96f70844a Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 11 Feb 2022 23:36:20 +0630 Subject: [PATCH 03/19] added 'naming a function' section --- concepts/functions/introduction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/concepts/functions/introduction.md b/concepts/functions/introduction.md index 76a318a4e9..5615d41efa 100644 --- a/concepts/functions/introduction.md +++ b/concepts/functions/introduction.md @@ -123,7 +123,7 @@ const obj = { [mdn-primitives]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive ## Naming A Function - Naming name is as important as writing codes. It is important to be clear and precise. Consider the following recommendations when you name your function. + Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. The longer the name is, the harder it get to remember and the more space it take on the computer scree - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. From 674b2435d9940be7925a63656215024049604004 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Sat, 12 Feb 2022 08:49:43 +0630 Subject: [PATCH 04/19] added 'naming function' to Function concept --- exercises/concept/lasagna-master/.docs/introduction.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/exercises/concept/lasagna-master/.docs/introduction.md b/exercises/concept/lasagna-master/.docs/introduction.md index 2ef177a752..2d02133c34 100644 --- a/exercises/concept/lasagna-master/.docs/introduction.md +++ b/exercises/concept/lasagna-master/.docs/introduction.md @@ -121,3 +121,12 @@ const obj = { [concept-arrays]: /tracks/javascript/concepts/arrays [concept-callbacks]: /tracks/javascript/concepts/callbacks [mdn-primitives]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive + + +## Naming A Function + Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. + - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade + - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. The longer the name is, the harder it get to remember and the more space it take on the computer screen. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. + - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. + - Pick one word per one concept and stick with it. For example, if you named `getStudentName()`, don't change `get` to `retrieve` like `retrieveStudentGrade()` when naming another function. + - Avoid using the same word for two purposes. For example, don't keep using `add` when you want to put a group of items to a collection. Use `insert` or `append` instead. From f125c0eaac508f41e185cc9bd236c244f94bdc5e Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Sat, 12 Feb 2022 08:51:32 +0630 Subject: [PATCH 05/19] Added 'naming function' to Function concept --- concepts/functions/introduction.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/concepts/functions/introduction.md b/concepts/functions/introduction.md index 5615d41efa..faa0883280 100644 --- a/concepts/functions/introduction.md +++ b/concepts/functions/introduction.md @@ -127,3 +127,5 @@ const obj = { - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. The longer the name is, the harder it get to remember and the more space it take on the computer scree - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. + - Pick one word per one concept and stick with it. For example, if you named getStudentName(), don't change get to retrieve like retrieveStudentGrade() when naming another function. + - Avoid using the same word for two purposes. For example, don't keep using add when you want to put a group of items to a collection. Use insert or append instead. From 200194f1dd7b7bd590ab5c8be2a3c5404b2da8ce Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Sun, 13 Feb 2022 22:57:07 +0630 Subject: [PATCH 06/19] fixed format --- concepts/functions/introduction.md | 14 ++++++++------ .../concept/lasagna-master/.docs/introduction.md | 14 ++++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/concepts/functions/introduction.md b/concepts/functions/introduction.md index faa0883280..7d813d6e78 100644 --- a/concepts/functions/introduction.md +++ b/concepts/functions/introduction.md @@ -123,9 +123,11 @@ const obj = { [mdn-primitives]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive ## Naming A Function - Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. - - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade - - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. The longer the name is, the harder it get to remember and the more space it take on the computer scree - - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. - - Pick one word per one concept and stick with it. For example, if you named getStudentName(), don't change get to retrieve like retrieveStudentGrade() when naming another function. - - Avoid using the same word for two purposes. For example, don't keep using add when you want to put a group of items to a collection. Use insert or append instead. + +Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. + +- Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade +- Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. The longer the name is, the harder it get to remember and the more space it take on the computer scree +- Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. +- Pick one word per one concept and stick with it. For example, if you named getStudentName(), don't change get to retrieve like retrieveStudentGrade() when naming another function. +- Avoid using the same word for two purposes. For example, don't keep using add when you want to put a group of items to a collection. Use insert or append instead. diff --git a/exercises/concept/lasagna-master/.docs/introduction.md b/exercises/concept/lasagna-master/.docs/introduction.md index 2d02133c34..c907e2fec0 100644 --- a/exercises/concept/lasagna-master/.docs/introduction.md +++ b/exercises/concept/lasagna-master/.docs/introduction.md @@ -124,9 +124,11 @@ const obj = { ## Naming A Function - Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. - - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade - - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. The longer the name is, the harder it get to remember and the more space it take on the computer screen. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. - - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. - - Pick one word per one concept and stick with it. For example, if you named `getStudentName()`, don't change `get` to `retrieve` like `retrieveStudentGrade()` when naming another function. - - Avoid using the same word for two purposes. For example, don't keep using `add` when you want to put a group of items to a collection. Use `insert` or `append` instead. + +Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. + +- Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade +- Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. The longer the name is, the harder it get to remember and the more space it take on the computer screen. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. +- Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. +- Pick one word per one concept and stick with it. For example, if you named `getStudentName()`, don't change `get` to `retrieve` like `retrieveStudentGrade()` when naming another function. +- Avoid using the same word for two purposes. For example, don't keep using `add` when you want to put a group of items to a collection. Use `insert` or `append` instead. From 198dc44af80ceb6f889a8c5e03563d7b1e1eae3a Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Thu, 10 Mar 2022 10:54:43 +0630 Subject: [PATCH 07/19] created PROGRAMMING_TIPS.md --- docs/PROGRAMMING_TIPS.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 docs/PROGRAMMING_TIPS.md diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md new file mode 100644 index 0000000000..f3f57c7964 --- /dev/null +++ b/docs/PROGRAMMING_TIPS.md @@ -0,0 +1,24 @@ +## Naming A Function + +Naming a function is as important as writing codes. +A function name is important to be clear and precise. +Consider the following recommendations when you name your function. + +- Choose meaningful words. + When you name your function, you should be clear on what it does. + On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. + Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade. +- Don't make the name too short or too long. + It is good to be clear and precise but take care not to make too long name. + `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. + The longer the name is, the harder it get to remember and the more space it takes on the computer screen. + On the other hand. making the name too short will also cause confusion. + `checkFPMD(mark)` is an example of the bad shortened name because when another programmer look at the function, he would get confused by what 'FPMD' mean. +- Use the name that everyone understand. + Your function name should be understandable by everyone who read your code. + For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. +- Pick one word per one concept and stick with it. + For example, if you named getStudentName(), don't change get to retrieve like retrieveStudentGrade() when naming another function. +- Avoid using the same word for two purposes. + For example, don't keep using 'add' when you want to put a group of items to a collection. + Use 'insert' or 'append' instead. From 0510aaf79c0b1a604444bd492f94a9b23af9f10c Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Thu, 10 Mar 2022 10:55:20 +0630 Subject: [PATCH 08/19] removed 'naming function' content --- concepts/functions/introduction.md | 10 ---------- .../concept/lasagna-master/.docs/introduction.md | 11 ----------- 2 files changed, 21 deletions(-) diff --git a/concepts/functions/introduction.md b/concepts/functions/introduction.md index 7d813d6e78..5af190ad18 100644 --- a/concepts/functions/introduction.md +++ b/concepts/functions/introduction.md @@ -121,13 +121,3 @@ const obj = { [concept-callbacks]: /tracks/javascript/concepts/callbacks [concept-arrays]: /tracks/javascript/concepts/arrays [mdn-primitives]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive - -## Naming A Function - -Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. - -- Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade -- Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. The longer the name is, the harder it get to remember and the more space it take on the computer scree -- Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. -- Pick one word per one concept and stick with it. For example, if you named getStudentName(), don't change get to retrieve like retrieveStudentGrade() when naming another function. -- Avoid using the same word for two purposes. For example, don't keep using add when you want to put a group of items to a collection. Use insert or append instead. diff --git a/exercises/concept/lasagna-master/.docs/introduction.md b/exercises/concept/lasagna-master/.docs/introduction.md index c907e2fec0..2ef177a752 100644 --- a/exercises/concept/lasagna-master/.docs/introduction.md +++ b/exercises/concept/lasagna-master/.docs/introduction.md @@ -121,14 +121,3 @@ const obj = { [concept-arrays]: /tracks/javascript/concepts/arrays [concept-callbacks]: /tracks/javascript/concepts/callbacks [mdn-primitives]: https://developer.mozilla.org/en-US/docs/Glossary/Primitive - - -## Naming A Function - -Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. - -- Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade -- Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. No one like a name too long. The longer the name is, the harder it get to remember and the more space it take on the computer screen. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. -- Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. -- Pick one word per one concept and stick with it. For example, if you named `getStudentName()`, don't change `get` to `retrieve` like `retrieveStudentGrade()` when naming another function. -- Avoid using the same word for two purposes. For example, don't keep using `add` when you want to put a group of items to a collection. Use `insert` or `append` instead. From 78dbdef9f8d6341e4f5aa700fa0e9339a6c77859 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Thu, 10 Mar 2022 11:01:47 +0630 Subject: [PATCH 09/19] fixed formatting --- docs/PROGRAMMING_TIPS.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index f3f57c7964..8b22de038b 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -7,7 +7,8 @@ Consider the following recommendations when you name your function. - Choose meaningful words. When you name your function, you should be clear on what it does. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. - Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade. + Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. + It will return the student grade. - Don't make the name too short or too long. It is good to be clear and precise but take care not to make too long name. `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. From 3e2fe3a5749e324f082734bb19cf0eb74e4b24d0 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:11:09 +0630 Subject: [PATCH 10/19] Update docs/PROGRAMMING_TIPS.md Co-authored-by: Joshua <62268199+minimalsm@users.noreply.github.com> --- docs/PROGRAMMING_TIPS.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index 8b22de038b..cc76cce20a 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -18,8 +18,10 @@ Consider the following recommendations when you name your function. - Use the name that everyone understand. Your function name should be understandable by everyone who read your code. For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. -- Pick one word per one concept and stick with it. - For example, if you named getStudentName(), don't change get to retrieve like retrieveStudentGrade() when naming another function. +### Pick one convention for naming operations + +Stick to one convention for naming operations that do the same thing. +For example, if you name the function to get a student's name `getStudentName()`, you should not use a different verb in the function name to get a student's grade (e.g. `retrieveStudentGrade()`). - Avoid using the same word for two purposes. For example, don't keep using 'add' when you want to put a group of items to a collection. Use 'insert' or 'append' instead. From 88e71dfefb8832487e3a729f80b39aeb0160bc64 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:11:20 +0630 Subject: [PATCH 11/19] Update docs/PROGRAMMING_TIPS.md Co-authored-by: Joshua <62268199+minimalsm@users.noreply.github.com> --- docs/PROGRAMMING_TIPS.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index cc76cce20a..5f5fdfd454 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -22,6 +22,7 @@ Consider the following recommendations when you name your function. Stick to one convention for naming operations that do the same thing. For example, if you name the function to get a student's name `getStudentName()`, you should not use a different verb in the function name to get a student's grade (e.g. `retrieveStudentGrade()`). -- Avoid using the same word for two purposes. - For example, don't keep using 'add' when you want to put a group of items to a collection. - Use 'insert' or 'append' instead. +### Avoid using the same word for two purposes + +For example, don't keep using 'add' when you want to put a group of items into a collection. +Use 'insert' or 'append' instead. From 4ab1fa2e0b2eacedb7591af02d551ec49ecdf5de Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:11:51 +0630 Subject: [PATCH 12/19] Update docs/PROGRAMMING_TIPS.md Co-authored-by: Joshua <62268199+minimalsm@users.noreply.github.com> --- docs/PROGRAMMING_TIPS.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index 5f5fdfd454..37ce5f6b66 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -15,9 +15,11 @@ Consider the following recommendations when you name your function. The longer the name is, the harder it get to remember and the more space it takes on the computer screen. On the other hand. making the name too short will also cause confusion. `checkFPMD(mark)` is an example of the bad shortened name because when another programmer look at the function, he would get confused by what 'FPMD' mean. -- Use the name that everyone understand. - Your function name should be understandable by everyone who read your code. - For example, don't use `DeathStar()` when you write delete item function. Use `deleteItem()` instead. +### Use the name that everyone understands. + +Your function name should be understandable by everyone who reads your code. +For example, an obscure function name like `DeathStar()` might be amusing to you, but the name doesn't communicate its purpose. + ### Pick one convention for naming operations Stick to one convention for naming operations that do the same thing. From c27461fbc4a0eeca3b3d0f4e793dbdeb5ce94f05 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:12:17 +0630 Subject: [PATCH 13/19] Update docs/PROGRAMMING_TIPS.md Co-authored-by: Joshua <62268199+minimalsm@users.noreply.github.com> --- docs/PROGRAMMING_TIPS.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index 37ce5f6b66..a88f200733 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -9,12 +9,16 @@ Consider the following recommendations when you name your function. On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. It will return the student grade. -- Don't make the name too short or too long. - It is good to be clear and precise but take care not to make too long name. - `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an example of a unneccessarily long function name. - The longer the name is, the harder it get to remember and the more space it takes on the computer screen. - On the other hand. making the name too short will also cause confusion. - `checkFPMD(mark)` is an example of the bad shortened name because when another programmer look at the function, he would get confused by what 'FPMD' mean. +### Don't make the function name too long + +Take care not to make a function name too long. +For example, `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an unnecessarily long function name. +The longer the name is, the harder it gets to remember and the more space it takes on the computer screen. + +### Don't make the function name too short +Conversely, making a function name too short can also confuse readers. +For example, `checkFPMD(mark)` is a bad function name as it isn't immediately obvious what 'FPMD' means. + ### Use the name that everyone understands. Your function name should be understandable by everyone who reads your code. From c76c2716042f3c39efc5daff63be9a6d30fb98f1 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:14:04 +0630 Subject: [PATCH 14/19] Update docs/PROGRAMMING_TIPS.md Co-authored-by: Joshua <62268199+minimalsm@users.noreply.github.com> --- docs/PROGRAMMING_TIPS.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index a88f200733..bb715c8618 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -4,11 +4,13 @@ Naming a function is as important as writing codes. A function name is important to be clear and precise. Consider the following recommendations when you name your function. -- Choose meaningful words. - When you name your function, you should be clear on what it does. - On Function name `get(studentId, subject)`, you can't tell what it is geting mark for or what it is getting or whether it is getting Studnet name or Age or their marks. - Function `getStudentGrade(studentId, subject)` told you everything you need to know about what it does. - It will return the student grade. +### Choose meaningful function names + +When you name your function, you should be clear on what it does. +For example, the function `get(studentId, subject)` doesn't have a meaningful function name, and therefore, it is not clear what it does. +It might be getting the student's subject grade or getting their enrollment status. +A better name would be `getStudentGrade(studentId, subject)`, as it precisely communicates what the function does. + ### Don't make the function name too long Take care not to make a function name too long. From ba6141dba2e3ee64c69d4e4c1fb002e4980b27f0 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:14:16 +0630 Subject: [PATCH 15/19] Update docs/PROGRAMMING_TIPS.md Co-authored-by: Joshua <62268199+minimalsm@users.noreply.github.com> --- docs/PROGRAMMING_TIPS.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index bb715c8618..c425b69138 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -1,7 +1,6 @@ ## Naming A Function -Naming a function is as important as writing codes. -A function name is important to be clear and precise. +Picking good function names is an essential part of writing good code. Consider the following recommendations when you name your function. ### Choose meaningful function names From 086e46a5ca818cd357224aa2bddb9bf4918a3aec Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:18:59 +0630 Subject: [PATCH 16/19] Update PROGRAMMING_TIPS.md --- docs/PROGRAMMING_TIPS.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index c425b69138..3b5ba29891 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -10,7 +10,7 @@ For example, the function `get(studentId, subject)` doesn't have a meaningful fu It might be getting the student's subject grade or getting their enrollment status. A better name would be `getStudentGrade(studentId, subject)`, as it precisely communicates what the function does. -### Don't make the function name too long +### Don't make the function name too long Take care not to make a function name too long. For example, `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an unnecessarily long function name. @@ -23,13 +23,14 @@ For example, `checkFPMD(mark)` is a bad function name as it isn't immediately ob ### Use the name that everyone understands. Your function name should be understandable by everyone who reads your code. -For example, an obscure function name like `DeathStar()` might be amusing to you, but the name doesn't communicate its purpose. +For example, an obscure function name like `DeathStar()` might be amusing to you, but the name doesn't communicate its purpose and can cause confusion for other developers who read your code. ### Pick one convention for naming operations Stick to one convention for naming operations that do the same thing. For example, if you name the function to get a student's name `getStudentName()`, you should not use a different verb in the function name to get a student's grade (e.g. `retrieveStudentGrade()`). + ### Avoid using the same word for two purposes -For example, don't keep using 'add' when you want to put a group of items into a collection. -Use 'insert' or 'append' instead. +For example, don't keep using `add` when you want to put a group of items into a collection if you already named it on a addition of two numbers. +Use `insert` or `append` instead. From 55c666a8e00601f098b1fb3363965b245326c747 Mon Sep 17 00:00:00 2001 From: Aung Myat Thu Date: Fri, 10 Jun 2022 00:24:14 +0630 Subject: [PATCH 17/19] formatted document --- docs/PROGRAMMING_TIPS.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index 3b5ba29891..7e513ea1ce 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -1,36 +1,37 @@ ## Naming A Function -Picking good function names is an essential part of writing good code. -Consider the following recommendations when you name your function. +Picking good function names is an essential part of writing good code. +Consider the following recommendations when you name your function. ### Choose meaningful function names -When you name your function, you should be clear on what it does. -For example, the function `get(studentId, subject)` doesn't have a meaningful function name, and therefore, it is not clear what it does. -It might be getting the student's subject grade or getting their enrollment status. +When you name your function, you should be clear on what it does. +For example, the function `get(studentId, subject)` doesn't have a meaningful function name, and therefore, it is not clear what it does. +It might be getting the student's subject grade or getting their enrollment status. A better name would be `getStudentGrade(studentId, subject)`, as it precisely communicates what the function does. ### Don't make the function name too long -Take care not to make a function name too long. -For example, `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an unnecessarily long function name. +Take care not to make a function name too long. +For example, `checkStudentFailOrPassOrMeritOrDistinction(mark)` is an unnecessarily long function name. The longer the name is, the harder it gets to remember and the more space it takes on the computer screen. ### Don't make the function name too short -Conversely, making a function name too short can also confuse readers. + +Conversely, making a function name too short can also confuse readers. For example, `checkFPMD(mark)` is a bad function name as it isn't immediately obvious what 'FPMD' means. -### Use the name that everyone understands. +### Use the name that everyone understands. -Your function name should be understandable by everyone who reads your code. +Your function name should be understandable by everyone who reads your code. For example, an obscure function name like `DeathStar()` might be amusing to you, but the name doesn't communicate its purpose and can cause confusion for other developers who read your code. ### Pick one convention for naming operations -Stick to one convention for naming operations that do the same thing. -For example, if you name the function to get a student's name `getStudentName()`, you should not use a different verb in the function name to get a student's grade (e.g. `retrieveStudentGrade()`). +Stick to one convention for naming operations that do the same thing. +For example, if you name the function to get a student's name `getStudentName()`, you should not use a different verb in the function name to get a student's grade (e.g. `retrieveStudentGrade()`). ### Avoid using the same word for two purposes -For example, don't keep using `add` when you want to put a group of items into a collection if you already named it on a addition of two numbers. +For example, don't keep using `add` when you want to put a group of items into a collection if you already named it on a addition of two numbers. Use `insert` or `append` instead. From b288d8b956043190f8104cc39d7be973664a9920 Mon Sep 17 00:00:00 2001 From: junedev <12543047+junedev@users.noreply.github.com> Date: Fri, 10 Jun 2022 20:54:05 +0200 Subject: [PATCH 18/19] add h1 title --- docs/PROGRAMMING_TIPS.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/PROGRAMMING_TIPS.md b/docs/PROGRAMMING_TIPS.md index 7e513ea1ce..9fd443f3f4 100644 --- a/docs/PROGRAMMING_TIPS.md +++ b/docs/PROGRAMMING_TIPS.md @@ -1,3 +1,5 @@ +# Programming Tips + ## Naming A Function Picking good function names is an essential part of writing good code. From 9b65244f98b8ca80cb21902eb3be28e4bd24f572 Mon Sep 17 00:00:00 2001 From: junedev <12543047+junedev@users.noreply.github.com> Date: Fri, 10 Jun 2022 20:54:11 +0200 Subject: [PATCH 19/19] add config entry --- docs/config.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/config.json b/docs/config.json index 6e18069b6b..2439a919d6 100644 --- a/docs/config.json +++ b/docs/config.json @@ -34,6 +34,13 @@ "path": "docs/ROADMAP.md", "title": "Roadmap & Concept List", "blurb": "Priorities for future development of the JavaScript track" + }, + { + "uuid": "eef6eca6-6ee8-4ab5-a97a-3e8eb7785c7e", + "slug": "tips", + "path": "docs/PROGRAMMING_TIPS.md", + "title": "Programming Tips", + "blurb": "General tips on how to write good code" } ] }