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

May 2025

S M T W T F S
    1 2 3
456 7 8 9 10
11 121314151617
181920 21 222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated May. 24th, 2025 04:44 pm
Powered by Dreamwidth Studios