Hi reader, I decided to write about the experiences that I gained and what I learned in the PowerCoders bootcamp. It is the first time that I participated in an IT course. For this reason I thought it would be nice to have an article that I can look back to in the future :)
In the bootcamp we started to learn CLI. Luckily I had a bit of knowledge :D. We continued to learn the basics of git&github. I uploaded some repositories on github before but with teammates it was different than working alone. Together we experienced some of the most common conflicts and errors. In the last day of the week Densy, Anna and me created a small game on CLI. Game is here. It was our first experience of creating something together and presenting it.
We started the week with HTML-101. After a quick look at the terminology and history, we learned common HTML tags and elements.
There were basic rules and hierarchies that we needed to know when we started. I think the most important thing to remember here
was that I should use semantic tags as much as possible instead of div div div :) There was also something I knew wrong: I must
choose the tag which is best describing my content. For example, I used the <h1> tag
only for large fonts... I put some examples and exercises from the second week below.
An example navigation bar:
<nav>
<ul>
<li><a href="#">a</a></li>
<li><a href="#">few</a></li>
<li><a href="#">links</a></li>
</ul>
</nav> An example form:
<fieldset>
<legend>Contact Details</legend>
<label for="first-name">First name *</label>
<input type="text" id="first-name" name="fname" required>
<label for="last-name">Last name *</label>
<input type="text" id="last-name" name="lname" required>
<label for="email">Email Address *</label>
<input type="email" id="email" name="email" required>
<button type="submit">Submit</button>
</fieldset> A question that asks us to predict what the outcome will be:
<style>
p {
color: rgb(255, 255, 255);
background-color: rgb(0, 0, 0);
text-decoration: none;
border: 1px solid rgb(0, 0, 0);
}
p.info {
background-color: rgba(0, 0, 255, 0.5);
text-decoration: underline;
padding: 1em;
}
</style>
Answer: p.info is higher because it has two hits.
After the Easter holidays we continued with CSS - Box Model & Layout techniques and programming 101.
Especially on CSS we needed to pay attention to best practices because later it will be easier to configure responsive or ensure 3rd party plugins and all browsers styled correctly.
Below is my fantastic sticky footer exercise which I made during the lesson :)
Another example for footer with grid:
/* min-width 1025px */
@media only screen and (min-width: 64.063em) {
footer {
grid-template-areas: "nav nav h3 h3"
"nav nav p p"
"address address address address";
width: 100%;
}
footer div {
width: auto;
}
footer nav {
grid-area: nav;
}
footer > h3 {
grid-area: h3;
}
footer p {
grid-area: p;
}
footer address {
grid-area: address;
}
} During introduction to programming we learned about How to think like a programmer?, How to solve problems? and The process to write a program.
Pseudocode is a plain language description of the steps in an algorithm or another system. Pseudocode often uses structural conventions of a normal programming language, but is intended for human reading rather than machine reading. [Wikipedia]
Sample pseudo code exercise:
#QUESTION
Darkness phobia
One family wants to get through a tunnel. Dad can make it in 1 minute,
mama in 2 minutes, son in 4 and daughter in 5 minutes. Unfortunately,
not more than two persons can go through the narrow tunnel at one time,
moving at the speed of the slower one.
Can they all make it to the other side if they have a torch that lasts
only 12 minutes and they are afraid of the dark?
#ANSWER
Solution:
speeds = person1 1, person2 2, person3 4, person4 5
locationA = 0
locationB = 0
sendlimit <= 2
returnLimit <= 1
walkingSpeed = slowest
maxTime = 12
torch = True
time = 0
check()
if time <= maxTime
raise Exception
updateTime(person_time_a, person_time_b)
time += max(person_time_a, person_time_b)
count(args)
lengthArgs = [args]
return lengthArgs
control()
if updateTime() and (locationA == 0 and locationB == 4)
return True
# They are the fastest
Send person1 + person2 from location A to location B
if updateTime(person1, person2)
locationB += count(person1,person2)
locationA -= count(person1,person2)
# Because we need person1 for last step
Return person2 from location B to location A
if updateTime(person2)
locationB -= count(person2) && locationA += count(person2)
# Person3 and Person4 have highest value
Send Person3 + Person4 from location A to location B
if updateTime(person3 + person4)
locationA -= count(person3,person4) && locationB += count(person3, person4)
# Person1 has a minimum value
Return Person1 from location B to location A
if updateTime(person1)
locationB -= count(person1) && locationA += count(person1)
# They are the last persons
Send Person1 + person2 from location A to location B
if updateTime(person1 + person2)
locationA += count(person1 + person2) locationB -= count(person1, person2)
if control() then "WIN"
We started the fourth week with an introduction to JS. After taking a look at the history of JS, we learned why we need it, possible use cases and how to implement it. Basically with JavaScript, we make the websites interactive. Some of the most common use cases are:
Indicate in JavaScript what types of value are possible and which kind of operations: Number, String, Boolean, Undefined, Null, Symbol (new in ES6), Object.
An example exercise of the first day:
// Exercises 3
// Printing quotes
// Create a program that prompts for a quote and an author.
// Display the quotation and author as shown here:
// [Author] says, "[Quote]"
var author = prompt("Author name:")
var quote = prompt("Quote: ")
alert(`${author} says, "${quote}"`) Loops are used in JavaScript to perform repeated tasks based on a condition. Conditions typically return true or false. A loop will continue running until the defined condition returns false.
for (let i = 0; i <= 20; i++)
{
if (i%2 == 0)
{
console.log(`${i} is even`)
} else {
console.log(`${i} is odd`)
}
} A JavaScript function is a block of code designed to perform a particular task. A JavaScript function is executed when "something" invokes it (calls it).
In JavaScript, an object is a standalone entity, with properties and type. Compare it with a cup, for example. A cup is an object, with properties. A cup has a color, a design, weight, a material it is made of, etc. The same way, JavaScript objects can have properties, which define their characteristics.
Document Object Model that allows programs and scripts to dynamically access and update the content, structure, and style of a document.
Events are notable things in the DOM that JavaScript detects and can react to. When an event occurs on a target element, a handler is executed. Events are an essential part of a dynamic website.
This JavaScript project is aimed at putting into practice the basics we learned this week.
At the beginning of this week, we repeated parts of what we have learned last week. We also learned some new things like algorithms, classes, prototypal inheritance, arrays and objects. Most important were the best practices of DOM and what can be the consequences of wrong use e.g. XSS :).
What an algorithm is: An algorithm is a step-by-step set of operations that need to be performed. If you take an algorithm and write code to perform those operations, you end up with a computer program.
Different types of programming:
Exercises of Day / Retirement Calculator:
var age = +prompt("What is your age? ")
var retiredAge = +prompt("At what age would you like to retire? ")
if ((isNaN(age) || isNaN(retiredAge)) || (age < 0 || retiredAge < 0)){
console.log("Inputs are not valid")
} else if (age >= retiredAge) {
console.log("Age cannot be smaller than retire age")
} else {
var currentYear = new Date().getFullYear()
var retire = retiredAge - age
console.log(`You have ${retire} years left until you can retire.\nIt's ${currentYear}, so you can retire in ${currentYear + retire}`)
} What is an object:
What is an array:
let topics = ["HTML","CSS","JS"];Exercises of day / Choices:
var choices = []
for (let i = 0; i <= 2; i++)
choices.push(prompt("Enter your choices: "))
console.log(`My 1st choice: ${choices[0]}, My 2st choice: ${choices[1]}, My 3st choice: ${choices[2]},`) Classes are templates for JavaScript objects. A newer notation for the object constructor function:
class Person {
constructor(name, age, married) {
this.name = name;
this.age = age;
this.isMarried = married;
}
hello() {
return "Hello " + this.name;
}
} Inheritance is a way to share common logic in programming:
class Animal {
constructor(name) {
this.name = name;
}
jump() { console.log(`${this.name} is jumping.`); }
}
class Bird extends Animal {
fly() { console.log(`${this.name} is flying.`); }
}
class Dog extends Animal {
bark() { console.log(`${this.name} says "Woof!"`); }
} With [] in your property name, you can put in dynamic values, like another variable or a calculation.
const name = "first name";
const obj = {
[name]: "Susanne",
[5 + 13]: 38,
experience: 13
}
DOM: Document Object Model — Anything found in an HTML or XML document can be accessed, changed, deleted, or added by a programmer using the DOM. The DOM of an HTML document can be represented as a nested set of boxes, called DOM Tree.
let elm = document.getElementById("demo");
let arr = elm.childNodes;
arr.forEach(function(el){
el.textContent = "new text";
}); JavaScript can be dangerous:
This code below is causing DOM XSS because it doesn't sanitize the user's input. Developers must always sanitize inputs and try to find more secure methods.
let urlDisplayElement = document.getElementById('urlDisplay');
let currentUrl = window.location;
urlDisplayElement.innerHTML = `Current url is: ${currentUrl}`
In the sixth week, we learned event AJAX and JSON, which are important parts of dynamic websites. In this area, I have to do some more exercises. In my final project, I used some AJAX and events features. They are really useful for dynamic website development.
Events are notable things in the DOM that JavaScript detects and can react to. When an event occurs on a target element, a handler is executed.
Common event types:
onclick — occurs when the user clicks on an elementonload — occurs when an object has loadedonunload — occurs once a page has unloaded (for body)onchange — occurs when the content of a form element changed (for input, select, textarea)onmouseover — occurs when the pointer is moved over an element or its childrenonfocus — occurs when an element gets focusonblur — occurs when an element loses focusWhat is the essential of javascript events? Sure, it is ToDo App :) I also created my ToDo app..
AJAX is a developer's dream, because you can:
Returns a promise: I promise to let you know when the response of my request is returned, then it returns a response with its own method json() to parse the response, then it returns an object with the data of your AJAX call.
fetch("https://jsonplaceholder.typicode.com/todos/1")
.then(response => response.json())
.then(data => console.log(data)); Exercises with event listeners: We created a background generator.
We are on the way to the interviews, time is running out :) I mainly focused on my final project and interview preparations. For this reason, I had to keep this week's blog a little short.
This is our last week of the Powercoders bootcamp. The time past really fast. It was nice to learn the fundamentals of frontend technologies. Some exercises were also challenging. Most of what I've learnt in the bootcamp I used in my final project. You can visit it here click on this. This week was our career day. We had two days off to have time for the interviews.
TLDR; Our some exercises are below.