Skip to content

Fire - Madeline #49

Open
made-line wants to merge 4 commits into
Ada-C14:masterfrom
made-line:master
Open

Fire - Madeline #49
made-line wants to merge 4 commits into
Ada-C14:masterfrom
made-line:master

Conversation

@made-line

Copy link
Copy Markdown

Assignment Submission: JS Adagrams

Congratulations! You're submitting your assignment. Please reflect on the assignment with these questions.

Reflection

Prompt Response
What patterns were you able to use from your Ruby knowledge to apply to JavaScript? Arrays and certain methods such as findIndex and split.
Did you need to use different strategies to find information online about JavaScript than you would for Ruby? With JavaScript, I need to look at multiple sources beyond just the official language documentation. I've been using multiple sources (e.g., MDN and Medium) after getting a general idea from StackOverflow.
What was something you needed to do independent research on for this project? What did you learn? How to shuffle an array. I learned about the Fisher-Yates Algorithm.
What was a challenge you were able to overcome on this assignment? Shuffling an array.
What has been interesting and positive about learning a new programming language? Seeing how similar methods in Ruby and JavaScript are used differently. For example, the findIndex method takes in a callback function as a parameter. In Ruby, the find_index parameters can be a block or element from the array.
What is something to focus on your learnings in JavaScript in the next week? Getting more comfortable with arrow functions and loops.

@beccaelenzil beccaelenzil left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JS Adagrams

Major Learning Goals/Code Review

Criteria yes/no, and optionally any details/lines of code to reference
Correctly uses variables, and only uses const and let variables. The program prefers const variables. The program never uses var. ✔️
Practices best-practices in JavaScript syntax. There are semi-colons at the end of most lines that need semi-colons. Variables and functions are named with camelCase. ✔️
Correctly creates and calls functions within an object with proper syntax (parameters, return statements, etc.) ✔️
Uses correct syntax for conditional logic and iteration ✔️
Practices git with at least 3 small commits and meaningful commit messages ✔️
Utilizes unit tests to verify code; tests can run using the command $ npm test test/adagrams.test.js and we see test successes and/or failures ✔️

Functional Requirements

Functional Requirement yes/no
For the drawLetters function, there is an appropriate data structure to store the letter distribution. (You are more likely to draw an 'E' than an 'X'.) See in-line comment
Utilizes unit tests to verify code; all tests for drawLetters and usesAvailableLetters pass ✔️
Utilizes unit tests to verify code; all tests for scoreWord pass ✔️
Utilizes unit tests to verify code; all tests for highestScoreFrom pass ✔️ Not required

Overall Feedback

Great work on this project! In this project you’ve taken some interesting logic and worked it into JavaScript syntax. Your code is clear and readable. Take a look at the in-line comments for some suggestions on how to DRY up you code. Keep up the hard work!

Overall Feedback Criteria yes/no
Green (Meets/Exceeds Standards) 5+ in Code Review && 3+ in Functional Requirements ✔️

Code Style Bonus Awards

Was the code particularly impressive in code style for any of these reasons (or more...?)

Quality Yes?
Perfect Indentation
Elegant/Clever
Descriptive/Readable
Logical/Organized

Comment thread src/adagrams.js
@@ -1,6 +1,139 @@
const Adagrams = {
lettersDistribution: [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This data structure works, but it's not very DRY and would be tricky to change. For example, suppose I said you had the wrong number of "I"s - you would have to do a lot of counting to solve the problem.

Instead you might store a hash of letter frequencies like this

letterQuantities: {
  A: 9, B: 2, ...
}

Comment thread src/adagrams.js

wordByLetter.forEach(letter => {
switch (letter) {
case 'A':

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider how storing the score for each letter in an object with the letter as the key, and the score as a value could DRY up this code.

Comment thread src/adagrams.js
return this.lettersDistribution.slice(0, 10);
},

usesAvailableLetters(input, lettersInHand) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work working through this logic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants