Sunday, March 12, 2023

Anakin is gone. I am what remains.

 


A Mente Influente - Notas

  • Seu cérebro, como o da maioria das pessoas, está programado para adorar informações. Isso faz de nossa atual era digital uma celebração explosiva para sua mente. 
  • Alguns estudiosos afirmam que o cérebro humano desenvolveu a capacidade de raciocinar não para descobrir verdades, mas para convencer os outros de que temos razão.
  • Uma reação emocional é o jeito de o corpo dizer: “Ei, tem algo importante acontecendo”, e é fundamental que sua reação esteja de acordo. Tão fundamental que a maior parte de seu cérebro é concebida para que você possa processar o acontecimento que evoca a emoção e gerar uma reação. Quando algo emotivo ocorre, sua amídala – a região do cérebro responsável por sinalizar a excitação – é ativada. A amídala então envia um “sinal de alerta” ao resto do cérebro, alterando imediatamente a atividade corrente. Não importa se você é uma dinamarquesa baixinha ou uma criança sérvia e alta – todos os cérebros são “pré-programados” para reagir de forma aproximadamente similar a estímulos que despertam emoções.
  • Acontece que nem sempre precisamos observar as pessoas para que suas emoções reverberem. Postagens em redes sociais bastam.
  • Como nos pombos e nos ratos, o desejo humano por instrumentalidade, controle e escolha transborda para situações em que fazer uma escolha não melhora necessariamente o resultado final.
  • As pessoas gostam de escolher e, assim, escolhem escolher.
  • As pessoas que se sentem no controle de suas vidas são mais felizes e mais saudáveis.
  • Quer estejamos no trabalho ou em casa, nosso instinto é de que se temos algo importante a transmitir, o outro vai querer saber. Esse instinto está errado. Se as pessoas não prestam atenção nem mesmo a informações que podem salvar a vida delas, ninguém pode pressupor que darão ouvidos ao que você tem a dizer. Precisamos repensar o que realmente leva as pessoas a quererem ouvir e depois reformular nossa mensagem de acordo com isso, porque ser ouvido é, de longe, o ingrediente mais importante para a influência. O que, então, as pessoas querem saber?
  • O desejo de saber é humano.
  • Um motivo é reduzir a desagradável incerteza.
  • Os neurônios dopaminérgicos são células encefálicas que liberam o neurotransmissor dopamina. 
  • A resposta simples é que a informação, em muitos casos, é de fato necessária para a sobrevivência, porque o conhecimento antecipado pode nos ajudar a tomar decisões melhores.
  • O que você sabe afeta não só o que você decide fazer, mas também como você se sente. É por isso que a informação é o básico de suas crenças e aquilo em que você acredita tem profundo efeito no quanto você é feliz.
  • É importante lembrar, então, que as pessoas são motivadas não só a ganhar recompensas e evitar a dor, mas também a acreditar que ganharão recompensas e evitarão a dor. Isso porque crenças podem deixar as pessoas tão felizes ou tristes quanto eventos reais.
  • Quando o mercado está em queda, elas preferem enterrar a cabeça no chão.
  • Contudo, isso é válido desde que a má notícia possa ser ignorada.
  • O que tal experiência nos mostra é que mesmo que você acredite que ficará melhor na ignorância, enfiar a cabeça na areia pode acabar por deixá-lo mais ansioso. 
  • Somos criaturas curiosas, e o único tema por que temos especial curiosidade somos nós mesmas. Na verdade, temos uma necessidade ardente de saber o que os outros pensam de nós e de nosso trabalho, mas não queremos saber de tudo. 
  • Quando estamos sob ameaça, é desencadeada uma reação fisiológica pré-programada: o estresse. A evolução nos equipou com essa resposta para nos ajudar a sobreviver. Imagine que você é um antílope no meio da selva e percebe um leão correndo em sua direção. Em segundos, são secretados hormônios do estresse, como o cortisol, despertando uma reação em cadeia – seu coração bate acelerado e a respiração fica mais curta. Não existem recursos de sobra e, assim, funções que não são urgentes devem ser desativadas; seu sistema imunológico se aquieta temporariamente, assim como os sistemas digestivo e reprodutor. Esse não é o momento de lidar com a cura de um ferimento ou digerir o que você estava mastigando uma hora atrás; você deve concentrar todos os recursos em um só objetivo: sobreviver naquele momento.
  • Nosso sistema imunológico se enfraquecerá e nos tornaremos mais suscetíveis a doenças; a digestão ficará lenta e, por conseguinte, é mais provável que acumulemos gordura, em particular na área da cintura; nosso sistema reprodutor será desativado e, como consequência de longo prazo, as mulheres podem ter dificuldades para engravidar.
  • Assim como o estresse altera significativamente a função de seu coração e dos sistemas digestivo, imunológico e reprodutor, ele também altera seu cérebro. Sempre que você sente o estresse chegar de mansinho, o funcionamento do cérebro se altera drasticamente. Em segundos, o estresse pode mudar a forma como você pensa, toma decisões e se comporta. E ele muda a maneira como você é influenciado por aqueles que o cercam


MARVEL: THOR VS THE SILVER SURFER

 


Saturday, March 11, 2023

The Weakness of Data

Your brain, like most people’s, is programmed to get a kick out of information. This makes our current digital era an explosive celebration for your mind. While the agricultural age gave us easier access to nutrition, and the industrial age dramatically increased our quality of life, no other era provided as much stimulation for our brains as the information age. It is as if, finally, the human brain has succeeded in building its own amusement park, complete with thrill rides, which are perfectly customized . . . for itself.

Consider the numbers: there are 3 billion Internet users worldwide; every day we produce approximately 2.5 billion gigabytes of data, perform 4 billion Google searches, and watch 10 billion YouTube videos. In the short time it took you to read the last sentence, approximately 530,243 new Google searches were executed and 1,184,390 YouTube videos played around the globe.3

It would seem that the digital revolution should come in handy when we are trying to alter people’s beliefs. If people love information, what better way to influence their beliefs and actions than to offer data? With big data at our fingertips and powerful computers at our disposal, we can run analyses to expand our knowledge and then share the resulting facts and figures. Seems straightforward, right?

That is, until you attempt to present your carefully collected data and thoughtfully constructed conclusions to the person you are hoping to influence. At that moment, you quickly realize that data is often not the answer when it comes to changing minds.

This epiphany came as a terrible blow to the scientist in me. As a cognitive neuroscientist, I work at the intersection between psychology and neuroscience. Like most scientists, I love data. Some people collect precious rocks; others collect first-edition books, stamps, shoes, vintage cars, or china dolls. I collect data. My computers hold hundreds of folders with thousands of files, each containing rows and rows of numbers. Every number represents an observation: a person’s response to a decision problem or their reaction to another human; other numbers indicate the activity in a person’s brain or the density of their neuronal fibers. Numbers on their own are useless. The reason I love data is that those rows and rows of numbers can be transformed into something beautiful: meaningful graphs, which, every so often, reveal an exciting new insight into what makes you and me, Homo sapiens, tick.

So, you can imagine my dismay when I learned that all those numbers, from numerous experiments and observations, pointed to the fact that people are not in fact driven by facts, or figures, or data. It is not that people are stupid; nor are we ridiculously stubborn. It is that the accessibility to lots of data, analytic tools, and powerful computers is the product of the last few decades, while the brains we are attempting to influence are the product of millions of decades. As it turns out, while we adore data, the currency by which our brains assess said data and make decisions is very different from the currency many of us believe our brains should use. The problem with an approach that prioritizes information and logic is that it ignores the core of what makes you and me human: our motives, our fears, our hopes and desires. As we will see, this presents a serious problem; it means that data has only a limited capacity to alter the strong opinions of others. Established beliefs can be extremely resistant to change, even when scientific evidence is provided to undermine those beliefs.

Saturday, March 04, 2023

FUNDAMENTALS OF HUMAN ACTION

THE DISTINCTIVE AND CRUCIAL FEATURE in the study of man is the concept of action. Human action is defined simply as purposeful behavior. It is therefore sharply distinguishable from those observed movements which, from the point of view of man, are not purposeful. 

These include all the observed movements of inorganic matter and those types of human behavior that are purely reflex, that are simply involuntary responses to certain stimuli. Human action, on the other hand, can be meaningfully interpreted by other men, for it is governed by a certain purpose that the actor has in view. The purpose of a man’s act is his end; the desire to achieve this end is the man’s motive for instituting the action.

All human beings act by virtue of their existence and their nature as human beings.3 We could not conceive of human beings who do not act purposefully, who have no ends in view that they desire and attempt to attain. Things that did not act, that did not behave purposefully, would no longer be classified as human.

It is this fundamental truth—this axiom of human action—that forms the key to our study. The entire realm of praxeology and its best developed subdivision, economics, is based on an analysis of the necessary logical implications of this concept.

The fact that men act by virtue of their being human is indisputable and incontrovertible. To assume the contrary would be an absurdity. The contrary—the absence of motivated behavior— would apply only to plants and inorganic matter.

Tuesday, December 27, 2022

The goals of code quality

Code should work

This one is so obvious that it probably doesn’t need stating, but I’ll go ahead and say it anyway. When we write code, we are trying to solve a problem, such as implementing a feature, fixing a bug, or performing a task. The primary aim of our code is that it should work: it should solve the problem that we intend it to solve. This also implies that the code is bug free, because the presence of bugs will likely prevent it from working properly and fully solving the problem.

When defining what code “working” means, we need to be sure to actually capture all the requirements. For example, if the problem we are solving is particularly sensitive to performance (such as latency, or CPU usage), then ensuring that our code is adequately performant comes under “code should work,” because it’s part of the requirements. The same applies to other important considerations such as user privacy and security.

Code should keep working

Code “working” can be a very transient thing; it might work today, but how do we make sure that it will still be working tomorrow, or in a year’s time? This might seem like an odd question: “if nothing changes, then why would it stop working?”, but the point is that stuff changes all the time:

  • Code likely depends on other code that will get modified, updated, and changed.
  • Any new functionality required may mean that modifications are required to the code.
  • The problem we’re trying to solve might evolve over time: consumer preferences, business needs, and technology considerations can all change.

Code that works today but breaks tomorrow when one of these things changes is not very useful. It’s often easy to create code that works, but a lot harder to create code that keeps working. Ensuring that code keeps working is one of the biggest considerations that software engineers face, and is something that needs to be considered at all stages of coding. Considering it as an afterthought, or just assuming that adding some tests later on will achieve this are often not effective approaches.

Code should be adaptable to changing requirements

It’s actually quite rare that a piece of code is written once and then never modified again. Continued development on a piece of software can span several months, usually several years, and sometimes even decades. Throughout this process requirements change:

  • business realities shift
  • consumer preferences change
  • assumptions get invalidated
  • new features are continually added

Deciding how much effort to put into making code adaptable can be a tricky balancing act. On the one hand, we pretty much know that the requirements for a piece of software will evolve over time (it’s extremely rare that they don’t). But on the other hand, we often have no certainty about exactly how they will evolve. It’s impossible to make perfectly accurate predictions about how a piece of code or software will change over time. But just because we don’t know exactly how something will evolve, it doesn’t mean that we should completely ignore the fact that it will evolve. To illustrate this, let’s consider two extreme scenarios:

  • Scenario A — We try to predict exactly how the requirements might evolve in the future and engineer our code to support all of these potential changes. We will likely spend days or weeks mapping out all the ways that we think the code and software might evolve. We’ll then have to carefully deliberate every minutia of the code we write to ensure that it supports all of these potential future requirements. This will slow us down enormously; a piece of software that might have taken 3 months to complete might now take a year or more to complete. And at the end of it, it will probably have been a waste of time because a competitor will have beaten us to the market by several months, and our predictions about the future will probably turn out to be wrong anyway.
  • Scenario B — We completely ignore the fact that the requirements might evolve. We write code to exactly meet the requirements as they are now and put no effort into making any of the code adaptable. Brittle assumptions get baked all over the place and solutions to subproblems are all bundled together into large inseparable chunks of code. We get the first version of the software launched within three months, but the feedback from the initial set of users makes it clear that we need to modify some of the features and add some new ones if we want the software to be successful. The changes to the requirements are not massive, but because we didn’t consider adaptability when writing the code, our only option is to throw everything away and start again. We then have to spend another three months rewriting the software, and if the requirements change again, we’ll have to spend another three months rewriting it again after that. By the time we’ve created a piece of software that actually meets the users’ needs, a competitor has once again beaten us to it.

Scenario A and scenario B represent two opposing extremes. The outcome in both scenarios is quite bad and neither is an effective way to create software. Instead, we need to find an approach somewhere in the middle of these two extremes. There’s no single answer for which point on the spectrum between scenario A and scenario B is optimal. It will depend on the kind of project we’re working on and on the culture of the organization we work for.

Code should not reinvent the wheel

When we write code to solve a problem, we generally take a big problem and break it down into many subproblems. For example, if we were writing some code to load an image file, turn into a grayscale image, and then save it again, the subproblems we need to solve are:

  • Load some bytes of data from a file
  • Parse the bytes of data into an image format
  • Transform the image to grayscale
  • Convert the image back into bytes
  • Save those bytes back to the file

Many of these problems have already been solved by others, for example loading some bytes from a file is likely something that the programming language has built in support for. We wouldn’t go and write our own code to do low-level communication with the file system.

Similarly, there is probably an existing library that we can pull in to parse the bytes into an image. If we do write our own code to do low-level communication with the file system or to parse some bytes into an image, then we are effectively reinventing the wheel. There are several reasons why it’s best to make use of an existing solution over reinventing it:

  • It saves a lot of time — If we made use of the built-in support for loading a file, it’d probably take only a few lines of code and a few minutes of our time. In contrast, writing our own code to do this would likely require reading numerous standard documents about file systems and writing many thousands of lines of code. It would probably take us many days if not weeks.
  • It decreases the chance of bugs — If there is existing code somewhere to solve a given problem, then it should already have been thoroughly tested. It’s also likely that it’s already being used in the wild, so the chance of the code containing bugs is lowered, because if there were any, they’ve likely been discovered and fixed already.
  • It utilizes existing expertise — The team maintaining the code that parses some bytes into an image are likely experts on image encoding. If a new version of JPEGencoding comes out, then they’ll likely know about it and update their code. By reusing their code, we benefit from their expertise and future updates.
  • It makes code easier to understand — If there is a standardized way of doing something then there’s a reasonable chance that another engineer will have already seen it before. Most engineers have probably had to read a file at some point, so they will instantly recognize the built-in way of doing that and understand how it functions. If we write our own custom logic for doing this, then other engineers will not be familiar with it and won’t instantly know how it functions.

The concept of not reinventing the wheel applies in both directions. If another engineer has already written code to solve a subproblem, then we should call their code rather than writing our own to solve it. But similarly, if we write code to solve a subproblem, then we should structure our code in a way that makes it easy for other engineers to reuse, so they don’t need to reinvent the wheel.

The same classes of subproblems often crop up again and again, so the benefits of sharing code between different engineers and teams are often realized very quickly.

Monday, December 26, 2022

Bad code, good code

 





Types of Code

  • Code base — the repository of code from which pieces of software can be built. This will typically be managed by a version control system such as git, subversion, perforce, etc.
  • Submitting code — sometimes called “committing code”, or “merging a pull request”. A programmer will typically make changes to the code in a local copy of the code base. Once they are happy with the change, they will submit it to the main code base. Note: in some setups, a designated maintainer has to pull the changes into the code base, rather than the author submitting them.
  • Code review — many organizations require code to be reviewed by another engineer before it can be submitted to the code base. This is a bit like having code proofread, a second pair of eyes will often spot issues that the author of the code missed.
  • Pre-submit checks — sometimes called “pre-merge hooks”, “pre-merge checks”, or “pre-commit checks”. These will block a change from being submitted to the code base if tests fail, or if the code does not compile.
  • A release — a piece of software is built from a snapshot of the code base. After various quality assurance checks, this is then released “into the wild”. You will often hear the phrase “cutting a release” to refer to the process of taking a certain revision of the code base and making a release from it.
  • Production — this is the proper term for “in the wild” when software is deployed to a server or a system (rather than shipped to customers). Once software is released and performing business-related tasks it is said to be “running in production”




High-quality code maximizes the chance that the software will be reliable, maintainable, and meet its requirements. Low-quality code tends to do the opposite.