TAILIEUCHUNG - HandBooks Professional Java-C-Scrip-SQL part 12

Tham khảo tài liệu 'handbooks professional java-c-scrip-sql part 12', công nghệ thông tin, kỹ thuật lập trình phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | The type is bound to the object. Therefore the type of containers can change. An imperfect rule of thumb is that static languages force you to declare variables but dynamic languages don t. Ironically most dynamic languages also tend to be strongly typed. Most weakly typed languages tend to be static. Said another way strong typing can be dynamic or weak but weak typing is usually also static. You don t find many weakly and dynamically typed languages beyond Assembly language. Figure 4-1 places programming languages on two axes. Java has strong static typing. You know this because you get type mismatch errors when you make certain kinds of mistakes. Compiling this class TypeTest public static void main String args i 4 Nope Static typing int j j Nyet Strong typing .gives you this result 3 cannot resolve symbol symbol variable i location class TypeTest i 4 5 possible loss of precision found double required int j Figure 4-1. Java is a strongly and statically typed language Sometimes that s good. After all a bug that gets caught at compile time takes much less time than a bug that gets solved much later. In general though the dynamic programmers that I interviewed said static typing simply mauls productivity. . Syntax Initially you immediately can see that Java s syntax forces you to do more work. You have to declare and type all of your variables and parameters. You also need to cast objects that are compatible but different and convert objects that aren t. The extra syntax provides valuethe compiler has more information to catch bugs earlier. There s a cost too. Static typing makes you work harder to enter equivalent code to dynamically typed languages but you also have more lines of code to understand maintain or enhance. It s very difficult to prove or disprove the notion that static typing makes you more or less productive in terms of hours at the keyboard but you can show that static typing leads to more characters and .

TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.