Oct. 16th, 2006

juan_gandhi: (Default)
Жизнь собачия... когда я устаю долбить свой проект, я беру учебник японского и повторяю. Это отдых такой для головы.

Но я не о том. Лень новый урок начинать. А знаете ль вы, как программисты складывают (add up) яблоки и апельсины? Нет, по-русски я и раньше нужных терминов не знал, дайте-ка я на удобный язык перейду.

So. A physicist would tell you that you cannot add entities of different dimensions; you can multiply mass by length, but not add. Neither you are supposed to add up oranges and apples.

Of course programmers can multiply entities, getting tuples. Pair<Apple,Orange>, for instance. That's obvious.

But we, programmers, can also add oranges and apples, easily.

Both apples and oranges are round fruits. So let's cast them to 'round fruits'. Two oranges and three apples will be five round fruits. You can even do it in Java, with generics. Note also that you cannot subtract oranges from apples - an apple would not cast to orange. How then can you add steaks and flies? You'll have a collection of objects.

It may be hard later to sort them by type. There are many different kinds of flies... each one is an individual. Mechanisms work well for joining things, but to separate things, you need criteria. Some people even think of an operating system as a kind of fly. This is a really hard problem, not complexity-theory-wise (this too), but philosophically.

Profile

juan_gandhi: (Default)
Juan-Carlos Gandhi

November 2025

S M T W T F S
       1
23456 7 8
9 1011 12 1314 15
16171819 20 2122
23 24 252627 28 29
30      

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 1st, 2025 09:27 am
Powered by Dreamwidth Studios