Is Programming Style important? How Important? [cl

2020-02-08 03:22发布

Last year I was troubleshooting a team member's code and it was lacking indents and comments. I was talking to him about it telling him it was not a good idea but he got offended. He was/is smarter than me or certainly more educated.

Since then I found out he applied to Microsoft and when they had him do a doubly linked list implementation, he wrote it without indentation or comments, stating that he did not have time to worry about style. ( It was an email submission for which there were 2 hours to complete )

Microsoft did not call him back..... How do you think they responded, how would you respond?

Anyone from Microsoft on here that can suggest what they would do in this case?

30条回答
三岁会撩人
2楼-- · 2020-02-08 03:39

"He did not have time to worry about style..." No wonder they didn't call him back. He didn't even get to the face-to-face interview and he's already refusing to do what is asked of him? That's a good way not to pass an interview for any profession.

Style is inherent in everything we do. It's not an overlay. It's not an add-on. It's not a perk. It exists whether we use it or not. Things - programs, products, what have you - are not improved upon by style; they are improved upon by having GOOD style (the opposite of which is simply having bad style).

The problem with people who come from a very technically-oriented point of view is that if it's not balanced out by any aesthetic interest or appreciation, it's assumed that "style" is a tool not used by programmers; "style" means "leave it to the UI or marketing guys." It's simply not true. In striving the best at what you do, you have to improve all aspects of the work. That means not just the execution, but the presentation.

Humans are visually-oriented beings. We choose things based on how they look (Pretty girl! Shiny package!).

In clearly announcing that he did not have time for style, he basically gave the impression that he was not the shiny package that Microsoft was shopping for. And through such an obvious pre-apology, he also made his lack of indents and comments more apparent to the evaluator (though I'm sure they wouldn't have hired him for his lack of comments alone).

查看更多
一夜七次
3楼-- · 2020-02-08 03:42

A developer who doesn't care about style is like an artist, a painter, who doesn't care about color.

查看更多
Evening l夕情丶
4楼-- · 2020-02-08 03:42

Code is read by three entities: The computer, the programmer, and ultimately the maintainer.
Style and Formatting is irrelevant to the computer, possibly important to the programmer, but it is certainly important to the maintainer, who has to try and comprehend the program's functionality.
Refusing to accommodate other developers by making code readable is disrespectful.
Creating organized code with meaningful variable names and comments is a form of common courtesy to anyone else who reads it.

查看更多
老娘就宠你
5楼-- · 2020-02-08 03:42

There is another reason why code style is important. It can act as a proxy for determining a programmer's professionalism. Just as a peacock's tail feathers demonstrate his health and virility (an unhealthy organism wouldn't be able to devote scarce resources into building a plush tail), a program's style can reveal a lot regarding the person who wrote it.

When I see badly formatted code with inconsistent naming conventions and scarce comments, I steer away from it not only because such code is inherently unreadable, but also because the code is quite likely to harbor even worse problems beneath this troublesome surface.

查看更多
祖国的老花朵
6楼-- · 2020-02-08 03:42

If you spend more time on indenting code than actually writing it, it could be a problem. But source code styling, conventions and consistency across the solution is important.

That is why I rely on a tool to do that. Resharper allows me to reformat all my code by pressing Ctrl+F, E keys combination.

查看更多
再贱就再见
7楼-- · 2020-02-08 03:42

Well, there's life, and then there's interviews.

Ask your friend - would he show up to the interview in tattered jeans and a grubby t-shirt?

His task in the interview (no matter what the format) is to impress the person conducting the interview. Impress them enough to get offered a job.

So if applying for a programmer job, why in the world would this guy submit "tattered jeans and grubby t-shirt" code?

I really hope this person has some clue about coding style, comments and whitespace. In that case, he made the judgement call that the interviewer was more concerned about "rightness" than about "goodness" (my interpretation).

BUT - given the task (linked list? this should be easy-peasy for a programmer), it would seem the task is about far more than just "rightness" of the code.

I suspect the interviewer was looking for many things, INCLUDING good coding practice (it's 1000x harder to "unlearn" bad programming practice than to get them right at the start). The interviewer was probably also looking for something to indicate initiative, good assumption making, perhaps even creativity or inventiveness.

For example, there are many ways to write a linked list that are "correct", but some (like using recursion) are deemed more "elegant" than others.

I suspect your friend missed the mark on several levels in this interview.

-R

查看更多
登录 后发表回答