lab-brussels-1 / home

Home repository for Lab Brussels 1.
https://lab-brussels-1.github.io/home
MIT License
4 stars 5 forks source link

Cristobal: separation-of-concerns, 3 weeks #369

Open alexander-lopez-s opened 1 year ago

alexander-lopez-s commented 1 year ago

Learning Objectives

Priorities: πŸ₯š, 🐣, πŸ₯, πŸ” (click to learn more)
There is a lot to learn in this repository. If you can't master all the material at once, that's expected! Anything you don't master now will always be waiting for you to review when you need it. These 4 emoji's will help you prioritize your study time and to measure your progress: - πŸ₯š: Understanding this material is required, it covers the base skills you'll need to move on. You do not need to finish all of them but should feel comfortable that you could with enough time. - 🐣: You have started all of these exercises and feel you could complete them all if you just had more time. It may not be easy for you but with effort you can make it through. - πŸ₯: You have studied the examples and started some exercises if you had time. You should have a big-picture understanding of these concepts/skills, but may not be confident completing the exercises. - πŸ”: These concepts or skills are not necessary but are related to this module. If you are finished with πŸ₯š, 🐣 and πŸ₯ you can use the πŸ” exercises to push yourself without getting distracted from the module's main objectives. ---
alexander-lopez-s commented 1 year ago

Week 1

I Need Help With:

a) Previous lesson was hard to understand, the topics are getting too complex that I cannot understand by myself with internet searches. Unfortunately I do not have any friend who knows JS and who can come to help me personally during the week.

What went well?

a) I was able to understand a little bit deeper what DOM manipulation is. I created a file with possible scenarios using DOM.

//QUERY SELECTOR//

//styling the border of an element//
let header = document.querySelector("#main-header");
header.style.borderBottom = "solid 4px #cccc";

//changing the predefined text in a field//
let input = document.querySelector("input");
input.value = "Hello world";

//changing the text in a button//
let submit = document.querySelector("input[type=β€œsubmit”]");
submit.value = "send";

//changing the color of the elements in a list//
let item = document .querySelector(".list-group-item");
item.style.color = "red";

//chaning the color of the last item in a list//
let lastItem = document.querySelector(".list-group-item:last-child");
lastItem.style.color = "coral";

//QUERY SELECTALL//

//changing the title text using index//
let titles = document.querySelectorAll(".title");
titles[0].textContebt = "hello";

//styling the items in a list in an intercalated way//
let odd = document.querySelectorAll("li:nth-child(odd)");
for (let i = 0; i < odd.length; i++) {
odd[i].style.backgroundColor = "#f4f4f4";
even[i].style.backgroundColor = "#ccc";
}

//EVENT LISTENERS//
//Syntax = element.addEventListener(event, function, useCapture);

//Click event - replacing the HTML text and changing the color of a div//
let myParagraph = document.getElementById("myP");
let myDiv = document.getElementById("myDiv");

myParagraph.addEventListener("click",changeText);

function changeText() {
myParagraph.textContent = "Hello world";
myDiv.style.background = "lightBlue";
}

b) I can connect my HTML files to the query selector.

What went less well?

a) I tried describing programs to understand the event listeners/handlers but I failed to do so, the code in Study lenses is too complex.

b) I am still confused with parameters and arguments sadly.

Lessons Learned

a) I gained a little bit more of confidence with DOM. b) Made a map to understand the logic in Study lenses but I am still confused. IMG_5357

Sunday Prep Work

a) Will try reviewing previous topics, I feel stagnant with the current module.

danielhalasz commented 1 year ago

I Need Help With:

hopefully the call yesterday helped to clear up most of the topics.

danielhalasz commented 1 year ago

b) I can connect my HTML files to the query selector.

what do you mean by this?

danielhalasz commented 1 year ago

a) I tried describing programs to understand the event listeners/handlers but I failed to do so, the code in Study lenses is too complex.

which programs have you tried to describe and how? you should not be looking at the code of study-lenses..it is just a tool that you can use for studying JS in the browser..but do not need to understand how it works.

danielhalasz commented 1 year ago

b) I am still confused with parameters and arguments sadly.

these terms are sometimes used interchangibly.. basically it just means that you can pass input values to a function..to make the function more useful and not always return the same result..but instead have results based on the input..

const myFunc = (myParam) => {
   console.log(myParam);
}

and then call the function:

myFunc(123);
myFunc('hello');
danielhalasz commented 1 year ago

b) Made a map to understand the logic in Study lenses but I am still confused.

again, study-lenses is just a tool..I assume you are talking about the content of the repo here..

you can look at this example, to see how it can be built up step by step: https://github.com/HackYourFutureBelgium/separation-of-concerns/tree/master/3-stepped/1-single-interaction/mouse-coordinates

DOM structure => styles => listeners => handlers => utils

alexander-lopez-s commented 1 year ago

Week 2

I Need Help With:

a) How are event handlers and event listeners related? Do we have a basic example? b) Do we mandatorily need both events in our programs?

What went well?

a) As a general idea, I understand that an event listener waits and responds for the click or any action performed by the user and the event handler holds the call-back function that is being called by the event listener. Utilities hold all the variables in the program. Correct me if I am wrong please. b) I was able to work on the design and skeleton of our Separation of Concerns project. c) I practiced DOM, specifically mouseover and mouseleave functions.

What went less well?

a) I got confused in this module, very very confused. I cannot separate my JS code in different files, I loose direction.

b) I tried drawing another mind-map of how files are related but I cannot understand the link between them yet.

Lessons Learned

a) I am more confident with DOM in general.

Sunday Prep Work

a) Will try reviewing previous topics, I feel stagnant with the current module.

alexander-lopez-s commented 1 year ago

Week 3

I Need Help With:

a) What is the difference between "utils" and "components"? b) If new functions are added to an existing program, do we need to create more folders with more JS files or can we just add them to the existing listeners/handlers/constants, etc?

What went well?

a) Was able to understand how to breakdown a piece of code. b) Finally I understand that "parameters" are variable names and "arguments" are their corresponding values. (A YouTuber made that quotation). c) In data roles we have the state and the constants and in the function roles we have:

d) I can create HMTL elements from JS using document.createElement() andinsertAdjacentHTML()

What went less well?

a) This is so far the most complex topic from all the course. I really need to review the whole topic. b) I get confused with complex programs, it is better to practice with easy basic functions.

Lessons Learned

a) At least I can breakdown small easy programs. b) I am a little bit more confident than previous week with DOM.

Sunday Prep Work

a) I will check the video that Daniel sent Help I'm stuck in an event loop.