teleren/devto huggingface dataset:
call, apply & bind
Tags: javascript, functionborrowing, object
Published: 2024-03-15 21:04:43

call, apply and bind sometimes we called it function borrowing

**Call:** it can map a function with different object like-

```
let name = {
  firstName: 'Danish',
  lastName: 'Raza',
};

let printFullName = function () {
  console.log(this.firstName + ' ' + this.lastName);
};

let name2 = {
  firstName: 'Lav',
  lastName: 'Singhania',
};

console.log(printFullName.call(name2));
```

above code we can just call the function printFullName by passing the object which we want to call.

call method accept the object as a parameter which you want to call. In above case we are calling name 2 object

We can also pass the extra parameter to the call function like-

```
let name = {
  firstName: 'Danish',
  lastName: 'Raza',
};

let printFullName = function (hometown, state) {
  console.log(
    this.firstName + ' ' + this.lastName + ' is from ' + hometown + ', ' + state
  );
};

let name2 = {
  firstName: 'Lav',
  lastName: 'Singhania',
};

console.log(printFullName.call(name2, 'uttam nagar east', 'delhi'));
```

in the same example we add the two extra parameter named hometown and state. by this way we can pass infinite no of parameters to the function.

**apply:** bind method is same as call method except we pass extra parameters in the array form, like-

```
let name = {
  firstName: 'Danish',
  lastName: 'Raza',
};

let printFullName = function (hometown, state) {
  console.log(
    this.firstName + ' ' + this.lastName + ' is from ' + hometown + ', ' + state
  );
};

let name2 = {
  firstName: 'Lav',
  lastName: 'Singhania',
};

console.log(printFullName.apply(name2, ['uttam nagar east', 'delhi']));
```

**bind:** bind is bit different from these two. In bind method it returns the copy of the existing function that we can invoke later.

```
let name = {
  firstName: 'Danish',
  lastName: 'Raza',
};

let printFullName = function (hometown, state) {
  console.log(
    this.firstName + ' ' + this.lastName + ' is from ' + hometown + ', ' + state
  );
};

let name2 = {
  firstName: 'Lav',
  lastName: 'Singhania',
};

const printName = printFullName.bind(name2, ['uttam nagar east', 'delhi'])

// printname is the copy of printFullName function which we are invoking below.

printName();
```

in this code snippet printName is the exact copy of prinFullName functon.
Aspect Programming comes in real handy to solve certain types of software problems
Published: 2024-03-15 21:03:31

Let's talk about Aspect-Oriented Programming, or at least some aspects of it. For those of you who are not familiar, you should certainly look it up. But I presume many of you may have used this at some point in your career. If you're a Java developer, you may have used AspectJ or Spring AOP depending on the language or stack you work with.

Many languages support this concept, albeit under different names. Sometimes the support may not be uniform across all languages, but there is support for aspects in most languages. If not, you may need to implement it yourself or approach it using a design pattern.

So let me explain why I think it's useful and discuss some of the more obvious use cases. When people talk about aspects or pointcuts and concerns, they're often referring to logging, performance monitoring, or caching.

Let's consider one of these examples. Imagine you have a large codebase with numerous classes and modules, and you want to improve performance. How do you go about it? First, you need to identify the bottlenecks. There are various tools available for this purpose. Once you've made progress, you might want to optimize certain methods or APIs. The most straightforward but not necessarily the best approach would be to edit each of these methods individually and make specific changes.

However, this approach has drawbacks. You'll need to conduct regression tests, go through the entire test suite again, and potentially disrupt multiple layers of your application. With aspects, you don't need to modify individual methods. Instead, you write the core functionality elsewhere. Whether it's caching, performance monitoring, or something else, you implement it in a separate layer or set of classes. Then, you "wrap" these methods with your aspects. This way, the changes occur outside the essential code layer, minimizing impact on the existing codebase.

By using aspects, your tests can focus on the new changes related to performance or caching, without worrying about breaking existing code. Remember, the more you modify, the more potential there is for disruption and the more extensive your testing requirements become. Even if you're not using a specific AOP library or framework, consider applying aspect-oriented design patterns to your problem-solving approach.

In the long run, you're likely to regret making changes directly to specific classes or methods, as it can lead to maintenance challenges and unintended consequences. So, give aspect-oriented programming another thought and use it whenever you can.
Episode 24/09: Testing without TestBed, SSR & Hydration
Tags: angular, webdev, javascript, programming
Published: 2024-03-15 20:56:28

Alex Rickabaugh clarified that tests without TestBed are not recommended. Matthieu Riegler talked about SSR, hydration, and things to come.

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

## Testing without TestBed?

As discussed in former episodes, the inject function has advantages over the constructor-based dependency injection. The main drawback with the inject function, has been writing tests without the Test


With a constructor-based DI, we just call new and provide the mocks to the constructor. That doesn't work with inject, and Angular forces us to use TestBed.


Alex Rickabaugh, the lead of the Angular framework, now has a clear answer regarding testing. We should go via TestBed. Only with TestBed can the Angular team ensure that tests behave like the application.


If you need to write tests without the TestBed, use an abstraction layer to decouple your code from Angular's DI. The argument that tests are too slow doesn't apply anymore is running on Ivy. That has been the case since Angular 9.

https://github.com/angular/angular/issues/54438

## SSR & Hydration

Matthieu Riegler was a guest on the Angular Air podcast and discussed hydration and server-side rendering (SSR).

He showed all the necessary things we must be aware of: how to opt-out specific components from hydration, what kind of code cannot be on the service, and issues with asynchronous functions and integration into the DevTools.

He also discussed the future plan.

For example, we might be able to run defer on the server in v18. That would be similar to Server Components in React, where the JavaScript for some components doesn't have to run on the client.

Another upcoming feature might be partial hydration, where the browser only downloads JavaScript chunks when they are required. Last but not least, SSR also has to be ready for zoneless applications.

{% embed https://www.youtube.com/watch?v=7XnWbV1ctmM %}

## Nx and "crystalizing" Angular

We have to accept a slight divergence when using Nx, an alternative to the Angular CLI. For example, the angular.json file is divided into multiple project.json files.


Version 18 of Nx brought Project Crystal, which allowed Nx to infer its task via the existing configuration files. Lars Nielsen started a discussion on GitHub about whether Nx wants to "crystalize" Angular. As a consequence, it would bring back the angular.json, improving Nx's compatibility with the Angular CLI.

https://github.com/nrwl/nx/discussions/21994

## RxJs 8 and the future of the `Observable`

Also happening on GitHub: A discussion about the shape of RxJs 8. With Observable becoming a standard and natively supported by the browser the obvious question is on which Observable RxJs should be based on.

https://github.com/ReactiveX/rxjs/discussions/7447
Exploring Python Objects: A Dive into Identity, Types, and Mutability
Published: 2024-03-15 20:45:16

Sup reader!!,

## Introduction

Python, a dynamic and robust programming language, it opens the door to the captivating realm of objects. In this article, we are going to explore the fundamental concepts of identity, types, and mutability within Python's object-oriented paradigm. Mastery of these principles is essential for crafting optimized and error-free code.

![Let's get started](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qugy7srisk44bgz1o6b8.png)

## What's id in Python?

In Python, the built-in function id() is a function that retrieves the unique integer representing an object's memory location. Every object in Python has a distinct identity, even if they share the same value.

## What's type in Python?

In Python, the type() function is a function that reveals an object's class or type, aiding informed decisions on manipulation or interaction.

## Mutable vs. Immutable Objects

In Python, mutable objects are those whose state or content can be changed after they are created whereas immutable objects are those objects that are essentially read-only any attempt to modify their content results in the creation of a 
new object.

Here are the examples of mutable and immutable objects:

**Mutable Objects:**

- Byte array
- Dictionary
- Set
- List

**Immutable Objects:**

- Numbers (int, float, complex)
- String
- Tuple
- Bytes
- Frozen Set

Understanding mutability is vital, as it impacts how objects behave during assignments and referencing.

## Variable Assignment vs. Referencing in Python:

Assigning a value to a variable establishes a reference to the object. In Python, variables are names bound to objects, making it vital to distinguish between assignment and referencing to prevent unforeseen outcomes in your code.

## Memory Storage of Immutable Objects:

Immutable objects, once initialized, remain unchangeable. A new object with the updated value is created if modifications are attempted. This approach preserves the integrity of the original object's value.

## Examples with Memory Schema

Let's explore examples to understand the concepts we discussed earlier clearly.

**Example 1: Immutable Object**

```
name = "Alice"

name[0] = "B"  # Throws an error as strings are immutable.

```
In this example, trying to modify the first character of the string name results in an error, highlighting the immutability of strings.

## Example 2: Mutable Object

```
colors = ["red", "green", "blue"]

colors[0] = "yellow"

```
Here, the first element of the list colors is successfully changed to "yellow", highlighting the mutability of lists.

## Variable Value Management in Function Calls

When passing a variable to a function in Python, the mechanism used is known as **"pass by assignment."** This implies that the function receives a reference to the object, rather than a copy. It's essential to learn this mechanism for anticipating your function's behavior.

If you've read this far, 

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/05lahb4cjrgwz7fe3j7p.png)
Treating code reviews like engineering tasks?
Published: 2024-03-15 19:59:48

I'm managing a team (around 6 devs, ~200 devs in the entire company) and we've always had some issues with code reviews and specifically collaboration between team members on reviews.

The way it used to work was as follows - someone would throw their merge request in the team's channel, and then start pinging team members for reviews.

This works eventually, but it keeps the dev blocked until someone takes a look at his code; moreover, some MRs are forgotten about/lost in the channel - until the dev remembers them and resends them again.

We started with a new pilot - sending a [general Slack message ](https://devoro.co/)before our daily standup and assigning each team member to an MR he should review; so far it's working much better, and team members are integrating reviews into their workflow.

Has anyone experienced anything similar? would appreciate some extra tips to reduce the time it takes to merge code/improve collaboration.
Thanks!

(Full disclosure - I'm building a [tool](https://devoro.co/) that originated as a solution for this exact problem. I'm curious about how different teams approach and solve this issue )
Assisted Tech (accessibility)
Tags: devops, a11y, devresolutions2024, devimpact2023
Published: 2024-03-15 20:08:29

For a new venture for eldercare and assisted living patients we are providing assisted tech to nursing homes etc. I am looking for people who are willing to collab someone told me this the best place to be. I'm an I.T. professional - Nuclear Imaging & Medical Informatics Sales Certified PACS/VNA - Co-founded 40+ American Brands to provide tech assistance, reputation management & cyber security.
The Homecoming: Rekindling My Journey on Dev.to
Published: 2024-03-15 20:07:11

Hello, Dev.to Community!

It's been a long four years since I've last connected with many of you. Back in my university days, I used to document my burgeoning journey into Google Summer Of Code right here, on this very platform. Since then, my path has taken me through a whirlwind of growth and experiences, particularly in the realms of **blockchain**, **AI**, and **WebAssembly**.

Now, after a significant hiatus, I'm thrilled to announce my return to Dev.to , ready to share the wealth of new insights and knowledge I've accumulated.

### Where I've Been

Since we last met on this platform, I've transitioned from a student to a **Web3 Developer**, deeply immersed in the decentralized tech space. My post-university days were ignited by the **Ethereum India Fellowship 2.0**, propelling me into a vibrant role at **dOrg**. There, I've had the privilege to contribute to projects that have pushed the envelope in **DeFi, governance, and infrastructure**.

### What's Next

As I make my return to Dev.to, I intend to bring you all along on my ongoing adventure. I'll be sharing:

- **In-depth analyses** of complex projects I've had the pleasure to architect and lead.
- **Insights into decentralized organizations**, reflecting on my journey with dOrg.
- **Experiences and tips** on software development to living the digital nomad life, balancing a global lifestyle with the demands of a tech career.

This blog is not just a one-way street. I'm looking forward to re-engaging with the Dev.to community. Your thoughts, feedback, and discussions are what I've missed the most. Let's reconnect and grow together as we explore the fascinating world of tech that lies before us.

Stay tuned for more posts, where I'll delve into the nitty-gritty of **blockchain development**, the challenges of **tech leadership**, and the exciting intersection of professional development and personal exploration.

I'm excited to be back, and I can't wait to start this new chapter with all of you.
GitHub Branch Management: A 3-branch approach for faster feature development
Published: 2024-03-15 19:53:19

I want to talk a little bit about Git's branch management. As you know, Git is a super powerful tool that can do a million things. So, I'll focus on just one tiny aspect of it.

A bit of background: We're a small team, but our product has a ton of features. At any given time, we have several feature branches open. Here's how we manage them:

We have three core branches: 

1. **Master branch**: This reflects what's currently in production and maps to our latest tags.
2. **Develop branch**: This contains the latest changes at any given time, with some caveats.
3. **Develop interim branch**: We didn't have this branch six months ago, but we found a need for it. Initially, it's in sync with the develop branch, pointing to the same commit IDs.

When we work on a new feature (let's say a UI enhancement), we create a new branch off of develop interim, make the necessary changes, and then proceed with the review, merge, and deploy process (RMD). We review the changes, make any necessary adjustments based on feedback, and then proceed with the merge.

We merge the feature branch into develop interim, not directly into develop, to avoid discrepancies and potential dependencies. Once other changes, like API updates, are completed, we follow the same process across other repositories. If everything looks good after deploying to development or testing environments, we merge the changes forward to develop.

Given that we often work on multiple features simultaneously and await feedback from other team members, we sometimes face merge conflicts. In such cases, we decide whether to create a new branch off of develop interim or work on the existing feature branch, considering the potential for conflicts.

Once we're satisfied with the merged changes in develop interim and have thoroughly tested them, we merge them into develop. After deploying to a different server and ensuring stability, we proceed with further testing and eventually deploy to production, creating a tag in the process.

That's a high-level overview of our Git management process. Thank you.
Free FigJam 4 Brainstorming Methods Templates
Tags: figma, figjam, ui, uidesign
Published: 2024-03-15 19:40:51

Empower your remote team's creativity with our free FigJam templates, offering four distinct methods for online brainstorming sessions. From traditional brainstorming to brainwriting, explore various techniques like How Now Wow and SCAMPER to spark idea generation. With FigJam's intuitive tools, facilitate collaborative mind mapping sessions and unlock your team's full potential regardless of geographical barriers.

> See Also
[Free FigJam (40+) Whiteboards Teams Templates](https://neattemplate.com/figjam/free-figjam-40-whiteboards-teams-templates/)

Utilize FigJam's versatile templates to seamlessly conduct brainstorming sessions, fostering innovation and problem-solving. Whether you're exploring new concepts or refining existing ideas, FigJam provides the framework for effective collaboration and idea generation among remote teams. Download our free templates today and revolutionize your brainstorming process.

**Author**: Rajeev B Pogaru

[Download](https://www.figma.com/community/file/1143933002014375180)

### See Also
✍[5+ Free Figma Login Page with Image Template](https://neattemplate.com/figma-templates/5-free-figma-login-page-with-image-template/)
✍[Figma Free 30 Screens eCommerce UI Kit](https://neattemplate.com/figma-mobile-app/figma-free-30-screens-ecommerce-ui-kit)
✍[Figma Free Glassmorphism Presentation Template](https://neattemplate.com/figma-templates/figma-free-glassmorphism-presentation-template/)
✍[Figma Freebie Glassmorphism Icons Simplified](https://neattemplate.com/figma-icons/figma-freebie-glassmorphism-icons-simplified)
✍[24+ Free Figma x Lottie Animated Emoji Pack](https://neattemplate.com/figma-icons/24-free-figma-x-lottie-animated-emoji-pack/)
✍[Figma Free Glassmorphism Presentation Template](https://neattemplate.com/figma-templates/figma-free-glassmorphism-presentation-template/)
From Coding to Writing: My Unexpected Blogging Journey
Tags: wecoded, womenintech, trans, diversity
Published: 2024-03-15 18:38:00

I am so happy to be a part of the **DEV community**. While writing my latest blog, I came across an article about **we_coded**. WeCoded is an event held by the DEV community on the occasion of **Women's Day**.
I read some of their blogs, and I felt happy to see the DEV community were encouraging and supporting womens.
It filled me with pride that I am part of such an inclusive and supportive community. Moreover, I thought to share my journey with my fellow developers and build connections with like-minded people.

I am here to share my blogging journey with you and how I started writing the blog from being a professional developer to a blogger.

As a professional developer, I never thought of stepping into the world of blogging. However, one fine day my husband (Rajeev) made an unexpected suggestion "**Why don't you write a blog?**" This helps beginners struggling to find a solution, or searching for a simple and basic informative blog which makes them kick-start their journey into the world of technology.

When I first heard of that I was taken aback. I had so many questions in my mind how do I do that? I am not into writing, what if there were no readers? But his faith in me made me overcome that fear.

I researched many different blogging platforms, weighed the pros and cons and finally settled on one which suited me.
Now my biggest challenge is to find my writing voice as a developer I always communicate in code. Further, I started researching how to write content, and on which topics should I write first. What technology it must be? 

I started with small tips and tricks, and coding tutorials in steps. I enjoyed converting complex concepts into simple and smallest steps. While writing from my very first blog to another, I thought I would not write more than two to three blogs, but I was wrong. I am deeply involved and I enjoying it. Though I am not good at writing content, I believe I am improving day by day with each blog post. 
Moreover, comments from the readers overwhelm me to write more.

It wasn't always an easy task. There were days when I felt sad and wondered if anyone was even reading my posts. Is anyone interested in it? But by considering my husband's (Rajeev's) faith in me and trusting myself, my love for coding would shine through. So I keep on writing.

**Conclusion:**
Staring a blog is not an easy task and requires patience, but it's been worth it. It has its challenges which grow me as a writer as well as a good coder. It introduced me to a wonderful community of like-minded people.

This is my journey from developer to blogger. I can't wait to see where it takes me next.

Thank you for reading. Please forgive me for any mistakes, as I am still learning and growing.

**Thanks!!**
**Happy Reading and Happy Coding!!**
:heart: :unicorn: