In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces what are the eight programming skills that Java programmers need to master, the content is very detailed, interested friends can refer to, hope to be helpful to you.
Java is one of the best programming languages at present, it can be used to write Windows programs or Web applications, mobile applications, network programs, consumer electronics, set-top box devices, it is everywhere.
More than 3 billion of devices run on Java. According to Oracle statistics, there are 5 billion Java Card in use alone.
More than 9 million programmers choose to develop in Java, which is the most popular language for developers and the best development platform.
What the editor brings to you this time is summed up by the experience of several great gods for more than 20 years. 8 Java programming skills that I feel most useful and paranoid. Please take a look.
1. Add comments to the code
Everyone knows this, but not everyone will do it. How many times have you "forgotten" to add comments? Indeed, comments do not add any functional functionality to your program. But how many times have you seen the code you wrote two weeks ago and you can't remember what it does?
Luckily for you, you wrote the uncommented code yourself, and you will still have a residual impression in your mind. Unfortunately, most of the time, the code is written by someone else, and that person is likely to have left the company. There is a good proverb: "come and go, mutual benefit", so programmers should be considerate of each other and comment your code.
2. Don't invent your own framework
Literally, thousands of frameworks already exist, most of them open source. Many frameworks are perfect solutions and have been used in thousands of systems. We just need to focus on popular frameworks, at least ostensibly.
One of the most successful and widely used examples is the Struts framework, an open source web framework that is an excellent choice for building web systems. Don't try to build your own Struts version, it will be exhausting. But you must remember the second commandment-don't complicate simple things. If the system you want to develop has only three interfaces, don't use Struts. For such a system, there is not enough to be "controlled".
3. Put the string constant in front
It's never a bad idea to prevent accidental NullPointerException by placing the string constant to the left of the comparison function equals () comparison item, like this:
There is no doubt that there is nothing to lose by converting one expression into another better expression. As long as our Options is real.
4. Don't trust the early JDK APIs
Programming must have been painful when Java first appeared. API was still immature at that time, and you may have come across a piece of code like this:
It looks weird, right? Maybe, but look at this Javadoc: "if the abstract pathname does not represent a directory, then this method returns null. Otherwise, it returns an array of strings, where each string represents a file or directory in the current directory."
Yes, plus an air check to make sure it is correct:
Oh, no! The former violates rules # 5 and # 6 of 10 subtle practices in Java coding. Therefore, be sure to remember to judge null examination!
5 、 Drop to Frame
Suitable for debugging phase. During debugging, you can jump back to the beginning of the call stack framework, and the variable value goes back to the beginning.
According to the depth of the rollback stack, the main purpose of this function is that the state of all variables can be quickly returned to the way the method started, and then you can execute it over and over again, so that you can debug many times where you are concerned, but there will also be some side effects during execution, such as the data inserted into the database cannot be deleted!
6. Do not "hard code"
Due to the lack of time, developers always forget or deliberately ignore this one. Another possibility, however, is that by following this commandment, we will not fall into the predicament of "pressing for time". How long can it take to define a static final variable and add a line of code? For example:
Now, every time we need to compare the string "ABC" to a variable, we just reference A.S_CONSTANT_ABC without having to remember what it is. It is also very convenient to modify this constant by changing it to one place without having to look for it in all the code.
7. pay attention to the graphical user interface
How ridiculous it sounds, but I've noticed one thing many times: graphical user interfaces are as important to business users as program functionality and execution efficiency. GUI is critical to the success of the application.
IT managers often ignore the importance of GUI, and many companies do not hire Web designers to save money, and these designers have enough experience to design "user-friendly" applications. Java programmers have to rely on their limited knowledge of HMTL. I have seen a lot of applications that are "computer-friendly" rather than "user-friendly", and developers who are proficient in software development and user interface development are very rare. If you are a Java programmer who is unfortunately assigned to do interface development, you should follow these three rules:
8. All variables and parameters are declared in final
Like I said. I can't believe I didn't inadvertently rewrite a value. So, I really don't believe in myself at all. Because:
This is why all variables and parameters are declared with final.
About Java programmers need to master 8 programming skills what is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.