When it comes to programmers, the usual impression for laymen is that they have plaid shirts, large underpants, flip flops, unkempt hair (bald head), dirty face and black circles under their eyes, and that “people are stupid and die quickly”. This is the inherent idea of programmers. However, as programmers in the new century, we are not so sloppy. We have white shirts, suits, black shoes and neat hairstyles. This is the new code farmer: Sunglasses:
For our insiders, what we contact most every day is code. Code is the best friend of programmers in life. Once we enter code, it is like a sea, so code is also the standard to judge the level of a programmer. The simplicity of the code, the use of API, code logic, comments, etc. are all used to evaluate the quality of the code Code that makes people feel comfortable is good code.
However, different programmers may write different levels of code at different stages of their career. Today, let’s enjoy a few confusing pieces of code, which have nothing to do with comments. If you smile, change it if you have it, and encourage it if you don’t.
At first glance, there’s nothing wrong with this code, right? A closer look, I found that this code is so stupid! dizzy_ face:
The most obvious is to use the iterative method to calculate the number of elements. I’m afraid I don’t know that there is a method called size () in the set set in Java, which can directly return the number of elements.
Then what? Is there any problem? Readers familiar with redis know that the set data type of redis also has its own API. We want to get the number of elements directly to jedis Scard (key) is OK. Dizzy, since you have used redis, why don’t you want to find out the basic use of redis. Come on, brother
Let’s look at the second code, which roughly means to record the monthly user visits of a business function. First, receive a month value from the front end, splice it into a key, then obtain the user ID of the current user, save the user ID into the set data type of redis (automatic de duplication), and then return the user visits through scar (learn to use it after being informed of the command of scar).
At first glance, there is nothing wrong with this code. All the APIs that should be used are used. It is no longer a silly circular counting of users. It’s not that simple. Confirm the business logic with the product manager first, brother. The same month occurs every year. What about the next year? Can I check the monthly visits all the time, or can’t I see the previous months for a while? These should be confirmed clearly.
Continue to look at the third code, which roughly means to remove some elements from the itemlist. Which elements are those elements whose code attribute is not in the codeset. Through two for loops, first traverse the itemlist, take out each element, take out the code attribute of the element, and then go through the codeset. When judging the same, add the element to the new list.
Inner circulation is unnecessary, codeset contains(code); An API was done, and nothing was added.
The above three are my personal experience. The new colleague of the company (more than two months) asked me to check the code after writing the code, and found several relatively low-level errors. When I came, the manager told me that it was the senior staff who asked me to bring it. The code is not high-level.
The fourth paragraph, which was circulated on the Internet for some time, said that it was a written test question for the interview, which was to sort the given int array.
The key is to have a big brain, man
ha-ha… I don’t know if it’s a joke or true..
The fifth paragraph is the front-end HTML. This code has a philosophy in it. There is no loophole in logic. Why can’t my code. Brother, in response to the customer’s demand for [clear cache], no wonder you write code fast.
Ha ha, bullying customers don’t understand the code?
The idea of this code is also very strange. The boss is admiring it!
Does anyone else say that no one talks in the notes? For example, one person said:
//Who wrote this paragraph?
Then another person answers below:
//It’s me. What’s the matter
Then the story begins
According to my girlfriend, a female developer in their company did an activity of signing in and sending points. He wrote two interfaces to the front-end, one for signing in and one for adding points. After signing in, he told the front-end that it was successful and the front-end adjusted the interface for adding points.
The development level of each project team is different. Don’t panic when you see the “confused” code. If you know who wrote it, tell him secretly. What other funny codes do you know? Leave a comment.
Involving: game development, curriculum design, common software development, hackers and so on