teleren/devto huggingface dataset:
Function Overloading vs Function Overriding in C++
Tags: overloading, programming, cpp, oop
Published: 2021-12-25 07:16:41

## Function Overloading:
**This can achieve at compile time**.

- It provide multiple definition of the function by changing the signature i.e change the number of parameter, change datatype of parameter .

- Return type can not play any role.


## Example:
```
// Function Overloading
#include <iostream>
using namespace std;

//overloaded functions
void test(int);
void test(float);
void test(int, float);

int main()
{
	int a = 5;
	float b = 5.5;

	// Overloaded functions with different type and number of //parameters
	test(a);
	test(b);
	test(a, b);

	return 0;
}

// Method 1
void test(int var)
{
	cout << "Integer number: " << var << endl;
}

// Method 2
void test(float var)
{
	cout << "Float number: "<< var << endl;
}

// Method 3
void test(int var1, float var2)
{
	cout << "Integer number: " << var1;
	cout << " and float number:" << var2;
}

```

## Output:
```
Integer number: 5
Float number: 5.5
Integer number: 5 and float number:5.5
```

 

## Function Overriding:

- _It can achieved at run time._

- Basically it is the features of c++ which can allow us to use and redefine a function in child class which is already declare in the base class. with the same signature.

```
// Function Overriding
#include<iostream>
using namespace std;

class BaseClass
{
public:
	virtual void Display()
	{
		cout << "\nThis is Display() method"
				" of BaseClass";
	}
	void Show()
	{
		cout << "\nThis is Show() method "
			"of BaseClass";
	}
};

class DerivedClass : public BaseClass
{
public:
	// Overriding method - new working of
	// base class's display method
	void Display()
	{
		cout << "\nThis is Display() method"
			" of DerivedClass";
	}
};

// Driver code
int main()
{
	DerivedClass dr;
	BaseClass &bs = dr;
	bs.Display();
	dr.Show();
}
```

## Output:
This is Display() method of DerivedClass
This is Show() method of BaseClass

- Overriding of function can occur when one class can inherited from  the  other class.

- overriding can come into picture when derived class want  to added the new job in the predefine function(define in the base class) without changing the signature of the function i.e number of argument, change in datatype of parameter.
Laravel 8 Interview Questions and Answers in 2022 (Part #1)
Tags: laravel, webdev, programming, computerscience
Published: 2021-12-25 09:42:46

In this tutorial we will see laravel 8 interview questions and Answers. So Please Like the post and visit on my website>>>>

[>>>>>>>>Click here to read this blog<<<<<<<](https://codexashish.blogspot.com/2021/12/laravel-8-interview-questions-and.html)


Thankyou
2022 Frontend Development interview checklist & Roadmap
Tags: javascript, webdev, react, css
Published: 2021-12-25 09:25:57

Hello folks,

I have created the Frontend Development #interview checklist and Roadmap for 2022.

Hope you find it helpful.


![Frontend fundamentals](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i0edsfikehyi36ovybnh.png)

![Framework & ecosystem](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zezt8yjfxkfoc09od8rf.png)

![Tools & advanced](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zxoei9w4y33lcfy93sv9.png)

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

[PDF link](https://github.com/sadanandpai/frontend-learning-kit/blob/main/2022_FE_roadmap.pdf)
uGUI
Tags: unity3d, ugui
Published: 2021-12-25 08:54:02

RectTransformのLeft,Right,Top,Bottomをスクリプトから変更する方法.
http://answers.unity.com/answers/1610964/view.html


```
 using UnityEngine;
 public static class RectTransformExtensions
 {
     public static void SetLeft(this RectTransform rt, float left)
     {
         rt.offsetMin = new Vector2(left, rt.offsetMin.y);
     }
 
     public static void SetRight(this RectTransform rt, float right)
     {
         rt.offsetMax = new Vector2(-right, rt.offsetMax.y);
     }
 
     public static void SetTop(this RectTransform rt, float top)
     {
         rt.offsetMax = new Vector2(rt.offsetMax.x, -top);
     }
 
     public static void SetBottom(this RectTransform rt, float bottom)
     {
         rt.offsetMin = new Vector2(rt.offsetMin.x, bottom);
     }
 }
```
Top Laravel Interview Questions & Answers 2022
Tags: laravel, webdev, tutorial, beginners
Published: 2021-12-25 08:47:28

## What is Laravel Framework?
Laravel is an open-source PHP web application framework. It is a very well-documented, expressive, and easily learn the framework. Laravel is very developer-friendly as the framework can help beginners as well as advanced users. As you grow as a developer you can go more deep into Laravel functionalities and give more robust and enterprise solutions. It is based on Symfony and its source is GitHub licensed under MIT license terms. Released in the year 2011, it is featured as a modular packaging system.

It works more efficiently by accessing relational databases which makes application deployment, orientation, and development easy. There are various features associated with Laravel; object-relational mapping, query building, application logic development of applications, reverse routing.

## Features of Laravel
Some of the main features of Laravel are:

- Eloquent ORM
- Query builder
- Reverse Routing
- Restful Controllers
- Migrations
- Database Seeding
- Unit Testing
- Homestead
- Source code hosted on GitHub and licensed under MIT License.
- Most Starred PHP Framework for custom software development on Github.
- Its ability to use all of the new features of PHP sets it apart.
- Friendly online community
- Detailed documentation

## Most Frequently Asked Laravel Interview Questions

### 1. What is the latest Laravel version?
The latest Laravel version is 8.x.

### 2. Does Laravel support caching?
Yes, Laravel provides support for popular caching backends like Memcached and Redis.

By default, Laravel is configured to use file cache driver, which is used to store the serialized or cached objects in the file system. For huge projects, it is suggested to use Memcached or Redis.

### 3. Define Composer
The composer is the package manager for the framework. It helps in adding new packages from the huge community into your laravel application. It generates a file(composer.json) in your project directory to keep track of all your packages.

### 4. Explain Events in Laravel
An event is an action or occurrence recognized by a program that may be handled by the program or code. Laravel events provide a simple observer implementation, that allows you to subscribe and listen for various events/actions that occur in your application.

All Event classes are generally stored in the app/Events directory, while their listeners are stored in the app/Listeners of your application.

[Read More](https://techvblogs.com/blog/laravel-interview-questions)
programming memes that are refreshing
Published: 2021-12-25 08:29:48

Time to take a short break from coding all day..


lol this one is funny: 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wkjewzo63cus42tefu8f.png)
Same for this:
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hybbj60u2sma9bvtl9o1.png)
 
<br><br>

 
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ltmp7mu4w9c4grk2zmai.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/enfqfu9em5hlyf2w96hl.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/iaw2iu8o81q0d4ps27cp.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ldyvwnt62juvj2k4ypwj.png)
 ![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sfnb7fpexpgv7mqlhwsh.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6po7pug86ip8w8lfz09y.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1z5kefpq0w9kjdtdgpfs.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c031rtm1yneyx23dwmk7.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rbxb64bkeqcvvhs3qfij.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/irn6rwe7ac4picwk9ovb.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lobhzywwaqime7ipgsxf.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dav2h7jym7dsf6q3ij6i.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gh79fs9bj11iou7srzgr.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/naisfqs5zrnz5am71ajv.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1amk5nfz2yvm90m1tizx.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zplb1kg0xojnm8ejw9wf.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l2v6ye5q9qqluk5qa1nq.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l259uxr53mz12d3b5qsf.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ivbapasrauy5kawkxy18.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dhvzbxeedw4llg3u6vdw.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0llfo6b8i8fdrmpxer5n.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a8yxaeq3r1lg07i3c9e5.png)
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vwecwnwv5xe8gr0r6jx7.png)

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

<br>

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

Also Merry Christmas to those who celebrate it! (Pacific standard time)
MOVIE APP USING HTML CSS AND JS
Tags: movie, movieapp, webapp, project
Published: 2021-12-25 08:25:42

hi guys today i make a movie app project using html css and js
i am not able to post the code because it is simple javascript having api key visible so next time i make the app using node and hide the key.

_for any query comment below;

linkedin profile link

[movie app link](https://www.linkedin.com/posts/abhishek-rajput-58b5811a8_movies-movieapp-project-activity-6880420546375405568-QUdr)
Interactive Personal Portfolio website with HTML CSS JS
Tags: css, tutorial, javascript, beginners
Published: 2021-12-25 08:19:36

{% youtube 7Zz61aOEXJI %}

How to make interactive personal portfolio website with html css javascript.

In this video, I will show you how to create (mobile-first responsive) interactive personal portfolio website using html css javascript.

---

HI 👋
I'm Sadee (webdev)
In this channel I make videos about Complete Responsive website.
You can checkout my channel 👇

📺 My Channel : [codewithsadee](https://www.youtube.com/channel/UC1PZHWV6VvICTL1LgFUZq6g)
🔔 Subscribe : [subscribe now](https://www.youtube.com/channel/UC1PZHWV6VvICTL1LgFUZq6g?sub_confirmation=1)
🕐 New videos Every Friday & Tuesday

---

🔗 Essential links
-----------------------------
[All Images](https://drive.google.com/file/d/1LGbS5U-ydGVDZzy14QdyyY3N26LQtWCt/view?usp=sharing)
[Text](https://drive.google.com/file/d/1sJjTY8nlESDecPoiNspLQuugX2V9qylh/view?usp=sharing)
[Font - Jost](https://fonts.google.com/specimen/Jost?query=jost)
[Ionicon](https://ionic.io/ionicons)
[Source Code](https://www.patreon.com/posts/source-code-60317722?utm_medium=clipboard_copy&utm_source=copy_to_clipboard&utm_campaign=postshare)

---

⏱️ Timestamps
-----------------------------
0:00 - Demo
3:35 - File structure
4:04 - Html initial
4:36 - Variables & reset css
6:33 - Header nav & intro
23:20 - Home section
25:50 - About section
45:55 - Portfolio section
55:20 - Services section
59:53 - Customers section
1:04:17 - News section
1:09:32 - Contact section
1:17:30 - Footer section
1:21:47 - Javascript functionality
1:30:45 - Media queries

---

💜 Like - Follow & Subscribe Me
-----------------------------
Twitter : https://twitter.com/codewithsadee
Github : https://github.com/codewithsadee
YouTube : [codewithsadee](https://www.youtube.com/channel/UC1PZHWV6VvICTL1LgFUZq6g)
Buy Me A Coffee : https://www.buymeacoffee.com/codewithsadee
Patreon : https://www.patreon.com/codewithsadee

---

[![Buy Me A Coffee](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9kn6vwn4mulhsx6o69is.png)](https://www.buymeacoffee.com/codewithsadee)
My Awesome Tic Tac Toe Game - Codecademy!
Tags: python, bash
Published: 2021-12-25 08:18:54


**Love For The Game?**

I do enjoy the game, don't get me wrong, but the reason why I wanted to code a game for my first final project on the path to becoming a computer scientist was the fact that I went into project based learning because I wanted to code a game to begin with. The game I wanted to code is an online version of **The Royal Game of Ur**, the oldest known board game. The game of Ur however is much more difficult to code than your typical tic tac toe and the outcome I was hoping for from doing this project is to get out with some lessons which could help me develop my future game. 

---



**What have I learned?** 

1. It's much more difficult to play with <u>object oriented programming</u> when the code base is small, going with functions felt much more natural, it kinda didn't make sense to have a class. Although, to be fair to OOP, I just started learning OOP recently. I am very excited to see what I can do with it in a bigger project.

2. TODO's and comments are essential, the helped me to think through the project and I think it made my coding experience much faster.

---


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


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


Code repo: https://github.com/ZeevKeane/TicTacToeTerminal
简单方法写高质量的代码
Published: 2021-12-25 08:13:54

---
title: 简单方法写高质量的代码
published: true
description: 如何写高质量的代码
tags: 
//cover_image: https://direct_url_to_image.jpg
---

首先，要知道单元测试是怎么写的。

下面是一个要测试的函数：

```ts
function add(a: number; b: number;) {
   return a + b;
}
```

我们要写单元测试，保证这个函数是OK的：

```ts

describe('add', () => {
  it('should work', () => {
     expect(add(1, 2)).toBe(3);
     expect(add(4, 4)).toBe(8);
  })
})
```

如果我们给的测试用例都能通过，那么说明我们的方法是安全可用的。

所以，在你写模块，写函数的时候，如果你的模块，函数，能被很容易的单元测试，那么你写的模块，函数就是80%安全可用的，出现bug的几率很少的。

但是，假如我们把上面的函数改变下：

```ts
import { addByRemote } from './api.js';

async function add(a: number; b: number) {
  return await addByRemote(a, b);
}
```

现在这个函数可以很方便的被单元测试吗？答案是不能。因为它依赖了一个接口调用，这个依赖的实现逻辑复杂度是不能确定的，但是我们把它耦合到了我们的add方法里了，那么我们的add方法逻辑就包含了这个接口的逻辑。

我们的add只是个例子，里面的逻辑很简单，但是想像这是个很复杂的业务逻辑，我们要写单元测试，保证这个业务逻辑是OK的，但是因为这个接口调用，我们的业务逻辑变得更复杂更臃肿了。我们的业务逻辑只是依赖这个接口的结果，不想关心接口里面的逻辑的。你如果把这个接口的结果看成函数的参数，就很好理解了。

现在这个 add 函数无法进行单元测试的，因为我们很难模拟这个 http 接口请求，我们可以称这个接口请求为副作用。如果这样的副作用变得多了，那么这个函数变得更加不稳定，更加难于测试了。

那么怎么处理这样的情况呢？

方法1: 把接口的结果作为参数传入我们的函数。
方法2: 通过依赖注入的方式，将这个API注入进去。这样的好处是，我们在单元测试的时候，可以注入一个我们模拟的函数作为这个API。

结论：如果你写的函数，不能很容易的被单元测试，那么你就需要考虑你的函数里面的依赖关系了，否则你写的就是一个很不好的代码。
Making a Slide Down Jigsaw Puzzle Game
Tags: gamedev, puzzle, indiegame, android
Published: 2021-12-25 08:13:42

I've been a fan of puzzle games ever since I'm a little kid, and the good thing with puzzles, even as an adult we can still play it and still feeling the same excitement as we were a little kid.

With mobile market flooded with all kind of puzzle games, finding some that are unique can be quite challenging. There are two types of puzzle nerds, one that want to solve complex puzzles no matter how long it takes for them to solve it, while the other one is more like a casual type, where all they want is to just killing some time and not being stressed or think hard while playing it. The later is where the idea of slide down jigsaw puzzle game came from. A simple, easy to play, one handed operation and that's all about it.

You can play the game for free with your android phone:
[Jigsaw Me Cat](https://play.google.com/store/apps/details?id=com.Breadnone.JigSawMeCat)

For years I've been what so called a solo-indie-developer. Juggling from one programming language into another is like a routine for each game I'd like to develop, just for the sake of developing games for hobbies and once the game done, bragging off in front of friends or relatives sorta feels like an achievement. The idea to publish my game came from 3 years ago, after reading some successful stories regarding indie games.
Advent of code, last puzzle
Tags: adventofcode, adventofcode2021, programming, 42
Published: 2021-12-25 08:00:12

And this is the solution for the last day of advent of code 2021
```
reuse [L42.is/AdamsTowel]
Fs = Load:{reuse[L42.is/FileSystem]}

Cell = Collection.Enum:{
  Right={},Down={},Empty={}
  }
Map = (
  input = Fs.Real.#$of().read(\"input")
  var I col = 0I
  var I row = 0I
  for s in input.split(S.nl()) (row+=1I)
  for s in input.split(S.nl())().split() (col+=1I)
  Collection.matrix(Cell.List,row=row,col=col)
  )//row=137, col=139

Right = {class method Map.Coord (Map.Coord that) = 
  that.with(col=(\col+1I).mod(139I))
  }
Down = {class method Map.Coord (Map.Coord that)=
  that.with(row=(\row+1I).mod(137I))
  }

StepRight = {class method Map (Map map) =(
  res = Map(\()(for v in map \add(v)))
  for c in map.coords(), v in map if v==Cell.Right() (
    cr = Right(c)
    go = map.val(cr)==Cell.Empty()
    if go (
      res.set(cr val=v)
      res.set(c val=Cell.Empty())
      )
    )
  res
  )}
StepDown = {class method Map (Map map) =(
  res = Map(\()(for v in map \add(v)))
  for c in map.coords(), v in map if v==Cell.Down() (
    cd = Down(c)
    go = map.val(cd)==Cell.Empty()
    if go (
      res.set(cd val=v)
      res.set(c val=Cell.Empty())
      )
    )
  res
  )}

Main=(
  input = Fs.Real.#$of().read(\"input")
  var imm map = Map(\()(
    for s in input.split(S.nl()) for c in s.split()(
      if c==S"." ( \add(Cell.Empty()) )
      if c==S">" ( \add(Cell.Right()) )
      if c==S"v" ( \add(Cell.Down()) )
    )))
  res = 0I.acc()(while Bool.true() (
    new = StepDown(map=StepRight(map=map))
    if new==map ( Break() )
    map:=new
    v=\val
    \addOne
    ))
  Debug(res)
```
Overall, this adventure guided me to try many different kinds of algorithms in 42, and by doing so I discover a bunch of bugs and missing features in AdamsTowel.

Still, this programming style is very far from the ultimate goal of 42: Enforcing modular security.
This is where 42 shines, but this mostly emerges when the program is large enough that can not be reasonably done by a single programmer and where long term maintenance is kept into account.

I will be back to Dev.to after the new year break to talk more about the details of 42 and on how it enforces modular security.

Marco!
To Pair Or Not To Pair: Benefits
Tags: agile, programming, productivity
Published: 2021-12-25 07:52:57

**This post serves as the continuation of a previously written piece with the link** https://dev.to/ulimicreator/to-pair-or-not-to-pair-introduction-1n9 

---

Like many other processes, the implementation details of pair programming are left to the entity that intends to implement it. This is so because all effects are eventually carried and borne by the entity.
And whiles one can't properly quantify the productivity of programmers in a workplace, when done well, pair programming could provide these benefits:

- Programmers get to learn easily from experienced developers and the knowledge flow is constant and all-encompassing to all participants.

- Better code writing, since the one typing the code, i.e. the driver, justifies their code as they type by explaining why they are writing it in such a manner, and a probable input from the navigator could produce a better option.

- More communication between programmers in the workplace since programmers who have been paired together would have been placed in the situation where they have to "program out loud" and express their opinions.

- Programmers get to understand each other's workflow and habits, and this can serve as a fertile ground for
relationships.

- Real-time feedback on the programmer's code is received since with pair programming, the driver literally has someone "watching their back" and this eventually leads to less future code refactoring and reduces the chances of repeating smelly code.

- Programmers tend to realize when paired with their fellow programmers that everyone makes mistakes, and understanding this fact is essential to a healthy mind.

- Bonds are formed fast and relationships are established easily. This can be extremely beneficial to new employees. And whiles you don't need to be friends to work with someone, most of the boundaries that exist with acquaintances are removed and this produces more efficiency.

- With pair programming, when new programmers are paired with programmers more familiar with the codebase they are initiated quite easily and efficiently.

- Participants grow to be able to accept feedback and work on them fast, and being able to learn from your mistakes in due time makes you a better programmer and ultimately, a better human being.

- Pair programming could be fun.

---

`All suggestions and criticisms on any of my posts are accepted as long as they are not provided in a disparaging manner`
Clavusin – Negative Side Effects or Legit Fungus Relief?
Published: 2021-12-25 07:52:42

My main worry is putting food on the table. I certainly disagree that we shouldn't presume everyone likes doing this. Now I can turn my focus to using it and you probably understand what I'm talking about touching on doing that. Luckily, a lot of connoisseurs feel that do-it-yourself [Clavusin ](https://ipsnews.net/business/2021/12/20/clavusin-review-real-ingredients-or-scam-user-complaints-and-warnings/)is not trustworthy. Let's fine tune your Clavusin although I'm finished with it. Feelings about that jest are deep rooted. It might want to have you eating out of the palms of their hands. Just how vital is that? That should be invaluable help to you. At the time gentlewomen wanted Clavusin but only the well off could obtain them whenever when you are completed studying this in depth article, you'll comprehend exactly what I mean. This has been one sunny day. How can societies grab priceless Clavusin manuals? My main response was as this relates to this problem. This was really a Clavusin palace like I had never seen. They're on solid ground now. Sigh… Only a few maniacs will forget that these kinds of Clavusin are the realities as it touches on Clavusin Reviews. In general, don't worry referring to that. This would be dull and boring if it stuck to small baby steps. This is not going to be a lecture on Clavusin. 

Click Here=> [https://ipsnews.net/business/2021/12/20/clavusin-review-real-ingredients-or-scam-user-complaints-and-warnings/](https://ipsnews.net/business/2021/12/20/clavusin-review-real-ingredients-or-scam-user-complaints-and-warnings/)