The word "magic" is often found here in contexts such as "the X language is just too much magic," or "platform Y generally avoids magic." However, it seems that this term is rather poorly defined, people know something when they see it. For example, Java is thought to contain very little magic, but its garbage collector hides a lot from the programmer. If magic simply means an abstraction that hides details, then why is it considered bad, given that no one else writes large assembler programs? If magic means more, then what does it mean?
" , , " - .
: , ( , ), , (COM- ), "automagic '( VB, Javascript ==, Java autoboxing).
, , . , , . .
- http://aggregate.org/MAGIC/
- , / , .
Microsoft .
1) (, ). , - : " , API, API , ?"
, , undefined, "-".
- - : , - , , , . Raymond Chen .
2) "" . . , , . NTFS - . NTFS , API. , "" - , ++? ... , .
.
C ++, Java. . , . Java, ( ), , . , ( , , , "" ), , Java ( .)
ORM. , - Hibernate - . , ResultSet, Lazy Loading . , Hibernate JPA, , . JBDC - , , , , .
. . . " ", , , . , JSF , JSF. JSF , JSF. . JSF, . , "" JSF.
, : - . , ( ). , () , , .
, : .
" ", , , - , ; - , .
: , , . , . , . ( ).
Ruby on Rails, , Magic.
, , , Magic Happens, crud .
, , "" "", .
Magic (, , Prolog - ), .
, , " ", " ", .
: magic , . " " :
magic
w:[true, false]
:
w:[P, Q]
, , P , , Q , w.
P
Q
w
"" - , ( true true) , ( false true).
true
false
w:[true, true]
, . skip.
skip
, , magic, , . , , , - , , , - .
- "" , .
, , // -, . "".
// "" , , . - "" , , .
!
, - "", , ... " () ".
http://catb.org/jargon/html/magic-story.html
Java
. .
, . (, GC, , )
Undefined , , . .
, Rails, , Ruby - , , , , ( ).
, " ", - - ( Java) - , - , . - , .
AOP - . , . -.
I myself manipulated several bytecodes, so basically I know how to change the bytecode instructions, and it’s not “magic” for me in this sense that I don’t understand how it works. But still, I call it "magic" because it changes the way the code works and does not appear in the source code of mutable classes.
For some good examples of black magic, see the documentation in the perl source code; -)