teleren/devto huggingface dataset:
Clean iOS Architecture pt.5: MVC, MVVM, and MVP (UI Design Patterns)
Tags: coding, ios, swift, learning
Published: 2018-09-25 06:35:08

---
title: Clean iOS Architecture pt.5: MVC, MVVM, and MVP (UI Design Patterns)
published: true
tags: coding, ios, swift, learning
canonical_url: https://www.essentialdeveloper.com/articles/clean-ios-architecture-pt-5-mvc-mvvm-and-mvp-ui-design-patterns
cover_image: http://static1.squarespace.com/static/5891c5b8d1758ec68ef5dbc2/58921b5a6b8f5bd75e20b0f4/5b7bde11032be4bba7fc2e06/1534844794366/thumbnail-4.png?format=1000w
---

<iframe scrolling="no" allowfullscreen="" src="//www.youtube.com/embed/qzTeyxIW_ow?list=PLyjgjmI1UzlSWtjAMPOt03L7InkCRlGzb&amp;wmode=opaque&amp;enablejsapi=1" width="854" frameborder="0" height="480">
</iframe>

{% youtube qzTeyxIW_ow %} [Watch on YouTube](https://www.youtube.com/watch?v=qzTeyxIW_ow&list=PLyjgjmI1UzlSWtjAMPOt03L7InkCRlGzb)

In this video, we're going to explore the main differences between the MVC, MVVM, and MVP design patterns.

We’ll start with a quick recap of the MVC, MVVM and MVP history and move to modern days where we’ll explore ideas on how we can apply those patterns in iOS applications with UIKit. Finally, we’ll discuss why none of those acronyms can be considered a software architecture, but just UI design patterns.

For more, visit the [Clean iOS Architecture Playlist](https://www.youtube.com/watch?v=PnqJiJVc0P8&list=PLyjgjmI1UzlSWtjAMPOt03L7InkCRlGzb).

[Subscribe now to our Youtube channel](https://www.youtube.com/essentialdeveloper?sub_confirmation=1) and catch **free new episodes every week**.

* * *

Originally published at [www.essentialdeveloper.com](https://www.essentialdeveloper.com/articles/clean-ios-architecture-pt-5-mvc-mvvm-and-mvp-ui-design-patterns).


We’ve been helping dedicated developers to get from low paying jobs to **high tier roles – sometimes in a matter of weeks!** To do so, we continuously run and share free market researches on how to improve your skills with **Empathy, Integrity, and Economics** in mind. If you want to step up in your career, [access now our latest research for free](https://www.essentialdeveloper.com/courses/career-and-market-strategy-for-professional-ios-developers).


## Let’s connect
If you enjoyed this article, visit us at [https://essentialdeveloper.com](https://essentialdeveloper.com) and get more in-depth tailored content like this.

Follow us on: [YouTube](https://youtube.com/essentialdeveloper) • [Twitter](https://twitter.com/essentialdevcom) • [Facebook](https://facebook.com/essentialdeveloper) • [GitHub](https://github.com/essentialdevelopercom)
Why you should use code coverage tools
Tags: testing, tdd, beginners, explainlikeimfive
Published: 2018-08-21 08:45:12

---
title: Why you should use code coverage tools
published: true
canonical_url: https://www.linkedin.com/pulse/why-you-should-use-code-coverage-tools-diederik-loos/
description: Code coverage can be one of the simplest steps towards testing your software. But what is Code coverage, and why would you even use it?
tags: testing, tdd, beginners, explainlikeimfive
cover_image: https://media.licdn.com/media/gcrc/dms/image/C5612AQHtfSUWDvvLRA/article-cover_image-shrink_720_1280/0?e=1540425600&v=beta&t=wToPw5T4ZjfcBE6c9qrEW4JBPvClj8Zg-Rk2Psa9FwI
---
*originally posted on [Linkedin](https://www.linkedin.com/pulse/why-you-should-use-code-coverage-tools-diederik-loos/)*

It can be quite difficult to write safe software sometimes. You have to take every possible execution path into account, and you should consider every possible input. And even if you have written code that covers virtually every possible situation, you still have to test every scenario. By using code coverage tools, you can see what lines of code have been executed, and how many times these lines have been executed. By combining your unit tests with code coverage, you can make sure that every function is executed at least once.

Given the following scenario:

You are writing a program that automatically will open your windows when the temperature in your house gets too high. you Define a function for opening the window, and one for closing the window. There is also a lock on the window, to keep burglars out. The program looks as follows:
![original program](https://thepracticaldev.s3.amazonaws.com/i/bgz42wqsvjsyv9y1czi6.jpeg)

After compiling and running the code, everything looks fine, but there is one problem that you could have spotted with gcov:

![The window is never locked!](https://thepracticaldev.s3.amazonaws.com/i/orjlx6ydpah85hn2b7zz.jpeg)

The program never locks your window! In this case, a necessary function is not executed. Code coverage can help you find functions that do not execute but should have, or functions that you have not tested yet(because they are never executed). You can use code coverage reports to further strengthen your unit tests, and confirm that your application works as it should (in every possible scenario).

*I wrote this article about two years ago, and have obtained much more experience in testing since. Do you have any questions about a certain subject, or would you like me to write an article about a certain subject(e.g. functional testing with selenium)? If so, then please leave a comment below. Feedback is also very welcome ;)*
Project Enmeti Update Log 2018/08/20
Tags: vscode, javascript, extensions, 100daysofcode
Published: 2018-08-21 06:30:27

---
title: Project Enmeti Update Log 2018/08/20
published: true
description: The first update regarding Project Enmeti, my vscode link inserting extension.
tags: VSCode, JavaScript, Extensions, 100DaysOfCode
cover_image: https://i.imgur.com/K8Mn8lz.png
---

_Cover photo by [Fahrul Azmi][5] on [Unsplash][4]_

# Project Enmeti Update Log #1

So, as I started my [100DaysOfCode][0] challenge, I [set out][1] to create an extension that would make it easier to insert links into Markdown files when writing articles, journal entries, whatever it is. I feel I have it at a comfortable state, however, I wanted to be able to try it out a bit more before I could say for sure.

For example, I'm writing this article not only to post an update that I've got this [extension working][2], but to test it out in a "production" environment 😅 As a result, the first thing I need to change is so that I can `Alt+Tab` away from VSCode to actually _get_ the link I need, and the input box not disappear...

Ahhh, [there we go][3] 🤗 Much better. 

Up next, what if you try to add a link that's already been added? Why add it twice when we can just reference the [pre-existing link?][6]

## How to Use It

So instead of just talking about the extension, how about I show you how to use it? The simplest way to insert a link would be to select some text, right click, and then select `Insert Link`. It will show an **InputBox** so you can give it the URL of your link:

![Example-1][10]

As you can see in the gif, you can also use the default `Ctrl+Alt+I` keybinding, or even change it to whatever you prefer in [keybindings.json][7]:

![Keybindings.json][11]

## Up Next

Thanks to [a great suggestion][8] by [Andrew Bone][9], my next step is to make it so you can insert images similarly to how links are inserted. What I'm thinking is something along the lines of:

- Select the text to turn into an image
- Execute the command (`Ctrl+Shift+I`)
- Input the path to the image in an **InputBox**
- Add the reference to the image at the end just as we do links

As usual, any and all input is welcome and much appreciated 😊

[0]: https://www.100daysofcode.com
[1]: https://dev.to/hf-solutions/project-enmeti-o0g
[2]: https://marketplace.visualstudio.com/items?itemName=hf-solutions-llc.enmeti
[3]: https://github.com/HF-Solutions/Enmeti/commit/66eb63d3951329eb704f4ca03b64eb3e96cdd4b4
[4]: https://unsplash.com
[5]: https://unsplash.com/photos/BnWDqUCWQDU?utm_source=unsplash&utm_medium=referral&utm_content=creditCopyText
[6]: https://github.com/HF-Solutions/Enmeti/commit/c1d5c504a854036eea134464a21e1bcf8ae4af5a
[7]: https://code.visualstudio.com/docs/getstarted/keybindings
[8]: https://dev.to/link2twenty/comment/4k81
[9]: https://dev.to/link2twenty
[10]: https://thepracticaldev.s3.amazonaws.com/i/zesvk29zyzdqlgvlvqp8.gif
[11]: https://i.imgur.com/7NKAy7e.png
LINQ Distinct-Method using Lambda Expression
Tags: dotnet, dotnetcore, netcore, linq
Published: 2020-03-30 14:21:36

---
title: LINQ Distinct-Method using Lambda Expression
published: true
date: 2018-08-21 05:33:00 UTC
tags: dotnet, dotnetcore, netcore, linq
canonical_url: https://sebnilsson.com/blog/linq-distinct-method-using-lambda-expression/
---

If you've ever wanted to filter a collection for a distinct result you probably know about the extension-method `.Distinct` in LINQ. It can be useful on simple data structures containing easily comparable objects, like I collection of `strings` or `ints`, but for more complex scenarios you need to pass in a `IEqualityComparer`. This is not very convenient.

More convenient would be to able to pass in a Lambda-expression, specifying what field you want to do the distinction by, like this:

```
var distinctItems = items.Distinct(x => x.Id);
```

To do this, you can **add the following extension-methods to your projects** :

```
public static IQueryable<TSource> Distinct<TSource>(
    this IQueryable<TSource> source, Expression<Func<TSource, object>> predicate)
{
    // TODO: Null-check arguments
    return from item in source.GroupBy(predicate) select item.First();
}

public static IEnumerable<TSource> Distinct<TSource>(
    this IEnumerable<TSource> source, Func<TSource, object> predicate)
{
    // TODO: Null-check arguments
    return from item in source.GroupBy(predicate) select item.First();
}
```

The extension-method using `IQueryable<T>` works with ORMs like Entity Framework, while `IEnumerable<T>` works with all types of collections, in-memory or otherwise, depending on implementation.

_ **Warning** : **Avoid using this with EF Core version 1.x or 2.0** , since the `.GroupBy`-execution is always made in-memory. So you might get the whole content of your database loaded into memory. [Only use it with EF Core 2.1 and above](https://blogs.msdn.microsoft.com/dotnet/2018/05/30/announcing-entity-framework-core-2-1/) in production-scenarios._
Random Computer Terms and a Lifetime of Learning
Tags: computers, learning, development, self
Published: 2018-08-21 04:57:28

---
title: Random Computer Terms and a Lifetime of Learning
published: true
description: The field of Computer Science is one of life-long learning. So let's learn with one random computer term each week!
tags: computers, learning, development, self
---

In the field of Computer Science, life-long learning is essential. I know that there is a huge amount of new technologies and paradigms every day. There is more than what you can keep up with. Luckily, there is one thing that all this new stuff has in common: it's part of the big, big world of computers. Understanding the basics of Computer Science should give you a good start. Right?

![Even superhoes need life-long learning.](https://thepracticaldev.s3.amazonaws.com/i/hhq6vo72x5h7eekw7tts.jpeg)

Based on that mindset, I recently had a new idea. How about taking one term out of the huge list of computer- and programming terms each week and discuss it? It's something that would benefit me. And while I'm at it, why not share my journey here, on dev.to? I guess it wouldn't hurt (but if it does, please tell me ;) ).

Right now, I'm using [this dictionary of computer terms](https://www.computerhope.com/jargon.htm) and take one of them out at random each week. Do you have another source list? For example, one that also contains recent technologies and frameworks? Please tell me! I'm happy to take a look at other lists as well.

So, let's go! The first article that I will write (expect it somewhere this weekend) will be about (*the random wheels are turning*)...

**Pumping**

🤨
Discuss: Good NYC Tech Communities to Join?
Tags: discuss, nyc
Published: 2018-08-21 04:14:49

---
title: Discuss: Good NYC Tech Communities to Join?
published: true
description: I am looking to get recommendations for tech communities to join in NYC
tags: discuss, NYC
cover_image: https://cdn-image.travelandleisure.com/sites/default/files/styles/1600x1000/public/1496170657/new-york-city-skyline-manhattan-dusk-INTERESTNYC0617.jpg?itok=RotKFKUJ
---

I graduated college this past spring and am moving out to New York City early September to start working my first full time job. I grew up and lived in Buffalo, NY (Go [#BillsMafia](https://twitter.com/TheBillsMafia)) my whole life, and was very involved with the startup/tech scene in the city, participating in any Startup Weekends, Hackathons, or developer conferences/meetups that I could attend.

Since I am brand new to the city, does anyone have recommendations for groups, communities, events, or resources that will help me put my foot in the door with the NYC tech community? 👞🚪

Any suggestions or leads would be greatly appreciated! 😄
From dev to data scientist - A first post about data science
Tags: datascience, career, beginners
Published: 2018-08-21 01:29:28

---
title: From dev to data scientist - A first post about data science
published: true
description: How internet and networking led me to the position I wanted
tags: #datascience #career #beginners
---

Hello there, I'm Matheus, a brazillian developer, on the road to become a data scientist and I wanted to be a biologist. *That didn't actually work out, since living in Brazil means that working with natural sciences leads you to starvation, but after 6 years I definitely don't regret choosing tech...*

I'm currently a Java Web Developer reaching my 6th year in tech, working with a fresh new product, but that's about to change, since the product I'm developing is heavyily based on data, and that opened a door for me to start showcasing what data science can do and how a few hours spent with some data (public data, which was around for a loooong time) can lead to a major new feature/service that will "WOW" customers like never before.

*Just to make sure we're on the same page, please be aware that data science in Brazil is something extraterrestrial... I'm not saying there aren't any companies making the most out of data here, it's just that most of it happens in big companies with huge products, with data-driven culture still being an aspiration for most SMBs around.*

At my 3rd year working as a dev I started a "Data Science (Big Data)" MBA (yes, with the parenthesis on it and all), not sure about what would happen, but feeling excited about the course's content. What started kicking me off during the 2 years that followed was that everywhere I looked said that "you need math to work with data science", and my background in regards to that was... null, since my degree was actually a "Software Analysis and Development" one, with basically no math in it, purely focused on programming languages, UML and software architecture.

Thankfully, internet is an amazing place (most of the time) and I managed to pick off some great courses, content and people in order to get the hang of it. I'm still in the basics, aiming for statistics and exploratory analysis

Anyway, after finishing the course (and starting a dozen others) I tried applying everything I learned in the company I was, but market pressure led my team to be constantly overloaded (now that's a story for a whole other post), and after a few months trying, I quit, joining another software development company in my town which works with public management systems, with it's focus being on public health, and that's where things got interesting.

I'm currently working in the product's MVP and due to it's nature as a data-based product, I'm being able to experiment quite a lot with it and most importantly, generate value from these experiments, which is super cool and motivates me like never before.

With that out of my chest and a lot of motivation behind me, I'm hoping to share the next steps on this great journey I'm having, and maybe some of the experiences I've had with our controversial Java :)
Fixing ThinkPad X1 Yoga (3rd Gen) Sleep and Trackpad Issues on Fedora Linux
Tags: linux, thinkpad, yoga, fedora
Published: 2018-08-20 23:52:21

---
title: Fixing ThinkPad X1 Yoga (3rd Gen) Sleep and Trackpad Issues on Fedora Linux
published: true
description: guide to fixing some issues on X1 yoga 3rd gen with Fedora Linux
tags: linux, thinkpad, yoga, fedora
---

So your Lenovo X1 Yoga 3rd Gen has some problems with Linux ([Fedora 28](https://getfedora.org/) Workstation in particular, though this might work elsewhere). The problems are as follows:

1. You can't get it to sleep and unsleep properly when the lid closes and
When it wakes up from this non-sleep, the trackpad behaves badly and is unusable.

1. Here's the two-step process I used (thanks to the investigative work of many others) to test and correct the problem.

## Test Parameters
 
While booting press 'e' to edit the kernel boot parameters. Then enter the following after the line that starts "linux16" ([source](https://docs.fedoraproject.org/f28/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader.html#sec-Making_Temporary_Changes_to_a_GRUB_2_Menu)):

    acpi.ec_no_wakeup=1 psmouse.synaptics_intertouch=1


## Boot and test the modified kernel parameters

1. Boot up.
1. Log in.
1. Close the laptop lid.
1. Wait until you enter sleep.
1. Open the lid.
1. Test the mouse.

If it works―congrats! You should move to the next step to make the changes persist across boots!

## Make Permanent

I did this manually (per the below), but the guides ([source](https://docs.fedoraproject.org/f28/system-administrators-guide/kernel-module-driver-configuration/Working_with_the_GRUB_2_Boot_Loader.html#bh-Adding_and_Removing_Arguments_from_a_GRUB_Menu_Entry)) allow for a commandline entry. What I did is below:

    sudo gedit /etc/sysconfig/grub

Find the line that starts with:

    GRUB_CMDLINE_LINUX

Then Insert the following before the final double-quote mark (") on the line:

    acpi.ec_no_wakeup=1 psmouse.synaptics_intertouch=1

Run the following command in the terminal to make permanent:

    sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

You should be good to go!

I've noticed only one remaining oddity―when I open my laptop from sleep the keyboard won't start working until I hit the "left ALT" key on the keyboard (weird, I know). Small concession. I'm very happy to have this working well!
Handling Passwords
Tags: security, password
Published: 2018-08-20 23:28:28

---
cover_image: https://imgs.xkcd.com/comics/password_strength.png
title: Handling Passwords
published: true
description: There are many ways to handle passwords, but this is how I do it.
tags: security, password
---

## Rules

* Minimum length of either 8 or 16 characters.
* A maximum length of 2,048 characters.
* Check if password is in breaches? (optional)

It's probably a good idea to make sure they're not putting in a common or breached password. I don't have any other rules, it's pretty simple. I think having the one or more numbers, symbols, capital letters, is a bit overrated. I don't really need it, do I? Got any examples/scenarios on why an application would *need* or *should have* something like that? Please, share.

And I encourage people who are writing password [this.](https://imgs.xkcd.com/comics/password_strength.png)


## Storage

And as for storing passwords, I'm not just gonna leave it as plain-text, unless of course my intent is to steal credentials. So I'd use a strong hashing algorithm like Bcrypt or some variation of Argon2. Hashing the passwords is good enough, or so some of us believe. While I don't doubt that hashing the password is good, I believe that it could be taken further to protecting the passwords.

Yes, *encrypt* the hash, with something strong. Preferably AES-256 or AES-128. And perhaps a more complex approach signing keys with RSA and encrypting with AES based on that. Not gonna get too far into it(I don't wanna start talking about stuff I don't understand).

Doing it this way gives hackers/crackers whatever you wish to call them, another step. To decrypt the hash, then finally deal with the hash.


## Summary

Make sure the password is within (8 or 16)-2,048 characters threshold, optionally check if it's common or breached. Hash the password, then encrypt the hashed password, and finally store it somewhere.


## Recommendations

Check these out, while you're reading about passwords.

{% link https://dev.to/paragonie/you-wouldnt-base64-a-password-cryptography-terms-and-concepts-for-developers %}

{% link https://dev.to/domysee/do-password-rules-impact-security-137n %}

{% link https://dev.to/oktadev/how-to-prevent-your-users-from-using-breached-passwords-5cne %}
php - How to fix "Class '' not found" error
Tags: php, tips
Published: 2018-08-20 23:09:43

---
title: php - How to fix "Class '' not found" error
published: true
description: Tips to help resolve the issue of "Class '' not found", when using composer autoload
tags: php, tips
---

## Problem
I am getting a "Class '' not found" when running my code. I use composer autoload to load my classes.

## Solution (hopefully 😜)
So there are a few things you can do to fix the "Class '' not found" in PHP.

Typically it's just a typo or a uppercase where it should be lower or vice versa, in the namespace.

So here is how I go about it.

### Step 0 (thanks Kushal Niroula! see his comment below)
As Kushal Niroula mentioned below, you should always check that you're importing the class at the top script, so do this first!

`use Your/Class/Here;`


### Step 1
Check the composer.json file, the autoload path. This is what the autoloader will be matching against, so confirm your base folder that it's pointing to is correct. 

For example if we have our psr-4 set to `"DeChamp\\MyApp\\": "src/"`, that would mean that if I have a folder called "Service" inside of the "src" folder, then the namespace would be "DeChamp\MyApp\Service". 

Check that the namespace path matches the path to the file.
- namespace DeChamp\MyApp\Service; // within file dummy.php
- src/Service/dummy.php

### Step 2
Check both the namespace at the top of your file, and the folder directory match up. Also that there are no typos and the paths match casing, both upper and lower.

Many times I've ran in to a missed casing issue. 

**Note:** some systems are case insensitive, so this may not apply but should still be practiced. I've had a time where local dev didn't match, so it worked on my machine but then production complained.

#### Wrong
- `namespace DeChamp\MyApp\Service; // within file dummy.php`
- `src/service/dummy.php //service is lower when the first character should be capitalized`

#### Right
- `namespace DeChamp\MyApp\Service; // within file dummy.php`
- `src/Service/dummy.php` // folder names match the namespace exactly

### Step 3
If you've confirmed all is right and you are banging your head against the wall, then this is probably what the issue is.

If you've updated your composer file since you last ran composer install, it could be outdated. Composer uses a cache file for speed and performance. 

To force the autoload file to regenerate just run the command below.

`composer dumpautoload`

This should fix it, if you indeed know for certain all other items are correct.

## Feedback

Did I misspeak on any of this? Have questions/suggestions? Feel free to give feed back or compliments 😁



---

Varymade LLC.

Current projects are https://charactergenerator4000.com and https://coder.exchange. Please check them out and let us know your thoughts.