Aktuelle Änderungen Printable View Änderungen Bearbeiten
GoogleChartsAPI > CurriculumVitae > MarketingPython > AndersHejlsberg > FunctionObjects > Functor > TrampolineStyle > MaintainableCode > AbstractDataType > OopVsAdt > DesignByContract > GenericFunctions > CPlusPlusSprache > FunctionPointers > FunctionPointer > CSharpAttributes > DynamicLanguagesClear Trailthe property of a language where type checks are performed mostly at run time.
I'm not against types, but I don't know of any type systems that aren't a complete pain, so I still like dynamic typing. AlanKay
Dynamic types are stronger than static types, as they don't flee the field at runtime. (Brian Foote)[2]
Static types give me the same feeling of safety as the announcement that my seat cushion can be used as a floatation device. (Don Roberts)[3]
In a statically typed language, the type of a value is defined by the variable holding the value or reference to the value. In a dynamically typed language, the type of a value is defined by the value itself. In a strongly typed language a value has one and only one type. In a weakly typed language the type of a value depends on how you process it.[4]
This is also known as “What a Compiler Can and Cannot Do”. In theory we need static typing, because then we will get easy compile-time type checking. This prevents us from nasty typing errors at run time. However, it is not a sufficient contract. OK, you got the argument count correct, and yes, you sent an Integer when it was expected. You still have to write all the same unit tests to demonstrate the behavior is what you expected.
If you are putting dynamic code into production that fails because of argument counts or incorrect data types then, frankly, you did not test your software for the behavior that was expected either! You probably don’t write enough tests in your static language too. The compiler maybe gave you a warm feeling by compiling your code, but I bet there are still run-time bugs in there.[6]
Static languages like C require the programmer to make a lot of decisions that nail down the structure of the program and the data it manipulates. Dynamic languages like Dylan and CLOS (Common Lisp Object System) allow these decisions to be delayed, and thus provide a more responsive programming environment in the face of changing specifications. Changes that would be too pervasive to even try in static languages can be easily explored with dynamic languages. Dynamic languages provide the interfaces by which a program can change or extend its performance. For example, in Dylan, a running program can add a method to an existing class without access to the original source code; can define a brand new class or function under program control; can debug another Dylan program, even one running remotely over the web. All this makes it possible to build, re-build and modify complex programs using components. Java is currently the most popular language with dynamic features, although it is not as thoroughly and elegantly dynamic as Dylan and CLOS.[7]