teleren/devto huggingface dataset:
Welcome Thread - v152
Tags: welcome
Published: 2021-11-24 20:51:24

---
title: Welcome Thread - v152
published: true
description: Welcome to DEV! A thread of hellos and intros.
tags: welcome
canonical_url: 
---

![Buddy the elf saying hi](https://media.giphy.com/media/3otPoSyc3ty37iTKsU/giphy.gif)

### Welcome to DEV!

1. Leave a comment below to introduce yourself! You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment, either with a question or just a hello. 👋 

**Great to have you in the community!**
Assignment has a return value in JS
Tags: javascript, programming, tutorial
Published: 2021-11-24 20:47:33

```js
console.log(b=1) // 1
```

Because assignment has a return value, we are able to chain assignments.

```js
let a;
let b;

a = b = 1

console.log(a); // 1
console.log(b); // 1
```

Hard to read, but it works...

```js
let a = 1;
let b = 2;

let c = 3 - (a = b + 1);

console.log(a); // 3
console.log(c); // 0
```
Learning Card: Web Components
Published: 2021-11-24 20:33:12

##Web Components 

For this project, our group had to create a Learning Card utilizing web components. It utilizes three technologies (HTML, CSS, and JavaScript) to create custom elements that can be reused anywhere.
We had to think of different considerations for the different properties the learning card might have, as well as the states it can have and how easily customizable it can be .
Some of the main things to consider for this project are accessibility, responsiveness, customization and re-usability.

The Learning Card will contain multiple elements: a header, banner, icon, and body,

##Learning Points 
In  the process of completing this project, we are excited to learn the process of creating custom elements that can be used over and over again in different ways. It is also really nice to learn how to combine each individual custom element into a full card. Another learning point is the accessibility and responsiveness of the card. Learning how to implement action events  and various states for the various elements is a great way we hope to master some of the concepts shared in the class discussion. 

We are very excited about this project and hope to learn as much as we can about web components
State of my Cloud Journey: Nov 24, 2021
Tags: cloud, learning, careerchanger, jobsearch
Published: 2021-11-24 20:24:19

Bit of a late blog this week. I was deep into some coding until late last night, and then got absolutely _flattened_ by my body's immune response to the COVID booster I received around lunchtime. I went from fine to feeling sicker than I've been in a long time in the span of about five minutes. I'm taking a sick day from work today, and with two more days off for the Thanksgiving holiday, I have plenty of time to lay around and recover. Maybe I'll get some solid learning in, too!

This past week started with a whimper: some personal frustrations boiled over and I didn't get a whole lot done for a couple days. However, some long days on the tail end of the week helped me regain momentum.

#Learning Paths 📚

_CS50x_

I've been really enjoying this course. Like, _really_ enjoying it. It's hard - C is different enough from Python that it gives me fits sometimes - but I'm learning a lot and really wish I'd run across a course like this when I was an undergrad. I suspect I would have been hooked.

The big battle this week has been working to understand how code in C interacts with memory. The programming concepts are familiar (loops, arrays, etc.) but the way C handles types has taken some getting used to. Thankfully, the lecturer is fantastic and I have a good coding mentor to help me understand how to get past the rough patches. I'm certain this course, even though I'm not taking it for any sort of credit, will help me grow as a programmer.

_DevOps in the Cloud_

I got my first look at Ansible this week. Even though I didn't dig in particularly far, I can see how powerful a tool it is, and I'm really digging it. I am excited to see how it integrates with Terraform and Jenkins.

#Job Search 🔎

This past week's focus was moving forward in my learning, so I didn't make much progress on the job search front. My goal this week is to take a hard look at my resume and projects (thanks for the advice, Lou!) and try to make them more appealing and more demonstrative of my abilities.

_0 applications; 0 interviews; 1 rejection_

#Wrap-up 🍩

Today is probably going to be a wash, but a couple more days off gives me the opportunity to relax a bit and make some forward progress. I _really_ want to fix whatever is preventing me from getting interviews right now, because there seem to be plenty of open positions into which I can see myself fitting. Time to do work.

Onward and upward!
Styling your React Native Project
Tags: reactnative, javascript, help, beginners
Published: 2021-11-24 20:15:28

#Styling in React Native can be done in various ways. 
###Let's have a look at a few of the most common ones. 



The most *basic* way of styling is inline **JS** styles. 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7ueddc2cx46t2mold4lb.png)

You can also use **StyleSheets**, they are mostly used when you have a *large codebase* and styles that have to be used in more than one tag.

 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvs85yipgad5s1hd2y4a.png)
 


To integrate StyleSheet in the JSX tags, all you have to do is call them wherever needed
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q1fi90bvvqp72up5vbit.png)
 

>Personal tip...
>You can create a separate javascript file for your styles. It helps when you document your code
Learn JavaScript Generators Quickly
Tags: javascript, beginners, tutorial
Published: 2021-11-24 20:01:02

In this video we learn about JavaScript Generator functions.
This is a great introduction to generator functions. Generators are functions that can be exited and later re-entered. 

You will learn what the yield key word does. How a generator function suspends execution when yield is called also known as deferred execution. You can do fun things like make an infinite number generator. 

If you enjoy this video please subscribe, like and share.

{% youtube hd6QgeJW-Rc %}
Dependency Inversion Principle
Tags: programming, productivity, beginners, architecture
Published: 2021-11-24 19:50:33

> “The most flexible systems are those in which dependencies refer only to abstractions and not concretions”

An application is almost always comprised of some core business logic triggering real-world outcomes through a set of utilities. A report generator exporting to a spreadsheet or railway traffic system controlling stop-lights being two such examples.

The flow of control of a program is often from core logic to more specialized utilities, such as I/O.

If the source code dependencies flow in this same direction, however, it can result in tight coupling of business logic with lower-level concerns. As low-level implementations are likely to change often, this will be a source of volatility within an application.

To protect against volatility, we want any high-level concerns to depend on abstractions rather than concretions — that is, interfaces rather than implementations. Interfaces change much less frequently than their instantiations, and so referencing these will shield a client from uncertainty.

Of course, something has to know about the dirty detail of implementation, and that’s where dependency injection helps.

Rather than core logic knowing what to use directly, you inject it with “an implementation” ensuring the source is as ignorant as possible to those low-level concerns. The grubby wiring can be tucked away in a few key places, such as factories or dependency injection frameworks, e.g. Spring.

To conclude this principle, it’s worth reiterating a few points listed by Uncle Bob concerning the DIP:

* Don’t refer to volatile concrete classes.
* Don’t derive (inherit) from volatile concrete classes.
* Don’t override concrete functions.
* Never mention the name of anything concrete and volatile.

Originally published at [Better Programming](https://betterprogramming.pub/revisiting-solid-927e6a5202d3)
Interface Segregation Principle
Tags: programming, beginners, productivity, architecture
Published: 2021-11-24 19:48:16

> “No client should be forced to depend on methods it does not use”

Conceptually the simplest of the principles and one that is closely related to the SRP, the interface segregation principle is about finding the most appropriate abstractions in your code. The reason for this, is again, to protect against one avenue of change affecting other orthogonal ones.

Having to depend on an interface that has muddled concerns can lead to a lot of unwanted baggage. The bloat can leak into your code as you have to cater for cases you don’t care about. Upgrades come thick and fast but for features that you don’t use and with the risk that those changes will break those you do.

Overly complex interfaces are usually grown rather than designed. The slow drip feed of additional requirements, odd tweaks, and little hacks can snowball over the years to create a monster.

Strong interface and API design is an exercise in restraint. Cohesion is your guide here. Keep your interfaces cohesive, collecting together those concerns that change together, and free your clients from an extra burden.

Originally published at [Better Programming](https://betterprogramming.pub/revisiting-solid-927e6a5202d3)
Liskov Substitution Principle
Tags: programming, productivity, beginners, architecture
Published: 2021-11-24 19:45:42

> “If for each object o1 of type S, there is an object o2 of type T such that for all programs P defined in terms of T, the behavior of P is unchanged when o1 is substituted for o2 then S is a subtype of T”

Ouch! That’s a bit of a mouthful. Let’s forget the computer science-y language for a moment and focus on the core point. The Liskov substitution principle is all about doing inheritance well.

It tells us not to create subtypes that, despite conforming correctly at a contract level, diverge wildly from the true semantics creating some nasty surprises in the behavior of our program in the process.

The usual example used (and I’ll do no different through sheer laziness) is that of the square/rectangle problem. To begin, let’s say we have a type, `Rectangle`, with two methods `#setX` and `#setY` to assign the lengths of the two dimensions appropriately — so far so good.

Now, what if we create a subclass for the special case of a `Square` in which X and Y must always be equal?

If we have a program that uses `Rectangle`, and then all of a sudden we sneak in the `Square` subtype, things could get a bit strange when we call `#setX` and it changes Y too (or vice versa). The subtype has to make sense in the shadow of its parent.

This isn’t limited to just inheritance but also makes sense in ensuring the robustness of any interface, be it an API, REST call, or something else.

Substitution of any of these for another should be seamless, going unnoticed by any caller. If the client has to hack in a workaround to handle different implementations then we’ve botched the point of having a contract.

Respecting this principle, however, can often be quite difficult. Many interfaces aren’t quite as abstract as they really should be, leaking some implementation detail.

This is especially true when it comes to the things you may not always really consider, like exceptions.

To avoid setting this trap yourself, try and keep your interface declarations as simple as you possibly can — other developers will thank you.

Originally published at [Better Programming](https://betterprogramming.pub/revisiting-solid-927e6a5202d3)
Deploy to Railway
Published: 2021-11-24 19:19:01

# [Railway](https://railway.app?referralCode=IMAGINEEE)
> Bring your code,
we'll handle the rest.
Made for any language, for projects big and small. Railway is the cloud that takes the complexity out of shipping software.
Quote from [railway.app](https://railway.app?referralCode=IMAGINEEE)

# Deploy to Railway
As the quote suggests its an Deployment platform for any language and project from discord bots and cron jobs, to Rust Bassed web server and VS Code in the browser.

On top of that their first class support of databases from postgres, redis and monogo DB.

Their pricing model is also quite fine for me, at $5 a month on the free tier, and $10 if you verify with a payment card.

And lastly I just feel the whole platform feels home grown by a group of passionate developers rather than huge enterprise like Heroku.

So, Get started and Deploy to [Railway](https://railway.app?referralCode=IMAGINEEE)
Could you suggest me a PHP Learning Roadmap?
Tags: php, beginners, help, codenewbie
Published: 2021-11-24 19:13:35

I have been trying to learn PHP since the beginning of the year, without that much effort, tho. I have done the [Laracasts' PHP Practitioner](https://laracasts.com/series/php-for-beginners), but I couldn't follow many concepts, even though I have done a project based on it.
If you could suggest me where and how to begin, how to get intermediate and when to begin learning Laravel, I would be 
really thankful.
Don't become a full-stack developer in 6 months
Tags: beginners, programming
Published: 2021-11-24 19:12:54

For the past couple of years, most of the courses and tutorials promise a fairytale of becoming a full-stack developer in 2, 4, or 6 months but no one mentions the flaws with this strategy. So let's get into it.

## Skipping Core Concepts

Even though many of the courses offered online do try to teach the fundamental concepts of the ongoing topic. These concepts are hurriedly explained, and they directly try to move the learner to a framework because of which many developers have no idea about how things are working. The issue on hand might not seem like a problem at the time, but later on, while developing complex applications these concepts can/will come in handy, and not knowing these concepts cause many developers to lose faith in themselves and straight-up quit programming.

## The Tutorial Hell Circle

Before discussing this problem let's just define tutorial hell so we are on the same page. 

> Tutorial hell is when you continuously keep on watching tutorials one after another and so on and you feel like, you are learning a lot of things and building some good projects. As soon as you start doing something on your own, you get to know that you don't know anything.

So, why do these courses cause a tutorial hell circle? Well, because these courses are pushing the learner to learn multiple things at once and skipping multiple core concepts while teaching these technologies, moreover, the project-based courses convince the learner that he is doing well and learning new technologies at a good pace all while they hide a real-world element from the learner causing the said learner to overlook the complexities that they might face while building an application by themselves. Therefore, when a graduate of any of these courses tries to implement something by themselves, they find that they do not understand or are unable to do so, hence, causing them to go through more tutorials about the same thing.

## Solution

I'm not discouraging anyone from taking these courses I just want you to take your time, pace yourself, and make sure the thing you're trying to learn is as clear to you as water, even if you have to do additional research and put some extra work into it. If you think that you completely understood a topic then force yourself to do a mini-project or give yourself a scenario in which you have to use the thing you learned. Hence, allowing yourself to be in an unpredictable situation so you can counter any problem you face while developing applications on your own. In this manner, you will develop debugging skills while learning new technologies that you want to learn in an effective manner.

## Disclaimer

Don't get me wrong not all people learn at the same pace or style so it might be different for you, but in my experience, most beginners are affected by this problem. Furthermore, I do want to clarify that I have nothing against any course free or paid I just want to point out some of the problems that I have seen over the years.
Open/Closed Principle
Tags: programming, architecture, productivity, beginners
Published: 2021-11-24 19:08:30

> “A software artifact should be open for extension but closed for modification.”

Extension, so this must be about inheritance? Sure enough, in Bertrand Meyer’s original incarnation, that was the case but hold on there!

Over the past 30 years, we’ve learned that inheritance is quite a tricky beast to tame, so we might not want to take that route right away.

What do we mean by preventing modification and allowing for extension? If you have to change reams of existing code every time you make a small alteration then you know there’s something wrong with your architecture — it isn’t closed for modification.

Rather than changing what’s already there, you should be able to build on top of a robust foundation through extension. Adding new features should ideally be easy and low risk.

Extension itself has more than one form. Firstly, you have the traditional mode of inheritance. This, as mentioned, comes with its own set of problems (discussed elsewhere).

Alternatively, you can inject additional behavior into high-level components. Interfaces are the perfect tool for extension through injection. They protect against modification by presenting a well-defined contract that controls change.

They then allow us to extend our software by providing and plugging in new implementations of this contract.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f9rpl8pe2keald1nq44n.png)

The use of interfaces here ensures a robust hierarchy where those important high-level components are protected from changes in lower-level ones. When that next feature request comes along you’ll be ready to slot it in without touching those precious existing functions.

Originally published at [Better Programming](https://betterprogramming.pub/revisiting-solid-927e6a5202d3)
Visual Studio Code Lifehack that saved me a ton of time!
Published: 2021-11-24 19:01:59

Do you know that situation when you have a huge file with a lot of lines in vs code and you jump from one line to another and lose your orientation where you where last?

Don't worry, i got you!

By simply pressing  
Alt + ⬅️ on **Windows** or 
control + "-" (minus letter) on **Mac** 
you will navigate to the last courser position. 

Thanks and i hope i could save you some time =)

If you likes this post you may will like some of my other posts too, like [that one chrome extension you didn't know of](https://dev.to/harsvnc/the-css-chrome-dev-tool-you-didnt-know-of-3155). 🧑‍💻 ✅
Or just follow me on[Twitter](https://twitter.com/harsvnc) 📢 ✅
Single Responsibility Principle
Tags: programming, architecture, beginners, productivity
Published: 2021-11-24 19:01:55

> “Gather together the things that change for the same reasons. Separate those things that change for different reasons.”

It’s a common misconception to simplify this as *“every module should do just one thing”*. That’s not quite right because it’s not the “doing” that’s the point.

Boiling your code down to the simplest possible components can lead to horribly disjointed software. It’s the reason to change that’s key rather than what it’s doing, but what defines a reason to change?

The principle is primarily about people. Those users and stakeholders that push for new features are those that drive change in your software, and it’s specifically the scope of that change that we’re looking to limit.

It’s frustrating for both users and developers when a reasonable tweak in one concern leaks into, and breaks, another. You’ll want to separate the responsibilities to avoid exactly this and to reduce the mental burden required by a developer when dealing with just one piece.

The single responsibility principle applies across the whole stack, from minute detail to high-level abstraction. It holds when building granular functions or coarse components and in determining architectural boundaries.

It may be seen under a different guise, for example, the common closure principle which itself advises that components should be deployed according to change and that any change should effect a minimal set of components (ideally one).

Much of the SRP can be seen as an answer to a development scalability problem.

Separate those areas that can change for different reasons and you can scale out your engineers without them treading on each other’s toes or scale-up teams without blocking dependencies and bottlenecks between them.

Originally published at [Better Programming](https://betterprogramming.pub/revisiting-solid-927e6a5202d3)
Librería con Lit 2.0
Tags: webcomponents, html, typescript, testing
Published: 2021-11-24 18:57:02

# Construyendo el scaffolding con open-wc
Open WC nos provee de una serie de herramientas que nos ayudan a utilizar de una manera más cómoda y sencilla los web components. 

```bash
  npm init @open-wc
```
```json
"devDependencies": {
    "@custom-elements-manifest/analyzer": "^0.4.17",
    "@open-wc/eslint-config": "^4.3.0",
    "@open-wc/testing": "next",
    "@typescript-eslint/eslint-plugin": "^4.33.0",
    "@typescript-eslint/parser": "^4.33.0",
    "@web/dev-server": "^0.1.28",
    "@web/dev-server-storybook": "next",
    "@web/test-runner": "next",
    "concurrently": "^5.3.0",
    "eslint": "^7.32.0",
    "eslint-config-prettier": "^8.3.0",
    "husky": "^4.3.8",
    "lint-staged": "^10.5.4",
    "prettier": "^2.4.1",
    "tslib": "^2.3.1",
    "typescript": "^4.5.2"
  },
```