Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть What are pure functions?

  • Smok Code
  • 2020-10-19
  • 1903
What are pure functions?
itcomputer sciencesoftware developersmoksoftware engineercoffee with smokSDEdesign patternsjobcareertechprogrammertechnologylearningbasicsknowledgeskillsprofessionalC++C#JavaJavaScriptlife of a software developer
  • ok logo

Скачать What are pure functions? бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно What are pure functions? или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку What are pure functions? бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео What are pure functions?

They can speed up development and increase productivity, but at what cost? Smok gives you a #QuickAnswer.

#programming #tech #softwaredevelopment #developer #sde

Clean Code (R. Martin) - US: https://amzn.to/3jVUEDU | UK: https://amzn.to/2Iij4Jz
Best Practices for Programmers - US: https://amzn.to/2SPRSEg | UK: https://amzn.to/2Fr2h6e

What are pure functions?

Let’s start by acknowledging there are pure functions and pure virtual functions. I want to clear that these are unrelated. Pure virtual function is used in C++ to name an abstract virtual function. However when a programmer says that a function is pure - they mean two things:
1. function doesn’t have any side effect, and
2. returns the same value for the same input.
Let’s unpack this. Side effect of a function is a process that changes things in an outside context of the function. For example this could be: consuming input, modifying an outside object or variable, writing to a file, network or console, starting a process, and simply calling a non-pure function.
We could possibly list many other examples of how a function can affect the outer scope of our program, but I think you get the idea: no side effects. Now why is that important?
Masters of the craft like Robert Martin say that the ”ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code”. You can take from it that we actually should care more about programs that are easier to read and understand. Pure functions reduce the overhead of thinking how everything else is affected by this function. Using pure functions enhances productivity and makes onboarding with the code easier.
Pure function has to meet another condition: produce the same output for the same input, no matter how many times you call it. Seems simple enough - we know plenty of those: max, min, find, sum, average and so on. This makes our function predictable and cacheable. Caching can be important for some more costly functions, and it’s good to know that once computed value won’t change.
There is an ongoing discussion if pure functions are idempotent. Which means almost exactly the same thing as producing the same output for the same input. However you need to know that we also use the term idempotent to label functions, or API endpoints. Such an endpoint will produce the same result for the same input, but there is no requirement that idempotent functions have no side effects.
You see: a function that deletes a record by ID can be idempotent, as the deleted record stays deleted no matter how many times you call the function, but - as you surely notice it has the side effect. So you may hear that some people say: that pure functions have no side effects and are idempotent, but I prefer to avoid this term, as it is used in this other meaning.
Pure functions can help you to avoid most of the bugs that can happen because of state modification, which is often the case with data races in parallel systems. Having that said - avoiding mutation of the state is not always possible, and is viewed as less performant, as you have to copy new state instead of changing data in place.
All in all - use the pure functions where you can, and others where you need to, but try to clearly separate one from another. Subscribe, and I’ll see you in the next one, cheers!

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]