📜 ⬆️ ⬇️

Mathematics for the programmer


Do mathematics need a programmer?

Needed And besides her, we need spherical geometry, geography, music and banking. And I'm not joking right now.


The fact is that programmers rarely solve problems for themselves: we work in banking services, hotel booking services, map services and other Yandex.Mail. It turns out that we solve the problems of our users.


To solve purely programmer tasks, we have algorithms and patterns: if you look at the code of the online flower shop and the banking site, it will be very similar. The same conditions, the same cycles will be used and even the MVC pattern will be the same.


More importantly, what is behind these things: understanding how the system works as a whole. If you look at things from this side, it becomes clear that the programmer is a junior expert in the field in which the site operates.


Five years ago, Artyom Polikarpov proved that each fender is a bit of a designer. We need to understand how the fonts are arranged: what is the grotesque, how does it differ from the antiqua, what is the leading, kerning, discharging, capital. Understand what a grid is and what a composition is. In addition, to understand the UX - we need to know what an optimistic UI is, where to put a preloader and why the user needs all this.


But to be only a designer is not enough. The fact is that users interact with our sites: in online stores they enter their bank card data, map routes and measure distances on map services, they transpose the tonality of songs on music sites and tune the guitar for the tuner. And all this has to be programmed by someone. It turns out that the programmer must have special knowledge.


For example, the correctness of a bank card number is determined by the algorithm of the Moon - this is the coding theory.


To find the distance between two points on the map, given by latitude and longitude, you need to use the large circle arc formula - this is spherical geometry. This formula is also often used in marine navigation.


In general, a lot of interesting things are connected with maps. For example, Yandex.Maps use an elliptical Mercator projection , and all other geographic services are spherical, so if you want to put a Yandex.Prob layer on any other map, you don’t have streets and you need to know how to transform one projection into another.


, . CSS- matrix? , ? . , .


.neo {
  transform: matrix(0, -1, 1, 0, 50px, 50px);
}

— , , . - , ? , , « ». , .


, . , , - . .


-, . , , , , .


— . . DOM — , . .


, , querySelector ? , DOM-, . querySelector , , .


<main>
  <section>
    <div id="underdog"></div>
  </section>
  <div id="favorite"></div>
</main>

const firstDiv = document.querySelector('div');
firstDiv.id === 'underdog';

— . . , , . .


const people = [
  { name: '', height: 183 },
  { name: '', height: 155 },
];

, — map , , reduce .


const averageHeight = people
  .map(it => it.height)
  .reduce((acc, it) => acc + it) / people.length;

, , . reduce , .


const averageHeight = people
  .reduce((acc, it) => acc + it.height) / people.length;

, , . , , , .


: , . , , , , .




.


')

Source: https://habr.com/ru/post/337952/


All Articles