teleren/devto huggingface dataset:
Kotlin Code Smell 25 - State as Properties
Tags: kotlin, codesmells, cleancode, programming
Published: 2023-08-05 07:01:31

---
title: Kotlin Code Smell 25 - State as Properties
published: true
date: 2023-08-04 08:30:08 UTC
tags: kotlin,codesmells,cleancode,programming
canonical_url: https://yonatankarp.com/kotlin-code-smell-25-state-as-properties
---

When an object changes its state, the best solution is to modify the attribute, right?

## Problems

- Mutability

- Attribute Polluting

- Setters

## Solutions

1. Use immutable objects

2. The model states as mathematical set inclusion.

3. Separate the state from the object as it is accidental.

## Examples

- State diagrams

## Sample Code

### Wrong

```
sealed class OrderState
data object OrderStatePending : OrderState()
data object OrderStateConfirmed: OrderState()

class Order(private val items: List<Int>) {

    private var state: OrderState = OrderStatePending

    fun changeState(newState: OrderState) {
        state = newState
    }
}

```

### Right

```
sealed class OrderState
data object OrderStatePending : OrderState()
data object OrderStateConfirmed: OrderState()

data class Order(val items: List<Int>, val state: OrderState)

val items = listOf(1, 2, 3)
val pendingOrder = Order(items, OrderStatePending)
val confirmedOrder = pendingOrder.copy(state = OrderStateConfirmed)

```

## Exceptions

- Over Design

- Performance issues (if a serious benchmark supports it).

## Conclusion

This technique is elegant but can lead to overdesign. For example, changing a visual component's color should be a counterexample of this smell.

We should be aware and very cautious as with any other smell.

These are hints and not rigid rules.

* * *

Stay updated with my latest thoughts and ideas by registering for my [newsletter](https://yonatankarp.com/newsletter). Connect with me on [LinkedIn](https://www.linkedin.com/in/yonatankarp/) or [Twitter](https://twitter.com/yonatan_karp). Let's stay connected and keep the conversation going!

* * *

## Credits

- [Code Smell 35 - State as Properties](https://maximilianocontieri.com/code-smell-35-state-as-properties) by [Maxi Contieri](https://hashnode.com/@mcsee)
rakhoitv - ra khoi tv trực tiếp bóng đá full HD
Published: 2023-08-04 08:21:38

rakhoitv - ra khoi tv là trang web chuyên cung cấp những trận đấu bóng đá trực tiếp có chất lượng tốt nhất thời điểm hiện tại mà ít trang web nào có thể sánh bằng.
#rakhoitv, #rakhoi, #tuctiepbongda, #ra khoi tructiep
Rakhoitv là gì?
Thời điểm hiện tại, có nhiều trang web được ra đời với mục đích mang đến cho anh em những trận đấu bóng trực tiếp vì nhiều lý do mà nhà đài không thể cung cấp cho anh em. Thế nhưng những trang web này lại không thể mang đến cho anh em những trải nghiệm tốt nhất. Hiểu được nỗi lòng này của nhiều anh em chính vì thế chúng tôi đã cho ra đời trang web rakhoitv.
Ra khoi tv là trang web chuyên cung cấp những trận bóng đá trực tiếp bóng đá tốt nhất thời điểm hiện tại. Được biết thì hiện tại, đang có nhiều giải đấu bóng đá lớn nhỏ trên thế giới đang diễn ra được rất nhiều trái tim đam mê bóng đá Việt Nam nói riêng và trên thế giới nói chung quan tâm. Chính vì thế, chúng tôi đã cung cấp cho anh em trang web ra khoi tv với chất lượng hình ảnh cũng như âm thanh tốt nhất cùng với đó là những trải nghiệm có 1-0-2 mang đến cho người dùng.
Lợi ích khi đến với Ra Khơi TV
Những giải đấu được chúng tôi trực tiếp vô cùng đa dạng từ những giải đấu lớn cho tới nhỏ trên khắp thế giới. Đặt biệt ở tại Rakhoitv anh em luôn có thể tìm được những giải đấu yêu thích một cách vô cùng nhanh chóng cùng với đó là dễ dàng nhất.
Với giao diện đơn giản và thân thiện với nhiều người mặc dù là người mới bắt đầu tiếp cận đến trang web.
Không những cung cấp những trận đấu chất lượng cao, Ra khoi tv còn mang đến cho người dùng những lợi ích khác có thể kể đến như: lịch thi đấu, tin tức cầu thủ, CLB, chuyển nhượng,…
Ra Khơi TV hỗ trợ rất nhiều nền tảng khác nhau, trong đó anh em có thể kể đến những hệ điều hành như:  IOS, Android, iPad, Windows,… để anh em có thể theo dõi thoải mái các trận đấu tùy thuộc vào sở thích cũng như điều kiện của bản thân mình.
Tất cả các trận đấu đều có bình luận tiếng Việt.
 Hiện tượng giật lag ở tại rakhoitv hoàn toàn không hề diễn ra với đường truyền ổn định.
Những giải đấu được Ra khơi tv trực phát trực tiếp
Ở tại đây, anh em sẽ được theo dõi hầu hết những trận đấu trong và ngoài nước, cùng với đó là những giải đấu lớn nhỏ ở trên thế giới có thể kể đến như: Cup C1, Ngoại hạng Anh, World Cup, La Liga, Ligue 1, Serie A,...

Web chính: 
https://tinsoikeo88.com/rakhoitv/
Web 2.0:
https://rakhoi9.blogspot.com/
tsParticles 2.12.0 Released
Tags: typescript, showdev, javascript, webdev
Published: 2023-08-04 08:09:23

## tsParticles v2.12.0 Changelog

### Bug Fixes

- Fixed pool on particles destroyed by updaters
- Fixed out modes, bounce was not checking the direction of the update request
- Fixed issue with change theme when an existing canvas is used
- Fixed updates on particles destroyed by updaters, that section wasn't using the memory pool for reusing old particles instead of creating new ones.
- Fixed memory leak in destroyed particles by updaters, the z array wasn't filtered, thanks to @longnguyen2004, closes #5101
- Fixed light interaction, particle shadow wasn't calculated correctly

### New Features

- Added range values to life duration and delay of emitters
- Added two new bundles
    - `tsparticles-basic`: minimum plugins for having circular dots moving in the canvas, common package for all bundles, and presets after this is released. Packages included:
        - `tsparticles-engine`
        - `tsparticles-move-base`
        - `tsparticles-shape-circle`
        - `tsparticles-updater-color`
        - `tsparticles-updater-opacity`
        - `tsparticles-updater-out-modes`
        - `tsparticles-updater-size`
    - `tsparticles-all`: a package that includes all the plugins, it's not a best practice to use this, but the easiest way for trying every feature available for sure. It will be used mainly in the [website](https://github.com/tsparticles/website).

--

## Social links

- [Discord](https://discord.gg/hACwv45Hme)
- [Slack](https://join.slack.com/t/tsparticles/shared_invite/enQtOTcxNTQxNjQ4NzkxLWE2MTZhZWExMWRmOWI5MTMxNjczOGE1Yjk0MjViYjdkYTUzODM3OTc5MGQ5MjFlODc4MzE0N2Q1OWQxZDc1YzI)
- [WhatsApp](https://chat.whatsapp.com/KQyHc9UEbRc2qlqNQR2J5c)
- [Telegram](https://t.me/tsparticles)
- [Reddit](https://www.reddit.com/r/tsParticles/)

---

{% github matteobruni/tsparticles %}
Farewell, Nodemon! 💔
Tags: node, programming, backenddevelopment, developers
Published: 2023-08-04 07:31:39

Nodemon has been our trusty friend, helping Node.js developers by automatically restarting our servers whenever we made changes to our code.

So if you don’t know what nodemon is, according to their official website:
<br>

> “Nodemon is a utility depended on about 3 million projects, that will monitor for any changes in your source and automatically restart your server. Perfect for development.” (nodemon.io, 2023).

<br>
```
npm install -g nodemon #install it globally
npm install -D nodemon #install it locally (dev dependency)

nodemon server.js localhost 8080 #then to run your local dev server
```
<br>
But now, with the release of Node.js 18, we don't need Nodemon anymore. Node.js 18 comes with a cool new feature called "--watch" that does the same thing. In this article, we'll explore how to use this built-in feature and enjoy an easier coding experience.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lbpi994wg8xterjs3fzt.gif)
<br>
## The Magic of "--watch"
With Node.js 18, we now have a built-in solution for auto-reloading, which means we can say goodbye to Nodemon. The magic is in the "--watch" feature. It allows Node.js to keep an eye on our code and automatically restart the server whenever we make changes.
<br>
- For a Single Entry Point File:

```
node --watch server.js
```

- For Multiple Watch Paths:

```
node --watch-path=./src --watch-path=./tests index.js
```

- Disabling Console Output Clearing:

```
node --watch --watch-preserve-output server.js
```
<br>

Goodbye, Nodemon! 💔 It's been a wild ride, but we're ready to embrace change and explore new horizons. We'll forever cherish the auto-reloading memories, but it's time to move forward without you. #NewChapter #NoMoreNodemon
Where to Find Hackathons
Tags: hackathon, hacktoberfest
Published: 2023-08-04 07:24:03

Hackathons are probably one of the best places to network with people and simultaneously learn and enhance your skills and also who doesn't love swags? Here are the 7 best places to look out for in order to attend a hackathon👇

Major League Hacking (mlh.io)
**MLH**

Major League Hacking is one of my favorites and one of the best places to find hackathons. MLH organizes many hackathons for University students and it also provides .tech, .space, and .online domain free for a year. I have been a part of 2 MLH hackathons and the experience is amazing.


Devpost(devpost.com)
Devpost

Devpost also has many exciting hackathons listed but mostly Hackathons use Devpost to help you find a team, submit your project, and look at other projects. I love Devpost as I can see other people's projects and get good ideas, isn't it cool?


Devfolio(devfolio.co/hackathons)
Devfolio

I came across Devfolio in the quarantine while searching for virtual hackathons. I haven't used it much but I like the UI/UX of the website and also I had an amazing experience during the hackathon.

HackClub(hackathons.hackclub.com)
Hackclub

**HackClub **is another great website to look for international hackathons for High School and University students. It has a wide list of hackathons to choose from.

Hackalist(hackalist.org)
Hackalist

**Hackalist** is a website that provides a list of upcoming hackathons around the world and also it is Open-Source. It also has a filter for hackathons that give travel reimbursement so it is awesome for people who like to travel.

Hackathon IO(hackathon.io/events)
HackathonIO

**Hackathons IO **includes almost every hackathon that is going on around the world. It even has a network tab where you can find hackers from all around the world and attend the hackathon with.

HackathonsNearMe(hackathonsnear.me)
HackathonsNearMe
Being a game developer
Tags: programming, devops, python
Published: 2023-08-04 07:17:03

Being a gamer and game developer is so good. I'm a passionate gamer and a professional developer. Now my aim is to made a open world game like  assassin creed. My friend create a [website ](https://skydownloading.com/)and he said to me gimme the mode batches of games like GTA V. This is cool being a gamer and game developer.
Khóa học SEO IMTA
Published: 2023-08-04 07:11:41

Khóa học SEO tại IMTA giúp bạn đưa từ khóa lên công cụ tìm kiếm Google trọng tâm bằng kỹ thuật White Hat. Đặc biệt là bạn phải làm bài bản, đúng từ đầu,với mục tiêu giữ vững thứ hạng lâu dài, tiết kiệm chi phí marketing online. Để đạt mục tiêu của mình, trước hết bạn cần tối ưu các kỹ thuật SEO (Technical SEO), hiểu về quy trình hoạt động của công cụ tìm kiếm (Search Engine), cách thức tối ưu Onpage SEO và Offpage SEO, SEO cộng hưởng và Entity SEO xây dựng thương hiệu uy tín của bạn trên Internet.
https://imta.edu.vn/khoa-hoc-quang-cao-google-ads/
Location: Tầng 4, Tòa Nhà Charmington La Pointe , Số 181 Cao Thắng nối dài, Phường 12, Quận 10, Hồ Chí Minh
Phone: 0896677499
Email: info@imta.edu.vn

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3jnpknvf2u45hweo6qrj.jpeg)
4. Tips and tricks for AWS-DevOps-Engineer-Professional-DOP-C01 Exam
Published: 2023-08-04 07:09:31

By the usage of [AWS-DevOps-Engineer-Professional-DOP-C01 Dumps](https://dumpsboss.com/amazon-exam/aws-devops-engineer-professional/) lifestyle, gear, and practices, we are able to continuously preserve the simplest and strong country of packages/offerings and reduce the shipping time of the goods. Under the DevOps engineer roof, you could see specific positions consisting of junior DevOps engineers, graduate DevOps engineers, accomplice DevOps engineers, senior DevOps engineers, and fundamental DevOps engineers primarily based totally on their capabilities and revel in. eight Responsibility of DevOps Engineers devops engineer duties Let’s see most of the DevOps Engineer’s roles. DevOps engineers take the software, use a few gear/practices and practice them withinside the operation segment [AWS-DevOps-Engineer-Professional-DOP-C01 Exam Dumps](https://dumpsboss.com/amazon-exam/aws-devops-engineer-professional/) to automate the system. Acts as a coordinator among improvement and IT groups. DevOps engineers also can be taken into consideration mediators among improvement and IT groups. A DevOps engineer ought to have a superficial understanding of developer sports and IT operations. They reveal the packages/assets and are liable for all of the apps strolling. They paintings in coordination with the DevSecOps group on safety and automation problems. Most DevOps engineers may be worried in making plans and assignment control in the course of the improvement segment. DevOps engineers in the main maintain in contact with Release Manager, Software Developer, Tester, Quality Assurance, and others. 

Get Upto 60% Off >>>>>> https://dumpsboss.com/amazon-exam/aws-devops-engineer-professional/
Best Bosses: What Made Their Mentorship Stand Out?
Tags: discuss, carreer, learning
Published: 2023-08-04 07:00:00

_Discover diverse career growth stories and coding journeys in "Mentors & Mentorships" on The Daily Byte. Get inspired! 💻🌟_

> Reflect on the best boss or manager you've worked with in your career. What qualities or actions made them exceptional, and how did their mentorship contribute to your professional growth?


Follow the DEVteam for more discussions and online camaraderie!

{% embed [https://dev.to/devteam](https://dev.to/devteam) %}
Coding Culture Fit: Where Do Your Values Align in Your Dream Workplace?
Tags: codenewbie, beginners, discuss, career
Published: 2023-08-04 07:00:00

_Welcome to "Discover Your Code," guided by our official DEV moderator, Sloan the Sloth 🦥. This series is designed to help aspiring coders and students explore the coding universe, ignite their passion, and find their ideal career paths._

Today's question is:

> How will you go about finding a company culture that aligns with your aspirations and personal goals?

Responses from newbies and experienced devs alike are encouraged in order to broaden our horizons and showcase different POVs.

Follow the [CodeNewbie Org](https://dev.to/codenewbieteam) and [#codenewbie](https://dev.to/t/codenewbie) for more discussions and online camaraderie!

*{% embed* https://dev.to/codenewbieteam *%}*
Car rental software for your marketplace business.
Tags: saas, marketplace, business, ideas
Published: 2023-08-04 06:51:57

Yes! There are many [car rental software](https://www.qoreups.com/qmarket/car-rental-software) available online.
Among them, I recommend you QoreUps.
QMarket is a [SaaS marketplace software](https://www.qoreups.com/qmarket/) where you can start any type of rental marketplace. 
QMarket provides unique and advanced features to make your car rental business more user-friendly.

1. Multiple Booking, Payment, Language, & Currency Options.
2. Real-Time Analysis
3. Cancel & Dispute Function
4. Site Management Options
5. Business Management Options
6. Marketing Management
7. Advance Search Filter
8. Custom Domain

The reason I strongly recommend QMarket is that it is a ready-to-go platform that helps you to launch your [car rental business](https://www.qoreups.com/qmarket/car-rental-software) within 5 minutes. 
Along with this QMarket provide a 30-day free trial to explore their product. Additionally, QMarket provides excellent customer support, ensuring that you have everything you need to get started and succeed. 
They also offer customization options, allowing you to tailor your car rental software to your specific needs and preferences. 
So, check out QMarket to know more about their offerings.
Plan to improve myself.
Published: 2023-08-04 06:43:45

■training.

| Category | Setup Software               | Memo                  | 
| -------- | ---------------------------- | --------------------- | 
| API      | Java(JDK11)                  |                       | 
| API      | MySQL8.0.19                  |                       | 
| API      | Visual C++ 2015              |                       | 
| API      | Eclipse(Pleiades All in One) |                       | 
| API      | 7-Zip                        |                       | 
| Front    | Visual Studio Code           |                       | 
| Front    | NodeJS, npm                  | node-v14.16.0-x64.msi | 
| Front    | angular-cliNodeJS, npm       |                       | 
| Utility  | git(Git Bash)                |                       | 
| Utility  | Postman                      |                       | 



●Glossary
・AOP：Aspect-Oriented Programming. A programming paradigm (思想) that focuses on separating and modularizing concerns that cut across multiple parts of a software application. In traditional programming, concerns like logging, security, error handling, and performance monitoring often become entangled (絡まった) with the main business logic. 

■Mastering Markdown Formatting Techniques
・Next!!

■Taking other actions.
　・Making a system by myself.
　　・2ch matome system.
Ruby Design Patterns | ADAPTER 🔌
Tags: ruby, rails, programming, architecture
Published: 2023-08-04 06:38:32

## Overview
The adapter is a structural design pattern that allows two objects with incompatible interfaces to work together.

## Real World Example
Before I explain what it is and how to use the adapter pattern, think about what this name associates you with. If you’ve ever been to a country that uses other electrical sockets, you must have used an adapter similar to the one in the picture below.


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

So what is the purpose of using an adapter? The adapter allows you to connect a plug(**Adaptee**) to an electrical socket(**Target**) that do not fit together.

## Coding Problem
First, we will create a simple **User** class that has two attributes, **first_name** and **last_name**, and a **full_name** method that returns the full name of the user.

```ruby
class User
  attr_reader :first_name, :last_name

  def initialize(first_name, last_name)
    @first_name = first_name
    @last_name = last_name
  end
  
  def full_name
    "#{first_name} #{last_name}"
  end
end
```

Now we want to prepare a class that will greet new users, so let's create a **Greeter** class with a **hello** method that will allow us to greet the user.

```ruby
class Greeter
  def self.hello(user)
    puts "Hello, #{user.full_name}!"
  end
end

mike = User.new('Michael', 'Scott')
Greeter.hello(mike) # => Hello, Michael Scott!
```

As we can see, everything in the example above works fine. Now let’s assume that we also want to say hello to new teams.

First we need to create a **Team** class.

```ruby
class Team
  attr_reader :name

  def initialize(name)
    @name = name
  end
end
  
development = Team.new('Development')
Greeter.hello(development) # NoMethodError: undefined method `full_name'
```

The method will of course raise an error because the **Team** class doesn’t have a method that returns the full name.

## Solution
Before we create a solution to this problem, we need to define three objects that we need in the **Adapter** pattern.

## Target
The object we want to use. In this case, it will be the **Greeter** class.

## Adaptee
The object we want to adapt to work with the target. In this case, it will be the **Team** class.

## Adapter
An object that allows **Adaptee** to connect to a **Target**.

If we have already defined **Target** and **Adaptee** objects, we can prepare our **Adapter** class. To create it, just wrap **Adaptee(Team)** with a new class(**Team Adapter**) and then create a method(**full_name**) that will be compatible with the **Greeter** class interface.

```ruby
class TeamAdapter
  attr_reader :team
  
  def initialize(team)
    @team = team
  end
  
  def full_name
    "#{team.name} Team"
  end
end
```

An adapter written in such a way can easily be used to work with the **Greeter** class.

```ruby
dev_adapter = TeamAdapter.new(development)
Greeter.hello(dev_adapter) # => "Hello, Development Team!"
```
Designing Microsoft Azure Infrastructure Solutions AZ-305 Questions
Tags: azure, certification, az305
Published: 2023-08-04 06:00:53

P2PExams is a reliable website that offers a set of real Microsoft Azure Solutions Architect [AZ-305 Questions](https://www.p2pexams.com/products/az-305) and answers that will assist you to easily pass the test with excellent result


Question No. 1

You are designing an app that will use Azure Cosmos DB to collate sales data from multiple countries. You need to recommend an API for the app. The solution must meet the following requirements:

* Support SQL queries.

* Support geo-replication.

* Store and access data relationally.

Which API should you recommend?

A. PostgreSQL
B. NoSQL
C. Apache Cassandra
D. MongoDB
Answer: A
Question No. 2

You have an Azure Functions microservice app named Appl that is hosted in the Consumption plan. App1 uses an Azure Queue Storage trigger.

You plan to migrate App1 to an Azure Kubernetes Service (AKS) cluster.

You need to prepare the AKS cluster to support Appl. The solution must meet the following requirements:

* Use the same scaling mechanism as the current deployment.

* Support kubenet and Azure Container Netwoking Interface (CNI) networking.

Which two actions should you perform? Each correct answer presents part of the solution. NOTE: Each correct answer is worth one point.

A. Configure the horizontal pod autoscaler.
B. Install Virtual Kubelet.
C. Configure the AKS cluster autoscaler.
D. Configure the virtual node add-on.
D. Install Kubemetes-based Event Driven Autoscaling (KEDA).
Answer: A, C
Question No. 3

You plan to migrate on-premises MySQL databases to Azure Database for MySQL Flexible Server.

You need to recommend a solution for the Azure Database for MySQL Flexible Server configuration. The solution must meet the following requirements:

* The databases must be accessible if a datacenter fails.

* Costs must be minimized.

Which compute tier should you recommend?

A. Burstable
B. General Purpose
C. Memory Optimized
Answer: C
Question No. 4

You have an app named App1 that uses an on-premises Microsoft SQL Server database named DB1.

You plan to migrate DB1 to an Azure SQL managed instance.

You need to enable customer-managed Transparent Data Encryption (TDE) for the instance. The solution must maximize encryption strength.

Which type of encryption algorithm and key length should you use for the TDE protector?

A. AES256
B. RSA4096
C. RSA2048
D. RSA3072
Answer: D
Question No. 5

You have an on-premises application named App1 that uses an Oracle database.

You plan to use Azure Databricks to transform and load data from App1 to an Azure Synapse Analytics instance.

You need to ensure that the App1 data is available to Databricks.

Which two Azure services should you include in the solution? Each correct answer presents part of the solution.

NOTE: Each correct selection is worth one point.

A. Azure Data Box Edge
B. Azure Data Lake Storage
C. Azure Data Factory
D. Azure Data Box Gateway
E. Azure Import/Export service
Answer: C, E