Oct. 16th, 2006
мелкий дыбр
Oct. 16th, 2006 11:14 pmЖизнь собачия... когда я устаю долбить свой проект, я беру учебник японского и повторяю. Это отдых такой для головы.
Но я не о том. Лень новый урок начинать. А знаете ль вы, как программисты складывают (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.
Но я не о том. Лень новый урок начинать. А знаете ль вы, как программисты складывают (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.