In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you "Why to use Java", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "Why to use Java" this article.
Debugging is a key language feature
I really hate wasting time tracking fuzzy errors caused by my code accidentally iterating to the end of the array, especially in the era of FORTRAN programming on IBM mainframes. Another obscure problem that arises from time to time is that when a subroutine is called, it takes a four-byte integer argument and is expected to have two bytes; on a small-end architecture, this is usually a benign error, but on a large-end machine, the value of the first two bytes is not always zero.
Debugging in that batch environment is also very inconvenient, with core dumps or inserting print statements that themselves move the wrong position or even make them disappear.
So my early experience with Pascal, first on MTS and then on IBM OS/VS1, using the same MTS compiler, made my life easier. Pascal's strong typing and static typing are an important part of this victory, and every Pascal compiler I use inserts run-time checks on the boundaries and ranges of the array, so errors can be detected when they occur. When we moved most of our work to Unix in the early 1980s, porting Pascal code was a simple task.
An appropriate amount of grammar
But for my favorite Pascal, my code is verbose and seems to have more syntax than code; for example, using:
If... Then begin... End else... End
Not in C or similar languages:
If (...) {...} else {...}
In addition, some things are difficult to do in Pascal, but easier in C. However, as I began to use C more and more, I found myself experiencing the same type of error that I had encountered in FORTRAN, for example, beyond array boundaries. The end of the array is not detected at the original error point, but their adverse effects are detected only later in the execution of the program. Fortunately, I no longer live in that batch environment, and I have good debugging tools on hand. However, C is a little too flexible for me.
When I met awk, I found that it was different from C. At that time, a lot of my work involved transforming field data and creating reports. I find it amazing that awk plus other Unix command-line tools, such as sort, sed, cut, join, paste, comm, and so on, can do things. In essence, these tools give me a relational database manager based on text files, which have a column structure and are the way many of our field data are saved. Or, even if it is not in this format, most of the time it can be exported to a column structure from a relational database or some binary format.
The string handling, regular expressions, and associative arrays supported by awk, as well as the basic features of awk (which is actually a data conversion pipeline), are well suited to my needs. I still switch back to C when faced with binary data files, complex data structures, and key performance requirements; but as I use awk more and more, I find C's very basic string support increasingly frustrating. Over time, more often I use C only when I have to, and use awk heavily the rest of the time.
The level of abstraction of Java is appropriate
And then Java. It looks pretty good-the relatively concise syntax is reminiscent of C, or at least the similarity is more obvious than Pascal or any other early language. It is strongly typed, so many programming errors are caught at compile time. It doesn't seem to require much object-oriented knowledge to get started, which is a good thing because I was not familiar with the OOP design pattern at the time. But even in the beginning, I liked the idea behind its simplified inheritance model. Java allows single inheritance using the provided interface to enrich the paradigm to some extent. )
It seems to have a rich functional library (that is, the concept of "self-contained battery"), which directly meets my needs at an appropriate level. Finally, I found myself quickly coming up with the idea of combining data and behavior in objects. This seems to be a good way to explicitly control the interaction between data-much better than a large list of parameters or uncontrolled access to global variables.
Since then, Java has become a Helvetic saber in my programming toolbox. I still occasionally write programs in awk or use Linux command-line utilities (such as cut, sort, or sed) because they are clearly the direct solution to the problem at hand. I suspect I haven't written 50 lines of C code in the past 20 years; Java completely meets my needs.
In addition, Java is constantly improving. First, it becomes more efficient. And it adds some very useful features, such as the ability to test resources with try, which can well clean up the lengthy and somewhat confusing error handling code during the file Ibind O, or lambda, which provides the ability to declare functions and pass them as parameters, while old methods need to create classes or interfaces to "host" these functions Or stream, which encapsulates iterative behavior in a function, and can create an efficient data conversion pipeline in the form of chained function calls.
Java is getting better and better
Many language designers have studied ways to fundamentally improve the Java experience. For me, most of them don't interest me much; third, it reflects more of my typical workflow and (more) reduces the functionality of these languages. But one of the evolutionary steps has become an integral part of my programming tool: Groovy. When I encounter a small problem and need a simple solution, Groovy has become my first choice. Moreover, it is highly compatible with Java. For me, Groovy fills the same use that Python provides for many others-it's compact, DRY (don't repeat yourself), and expressive (lists and dictionaries have full language support). I also used Grails, which uses Groovy to provide a simplified Web framework for very high-performance and useful Java Web applications.
Is Java still open source?
Recently, the increasing support for OpenJDK has further improved my comfort with Java. Many companies support OpenJDK in various ways, including AdoptOpenJDK, Amazon, and Red Hat. In one of my larger, longer-term projects, we used AdoptOpenJDK to build custom runtime environments on several desktop platforms.
Is there a better language than Java? I'm sure there is. It depends on your job needs. But I've always been very happy with Java, and I haven't come across anything that might disappoint me.
The above is all the contents of the article "Why use Java". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.