teleren/devto huggingface dataset:
What problem does Typescript solve ?
Tags: typescript, beginners, javascript
Published: 2021-09-04 20:59:55

If you're thinking about learning Typescript but not sure about the values it brings to the table, or you're already learning it and need to understand better its purpose, here I try to give a brief overview about what Typescript is.

When we are writing javascript, or other dynamically typed languages, we have to keep information about the type of a variable in our head and hope that we use the value properly. Let's see a quick example.

Consider how many operations we can run on a `message` variable:

```javascript
//we can try to get message length: 
message.length

//we may attempt to call message with an argument:
message("Hello World")
```

But wait, what is `message` exactly? What is the Type of the message variable? Is it a string? an array or a function? How do we even know `message` takes an argument and the argument is a string?

Well, in javascript, if we have doubts about the type - maybe we fail to remember it, maybe we are working with a codebase we're not quite familiar with yet - we basically rely on the Javascript runtime to throw a `TypeError` which will suggest to us that we were wrong about the type of the variable.

So you can imagine if `message` was declared as:
```javascript
const message = “Typescript is fun” 
```
the first line of code would work, but the second would throw a TypeError telling us `message is not a function`.

This is because javascript is a dynamically typed language, it checks the type of `message` at runtime (while the program is running) and thus cannot tell you if there's a problem with your code before you run it.

Now if you're working with a small codebase you may think that's not a problem not having everything typed, but things get messy pretty quickly with little bugs here and there as your codebase starts to become larger. It would be great if we could solve that problem. That's where typescript comes in.

**static type checking**
Typescript is a static type checker for javascript, it is called static because it runs before your code runs and it is a type checker because it tells you
	ahead of time if there's something wrong with your code as it relates to how you attempt to use different types.
	Coming back to our example earlier, when we tried to call message with an argument.

```javascript
const message = “Typescript is fun”
message("Hello") //(Error) This expression is not callable.

```

Typescript would show a red squiggly line under message and would tell us
	`This expression is not callable.   Type 'String' has no call signatures.`
So we can infer from this message that our variable is not a function but a string, attempting to call it will break our program.

At a high level this is what Typescript does, it adds a type system to javascript to help us developers catch bugs in our program early on, in the example above we relied on Typescript Type Inference ability so we didn't have to explicitly tell typescript that `message` is a string, we'll learn more about explicit types in a later post and how typescript deals with them.
Reduce, Reuse, and Recycle? Components!
Tags: react, redux, javascript, frontend
Published: 2021-09-04 20:16:04

This week I realized that one of the major keys of keeping a healthy environment is also one key to effective programming as well! Reusable components that are either made in a previous project or from just scratch will help your next project out a ton! Few examples will include but not limited to:

-Signup Component
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3sujm6x0urs8c1md3wn5.PNG)

-Login Component
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/een2ctx64oo3x2lz6ul0.PNG)

Coding out this signup and login skeleton to be able to reuse made developing my e-commerce and fgc application 10x easier! Not having to worry about setting up the bare minimum event listeners and such made adding on what I needed a lot easier as controlled forms can be tricky! 

-NavBar
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r74h759zy2mnppxcfajt.PNG)

The NavBar Skeleton is also very efficient as well! Can copy paste the line commented and add on as much needed to fit the needs of a traditional or complex NavBars!

Reusable components can go very long ways beyond just basic authentication and navigation bars! To be able to drop a component in from my computer definitely reduces the time needed to set a certain function up!

Thank you for giving my post a read! Follow me for more weekly content!

William West
Rails/React/JS Software Engineer


-
Competitive Polling and API adventure
Tags: sideprojects, webdev, showdev
Published: 2021-09-04 20:10:51

Hey friends, 

I just finished deploying a Competitive Polling App + Api Adventure!  It's written in Go with a postgres db and stock html templates.  Voting interfaces include a web interface, HTTP, as well as unary gRPC.  Looking to extend it with a streaming gRPC endpoint soon.  Rate-limiting is handled with the fantastic [go limiter library.](https://github.com/sethvargo/go-limiter)

It's mostly been helpful to learn more about implementing a gRPC server as well as diving deeper into a basic Golang web app.  Definitely becoming my preferred stack for small projects over node/ruby or kotlin.

Any feedback around mechanics or styling would be great!
https://economicsfight.com/
Fist week of the task force
Published: 2021-09-04 20:02:41

As we are winding up with week one, here is what I learnt and the challenges that I have encountered and how I tried to overcome them.

The first week of the task force was full of many new resourceful skills that I did not even know that I needed. Firstly, the warm up session taught me that knowing how to communicate properly with your team mates can make the work easier and that the communication does not necessarily have to be verbal which was quite interesting and fun. And also when we did the 16 personalities, I got to learn a few new things about myself that I usually did not pay attention to.

Secondly, the presentation session taught me what actually matters most in presentations is how you present your work and not the actual work which was quite surprising because I always thought the opposite way, so that was very educative. Thirdly, the session with Hans was very resourceful because I learnt that there are many ways to address certain things with different people depending on the environment that you are in, which is effective communication. 

On the other hand, the tech sessions taught me the importance of good user stories and the impact they can have on the design of the interfaces. I also got to learn how to make good and straight to the point user stories that helps the developer to understand well the functionalities. From this, I got a bit challenged when I had to implement someone else's user stories in a short period of time. This made me learn to deliver a good work in the shortest period of time which pushed me to put in more effort, so I would say that this challenge was worth it.
Looking forward to week two.
What are some of the biggest software mistakes and tradeoffs you’ve encountered? Answer to be featured on our podcast 🎧
Tags: podcast, discuss, career
Published: 2021-09-04 19:57:23

---
title: What are some of the biggest software mistakes and tradeoffs you’ve encountered? Answer to be featured on our podcast 🎧  
published: true
description: 
tags: podcast, discuss, career
---

The [DevDiscuss Podcast](dev.to/devdiscuss) begins with an interview and ends with commentary from listeners — and we like to feature the _actual_ voices from our community!

To inform an upcoming episode of the show, we'd like to know...

> ### **What are some of the biggest software mistakes and tradeoffs you’ve encountered?**

For your chance to hear your actual comments on an upcoming episode, answer the question above by:

- Calling our Google Voice at +1 (929)500-1513 and leave a message 📞

- Sending a voice memo to pod@dev.to 🎙

- OR, leaving a comment here (we'll read your response aloud for you) 🗣

Please send in your recordings by Wednesday, September 8th at 1 PM, ET (5 PM UTC, 10 AM PT)

#### Voice recordings will be given priority placement 😉

Catch up on recent episodes of the show [here](https://dev.to/devdiscuss) 👀
Week 1 task-force-3
Tags: code
Published: 2021-09-04 19:49:13

# Week 1 task force at awesomity lab and code of africa

This week was good because I made new friends and mates which is the coolest thing in this week ever.
On my first day, We had a game of putting an egg on top of the bottle which was tough, but we did it.
We had a good introduction from both awesomity and code of africa team members. It was my first time to do a 16 personalities test which made me discover and realize many things about me.

Let's talk about soft skills, we learned many things including presentation delivering, communication,... In the presentation, It was a little bit challenging because we knew that actual presentation slides occupy 7% of what remains in the audience's mind.
In communication we learnt that a good one has 3 parts: intro,main, end and at the end of each part there should be a question. We had many examples and plays related to that topic which was cool.

What about coding skills, we learnt about user stories which are a unit of agile framework about explaining features from the user's perspective. I was able to build user stories related to my app([Yombi app](https://yombi.rw)) which made me realize that there are many things to change.
We learnt to build the best front end pages related to user stories we've developed.

Did you have fun with the team ? Yeah, on Friday afternoon, we had a game with awesomity team which was the funniest thing ever. After the game,everyone was saying : Oooooh my ribs !!!!!!!. We beat an awesome team which was tough to win against an experienced team. We had drinks and chocolate to eat. Funny thing was that I was the only one who drank soda, others were drinking beers except me which amazed me so much.

What I expect at the end of this 6 weeks program, I want to be not only good but best front end developer who can work in any team across the world, I want to get paid so that I can support my startup growth, I believe that one time I will be sharing stories of how I built my startup to be the best not only in Africa but in the world.
Activity in Android Development
Tags: 50daysofcode, android, sharingknowledge
Published: 2021-09-04 19:25:51



**What is Activity in Android?**
➡️ An activity represents a single screen with a user interface just like window

**Lifecycle of Activity :**
➡️ The Activity class defines the following call backs i.e. events.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pe5uji5g262qvwvtrake.png)

PC:(Android Developers official website)

<h4>Methods:</h4>

**1. OnCreate() :**
➡️ This is the first callback and called when the activity is first created.

**2. onStart() :**
➡️ This callback is called when the activity becomes visible to the user.

**3. onResume() :**
➡️ This is called when the user starts interacting with the application.

**4. onPause() :**
➡️ The paused activity does not receive user input and cannot execute any code and called when the current activity is being paused and the previous activity is being resumed.

**5. onStop() :**
➡️ This callback is called when the activity is no longer visible.

**6. onDestroy() :**
➡️ This callback is called before the activity is destroyed by the system.

**7. onRestart():**
➡️ This callback is called when the activity restarts after stopping it.
Code splitting with CSS and JS
Tags: coding
Published: 2021-09-04 19:23:26

## What is code splitting?

Basically, it's splitting your code up into separate files, rather than having it all in one file. Let's say you have a really simple website with three sections: header, main and footer. You'd put your CSS for the header in one file, your CSS for the main in another file, and the CSS for the footer in a third file. Then you have an index file to tell it to use these three files, which the HTML points to.

## Why would you split your code up?

One thing it does is to make it easier to find things. If you know you want to find something in the header's CSS you know it's in the header CSS file, rather than somewhere in a long CSS file.

You might think, as I did, that it's perfectly easy to find things in one file as long as you're organised. You can do things like this to make the sections easier to find:
```css
/********************** Header **********************/
.menu {
  background-color: black;
}
```
Then no matter where you are in the file, it's easy to see the lines that stick out a lot further than the rest. The thing is, if you know you're looking for the header section, then you can just open the header file. I really thought the method of commenting sections was perfectly fine, until I tried code splitting and found this was easier, when you have a lot of CSS.

You might also think that it's easier to do a search in just one file. However, if you have a decent IDE it will have an option to search through all files in the project, or all open files. So it's no different to searching in just one file.

## Any other reasons?

Yes. Well, sort of. 

If three people were working on our imaginary simple website, each working on a different section, it would make things easier if they did things in separate files - no need to worry about merge conflicts. But if you're the only one working on the project, then that's not going to make a difference, unless you want to get used to the ways this would work in a job.

Theoretically it will make your site/app faster. This is because the browser caches files and if you only change one it can use the rest of the cached files. I say theoretically because it depends on what you do here. So if you had your CSS and JS in the HTML file, then splitting them into separate files will help. If you do what I do with SCSS files and have a bundler put them into one CSS file that's not going to make a difference.

## How do I do it?

The easiest way is to have your separate files and then link them separately, the same way you do for any file.
```html
<link rel="stylesheet" type="text/css" href="header.css" />
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="stylesheet" type="text/css" href="footer.css" />
```
And there you have all your CSS on your page, with the speed advantage, since the HTML is using three files rather than one.
Open sourcing my first Flutter project.
Tags: flutter, opensource, github, android
Published: 2021-09-04 19:22:21

A year ago I started working with Flutter and made an app for practicing. Today I'm making that project public on github.

This app is a static mobile version of the Sewistic web app, a Karachi based startup providing hassle free tailoring services.

Feel free to fork it, clone it, use it as a widget template or resource and also contribute through your PRs as there is a lot of room for improvements in the code. I myself will be commiting to it on and off.

Link: https://github.com/Shobu95/sewistic_app
Create a Netflix clone from Scratch: JavaScript PHP + MySQL Day 40
Tags: php, javascript, webdev, tutorial
Published: 2021-09-04 19:15:02

Netflix provides streaming movies and TV shows to over 75 million subscribers across
the globe. Customers can watch as many shows/ movies as they want as long as they are
connected to the internet for a monthly subscription fee of about ten dollars. Netflix produces
original content and also pays for the rights to stream feature films and shows.

In this video,we will be uploading Entity Data into Database

{% youtube axv02iEQvRc %}


If you like my work, please consider
[![Buy me a coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jm11knj7d8zwcvo150q2.png)](https://www.buymeacoffee.com/cglikpo)
so that I can bring more projects, more articles for you

If you want to learn more about Web Development, feel free to [follow me on Youtube!](https://www.youtube.com/c/ChristopherGlikpo)
First Post! Connect4 commandline game
Tags: python, beginners, codenewbie
Published: 2021-09-04 19:13:36

Not much of a blog writer, so forgive my lack of engaging content.  I recently started on the CompSci path through the codeacademy website, I have a bit of a background in programming but nothing very substantial.  At the end of the 'intro to programming' section, the task was to create a command-line game of my choosing, complete with github repo, blog post, and all the rest.  Luckily, a couple months ago I had written a command-line connect4 game, so most of the work had already been done.  Unfortunately I didn't do much version control, as the code was already mostly bug free, and complete.  But after revisiting it I think there's a couple more things I can fix.  Here's a [link](https://github.com/codeNewb204/Terminal-Game) to the repo if you want to try the game out yourself.

The Connect4.py file consists of a Connect_Four class which is essentially made up of a 2d list (the board), and 2 class variables which determine the dimensions of the board.  As well as some instance methods which print out the board, checks if a team has won the game, and drops a piece into a column on the board.

Not much more to say about it really, constructive criticism, and comments are encouraged.  Anything I can do better?  Different?
GIT: How to commit only parts of a file?
Published: 2021-09-04 18:30:20

## Scenario

It probably happened to you that after making lots of changes to some code files, you see one of those changes is ready so you decide to commit only this single change (maybe because you want to share it with other colleagues or maybe the client is asking to have this change ready).

So you open your terminal and run the git diff command on the file where your change is and see the following output:
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0jtid31t8atwk1kl03kw.png)

And there it is, the part of the file you want to commit is the where the line `font-weight: normal;` is added. But there is also another change in this file. 

So using `git add style.css` isn't an option for this scenario, as it would be introducing two different changes into the commit I want to share.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/005a0x75yc2ywizzh5fg.png)

## The solution: the --patch argument

So the solution to this usual scenario (it has happened to me a million times) is adding the argument `--patch` to the `git add` command.

Doing this will prompt us for each change (or hunk) we have in our file if it should be part of our changes to be committed. 

So after running `git restore style.css --staged` to restore our previously staged changes, we run `git add style.css --patch` and see the following output:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/crt7r3tu1de867hodq63.png)

And as you can see, now git is asking us if the line that contains the change to the `background` should be included or not. 

We can input `y` for yes or `n` for no, or simply input a `?` to get a description of each option.

So we decided to not include the first hunk and then include the second one as we can see in the image below:

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a5k24k9odqz6ymqh6rqg.png)

Then if we inspect our staged changes there's only the changes we want.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9wpc6rhqolayzsahz92c.png)

## Why would I ever want to commit one part of the file?

In git there is a concept called "atomic commits", which are commits that only contains a single logical change to a part of the code. 

Using atomic commits makes our repositories easy to navigate and to inspect, and has a lot of benefits for teams that needs to review older parts of the code in order to fix a bug for example.
What is SMTP?
Tags: smtp, tutorial, programming, beginners
Published: 2021-09-04 18:13:10

Email is a method of communication. Nowadays, people around the world use email services.

Exchange information with electronic devices is possible with email. The exchange of information can be between two people or a group of people.

Let us know about a protocol related to transferring email.

SMTP stands for Simple Mail Transfer Protocol. It is a protocol used to send email through the internet.

Read more information at https://praveena-thavarajah.blogspot.com/2021/09/what-is-smtp.html
My Taskforce Bootcamp Weekly Journal 1
Published: 2021-09-04 17:57:03

Here is a breakdown of the entire week's challenges and takeaways in my boot camp.

Monday 🤵 was all about meet and greet. Of course, I had to make a good first impression, which is why the best fit for that day was set and ready to go 😉😂.

After the introduction was out of the way, we played a challenging game targeted at showing us the importance of communication skills 🤔, as if we didn't know that already, but it was fun playing it.

What I found interesting tho is learning about personalities and **User Stories** which was quite interesting, as it led us to design systems in a non-technical manner.

Tuesday was off to a bad start, they wrote the wrong start time and didn't notice it until we got there, and even as we all gathered we still had to wait for 30mins which was waste of time 😠.

Then all the coding challenges they had were child's play 😏, which didn't really get me thinking.
> Is that the best that you can do ~ Thor in Avengers: Age of Ultron

On Wednesday, we had a work from home training wheel sort of say, preparing us for the next day's meeting with a managing director of **Code of Africa**.

On Thursday, we had some role-playing and a deep dive into soft skills to show its importance. Tho the soft skill or communication talks are getting too old for my taste. Communication's vitality isn't news to me, I grew up communicating and learning that in school, let's just say they are not for me 😴.

On Friday, after we finished our program, we played a game with the team of **Awesomity** which was quite fun getting to know the team better. Oh yeah, we won 😎.