Why Coffee Does Non Back Upwards Operator Overloading
Unlike C++, Java doesn't back upward operator overloading. Java doesn't supply liberty to programmer, to overload the measure arithmetics operators e.g. +, -, * as well as / etc. If you lot possess got worked previously inwards C++, than you lot know that, Java has left lot of characteristic supported inwards C++ e.g. Java doesn't back upward multiple inheritance, no pointers inwards Java, as well as no transcend yesteryear reference inwards Java. Rarely this interrogation asked inwards Java interviews, to cheque how programmer thinks close sure enough features, which is non supported inwards Java. Another similar questions is regarding Java beingness transcend yesteryear reference, which is generally seem as, whether Java is transcend yesteryear value or reference. Though I don't know the existent argue behind it, I recollect next observation brand feel on, why Operator overloading is non supported inwards Java.
1) Simplicity as well as Cleanliness
2) Avoid Programming Errors
Java doesn't allow user defined operator overloading, because if you lot allow programmer to exercise operator overloading, they volition come upward up amongst multiple meanings for same operator, which volition brand the learning bend of whatsoever developer hard as well as things to a greater extent than confusing as well as messy. Its been observed that, at that spot is growth inwards programming errors, when linguistic communication supports operator overloading, which inwards plow growth e evolution as well as delivery time. Since Java as well as JVM has taken most of developers responsibility, inwards retentiveness management yesteryear providing garbage collector, it doesn't actually brand feel to left this characteristic to pollute the code, as well as equally a loop hole for programming errors.
3) JVM Complexity
From JVM perspective, supporting operator overloading is to a greater extent than difficult, as well as if the same affair tin live on achieved, yesteryear using method overloading inwards to a greater extent than intuitive as well as construct clean way, it does brand feel to non back upward operator overloading inwards Java. Influenza A virus subtype H5N1 complex JVM, may lawsuit inwards slower JVM, than a relatively simpler JVM ,and cut down the chance of optimization yesteryear taking out guaranteed conduct of operators inwards Java.
4) Easy Development of Tools
This is an additional exercise goodness of non supporting operator overloading inwards Java. Omission of operator overloading has kept the linguistic communication easier to grip as well as process, which inwards plow makes it easier to prepare the tools, that procedure the linguistic communication e.g. IDE or re-factoring tool. Re-factoring tools inwards Java are far ameliorate than C++.
Further Learning
Complete Java Masterclass
method overloading using to a greater extent than intuitive as well as like shooting fish in a barrel agency as well as that powerfulness live on the argue coffee designer idea that supporting operator overloading volition non live on a big exercise goodness for language, merely inwards fact solely Java designer tin respond existent motivation of, why Java doesn't back upward operator overloading, similar another questions equally Why Java doesn't back upward multiple inheritance or Why String is immutable inwards Java.
Komentar
Posting Komentar