gisaac85 / hyf-javascript3

JavaScript3 Homewrok
1 stars 0 forks source link

Feedback homework week 1 #1

Closed remarcmij closed 6 years ago

remarcmij commented 6 years ago

Hi Isaac, here is my feedback on your homework for week 1.

Just running your code reveals that it meets the stated functional requirements. From that perspective: well done!

However, when looking at your code I am less pleased. I see a single, large function, called populateSelect. Of course, this function does far more than populate the <select> element. It contains all of your program (apart from the createAndAppend() function). This is not the way to write programs in general. It is not good enough that your program is working. It must also be readable and maintainable by humans. Take into consideration that in real life the programs that you write must be maintained by others, perhaps long time after you have switched jobs. All the maintainer then has is your source code to work with. Conversely, you may have to maintain software that somebody else wrote. In that case you would hope for code that is readable, well organized and easy to grasp.

The assignment requires you to write a function called fetchJSON():

Write a function called fetchJSON (or copy from the lecture code) which accepts (at least) the following parameters: url and callback.

I don't see that in your code.

It also stated:

Make your functions small and reusable (modular)! That means create separate functions to handle certain steps.

Again, this is also not done.

I completed a write-up today on this topic and posted it in slack: https://gist.github.com/remarcmij/57101c1107f2bd479a162b18a1e7ae01

Your code could benefit from restructuring using the principles discussed in this document. This restructuring would also help making the changes required in week 2 and week 3. I would recommend to make these changes before starting with the week 2 homework.

Note: although your program is relatively small and therefore not too difficult to oversee, it is important to always apply the same rigorous style of writing code using the stated principles.

gisaac85 commented 6 years ago

Good evening Jim. Ja i know that my code is one function and it must be multi function to be more readable and cover all requirements that you mentioned them. I am now really busy with changing my code and i understand that i must make week2 promises depending on good readable functional callback code. Again thanks Jim...💐💐