teleren/devto huggingface dataset:
Code Smell 169 - Glued Methods
Tags: webdev, beginners, programming
Published: 2022-10-15 01:46:12

*Don't make two or more things at once.*

> TL;DR: Try to be as atomic as possible in your methods

# Problems

- Coupled Code

- Harder to test

- Harder to read

# Solutions

1. Break the method

# Refactorings

{% post https://dev.to/mcsee/refactoring-002-extract-method-1eee %}

# Context

If you name a method with 'And' you are probably missing an extract-and-break method opportunity.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/a5f7f776b32957ad3d40d57b4ff99c7f)

```rust

calculatePrimeFactorsRemoveDuplicatesAndPrintThem()

// Three responsibilities

```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/435d364b6ae0222952ace057ec099e94)

```rust

calculatePrimeFactors();

removeDuplicates();

printNumbers();

// Three diferent methods

// We can test them and reuse them

```

# Detection

[X] Semi-Automatic 

Some linters can warn us about methods including the term 'and'.

# Tags

- Coupling

# Conclusion

When making methods, it is very important to play some rubber duck story and tell ourselves if we are making things right.

# Relations

{% post https://dev.to/mcsee/code-smell-85-and-functions-3h21 %}

# Disclaimer

Code Smells are just my [opinion](https://dev.to/mcsee/i-wrote-more-than-90-articles-on-2021-here-is-what-i-learned-1n3a).

# Credits

Photo by [Scott Sanker](https://unsplash.com/@scottsanker) on [Unsplash](https://unsplash.com/s/photos/glue)  

* * *

> Learning the art of programming, like most other disciplines, consists of first learning the rules and then learning when to break them.

Joshua Bloch
 
{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
Squash
Tags: git, opensource, beginners
Published: 2022-10-15 01:39:17

## Lab 5
This week we were taught how to rebase and squash commits so that we can keep our work trees as clean as possible.

To test our new found knowledge of rebasing and squashing we were tasked to refactor our Site Generator code and improve it in a few separate commits so that when we were done with the task of refactoring we could then take these separate commits of improvements and squash them all together.

The improvements I made for my program specifically are as follows:
* I changed a confusing variable name that Arryell pointed out should be changed when working with my last lab
* I changed the name of my main class from Sitegen.py to main.py for some additional clarity
* I changed the directory structure of my project to include a src folder for all of my .py files instead of just having them on the project's root
* Instead of working with strings and concatenating them with the '/' character to create paths I started using the pathlib library so that it would work across operating systems in all cases

After making all of the improvements I rebased them with the -i option to start an interactive rebase and I left the latest commit as the pick and squashed the rest.

Finally just before merging with main and pushing I commited an amendment to the message of my previous commit of commits to make it better reflect what my commit was about, and to summarize it I wrote that it was a set of commits to refactor my application.
Modify an Array Stored in an Object (freecodecamp notes)
Tags: javascript, beginners, programming, tutorial
Published: 2022-10-15 01:37:11

So in this particular exercise we are given an user obj as below;

```javascript
let user = {
  name: 'Kenneth',
  age: 28,
  data: {
    username: 'kennethCodesAllDay',
    joinDate: 'March 26, 2016',
    organization: 'freeCodeCamp',
    friends: [
      'Sam',
      'Kira',
      'Tomo'
    ],
    location: {
      city: 'San Francisco',
      state: 'CA',
      country: 'USA'
    }
  }
};
```

**Exercise**

Write a function that adds a new friend to friends array in the user obj
They provide us the following function structure

```javascript
  function addFriend(userObj, friend) {
       // Only change code below this line
  
     // Only change code above this line
    }
  console.log(addFriend(user, 'Peter Gregory'));
```
{% gist https://gist.github.com/NaveenDK/e5bc3c3cf3d0fbc5213cd040ccb0600d %}

**Correct Answer? Answer 2**

In attempt 1 we are returning what push function returns. Push returns the length of the array , instead of the array. Therefore we have to push the new friend and then return the array in the next line separately

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

Once you add Peter Gregory as a friend, remember to get him some asparagus!

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

Check the exercise here https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-data-structures/modify-an-array-stored-in-an-object
Hacktober fest week 2
Published: 2022-10-15 00:48:59

For my second pull request in hacktoberfest, I contributed to the [dzikoysk/reposilite](https://github.com/dzikoysk/reposilite) repository. The language I used was Kotlin which I have little to no experience with. However, I have used Java a lot and it is very similar in terms of syntax

# What I Did

# [Issue](https://github.com/dzikoysk/reposilite/issues/1604)

The issue wasn't asking for too much it was only asking to add a try-catch statement when a user tries to communicate with a closed channel. I saw someone was attempting it and then dropped it but I figure I would attempt it. I was able to find the code they were referring to then I added the Try catch. After I asked what else needed to be done they replied by telling me to log the error as a debug. I needed to look into the code to figure out what they meant and found the Debug log subclass. I created a message based on the other logs and than created a PR.

# [Pull request](https://github.com/dzikoysk/reposilite/pull/1607)

I asked the maintainers to review my code and see if my message was done correctly. They responded by saying I needed to import the class so I did. 

# conclusion

This was the first PR I made in a big repo it had more than 100 forks and 700 stars. I also feel more comfortable asking questions.
Hacktoberfest Week 2
Tags: hacktoberfest, beginners, opensource, github
Published: 2022-10-15 00:39:04

Starting my second week of Hacktoberfest, I got involved in creating another UI. This app was a new app, and they wanted something in order to enhance the user interface as a whole.

##Contributing
Before I had made any modifications, I thought about what the UI was missing, The search bar was one of the few, but that was a different issue that the author had requested.

I opened an issue for the new UI and asked to be assigned to be the one to enhance the UI. Shortly after, the author assigned me the issue. [Issue #10](https://github.com/BhaktaGopal/online_Dictionary/issues/10)

I then started by creating a CSS file and, modified the background to be a dark blue image. I then created a navigation bar underneath the title including a Home, Contact, About, and a Print button on the bar. [Pull Request #15](https://github.com/BhaktaGopal/online_Dictionary/pull/15)

##Conclusion
After finishing everything, I then created a pull request. Although not too different from my previous contribution, though a bit of a different execution, this time using an image for the background. 

Though it was unique being one of the first contributions to a repository without any functions, or modifications. It was just a simple blank page at first but I can see with the numerous contributions it looks functional now.
The next steps in Github Pages
Tags: github, jekyll
Published: 2022-11-29 08:08:07

---
title: The next steps in Github Pages
published: true
date: 2022-10-15 00:00:00 UTC
tags: Github,Jekyll
canonical_url: https://robvanpamel.github.io/2022/10/15/UpdatingGitHubPages.html
---

After the first steps follows … the next steps. I created the first blogpost and made it public, I already realised that it wasn’t ready yet to be launched. It was way too early, but at least it was something.

So while waiting <!--more--> in the airport on my next flight I continued to work on it. What needed to be done ? A lot of things!

- The title of the site was the one from the repository
- I didn’t had the social media links
- I couldn’t get an excerpt of my blogpost on the main page
- …

## Adding social media links

Adding these social media links didn’t went as fast as I expected it. It seemed that I was using an ‘old’ version of the minima theme. Due to this, the settings which i applied in the `_config.yml` didn’t apply.

You can always refer to the remote theme from github by using a plugin. After changing it to use that remote theme, I got a step further and after tweaking a bit more the media links worked. See the `_config.yml` below for more information

```
minima:
  social_links:
    twitter: youraccount
    github: youraccount
    linkedin: youraccount-878796454

remote_theme: jekyll/minima
plugins:
  - jekyll-remote-theme

```

## Adding titles

By default the title and description of your page are the name and description of the repository. Which is mostly not what you want. So lets change this as well I saw multiple options online, but not all of them worked. This one worked for me in the `_config.yml`

```
title: Rob Van Pamel
description: Rob Van Pamel

```

## Adding Excerpts

Another default setting of the minima theme is that there is no excerpt shown on your post page, but only the title. I like it that you can already see a bit of the post, so I enabled that as well in the  
`_config.yml`

```
show_excerpts: true

```

Afterwards add the excerpt seperator in your blogpost header and off course also in the blogpost. Here is an example

```
title: The next steps in Github Pages
date: 2022-10-15   
excerpt_separator: <!--more-->
---
After the first steps follows ... the next steps. I created the first blogpost and made it public, I already realised that it wasn't ready yet to be launched. It was way too early, but at least it was something. 

So while waiting <!--more--> 

```

That will be it for now, it the next one, i would like to change some more smaller things, like a favicon, look at SEO, add tags to the blogposts, and so on.
Matrix In Terminal
Tags: terminal, programming, devops, justsomefun
Published: 2022-10-14 23:43:46

Action Movies have really defined a different way on how we view Hacker Computers. The animations on the terminal have always made it look cool and who doesn't like Cool things?🤷‍♂️

Let's do this,

I'll show you how to make your terminal look cool and make you prank your friends on your killer hacker skills.

It's simple, just follow this steps.

1. 1. Open Terminal on your Linux Machine or WSL terminal(Linux distro) on Windows Machine.
2. 2. Run ``sudo apt update``
3. 3. After the update, clear your terminal by using command `clear`
4. 4. Then type this command, `sudo apt install cmatrix`
5. Then Run the command `cmatrix` and wait for the magic to happen
At this point you should have something like this on your terminal

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ijgouvlg4wi9xmyc62gv.PNG)
Note: If you wanna exit the screen just press `ctrl + c`

I hope you have fun ❤. Kindly share more fun things on the comment section.
DPS909 Blog :LAB 5 Refactoring
Tags: opensource
Published: 2022-10-14 23:42:50

## Overview
* Refactoring of my [ssg](https://github.com/anshul137/ag-ssg).
* Using `git rebase` to rewrite history on a branch.
* Using `git commit --amend` to add things to a previous commit and update a commit message.
* using `git merge`

## What is Code Refactoring?

Refactoring is one of the most important skills for developers. It is the process of restructing the existing code without changing its functionality of the application.
 
## Why Refactoring is important?

* As a software developer we need to make sure our application is always up-to date with the current dependencies and the latest syntax.
* It helps us maintain our application and make it extensible and easy for our readers to understand our code.
* It helps us fix the codes, methods, or classes that are so enlarged.
* It helps us fix areas in code that do not require repeated code.
* It helps us to remove any code that is unnecessary and removing 
 it won’t be detrimental to the overall functionality of the 
 application.

##  Rebasing and Squashing

After Refactoring all of my code I have 5 commits in my application.
Before merging my work, i squashed everything in one single commit.
Furthermore, I have amended my commits and successfully merged it to the main branch.

## Links
 * [ag-ssg](https://github.com/anshul137/ag-ssg)
 * [my commit](https://github.com/anshul137/ag-ssg/commit/f6ada677765a1a72b0da8e0ebed518377efe426e) 
 * [PR](https://github.com/anshul137/ag-ssg/commit/85070521647c3f10702107b4a508ec77f8607c89)
Is web3 business just web2 in disguise? Why importing web2 thinking is hurting our startups
Tags: blockchain, busines, startup, career
Published: 2022-10-14 22:37:36

Despite the technological advantages of blockchain giving us access to trustlessness, transparency and more fairness in our tech, it seems to me that many web3 companies are importing the cultures from web2 that do the exact opposite.

This is a time to be rethinking how we are cooperating and collaborating as people and to be empowering new ways of working that include autonomy, fairness and transparent processes., Instead of importing the same problems that perpetuate lack of pay equality, unequal power dynamics and a lack of transparency and support, we should be embracing the benefits web3 gives us and the values it stands for.
Day 636 : Once Again
Tags: hiphop, code, coding, lifelongdev
Published: 2022-10-14 22:31:45

_liner notes_:
- Professional : And the frustration continues... I thought I was going to be able to cut out early because of the extra time I put in this week, but nope. Had a meeting late afternoon and then as I was getting to get my weekend started something else came up with a project that I was done. And the issue is that it has nothing to do with me, but I was put in the middle. I still didn't effing get the one thing I wanted to get done today!

- Personal : Last night I watched "Chainsaw Man". Really good. Then I watched the season finale of "She-Hulk". I like the show. Hope it gets another season. I also went through some tracks for the radio show.

![Ocean waves crashing onto the Jacksonville, Fl, USA coastline](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ed7ue6hxg06ouccujfr1.png)

Once again, I'm ending work late because of some BS that has nothing to do with what I get paid for. Well, I need to finish putting together the radio show and maybe do some side project coding.

On Sunday, I'll probably do some cyphers at https://untilit.works

Have a great night and weekend!

peace piece
Dwane / conshus
https://dwane.io / https://HIPHOPandCODE.com
{% youtube Fdv2l8OlBBA %}
JavaScipt: Express.js
Tags: javascript, beginners, programming
Published: 2022-10-14 22:05:56


* Node.js is a runtime environment that allows Javascript files to run outside of browser runtime; `Express.js` is a server-side framework built to work with Node.js
* `CRUD` means the api allows clients to create, read, update and delete information.
* Require the express module and invoke an instance.

```
const express = require('express')
const app = express()
```
* `app.listen(PORT, callback)` can start a server. The first parameter is the port number argument tells the server where to listen; the callback function is executed when the server is listening and ready for response.
* `route` is a section of Express code that is associated with an HTTP verb, a url path, and a function that is called to handle that pattern.
* Express searches through the routes and responses with the first route matches the request url.
* `path` is part of the requested url after the hostname and port.


### HTTP verb(GET,PUT,UPDATE,DElETE)
* `app.get()` is used to match the route with GET request. The first parameter is the route path(string), the second parameter is the callback function to handle the request and send a response. When a requested url arrives, `req.params` object will store the information from the requested url path. (query string is not necessary)

```
app.get('/monsters/:name', (req, res, next) => {
  res.send(...); // or res.json() to send json format response
});
//request url : 'monsters/rx'  req.params = {name: 'rx'}
```

* `app.put()` is used to update existing data from the database. It needs data from `query string`. 
* `app.post()` is used to create a new resources. It needs data from `query string`. 
* `app.delete()` is used to delete a resource. (query string is not necessary)

### req.params and req.query
* `route parameter` is in route path and begins with `':'` it. `req.params` stores route parameters in an object. It is like a **unique identifier** for the database, so the server can send the requested resource.
* `query string` is the part of url after `'?'`. Express parse the information into `req.query` object. The value of the key is a **string**. It stores information the client send to the server.

### Router

* using router can make code cleaner. It adds the router path to the path in `app.use()`
Eg:
```
// in router.js file:
const monserRouter = express.Router()
monsterRouter.get('/:name',(req,res,next)=>{....})
module.exports = monsterRouter;

// in main.js file
const monsterRouter = require('./router.js')
app.use('/monster',monsterRouter)
```

### res.status

![status code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhrsiysiukv6bb3uz0vs.png)
Stuff I've read, watched, and heard - #1
Tags: javascript, webdev, tutorial, career
Published: 2022-10-14 21:46:40

Hello everyone, This is my second article in a weekly series in which I share stuff I've read, watched, and heard throughout the week and found interesting and worth sharing.

## Stuff I've Read
[Proxy vs Reverse Proxy](https://pankajtanwar.hashnode.dev/proxy-vs-reverse-proxy-using-a-real-life-example)
- Understanding the difference between Proxy and Reverse Proxy servers is very important especially if you're interested in Backend Engineering or Networking. This article provides a simple explanation for both of them using a simple and intuitive example and compares the benefits of both of them.

[What is latency? Let’s deep dive & understand possible ways to optimize it](https://pankajtanwar.hashnode.dev/what-is-latency-lets-deep-dive-and-understand-possible-ways-to-optimise-it)
- Latency is also an important topic regarding Backend Engineering and Networking. This article provides a deep dive discussing Latency, why it's important, how to measure latency, and how to optimize latency to improve performance.

[Which Programming Language to Choose for Coding Interviews](https://www.techinterviewhandbook.org/programming-languages-for-coding-interviews/)
- Most companies let you code in any language you want but your choice can make a huge difference in your performance during the interview. This article provides a guide to help you choose the suitable programming language for your coding interview to maximize your performance.
- Check the [Tech Interview Handbook](https://www.techinterviewhandbook.org/) if you're preparing for a coding interview and looking for a reference to help you organize your preparation process.

## Stuff I've Watched

[DNS and How does it work](https://youtu.be/Wj0od2ag5sk)
- Domain Name System (DNS) is a must-know topic for every software engineer. This video provides a general idea about the internet and explains the journey of your request through the internet until the requested website (Domain Name) is found.

[What is the JavaScript Event Loop Really all About](https://youtu.be/EI7sN1dDwcY)
- I'm currently learning Node.js and understanding the javascript event loop is crucial to understand how Node.js works under the hood. This video is by far the best tutorial I've seen explaining the javascript event loop (and believe me when I say the best I've seen A LOT).

## Stuff I've Heard
[What's a Zero Day Attack?](https://podcasts.google.com/feed/aHR0cHM6Ly9hbmNob3IuZm0vcy8xZWI2ZDE0L3BvZGNhc3QvcnNz/episode/NjZkZGVlZGUtNzdhMS00NjkzLWE3NzgtZDM4YzI2NzY4YTM1?ep=14)
- This is a short episode from one of my favorite podcasts [The Backend Engineering Show with Hussein Nasser](https://podcasts.google.com/feed/aHR0cHM6Ly9hbmNob3IuZm0vcy8xZWI2ZDE0L3BvZGNhc3QvcnNz?sa=X&ved=0CAMQ4aUDahcKEwioxbmXieD6AhUAAAAAHQAAAAAQAg) explaining what's a zero-day attack or vulnerability

---
Lugar de mulher também é na carreira tech
Tags: career, beginners
Published: 2022-10-14 21:45:44

Acredito que a maioria das pessoas já ouviu a frase “Lugar de mulher é onde ela quiser”, e isso é uma grande verdade. Por isso, trago neste artigo um mercado potencial, no qual você, mulher, pode seguir sua carreira: o mercado de Tecnologia da Informação (TI).

##Contexto atual
Vivemos em uma sociedade que ainda sofre com o machismo, onde é comum ouvirmos comentários do tipo: “Mulher não sabe programar” ou “Área de exatas é para homem”.

Prova disso, é que pesquisas recentes mostram que a maioria dos estudantes de graduação nas áreas de Ciência, Tecnologia, Engenharia e Matemática (STEM - _Science, Technology, Engineering and Mathematics_) ainda são homens, com apenas 35% das mulheres ocupando essas vagas e, desse percentual, somente 3% seguem na área de tecnologia.¹

Além disso, nos EUA, uma pesquisa realizada com 10 mil funcionários de tecnologia constatou que a desigualdade de gênero exerce uma grande influência nos salários recebidos pelas mulheres, o que independe do seu grau de educação.²

> “A maior diferença é entre homens e mulheres cujas qualificações incluem "alguma faculdade", onde as mulheres relataram um salário médio de US$72.000 e os homens US$107.000.”²

Contudo, a participação feminina no mercado _tech_ está aumentando, e, segundo dados apresentados pelo Cadastro Geral de Empregados e Desempregados (Caged), houve um crescimento de 60% no ano de 2019.³

##Possibilidades de atuação no mercado _tech_
Embora seja comum associarmos a carreira na área de TI com programação, ela não se restringe a este setor. E se você, mulher, não se identificou nem se vê atuando na área de desenvolvimento, existe uma gama de possibilidades que você pode seguir, como: 
- Garantia de Qualidade;
- Gerência de projetos;
- UI/UX;
- Segurança;
- Computação em Nuvem;
- etc.

Um artigo que pode lhe ajudar a identificar qual caminho seguir é [“Desenvolvimento talvez não seja pra você”](https://dev.to/devs-jequie/desenvolvimento-talvez-nao-seja-pra-voce-5dnk), do Tulio Calil.

###Sobre mim
Meu nome é Lara Fábian, sou estudante de Sistemas de Informação pela Universidade Estadual do Sudoeste da Bahia (UESB) e tenho focado na área de Garantia de Qualidade (QA), atualmente.

###Referências
1- [A presença de mulheres nas faculdades de Ciências e Tecnologias](https://blogs.unib.org/pt/professores/2020/12/28/unini-mulheres-stem/)
2- [Estatísticas sobre mulheres em tecnologia: Últimas pesquisas e tendências](https://www.computerweekly.com/br/reportagen/Estatisticas-sobre-mulheres-em-tecnologia-Ultimas-pesquisas-e-tendencias)
3- [Cresce o número de mulheres na área de tecnologia | Master Da Web](https://blog.masterdaweb.com/artigos/mulheres-marcam-presenca-na-area-de-tecnologia/)
How to Move to UK as a Designer
Published: 2022-10-14 21:33:55

If you are a UX/UI designer interested in relocating to the UK, make sure you watch the recording of my chat with Darya Luganskaya.

This chat has it all:
- a career change
- self-study to become a designer (Darya used to be a journalist)
- three different types of UK visas 😮
- a very interesting and unusual case for the Global Talent visa (listen to find out how you can potentially use your previous non-technical career to build a stronger case for Tech Nation)
- and lots more.

{% embed https://youtu.be/nUTFiTVlvP8 %}