答:
In this case, big fat YES.

Reasons:

The original line actually violates DRY - on a micro scale, but still. You are performing the same calculation twice; factoring it out removes one potential source of bugs

You have a bracket nesting level of 5, which is way way too much. 3 is about as deep as I'd be willing to read without line breaks and indentation to help me

I'd even take it a step further and separate concerns a bit more, factoring out the "split at first occurrence of specified character" into a function in its own right, so it would boil down to something like:

```<code>def split_at_char(s, c):
    charIndex = s.index(c)
    left = s[:charIndex]
    right = s[charIndex + 1:]
    return left, right
</code>```

...and then, using it:

```<code>indexStr, attrName = split_at_char(id, '.')
index = int(indexStr)
setattr(self.data[attrName], index, val)
</code>```

In fact, there's an existing python function that does exactly what split_at_char does:
http://docs.python.org/library/stdtypes.html?highlight=split#str.split
No need to reinvent any wheels here. So:

```<code>indexStr, attrName = id.split('.', 2)
index = int(indexStr)
setattr(self.data[index], attrName, val)
</code>```

The ultimate test is: can someone who is not familiar with the codebase fluently read through the code without having to re-read anything? If not, the parts that make you stumble need more work.

Title: If the purpose of a single complicated LOC is clear, would you bother to split it on to multiple lines to make its method clear as well?

Body:
Given some (relatively) complicated line of code, I would often be inclined to split it onto multiple lines to make its function/purpose clear to others.

However, if it is quite clear from context what a line does, would you still do the same thing merely to make clearer how it does it? Or would you take the attitude that future developers probably don't know/care how it works, only that it works?

For some context, the particular line that's prompted this question is Python code that takes a string like "1.title" and uses it to modify self.data[1].title:

```<code>#IRL, these 2 values are already set somehow
id = "1.title"
val = "foo"

setattr(self.data[int(id[:id.index(".")])], id[id.index(".")+1:], val)
</code>```

That last line is not the nicest thing in the world to read, so I was thinking of splitting it into:

```<code>index = int(id[:id.index(".")])
attrib = id[id.index(".")+1:]
setattr(self.data[index], attrib, val)
</code>```

If you wanted to go crazy, you could even do dotLocation = id.index(".") first, and use that in the setting of index and attrib.

This is probably a bit clearer to someone else reading it for the first time, but I prefer it nice and concise on one line, and it's highly unlikely that anyone is going to need to modify this one-line utility function. Is there really much point to splitting it up like that?

(Note: I'm fully aware that this is not exactly life-or-death stuff. I'm not going to lose any sleep over it,  I'm just wondering what others would do in this kind of situation.)

(Last thing: someone might want to add better tags to this, it's my first Programmers question :) )

Body:
In this case, big fat YES.

Reasons:

The original line actually violates DRY - on a micro scale, but still. You are performing the same calculation twice; factoring it out removes one potential source of bugs

You have a bracket nesting level of 5, which is way way too much. 3 is about as deep as I'd be willing to read without line breaks and indentation to help me

I'd even take it a step further and separate concerns a bit more, factoring out the "split at first occurrence of specified character" into a function in its own right, so it would boil down to something like:

def split_at_char(s, c):
    charIndex = s.index(c)
    left = s[:charIndex]
    right = s[charIndex + 1:]
    return left, right

...and then, using it:

indexStr, attrName = split_at_char(id, '.')
index = int(indexStr)
setattr(self.data[attrName], index, val)

In fact, there's an existing python function that does exactly what split_at_char does:
http://docs.python.org/library/stdtypes.html?highlight=split#str.split
No need to reinvent any wheels here. So:

indexStr, attrName = id.split('.', 2)
index = int(indexStr)
setattr(self.data[index], attrName, val)

The ultimate test is: can someone who is not familiar with the codebase fluently read through the code without having to re-read anything? If not, the parts that make you stumble need more work.


问:
Is it an inefficient workflow to write out code and THEN go back and optimize?
I'm a newer enthusiast programmer. I've been doing small and big projects on and off for the past two or three years.

I always hit small snags in my code that add up to big memory hogs or unnecessary lines of code down the road. My philosophy on big projects has always been to just 'get it out of my head' and write all the code into a working product, then going back and reducing the code to a simpler, more optimized form. However, this doesn't always work: when doing database structures, I tend to have to go back many times to add in features that come up spur-of-the-moment. Entire blocks of code have to be erased because of a spontaneous brainchild.

My question to you is, is it more efficient to write an entire program and THEN go back and optimize it, or should I optimize code as I write it?

答:
is it more efficient to write an entire program and THEN go back and
  optimize it, or should I optimize code as I write it

Neither.

You're missing an entire huge component to the SDLC: design.

You should prove out concepts that you're unfamiliar with in a sandboxed environment (meaning it doesn't actually link in with the rest of your project, or if it does, it's easy to swap it out with something with a little more thought behind it).

Take the learnings from your prototype and write up a technical design. By now, you should have proven out any unknowns and figured out any potential small technical gotchas. The intent here is to fully flush out your design and make it as optimal as needed (refactoring for optimization while coding is a bad practice).

Then implement your design. There may be small oversights that you may have to account for, but by the time you start writing the code that will make its way into your main project, you will have your concept proven out (by prototyping) as well as an efficient design that accounts for as many edge cases as you and your peers can think of (technical design).

ContentLicense: CC BY-SA 3.0


问:
How do you manage your knowledge base?
As programmers we have a lot of inputs:

Ebooks

Code snippets

Interesting emails

Documents

Web articles

Blog posts

StackOverflow questions

Podcasts
...

Which tools do you use to store, organize, search and consult all of this stuff?

Is there a silver bullet solution to handle this huge amount of data?

答:
The best thing I've come across is Springpad

I've tried a personal wiki, evernote, textfiles on dropbox. . .

I stick with Springpad for the following

Online

Syncs with iPhone & Android

Easily customizable

Ability to clip from the web

Ability to add by email

I set up notebooks per client, project, technology or language. I can set up reading lists and add alarm reminders to study, personal curricula for skill-building, etc. Each entry can include notes, tasks, tags, hyperlinks, files, books (with links from amazon) and more. The notebooks can have tabs and even be organized into folders. If all else fails, there's a sweet search functionality. Springpad all the way.

ContentLicense: CC BY-SA 2.5

Title: How do you manage your knowledge base?


问:
Forgetting stuff I've done before and how do you fix this
I'm not sure if it's just me or if this is common in our field.

The past year has been a bit intense for me. I've been learning a few different technologies to get some tasks done and sometimes I've had to completely focus on that one new technology I'm learning.

What I noticed though when I go back to using everything together in the full project is that I forgot how to do things that I already knew how to do before I started focusing on learning that other new technology. Sometimes I find that I forget even simple things like the syntax for selecting a div in jquery, that I have to go back to old files to get a quick peek.

Sometimes I could be coding something that I recognize I did before in another project, but can't quite remember which project it was for, so I have to go through several projects and look through the code to try and remember where I did that.

What ways have you invented to prevent yourself from forgetting things you've done before, or to easily access code you've written in the past?

答: It happens to me.  For example, since I don't really use them at my job, I am constantly re-learning Ruby/Javascript.  You eventually start remembering some things, but I have also acquired a HUGE number of browser bookmarks with a lot of tags that I depend on heavily. For commonly used code-snippets, I have a collection of them, but I still have to: 1. Remember that I have them, 2. Find the one I thought might be relevant, and 3. Determine whether what I remember was really applicable or not.  I haven't bothered to come up with a better system, unfortunately.</p>


问:
Is programming a profession not for a person with speech impairment?
My friend has 15 years of programming experience and Ph.D. in mathematics. He has also cerebral palsy with speech impairment. Because of his handicap, he chose to being a software developer after his Ph.D. As far as I can see, he is still an excellent c# developer.

Nowadays, however, he has hard time to find a job for himself because most of developer jobs require good communication skills. Looking at him struggling so much, do I have to advise him software industry is not suitable for him any more? It will be extremely difficult for me to do that to the friend but I think it would be better than making him wasting his time.

What do you think?

Update: Thanks a lot for your excellent answers. I can see most answers recommend against my advice and I really really hope you guys are right. In reality, however, he has been rejected in 100 or so phone interviews. That's where I want to be a potential bad adviser rather than a politically right friend.

答:
For a programmer with 15 years of programming experience and and Ph.D(irrespective of the subject) communication should not hinder in anyways. Even Bill Gates was lagged behind in the communication skills department....

Even if your fried has incapability to communicate there are many other ways nowadays to communicate....Most of the companies use the chat system to communicate within peers that does not require ant speech skills...

Its always the Programming Skills that Matters!!!

The Company he went to might not be interested in his programming skills. The company should be smart enough to know that there are less chances that person with 15 years of experience in programming would goof up than to a new programmer with rich vocab and high end communication skills...

Although after a certain level efficient communication skills are necessary for the fruitful and coordinated development of the company and the peers.

Your friend should not lose hope and you should never advise him to leave the programming field something that he has mastered over the years.


问:
Interviews: How far to go on DVCS experience?
I've been interviewing some potential interns for a project I'm working on. We use git, so I'm looking for someone familiar with DVCS (or SVN/CVS or a desire to learn). A response that threw me off was "I've worked with github" with no further information, so it forced me to consider what to expect from a programmer working with version control.

I actually led a VCS conversion, so I got more intimately involved with Git/DVCS administration than I thought I ever would be, so I don't think it is fair to hold a student to that standard.

My question is, what should a junior programmer be comfortable doing when working with a DVCS? Should it be simple adds, commits, merges, remotes, or would you expect something more? If you've been asked good questions in interviews, I'd appreciate them being shared.

I don't really want to hire the developer that pushes a backwards merge!

Edit: I really should have mentioned before this got rolling that our distribution model relies heavily on Git and our self-hosted repository (I'm a web developer), and that's why  I feel it's important to know (at the very least) the consequences of serious actions like remote pushes; these actions triggers a few different processes in our environment. My fault! The answers have still been very helpful.

答:
Whether someone has worked with a version control system or not is relatively uninteresting, unless you need someone right now to fix your broken version control yesterday.

Otherwise, what you are interested in is whether the candidate is capable of grasping the concepts involved in version control - and in fact, since the abstract concepts are similar to ones used in many programming problems, you want such a person anyway. Someone who understands pointers and recursion will be able to understand version control.

The basics of any version control system can be learned in less than an hour; more complex tasks may take a while to get used to, but not enough to worry about.

That said, if someone uses version control, that's a positive indicator for doing things the right way - but if they don't, it doesn't mean they're not a good fit.


问:
a better approach for reviewing performance of developers?
I am a web developer.
My office sets a list of criteria such as

Discipline

Attendance

Project Schedule

Teamwork

Problem Solving

Idea Sharing

Dedication

for evaluating employees performance.

Each criteria is allocated some points and the review is based on the total points scored in each criteria.
My problem is I feel these criteria are quite vague and I don't think they can actually portray an employees performance. In software development, I think there are other other ways to measure an employees performance.
Any suggestions?
Thanks

答:
Well i must admit first that this system in your company is really a bore!!

Though some of the points can be retained...some need to be removed they are too old fashioned

Discipline

Attendance

Dedication

I think the above points can be removed blind folded!!!

A true passionate programmer can be identified by the naked eye to any one who understands a bit of programming! Such guys might score the lowest in the above marking system you have got...

With a programmer you need to look at his / her

Approach towards the work is a very necessary aspect a programmer, he/ she might take a project with different eyes and in most cases this first look and approach will decide the future of the project...These things can be very well identified in team meeting and discussions...

Team work (that there in your list)

Idea Sharing is vital, If done in proper way I think that it would always help and if not done will mar the progress of the company...

Problem Solving though it can be a team effort at times but you cant push it away as sometimes individual brilliance in a team can do wonders

Also another thing you must see is the efficiency of the programmer in his work.... a loop may be executed in different ways but the most efficient LOC should be applauded

OwnerDisplayName: Pirus


问:
What are the Pros and Cons of the GPL?
I'm looking at licensing some open source software and am looking at the GPL.  What are the pros and cons of using this license?</p>

答: When it comes to liberally-licensed open source projects (e.g. X11, PostgreSQL, Haskell), the GPL and LGPL backfire.  GPLed code cannot be used in such projects, not because the GPL forbids it or the X11 license forbids it, but because such projects do not want to "upgrade" their entire product's effective license to the GPL.</p>

Title: What are the Pros and Cons of the GPL?


答:
Output

That's the only performance measure I can think of. You come to work late, you drink wine, you sleep at work, whatever you do, I just want you to write that feature in 2 days. This is what I want, if I be a manager.

However, there are other things (bureaucratic things) which need to be addressed in many companies. While they matter, they shouldn't be regarded as an indicator of the developer's performance. Rather they can be applied as indicators of developer's loyalty or developer's qualification, or stuff like that.

Among your items, IMHO, Project Schedule, Teamwork, and Problem Solving are indicators that a good developer should have.

Title: a better approach for reviewing performance of developers?

Body:
I am a web developer.
My office sets a list of criteria such as

Discipline

Attendance

Project Schedule

Teamwork

Problem Solving

Idea Sharing

Dedication

for evaluating employees performance.

Each criteria is allocated some points and the review is based on the total points scored in each criteria.
My problem is I feel these criteria are quite vague and I don't think they can actually portray an employees performance. In software development, I think there are other other ways to measure an employees performance.
Any suggestions?
Thanks


答:
Of course there are other ways to measure performance. Unfortunately (unless I missed something in your post), you're not in a position to dictate the office's criterea (however archaic it may seem).

Your job (if you want to succeed there and further your career), is to meet and exceed those expectations. Ask your manager for an explanation of how they quantify this criteria. You need to understand and align yourself with their expectations.

Only if they don't have methods to quantify these things (and I suspect that they can't produce a list for a few of those things on their list), perhaps have the conversation about how they can possibly expect anyone to be able to excel in the company if there's no way to attach tangibles to each item in the list. IMHO, this is the politically correct way to go about telling your office management they're nuts without telling them: By making them realize that their criteria is a little out.

If you feel that something is vague, seek clarification from the people imposing this criteria on you, not from internet randoms.


答:
No, a speech impairment is in no way a reason not to go into programming.

Communication is important, but it is not restricted to verbal communication.

Back in 1986/87 I worked with someone who had cerebral palsy and, amongst others, a speech impairment. I got used to his way of speaking soon enough. For the most time we had no difficulties at all in our communication. On the few occassions when it did become difficult, we simply switch to writing or drawing. On a whiteboard, notepad, or whatever was at hand.

Title: Is programming a profession not for a person with speech impairment?

Body:
My friend has 15 years of programming experience and Ph.D. in mathematics. He has also cerebral palsy with speech impairment. Because of his handicap, he chose to being a software developer after his Ph.D. As far as I can see, he is still an excellent c# developer.

Nowadays, however, he has hard time to find a job for himself because most of developer jobs require good communication skills. Looking at him struggling so much, do I have to advise him software industry is not suitable for him any more? It will be extremely difficult for me to do that to the friend but I think it would be better than making him wasting his time.

What do you think?

Update: Thanks a lot for your excellent answers. I can see most answers recommend against my advice and I really really hope you guys are right. In reality, however, he has been rejected in 100 or so phone interviews. That's where I want to be a potential bad adviser rather than a politically right friend.


答:
The Ultimate review Point is gets things done, but that is even more vague than the presented ones.

The presetend Points could be a try to break getting things done down in components that are easier to measure.

But the problem with these points is (with exception of attendance, that's just stupid) is that they are again hard to measure and easy to get wrong.

For example, Idea Sharing: here are my 100 mails with suggestions for improvement of the company. Does that mean i provide valuable input, or did i just realize that it is far easier to suggest things other people should do than doing them myself?

Or, the evergreen, Teamwork. How do you want to measure it? 'Doesnt show up with an Axe to kill coworkers'? Every method that involves the rest of the Team degrades quickly into a groupthink-fest, imho. Noone likes the collegue who states a Team's low standards, regardless how good he presents it.

I think, to improve the situation, instead of trying to improve the reports, one should find out, what they try to manage with the information they hope to get from the reports, and improve that. The try to get a 'big picture' and then make some sound management decision about individual developers failed to often that i have any hopes that it could be done right.


答:
One can be a good programmer with speech impairment.

Unfortunately, speech impairment could be an obstacle to being hired in almost any type of job because of unjustified biases and as mentioned above lack of management skills and relaxed ethical standards.

All things being equal then, your friend is better off looking for a job where his skills and  experience are most relevant.

Having said that, generally speaking, every job seeker who has been on the market for a while (even for reasons such as a weak market) should be open minded about his prospects and alternative career options.


答:
I am not being flippant - the PhD can be as much of a handicap.  This is, in my experience, often a warning sign that the applicant has a very narrow view.  They may be the world expert on sorting integers but have no idea when it comes to sorting strings.

I would however love to have another good, experienced programmer to add to the team.  If I could rely on him/her to take a specification (assuming that we can beat one out of the marketing department) and run with it to get a product to delivery then I would be very happy.

The real difficulty is to communicate at the interview, to get the hiring company to see the passion, ability and experience that is on offer.


答:
I am a project leader in a mid size company in Switzerland (about 2000 people). In my team I always try to avoid being too strict about office time.
I also organize a social event weekly in order to know my collegues also under a personal perspective.

However every week or 2 weeks I set a milestone that has to be achieved by each developer. In this way i can clearly see if that person is productive or not. I leave to anyone the freedom to come and go from the office when s/he likes, but everyone knows that has to deliver before the deadline.

I found that this approach pays back in terms of dedication and attendance, since people do not feel "controlled", but they are more relaxed at work. This lets they be always capable to finished their own tasks, since everyone finds his/her own better working "style". At last Teamwork is excellent too, thanks to our socialc events.


问:
Why it is called "hash table", or "hash function"? Hash doesn't make any sense to me here
It's now about 4 years of development that I'm using, hearing, talking about, and implementing hash tables and hash functions. But I really never understand why it's called hash?

I remember the first days I started programming, this term was kind'of cumbersome terminology to me. I never figured out what is it, based on its name. I just experimentally understood what it does and why and when should we use it.

However, I still sometimes try to figure out why it's called hash. I have no problem with table or function and to be honest, they are pretty deductive, rational terms. However, I think better words could be used instead of hash, like key, or uniqueness. Don't key table or uniqueness table.

According to my dictionary, hash means:

Fried dish of potato and meats (highly irrelevant)

# symbol (AKA number sign, pound sign, etc.) (still irrelevant, maybe just a mis-nomenclature)

Apply algorithm to character string (still has nothing to do with uniqueness, which is the most important feature of a hash table)

Cut food

Another term for hashish

Does anyone know why it's called hash?

答:
According to wikipedia, it refers to the hash function.  If you want to go a step further, the wiki page for hash function says that the use of the word "hash" in hash function originated like so:

The term "hash" comes by way of analogy with its non-technical
  meaning, to "chop and mix". Indeed, typical hash functions, like the
  mod  operation, "chop" the input domain into many sub-domains that get
  "mixed" into the output range to improve the uniformity of the key
  distribution.


答:
Number 3 has everything to do with it. From Wikipedia:

At the heart of the hash table algorithm is a simple array of items; this is often simply called the hash table. Hash table algorithms calculate an index from the data item's key and use this index to place the data into the array. The implementation of this calculation is the hash function, f:

index = f(key, arrayLength)

The hash function calculates an index within the array from the data key. arrayLength is the size of the array. For assembly language or other low-level programs, a trivial hash function can often create an index with just one or two inline machine instructions.

So a hash table doesn't really store values based on a key; it stores values based on a hashed version of that key.

Title: Why it is called "hash table", or "hash function"? Hash doesn't make any sense to me here

Body:
It's now about 4 years of development that I'm using, hearing, talking about, and implementing hash tables and hash functions. But I really never understand why it's called hash?

I remember the first days I started programming, this term was kind'of cumbersome terminology to me. I never figured out what is it, based on its name. I just experimentally understood what it does and why and when should we use it.

However, I still sometimes try to figure out why it's called hash. I have no problem with table or function and to be honest, they are pretty deductive, rational terms. However, I think better words could be used instead of hash, like key, or uniqueness. Don't key table or uniqueness table.

According to my dictionary, hash means:

Fried dish of potato and meats (highly irrelevant)

# symbol (AKA number sign, pound sign, etc.) (still irrelevant, maybe just a mis-nomenclature)

Apply algorithm to character string (still has nothing to do with uniqueness, which is the most important feature of a hash table)

Cut food

Another term for hashish

Does anyone know why it's called hash?


问:
How have you made unit testing more enjoyable?
If you've always loved unit testing, good for you! But for the unfortunate ones who weren't born with a liking for it, how have you managed to make this task more enjoyable ?

This is not a "what is the right way to unit test" question. I simply want to know little personal tricks that reduce the boredom (dare I say) of writing unit tests.

答: Try to get into the Flow. Set tough, but achievable goals to yourself. What could be a goal in unit testing? For example, try to write faster while keeping quality. Unit tests don't require too much thought so mistaking is unlikely. Concentrate on your goal and check often to see as you are nearing it.</p>


答:
hash tables are called that way because of using hash code and it's related to "cut food".

Think of it like this - you take your nice pretty object, like a fruit, then hash it so that it starts looking just like anything else - just a number - there's no more structure in it anymore. That piece of "cut food" is used in hash table to find out your nice pretty object.

It looks uglier than your pretty object? maybe - but it helps to find it fast - that's the point. oh and it's not unique that's for sure.

Hash code finds a bucket in the table where your pretty object sits in a small company of others with same hash code. Within this small company, object is looked up using equality check - which is expected to be much slower than hash lookup but it's not a big deal since there are only a few of them (most of other objects are already ignored thanks to fast hash).


答:
In French, a hash table is called "table de hachage", the related verb "hacher" means to chop/to mince (food mostly). The verb to hash has the same meaning in English.

So as other have pointed out it is called hash, because you chop your input that you put in pieces in different places (your table entries).

ContentLicense: CC BY-SA 4.0


问:
What naming anti-patterns exist?
There are some names, where if you find yourself reaching for those names, you know you've already messed something up.

For example:

XxxManager

This is bad because a class should describe what the class does. If the most specific word you can come up with for what the class does is "manage," then the class is too big.

What other naming anti-patterns exist?

To clarify, I'm not asking "what names are bad" -- that question is entirely subjective and there's no way to answer it. I'm asking, "what names indicate overall design problems with the system." That is, if you find yourself wanting to call a component Xyz, that probably indicates the component is ill concieved. Also note here that there are exceptions to every rule -- I'm just looking for warning flags for when I really need to stop and rethink a design.

答: I frequently encounter software libraries with generic names such as Library or Common.  They indicate suboptimal design: the developers make an effort to avoid code duplication but without any attempt to create a design decomposed on the basis of functionality.

Title: What naming anti-patterns exist?


问:
How hard would it be for Microsoft to support deployment of .net apps onto OSX and linux
Given the announcement of the windows 8 tablet edition and more details on the app store, it would be amazing if this infrastructure could be leveraged for the OSX desktop and or MonoTouch. http://www.wired.com/gadgetlab/2011/09/windows-8-experience/

Technically how hard would it be for Microsoft to do this?

Is the only problem strategic?

I know all about Mono, this is a question about microsoft supporting it directly from Visual Studio.

答:
Well, they could talk nicely to Embarcadero & buy Delphi. There used to be a Linux version & the latest version is cross-platform Win/Mac/iOS.

The problem is soluble, it's just that the Linux & MacOS communities would represent around 20% of the desktop but 99% of the complaints.  The FLOSS brigade would expect MS to open source Visual Studio & the Cult of Steve would complain about the user experience.

That's without getting into any strategic stuff like why would MS want to encourage the uptake of other operating systems by providing an easy tool for migration.  If you could simply push a button & deploy to Linux or MacOS, the next audit MS did of a Government department would be its' last.


问:
Are developers more productive at night?
I personally stay awake late at night, coding and enjoying working on personal projects. My other colleagues also feel the same and like coding at night. However, it's not about being passionate about personal hobbies, rather, I really feel that I'm more productive at night.

I think that there is something about night, maybe its darkness, maybe its silence, maybe another attribute that makes developers become more productive.

Is there some truth to this? Why do some developers believe that they are more productive at night? Is there any scientific proof to justify this proposition? Maybe something like "in night, monitor light is less harmful" or "the natural air in night has more oxygen, thus is more suitable for thinking process", or anything like that.

Moderator Note:

The question is asking for scientific proof and otherwise cited information on this subject. Answers that do not provide supporting references will be removed. This is not a poll where you should share when you wake up and what parts of the day you personally are productive.

答:
I think this is a per-person trait.  I've known many developers, especially those with families they spend time with at night, who deliberately come into the office early.

In the example you gave, though, I think it is generally true that people are able to maintain higher levels of productivity for personal projects compared to work projects.  It makes sense, since in general there is a higher level of interest and passion in the project than a task you may be delegated in the office.


答:
Its not necessarily the time of night that makes the developers more productive...

The night time gives a calm and silent ambiance for the thoughts to get a free flow in the mind and which is very essential while programming.

Less distractions! Just not having the phone ring, solicitors selling cookies, the reduction of emails, and less chatter pays tremendous dividends to working at night. Your mind relaxes and opens up to a slew of creativity — it’s easy to get into the zone when you’re at ease.

It doesn't necessarily be the night time, an environment with lesser distractions and disturbance will always act as a catalyst for the Developers productivity

Also may be at the night the mind will have lesser thoughts about the outer world, so fewer thoughts revolving in the head helps the programmer to get free flow of programming thoughts and logic

Also the fact that the personal projects are done out passion for programming while the office projects are because you are bound to do that, so the former would interest you more than the later. So you tend to work with heart, which is what gives you a feeling that the night gives you a few more hours to work.

Title: Are developers more productive at night?

Body:
I personally stay awake late at night, coding and enjoying working on personal projects. My other colleagues also feel the same and like coding at night. However, it's not about being passionate about personal hobbies, rather, I really feel that I'm more productive at night.

I think that there is something about night, maybe its darkness, maybe its silence, maybe another attribute that makes developers become more productive.

Is there some truth to this? Why do some developers believe that they are more productive at night? Is there any scientific proof to justify this proposition? Maybe something like "in night, monitor light is less harmful" or "the natural air in night has more oxygen, thus is more suitable for thinking process", or anything like that.

Moderator Note:

The question is asking for scientific proof and otherwise cited information on this subject. Answers that do not provide supporting references will be removed. This is not a poll where you should share when you wake up and what parts of the day you personally are productive.


问:
Should Professional Development occur on company time?
As a first-time part-time software developer at a small consulting company, I'm struggling to organise time to further my own software development knowledge - whether that's reading a book, keeping up with the popular questions on StackOverflow, researching a technology we're using in-depth, or following the front page of Hacker News. I can see results borne from my self-allocated study time, but listing and demonstrating the skills and knowledge gained through Professional Development is difficult.

The company does not have any defined PD policy, and there's a lot of pressure to get something deliverable done now! when working for consultants. I've checked what my coworkers do, and they don't appear to allocate any time to self-improvement; they just work at the problems they're given, looking up specific MSDN references, code samples, and the like as they need them.

I realise that PD policy is going to vary across companies of different size and culture, and a company like my own is probably a bit of an edge case. I'd love to hear views and experiences from more seasoned developers; especially those who have to make the PD policy choices in their team or company.

I'd also like to learn about the more radical approaches to PD, even if they're completely out there; it's always interesting to see what other people are trying.

Not quite a summary, but what I'm trying to ask:

Is it common or recommended for companies to allocate PD time?

Whose responsibility is it to ensure a developer's knowledge and skills are up to date?

Should a part-time work schedule inspire a lower ratio of PD time : work?

How can a developer show non-developer coworkers that reading blogs and books is net productive?

Is reading blogs and books actually net productive? (references welcomed)

Is writing blogs effective as a way of PD? (a recent theme on Hacker News)

This is sort of a broad question because I don't know exactly which questions I need to ask here, so any thoughts on relevant issues I haven't addressed are very welcome.

答:
Is it common or recommended for companies to allocate PD time?

Recommended yes, common no.

Whose responsibility is it to ensure a developer's knowledge and skills are up to date?

It's the developer's own responsibility.

I think you just have to take the time. Use your own judgement and spend 10 % or so of your company time to study secretly. It's easier to ask forgiveness than it is to get permission.


答:
Be wary though. While working at night, you might get things done because of the calmness of mind and lack of interactions but even though I am a night owl myself, I find that my brain does not function as well at night. I am definitely not as quick and innovative.

Working at night also has the unfortunate side effects of not sleeping enough. Your brain needs its rest and if you do not rest when everything is quiet, you might not rest as much or the quality of your rest might suffer. The natural thing for many creatures is to sleep at night and that is the human default behavior as well.

In conclusion, I believe night hours are better for certain tasks. However, you should maintain a good balance between sleeping and working at night as well as during the day.


答:
Officially supporting .NET for other platforms would be a serious nail in Microsoft's coffin.

One of the reasons Windows succeeded where other operating systems failed has been due to Microsoft's support for the developer - Microsoft produce some of the best tools in the industry. Use of these tools however, come at a cost - you are tied to Windows. This suits microsoft greatly, as it boosts sales in Windows, and as such tools such as Visual Studio and .NET can be produced as loss leaders in order to tie users in to the Windows platform.

If Microsoft were to release .NET for Linux/Mac, then they will turn operating systems into a commodity - everyone could freely switch between operating systems and still have access to the same software (assuming everything was written in .NET).

Why would someone choose to buy Windows for £100+ when they can use Linux for free, and still get access to the same software?

There is just no incentive for Microsoft to do so, in fact it would be counter productive to their business.

Title: How hard would it be for Microsoft to support deployment of .net apps onto OSX and linux

Body:
Given the announcement of the windows 8 tablet edition and more details on the app store, it would be amazing if this infrastructure could be leveraged for the OSX desktop and or MonoTouch. http://www.wired.com/gadgetlab/2011/09/windows-8-experience/

Technically how hard would it be for Microsoft to do this?

Is the only problem strategic?

I know all about Mono, this is a question about microsoft supporting it directly from Visual Studio.


答:
As pointed out in a comment by SK-Logic, there is some scientific evidence to back this up.

From wikipedia's article on night owls:

Researchers have found that 'differences in a fundamental property of
  the circadian timing system, its intrinsic period, will determine
  whether someone is an early bird, who awakens before dawn or a night
  owl, who tends to stay up late at night but sleeps in late'.

This is an indication that some people would prefer to work at night.

This interesting paper studies the productivity of a programmer over time.

The sequence of phases is: euphoric, productive, irreplaceable,
  resentful, bored, and unproductive. Overall productivity is
  characterized by an initial six month period of intense interest, at
  which time productivity rates are often an order of magnitude higher
  than the oft-quoted 500 LOC/month average. After a short period of
  volatility, the programmer then enters a prolonged phase of steadily
  dwindling interest, resulting in productivity rates that mimic the
  average.

Taking this into account, and considering that a programmer usually works on individual projects at night, a simple reason could be that it's this 'euphoric' drive for short-term individual projects that makes them productive, causing the desire to stay awake and continue work.


问:
What features are vital for good bug tracking software?
What features are vital for good bug tracking software and why are they important? What in particular is necessary for you to consider these features done right?</p>

答:
Powerful Query

The bug tracking software should help to manage the projects by enforcing rigorous development process at each stage of issue resolution.


问:
How can I explain the usefulness of Inheritance?
When trying to explain the concept of Inheritance in OOP, the common example is often the mammals example. IMHO, this is really a bad example, because it will lead the newbies to use this concept the wrong way. And moreover, it is not a common design that they will face in their day-to-day design job.

So, what will be a nice, simple and concrete problem that is solved using Inheritance ?

答:
Encapsulate what varies ... show them a template method pattern, it demonstrates the usefulness of inheritance by putting common behaviour in a base class and encapsulating varying behaviour in subclasses.

UI controls and Streams are also a very good example for the usefulness of inheritance.


答:
Remember

Every instance of an object is a concrete example of the usefulness of inheritance!

If you mean specifically class inheritance, now you are in the world of taxonomies, and those will vary drastically by the goals of the system using them. The animals/mammals example uses a common and hopefully familiar taxonomy from biology, but it is (as you mentioned) nearly useless for the vast majority of programming problems.

So try something universal: the notion of a Program. Every program starts, runs, and ends. Every program has a name, and optional command-line parameters. So a base Program class would be very useful, to start execution, grab and process the command-line arguments, run the main logic, and shut down gracefully.

Which is why so many object-oriented programming languages provide a Program class, or something that behaves exactly like a Program class.

Title: How can I explain the usefulness of Inheritance?

Body:
When trying to explain the concept of Inheritance in OOP, the common example is often the mammals example. IMHO, this is really a bad example, because it will lead the newbies to use this concept the wrong way. And moreover, it is not a common design that they will face in their day-to-day design job.

So, what will be a nice, simple and concrete problem that is solved using Inheritance ?


答: Your typical rails-clone provides many practical examples: you have the (abstract) base model class, that encapsulates all data manipulation and you have the base controller class, that encapsulates all HTTP-communication.


问:
What made jQuery so popular? What is offers that other JavaScript libraries don't?
According to W3Tech, this link, this link, this link, and many other sources, jQuery is really becoming what IE experienced in the world of web browsers (gaining more than 80% of the market for a period).

I don't have the knowledge of any other JavaScript library like MooTools, YUI, etc. because when I started web development, jQuery was already ahead and I chose it.

Are other libraries really that awful, or do they lack something jQuery exclusively has? What is the reason(s) behind this huge market share?

答:
What did it for me is the excellent documentation and terseness of syntax.

Other toolsets don't (didn't?) have the great documentation that jQuery has, and being able to refer to it just using $ is great.

Its use of CSS selector syntax for selection of elements was also something I did not see before and makes it a very low barrier of entry for designers who know CSS really well but not javascript.

And of course an unbelievable amount of plugins.


答:
The key to jQuery's popularity, I think, lies in it's visibility.

Once you get into JavaScript in a professional (or "elite enthusiast") way, and you want Awesome Stuff, you look at what other pages with Awesome Stuff on them have used.

"View source" on this very page, for example.

It became popular because it was by far the best around.  Now that many have caught up they are behind, and will be behind for a long while, because jQuery already has spread so much.
Also, names are important.  I entirely skipped "Prototype" because I thought it wasn't finished/stable yet.  It's ... just a prototype.

I realize now that I was wrong, of course, but now I'm already super-happy with jQuery.

Title: What made jQuery so popular? What is offers that other JavaScript libraries don't?

Body:
According to W3Tech, this link, this link, this link, and many other sources, jQuery is really becoming what IE experienced in the world of web browsers (gaining more than 80% of the market for a period).

I don't have the knowledge of any other JavaScript library like MooTools, YUI, etc. because when I started web development, jQuery was already ahead and I chose it.

Are other libraries really that awful, or do they lack something jQuery exclusively has? What is the reason(s) behind this huge market share?


答: One of the reasons why jQuery became so popular is because of its plugin-able nature. It allowed others to build on top of jQuery while the base code remained the same. Of course, being open source and having good documentation support also helped. Adoption from some big companies like Google also fueled its growth.</p>


问:
What non-programming books should a programmer read to help develop programming/thinking skills?
There are a lot of questions about what programming books should be on the programmer's bookshelf. How about non-programming related books that can help you become a better programmer or developer? It would also be interesting to know why they would help.

My first choice would be Sun Tzu's "Art of War" (however cliché), because it made it obvious that the success of any project depends on the strength of its weakest link (and warfare is a big project).

答:
How to win friends and influence people

As mentioned here: What non-programming books should programmers read? "How to win friends and influence people" is a VERY good book.

You don't acquire programming skills directly by this book, but indirectly I'll argue that you do. If you're not very good at dealing with people this will help you with socializing with people that may influence you and your programming skills.

The title of the book may sound a little superficial but it´s not. You learn what others do naturally, and Dale Carnegie encourage you not to be superficial.

Worth a read :-)


问:
Should we encourage coding styles in favor of developer's autonomy, or discourage it in favor of consistency?
A developer writes if/else blocks with one-line code statements like:

```<code>if (condition)
   // Do this one-line code
else
   // Do this one-line code
</code>```

Another uses curly braces for all of them:

```<code>if (condition)
{
   // Do this one-line code
}
else
{
   // Do this one-line code
}
</code>```

A developer first instantiates an object, then uses it:

```<code>HelperClass helper = new HelperClass();
helper.DoSomething();
</code>```

Another developer instantiates and uses the object in one line:

```<code>new HelperClass().DoSomething();
</code>```

A developer is more easy with arrays, and for loops:

```<code>string[] ordinals = new string[] {'First', 'Second', 'Third'};
for (i = 0; i < ordinals.Length; i++)
{
    // Do something
}
</code>```

Another writes:

```<code>List<string> ordinals = new List<string>() {'First', 'Second', 'Third'};
foreach (string ordinal in ordinals)
{
    // Do something
}
</code>```

I'm sure that you know what I'm talking about. I call it coding style (cause I don't know what it's called). But whatever we call it, is it good or bad? Does encouraging it have an effect of higher productivity of developers? Should we ask developers to try to write code the way we tell them, so to make the whole system become style-consistent?

答:
There are coding styles and there are coding smells.
It wasn't once that I have found:

```<code>    if(debugCondition)
//         printf("DEBUG: state:%s at debugCondition\n",dbg_state());

    for(i=0; i<MAX;i++)
    {
       //some essential business logic
    }
</code>```

My previous employer has rigoristically forbidden using multiline if() without braces. It was considered a "do it again and you're fired" type fault. The allowed constructs were

```<code>     if(condition) break;
     if(condition) continue;
     if(condition) return;
     if(condition) for()...;
</code>```

This resulted from an error just like the one I showed above, which took a couple hours to find bringing the portal's main page to a stop.

There are things you just ought to always do. Like switch():

```<code>     case 1:
         something();
     break;
     case 2:
         something();
     return;
     case 3:
         something();
     continue;
     case 4:
     case 5:
         something();
     break;
     case 6:
         something();
     //fallthrough;
     case 7:
     ...
</code>```

Meanwhile, typing:

```<code>     case 1:
         something();
     case 2:
         something();
     break;
</code>```

without closing a case with //fallthrough is considered a bug.

Generally, there is the coding standard which is the guidelines which can be ignored, interpreted creatively or modified for given needs. And there's the section on "smells" and it's to be obeyed rigorously.

Body:
There are coding styles and there are coding smells.
It wasn't once that I have found:

    if(debugCondition)
//         printf("DEBUG: state:%s at debugCondition\n",dbg_state());

    for(i=0; i<MAX;i++)
    {
       //some essential business logic
    }

My previous employer has rigoristically forbidden using multiline if() without braces. It was considered a "do it again and you're fired" type fault. The allowed constructs were

     if(condition) break;
     if(condition) continue;
     if(condition) return;
     if(condition) for()...;

This resulted from an error just like the one I showed above, which took a couple hours to find bringing the portal's main page to a stop.

There are things you just ought to always do. Like switch():

     case 1:
         something();
     break;
     case 2:
         something();
     return;
     case 3:
         something();
     continue;
     case 4:
     case 5:
         something();
     break;
     case 6:
         something();
     //fallthrough;
     case 7:
     ...

Meanwhile, typing:

     case 1:
         something();
     case 2:
         something();
     break;

without closing a case with //fallthrough is considered a bug.

Generally, there is the coding standard which is the guidelines which can be ignored, interpreted creatively or modified for given needs. And there's the section on "smells" and it's to be obeyed rigorously.


答: As a developer I fix myself only one objective, whatever my boss expects from me, and this objective is customer satisfaction.</p>


答:
Mission and philosophy: jQuery set out to make DOM manipulation easier to use, and had a single minded focus on achieving that goal. Other frameworks like Mootools and Dojo focused on making it easier to create complex applications, an idea that was ahead of its time (in 2007), and split the attention of the community and created unnecessary complexity for 99% of developers who are not interested in complex applications or advance javascript.

Chaining. jQuery chains, other frameworks didn't. This resulted in a great readability and ease of use revolution as far as javascript is concerned.


问:
Recursion without factorial, Fibonacci numbers etc
Almost every article I can find about recursion includes the examples of factorial or Fibonacci Numbers, which are:

Math

Useless in real life

Are there some interesting non-math code examples to teach recursion?

I'm thinking divide-and-conquer algorithms but they usually involve complex data structures.

答:
A rather useless yet showing recursion inner working well is recursive strlen():

```<code>size_t strlen( const char* str )
{
    if( *str == 0 ) {
       return 0;
    }
    return 1 + strlen( str + 1 );
}
</code>```

No math - a very simple function. Of course you don't implement it recursively in real life, but it's a good demo of recursion.

Body:
A rather useless yet showing recursion inner working well is recursive strlen():

size_t strlen( const char* str )
{
    if( *str == 0 ) {
       return 0;
    }
    return 1 + strlen( str + 1 );
}

No math - a very simple function. Of course you don't implement it recursively in real life, but it's a good demo of recursion.


问:
Namespaces and naming
I'm having some trouble working this one out, probably more than I should. This is a pretty large project, with a very clearly defined structure, with no obvious problems, but I can't seem to figure out the optimal solution for this case, even after reading several convention documents and such.

For example, given the following namespace:

```<code>\vendor\core\lib\view;
</code>```

Obviously it refers to a "view" namespace...which technically also has a 'view' class in it:

```<code>\vendor\core\lib\view\view
</code>```

This is clearly not ideal, but I can't come up with a better way to name these. Take for example the cache namespace:

```<code>\vendor\core\lib\cache;
</code>```

Same deal, the cache class becomes confusing when inside this namespace:

```<code>\vendor\core\lib\cache\cache;
</code>```

Should I just move these 'core' classes from their namespaces, and put them in the parent namespace?

```<code>\vendor\core\lib\cache (class)
\vendor\core\lib\cache\adapter\redis (class)
</code>```

Or is there a better term to refer to these types of classes?

Pardon my circularity, it's a bit late and my head's not quite working in optimal condition.

答:
By convention, class names should be uppercase and namespaces lowercase, so it's not "confusing" to do what you're doing:</p>

```<code>use \vendor\core\lib\cache\Cache;
</code>```

OwnerDisplayName: Filipe

Title: Namespaces and naming

Body:
By convention, class names should be uppercase and namespaces lowercase, so it's not "confusing" to do what you're doing:

use \vendor\core\lib\cache\Cache;

OwnerDisplayName: drrcknlsn


答:
Hashing (as in cutting into small pieces, shredding, etc.) takes an input (food or sometimes supervillains) and transforms it into a relatively homogeneous output. I.e. no matter what you had in the beginning, in the end you just have hash. And a spoonful of the hash is about as helpful as all the hash in determining, what the input was (assuming your hashing machine hashes well).

So hashing can reduce any edible or evil object into a spoonful of hash, where two different objects yield different hashes, whereas two equal objects yield equal hashes. Which means if two supervillains fell into your hashing machine, it suffices comparing their hashes to determine whether one was a clone of the other.

In a way hashing functions in computer science are a bit alike. They take a whole input of different size and semantics, and -very simply put- they just cut it into pieces and mix those around and cut the resulting sequence back into pieces and mix that around and so on. In the end you have a spoonful (n bytes) of the input you hashed.


问:
Computer Science and other advance topics taught in javascript
I'm an 'okay' Javascript developer working on browser javascript and node.js. However because I'm self taught, starting from copying and pasting jquery, there are a lot of holes in my programming/CS education.

I don't really have the time to devote myself to fully learning all the CS concepts that might be taught in a real college program, and learning C or Scala or whatnot, I'm just too addicted to hacking and making things that work. On some level studying CS seems to be 'premature scaling' in Hacker News parlance.

But every so often I get struck by the thought that maybe there is something that I should really really learn to take my skills and productivity to the next level.

Is there a book, a list of concepts or things that I can study and learn in my 'down time' that would see reasonable returns on my productivity and ability in 1 - 2 months?

Thanks!

And yes, the only language I know and use is Javascript, though I have tinkered with Python (High School), Ruby (RoR), PHP (Drupal), and Assembly (Making Diablo 2 Mods) in the past.

Please note that a book like O'Reilly's JavaScript Web Applications is too easy for me and not really what I'm talking about.

答:
Good programming practices transcend languages, and you would probably be better off looking to expand your knowledge without tying it strictly to JavaScript.  Many concepts will be applicable once you understand them, but filtering the list of books you are willing to read to only JavaScript ones cause you to miss many of the best ones.

There are tons of excellent books out there which deal with this topic (let's call it software engineering), such as Refactoring: Improving the Design of Existing Code (halfway down the page), The Pragmatic Programmer: From Journeyman to Master, or on a management side Object Solutions: Managing the Object-Oriented Project to name just a few.  Most of these books contain concepts which will change the way you think about development, regardless of what language you end up using, although admittedly the ones I've mentioned have an OO angle to them.


答: In addition to your list, I would stress on completing the assigned work, positive and effective communication within and outside the team and a bonus for positive suggestions and helping others. Attitude is important. While positive attitude is hard to measure, negative attitude can be easily spotted and is harmful to the team.</p>


问:
When is a version control commit too large?
I've heard in several places "Don't make large commits" but I've never actually understood whats a "large" commit. Is it large if you work on a bunch of files even if there related? How many parts of a project should you be working on at once?

To me, I have trouble trying to make "small commits" since I forget or create something that creates something else that creates something else. You then end up with stuff like this:

```
Made custom outgoing queue

Bot
-New field msgQueue which is nothing more than a SingleThreadExecutor
-sendMsg blocks until message is sent, and adds wait between when messages get
sent
-adminExist calls updated (see controller)
-Removed calles to sendMessage

Controller
-New field msgWait denotes time to wait between messages
-Starting of service plugins moved to reloadPlugins
-adminExists moved from Server because of Global admins. Checks at the channel,
server, and global level

Admin
-New methods getServer and getChannel that get the appropiate object Admin
belongs to

BotEvent
-toString() also show's extra and extra1

Channel
-channel field renamed to name
-Fixed typo in channel(int)

Server
-Moved adminExists to Controller

PluginExecutor
-Minor testing added, will be removed later

JS Plugins
-Updated to framework changes
-Replaced InstanceTracker.getController() with Controller.instance
-VLC talk now in own file

Various NB project updates and changes

---

Affected files
Modify  /trunk/Quackbot-Core/dist/Quackbot-Core.jar
Modify  /trunk/Quackbot-Core/dist/README.TXT
Modify  /trunk/Quackbot-Core/nbproject/private/private.properties
Modify  /trunk/Quackbot-Core/nbproject/private/private.xml
Modify  /trunk/Quackbot-Core/src/Quackbot/Bot.java
Modify  /trunk/Quackbot-Core/src/Quackbot/Controller.java
Modify  /trunk/Quackbot-Core/src/Quackbot/PluginExecutor.java
Modify  /trunk/Quackbot-Core/src/Quackbot/info/Admin.java
Modify  /trunk/Quackbot-Core/src/Quackbot/info/BotEvent.java
Modify  /trunk/Quackbot-Core/src/Quackbot/info/Channel.java
Modify  /trunk/Quackbot-Core/src/Quackbot/info/Server.java
Modify  /trunk/Quackbot-GUI/dist/Quackbot-GUI.jar
Modify  /trunk/Quackbot-GUI/dist/README.TXT
Modify  /trunk/Quackbot-GUI/dist/lib/Quackbot-Core.jar
Modify  /trunk/Quackbot-GUI/nbproject/private/private.properties
Modify  /trunk/Quackbot-GUI/nbproject/private/private.xml
Modify  /trunk/Quackbot-GUI/src/Quackbot/GUI.java
Modify  /trunk/Quackbot-GUI/src/Quackbot/log/ControlAppender.java
Delete  /trunk/Quackbot-GUI/src/Quackbot/log/WriteOutput.java
Modify  /trunk/Quackbot-Impl/dist/Quackbot-Impl.jar
Modify  /trunk/Quackbot-Impl/dist/README.TXT
Modify  /trunk/Quackbot-Impl/dist/lib/Quackbot-Core.jar
Modify  /trunk/Quackbot-Impl/dist/lib/Quackbot-GUI.jar
Modify  /trunk/Quackbot-Impl/dist/lib/Quackbot-Plugins.jar
Modify  /trunk/Quackbot-Impl/lib/javarebel.stats
Add /trunk/Quackbot-Impl/lib/jrebel.info
Modify  /trunk/Quackbot-Impl/nbproject/private/private.properties
Modify  /trunk/Quackbot-Impl/nbproject/private/private.xml
Modify  /trunk/Quackbot-Impl/nbproject/project.properties
Modify  /trunk/Quackbot-Impl/plugins/CMDs/Admin/reload.js
Add /trunk/Quackbot-Impl/plugins/CMDs/Operator/hostBan
Modify  /trunk/Quackbot-Impl/plugins/CMDs/Operator/mute.js
Modify  /trunk/Quackbot-Impl/plugins/CMDs/lyokofreak/curPlaying.js
Modify  /trunk/Quackbot-Impl/plugins/CMDs/lyokofreak/lfautomode.js
Modify  /trunk/Quackbot-Impl/plugins/listeners/onJoin.js
Modify  /trunk/Quackbot-Impl/plugins/listeners/onQuit.js
Modify  /trunk/Quackbot-Impl/plugins/testCase.js
Add /trunk/Quackbot-Impl/plugins/utils/whatsPlaying.js
Modify  /trunk/Quackbot-Impl/src/Quackbot/impl/SandBox.java
Add /trunk/Quackbot-Impl/vlc_http
Add /trunk/Quackbot-Impl/vlc_http/current.html
Modify  /trunk/Quackbot-Plugins/dist/Quackbot-Plugins.jar
Modify  /trunk/Quackbot-Plugins/dist/README.TXT
Modify  /trunk/Quackbot-Plugins/dist/lib/Quackbot-Core.jar
Modify  /trunk/Quackbot-Plugins/nbproject/private/private.properties
Modify  /trunk/Quackbot-Plugins/nbproject/private/private.xml
Modify  /trunk/Quackbot-Plugins/src/Quackbot/plugins/JSPlugin.java
Add /trunk/Quackbot-Plugins/vlc_http
Add /trunk/global-lib/jrebel.jar
```

Yea....

So for questions:

What are some factors for when a commit becomes too large (non-obvious stuff)?

How can you prevent such commits? Please give specifics

What about when your in semi-early stages of development when things are moving quickly? Are huge commits still okay?

答:
You have probably heard the saying that perfection is when you cannot take anything more away.  That should also describe your standard for commit size.

It depends on your project where that "perfect" size is.  If you are shipping to external customers, a good size might be the smallest increment that you would be comfortable shipping if you didn't finish the next one on time.  If you are building internal, frequently deployed applications, the best size might be the smallest increment that doesn't break anything (and gets you closer to where you want to be).

Modern version control systems help you create good commits with easy branching, interactive rebasing, staging area, etc.


问:
does quicksort provide less swapping step?
So far, most of the fastest and common sorting method is quicksort. Although it has its pro and cons. However, i'm thinking that although this sorting method is fast but does it provide shortest swapping step? Because quicksort divide a set of element into 2 and then sorting, will it double up the swapping step?</p>

答:
will it double up the swapping step?

In most cases: The contrary. I'll assume that by swapping you refer to the total number of comparisons. Swapping doesn't really matter in my opinion as it should be a constant time operation and as it is the result of a comparison. The number of comparisons is important.

By dividing the set into two halves you can always think of it as a binary tree. The amount of comparisons to be done is thus logarithmic and dependent on the height of this tree. However, for quicksort, this is not true for all input vectors. When the input is already sorted and the wrong pivot is chosen, then quicksort will run in O(n^2) which is terribly slow. You can think of it as a pretty high tree because quicksort could not properly divide the input vector. Worst case: Not swaps at all and costly at runtime.

Generally you can say, the number of swaps is related to the number of comparisons. The fewer comparisons, the fewer swaps. The number of swaps always depends on the specific input vector!


问:
Guess if a time is AM or PM
I'm currently in the process of writing a human date parser. By human date, I mean it should be able to interpret strings as "tomorrow at 2" and return a valid date depending on the current time.

The issue I'm facing is the automatic detection of missing AM/PM token. For example, if I receive an email that says "Lets meet tomorrow at 2", I know that 2 is likely to be, in fact, 2 PM. On the other hand, if the email said "Lets meet tomorrow at 11", 11 is more likely to be 11AM.

I guess most of the time, a simple comparison should do the trick. If the number is bigger than a certain limit n, we can suppose that the time is AM. If the number is smaller, then it is probably PM. In the sample above, 2 was more likely to be PM, and 11 was AM.

I know that a common work day is about 9AM-6PM, so numbers lower than 6 or bigger or greater than 9 are fine. We can easily guess for those. But what do I do with 7 and 8?

So the exact question I have is, where do I put this exact limit? When numbers approach 7~8, the limit becomes more ambiguous. I tried to search for previous documentation on this problem but couldn't find any. Is there any kind of convention about this? Also, in my opinion, the locale and/or timezone could influence this limit.

By the way, I'm not interested by non-definitive answers such as "In my opinion, 7 is afternoon" or "For me, 8 is morning". I'm really interested in documentation that could help me draw a definitive line.

Hope the description of the problem is understandable enough.

答:
Very complicated. You won't successfully set a hard limit. Some thoughts:

Take into account awake time. Most are awake anywhere from 6am to 12am. Times outside of that are unlikely.

You'll have to use context. If the event is a meeting at 6, 6p is more likely than 6a unless the context is "breakfast", "wake-up", etc.

You should ideally build the system to learn what is most likely by allowing users to correct the times, if wrong, and having the system analyze the conditions and context under which corrections were done.

Like I said, this is very complicated. Google calendars does a bit of this. Examine that solution for examples.

EDIT with addtional thoughts:

I'd collect a bunch of keywords, associate them with AM/PM, search in the context phrase and use them to help determine correct time of day:

PM:
afternoon, "after work/school", "from work/school", dinner, supper, evening, tonight, night, late, noon, "prime time", etc.

AM:
morning, "before work/school", "to work/school", breakfast, early, wake, midnight, etc.

For something like "lunch", you'll have to have a rule like, if time is 12 or less than 6 it's pm, else it's am.

OwnerDisplayName: Vivien Barousse

Title: Guess if a time is AM or PM

OwnerDisplayName: Jonathan M


答:
In addition to Jonathan's answer (basically an extension of 2) you could create some sense of context. Try to look for phrases "before lunch", "after lunch" and narrow down likely times. You could tweak the heuristics here a bit to make it more accurate as well. I think your best bet is to make it context sensitive.

As it has been stated, natural language analysis is a tough problem to crack.

Title: Guess if a time is AM or PM

Body:
I'm currently in the process of writing a human date parser. By human date, I mean it should be able to interpret strings as "tomorrow at 2" and return a valid date depending on the current time.

The issue I'm facing is the automatic detection of missing AM/PM token. For example, if I receive an email that says "Lets meet tomorrow at 2", I know that 2 is likely to be, in fact, 2 PM. On the other hand, if the email said "Lets meet tomorrow at 11", 11 is more likely to be 11AM.

I guess most of the time, a simple comparison should do the trick. If the number is bigger than a certain limit n, we can suppose that the time is AM. If the number is smaller, then it is probably PM. In the sample above, 2 was more likely to be PM, and 11 was AM.

I know that a common work day is about 9AM-6PM, so numbers lower than 6 or bigger or greater than 9 are fine. We can easily guess for those. But what do I do with 7 and 8?

So the exact question I have is, where do I put this exact limit? When numbers approach 7~8, the limit becomes more ambiguous. I tried to search for previous documentation on this problem but couldn't find any. Is there any kind of convention about this? Also, in my opinion, the locale and/or timezone could influence this limit.

By the way, I'm not interested by non-definitive answers such as "In my opinion, 7 is afternoon" or "For me, 8 is morning". I'm really interested in documentation that could help me draw a definitive line.

Hope the description of the problem is understandable enough.


答:
On average Quicksort sorts an array in n(log n) time (which is almost as good as it gets). In worst case it takes n² (but this happens rarely).

Another common sorting algo that takes n(log n) time to sort is Merge Sort. You'll notice that both use the "Divide and Conquer" method, but each with a different strategy.

As for swapping steps, it depends on how each algorithm is implemented. For instance, the number of steps on Merge Sort depends heavily on how you implement the Merge function (e.g., you could merge in place, use an auxiliary array, etc).

Overall it's assumed that the constant factors (swap steps, comparisons and so on) are smaller on Quicksort, though, so it's usually preferred over Merge Sort.

Finally, comparing the number of swap steps with slower algorithms, like Insertion or Bubble sort, makes no sense in my opinion, because the running time has a much more important role.

Title: does quicksort provide less swapping step?

Body: So far, most of the fastest and common sorting method is quicksort. Although it has its pro and cons. However, i'm thinking that although this sorting method is fast but does it provide shortest swapping step? Because quicksort divide a set of element into 2 and then sorting, will it double up the swapping step?</p>


答:
The presentation provided in the link show the number of swaps of different sort algorithms using the O notation. I hope that this could help you.

Power point presentation for different sort alg. showing complexity


问:
Are there any .NET based framework for working with English language?
I'm writing a web application in which I need to analyze words (now just in English, but maybe in future in any language). I tried to write a framework to do the job, but it soon proved to be something really really hard. Finding stems, understanding part of speech, finding consonants, determining morphological patterns, etc. It's really getting harder with each new requirement.

Is there any framework out there (preferably compatible with .NET or PHP frameworks) for working with human languages (English for example)? Some common methods of such framework could be:

```<code>List<Synonym> synonyms = SynonymFinder.FindSynonyms("Help");
Stem stem = MorphologyAnalyzer.GetStem("Determining");
Pronunciation pronunciation = Phonetics.Transcribe("Speech");
</code>```

答:
Perhaps you could use a combination of NLTK (Natural Language Toolkit) and IronPython

NLTK is a leading platform for building Python programs to work with human language data. It provides easy-to-use interfaces to over 50 corpora and lexical resources such as WordNet, along with a suite of text processing libraries for classification, tokenization, stemming, tagging, parsing, and semantic reasoning.

Thanks to a hands-on guide introducing programming fundamentals alongside topics in computational linguistics, NLTK is suitable for linguists, engineers, students, educators, researchers, and industry users alike. NLTK is available for Windows, Mac OS X, and Linux. Best of all, NLTK is a free, open source, community-driven project...


问:
Is programming a profession not for a person with speech impairment?
My friend has 15 years of programming experience and Ph.D. in mathematics. He has also cerebral palsy with speech impairment. Because of his handicap, he chose to being a software developer after his Ph.D. As far as I can see, he is still an excellent c# developer.

Nowadays, however, he has hard time to find a job for himself because most of developer jobs require good communication skills. Looking at him struggling so much, do I have to advise him software industry is not suitable for him any more? It will be extremely difficult for me to do that to the friend but I think it would be better than making him wasting his time.

What do you think?

Update: Thanks a lot for your excellent answers. I can see most answers recommend against my advice and I really really hope you guys are right. In reality, however, he has been rejected in 100 or so phone interviews. That's where I want to be a potential bad adviser rather than a politically right friend.

答: He may not be able to become a Project Manager, but I think in the age of Electronic Communication it won't be tough for him to be a Software Developer. 90% of the communications happen via emails, even with clients too! </p>


答:
As others have said I think it's a per-person trait. Speaking for myself I find that I'm usually productive in the morning and in the evening (or at night) - which probably boils down to being most productive when there's not too much hubbub or distrations of any kind going on around me.

It might also be that late at night you don't have any other appointments or other things that can take you out of the flow.

I don't know about any scientific reasons other than what has already been mentioned which is that apparently each person's inner clock just works a bit differently and some of us are more productive early in the day and others are more productive late at night.


问:
Is it an inefficient workflow to write out code and THEN go back and optimize?
I'm a newer enthusiast programmer. I've been doing small and big projects on and off for the past two or three years.

I always hit small snags in my code that add up to big memory hogs or unnecessary lines of code down the road. My philosophy on big projects has always been to just 'get it out of my head' and write all the code into a working product, then going back and reducing the code to a simpler, more optimized form. However, this doesn't always work: when doing database structures, I tend to have to go back many times to add in features that come up spur-of-the-moment. Entire blocks of code have to be erased because of a spontaneous brainchild.

My question to you is, is it more efficient to write an entire program and THEN go back and optimize it, or should I optimize code as I write it?

答:
Don't optimize at all until the running program tells you what needs optimizing.

Here's what I mean.

If we optimize without knowing what to optimize, we are a bit like the drunk looking for his keys.


答:
Well, there's two things I'd like to point out:

There's far less people out there with great programming skills, than with good communication skills. Your friend is a rare resource. Communication only adds value, if you communicate great solutions. Coming up with great solutions requires great skills. If a solution is really great, than "mediocre" skills suffice to understand it. Even sometimes it speaks for itself.

Having great communication skills involves also being a great listener. So somebody with great communication skills should easily be able to compensate for your friend's limitation.

I think your friend should strive to find a work place, where people really value skills and  engage in a dialogue to understand, instead of throwing stuff at each other. Such places are rarer and treasured. However with his background, it sounds like he might qualify above average.


答:
I am mainly a mootools user so my view may be biased. What makes jQuery so popular is that it's been used in popular web apps at the beginning of the js library days. And you don't have to understand anything to javascript (closures for example) to use it efficiently.

It has a relatively good documentation, lot of live examples and lot of plugins and libraries you can just unzip in your project to use.


答:
Is it common or recommended for companies to allocate PD time?

Like someone else said, it's recommended but I've never seen it.

Whose responsibility is it to ensure a developer's knowledge and skills are up to date?

Ultimately, it's the developer's. Part of that responsibility is also finding an environment that allows you and/or encourages you to do so.

Should a part-time work schedule inspire a lower ratio of PD time : work?

Part-time: Yes. All part-time work I've ever seen is paid by the hour, for a specific purpose. Part-time work, for a job like software development, already signifies (to me anyway) that the company has no interest in keeping developers for the long term, let alone cultivating a strong team.

How can a developer show non-developer coworkers that reading blogs and books is net productive?

I've never heard of a respected developer that wasn't expected to know about bleeding edge technologies and techniques at the drop of a hat. Part of a good developer's value is being aware of those technologies and techniques that can provide value to a company/team and then sharing them when appropriate.

The employers that are users (not end-users, but the hot girl that wants to you to do her homework) will expect that you do that on your own time. Others will not.

Is reading blogs and books actually net productive? (references welcomed)

Depends on the blog. Will Eric Lippert's blog generally make you a better C# developer? Likely. TheDailyWTF? As entertaining as it is... maybe not so much.

Title: Should Professional Development occur on company time?

Body:
As a first-time part-time software developer at a small consulting company, I'm struggling to organise time to further my own software development knowledge - whether that's reading a book, keeping up with the popular questions on StackOverflow, researching a technology we're using in-depth, or following the front page of Hacker News. I can see results borne from my self-allocated study time, but listing and demonstrating the skills and knowledge gained through Professional Development is difficult.

The company does not have any defined PD policy, and there's a lot of pressure to get something deliverable done now! when working for consultants. I've checked what my coworkers do, and they don't appear to allocate any time to self-improvement; they just work at the problems they're given, looking up specific MSDN references, code samples, and the like as they need them.

I realise that PD policy is going to vary across companies of different size and culture, and a company like my own is probably a bit of an edge case. I'd love to hear views and experiences from more seasoned developers; especially those who have to make the PD policy choices in their team or company.

I'd also like to learn about the more radical approaches to PD, even if they're completely out there; it's always interesting to see what other people are trying.

Not quite a summary, but what I'm trying to ask:

Is it common or recommended for companies to allocate PD time?

Whose responsibility is it to ensure a developer's knowledge and skills are up to date?

Should a part-time work schedule inspire a lower ratio of PD time : work?

How can a developer show non-developer coworkers that reading blogs and books is net productive?

Is reading blogs and books actually net productive? (references welcomed)

Is writing blogs effective as a way of PD? (a recent theme on Hacker News)

This is sort of a broad question because I don't know exactly which questions I need to ask here, so any thoughts on relevant issues I haven't addressed are very welcome.


问:
The business and architecture challenge behind creating effective user stories
A friend of mine in another department had a problem and came to me with a question that I wasn't sure how to help him with.  He recently became promoted to architect and he was put in charge of design and leading a team of developers that are of questionable quality and little to no experience with following a project plan.  This team got in the habit of starting development as soon as possible before business needs were even evaluated, and then hacking the software to pieces when requirements finally became clear near the end of the deadline.  Because of this they have tried formulating design standards in the past but never bothered following them later in the project when the heat was turned up.

He aims to change this and asked me about the best way to handle these challenges.  My perspective is that the project is doomed before they start because management sets a tight deadline before the requirements are clearly known or understood.  Dithering from the client exacerbates the problem further. I told him that Agile was MADE for these kinds of problems, formulate user stories based on the customer requirements as you are aware of them now, and then as more user stories or as they change just add to the backlog and readjust your sprint plan accordingly.

But then I got thinking about what really is the best way to handle this?  The client has no way of knowing exactly what they want from the software now, but they know they want it and are willing to pay for it and they want at least some kind of working release by a specific date.  They are given a quote with a breakdown of what will be delivered (it is a guess for both vendor and client), price is agreed upon.

When formulating the quote a deadline of some kind must exist even though it is soft at this point.  User stories aren't even known and certainly not tasks and the ability to provide a reasonable estimation either.  How do you approach this challenge?

When this quote is taken and agreed upon is it normal to use the rough deliverables as outlined in the quote as a basis for formulating your user stories?

Further do you have any advice on how to "keep the design patterns and documents alive" throughout the project as requirements change drastically?

EDIT: It seems many people assume that the client involved should be the one to provide the user stories as if it were a given.  I don't have any personal experience with a client willing to put this kind of effort into being involved with the development process.  Due to this, it seems to make sense that because of their lack of input into the development process, they are not a very good stakeholder for the project itself.  The stakeholders at this point become the business analysts and application managers who are supposed to squeeze whatever trickle of information they can get from the client and turn it into usable information for the developers.  This is clearly not working though so perhaps the ONLY way that Agile or Kanban can work is to have direct client involvement in user stories or else the project is doomed to failure?

答:
Being also a good development approach, Agile is also a perfect way to make the customer care of a project.  All the developers need is to refuse to work out of the framework.

A client has set up no user stories?  Okay, then we do not do anything useful, hacking around software as we wish (there always is something to refactor, some bugs to fix, some new libraries to study and try, etc).

"Why are you slacking?" the customer might ask.  "Because the software is ready," the team answers (and I imagine this is the  claim that may provoke the necessary input). "Wait, how come it's ready?  It's missing the X form!  And the operator has to wait for 5 minutes while Y loads, while the time should be decreased to 1 minute."

Here, you have two user stories.  Repeat until deadline.

As for "keeping the design patterns and documents alive", rubbish bin is a key tool for this.


答:
The client has no way of knowing exactly what they want from the software now, but they know they want it and are willing to pay for it

Part of the thinking behind TQM and BPR was convincing corporations that the price of the product includes the cost of quality. That is, if the customer is wishing to pay for the product, why not include quality processes into the building of the solution? Is the barrier to collecting requirements a financial issue or is it a time issue?

The facts your are stating in your description raises high risk.

Unless you are using a tool that can generate most of your code automatically, the risk in your described scenario will never go away.

There is no substitute whatsoever for understanding the requirements (at least core functionality and business rules) and determining with confidence what can be delivered in the deadline.

Even if you use the approach of generating a solution by evolution/prototyping, you'll need time and user interaction.

Some ideas that come to mind here are:

0-Clearly identify the reason why you can't have requirements defined up-front.

1-Attempt to educate the main players in the value of requirements determination. This can be done by showing the cost of fixing bugs vs. the cost of building the right software in the first time. There are some interesting charts for that (I can dig at least one for you if you want).

2-Attempt to involve the customer as a responsible party in the solution not just as source for requirements and a point for acceptance testing.

3-Attempt to quote based on time and effort rather using a fixed price contract

4-Attempt to break the systems in several small components (subject areas) and deliver each separately and frequently. While this adds more work on your team, it helps you add more interaction with the customer, an interaction based on a real product not just documentation.

5-Find tools that speeds up development as much as possible

Addition
Few references and charts that show the value of catching errors early and that encourages front end analysis and requirements gathering:
References:
What do we mean by "design" in software engineering?

https://softwareengineering.stackexchange.com/questions/104232/how-do-you-address-or-avoid-problems-with-new-features-being-quickly-added-to-the/105600#105600

How to explain that it's hard to estimate the time required for a bigger software project?

Charts:

http://www.codinghorror.com/blog/2005/03/on-software-engineering.html

http://www.isixsigma.com/index.php?option=com_k2&view=item&id=520:defect-prevention-reducing-costs-and-enhancing-quality&tmpl=component&print=1&Itemid=95

http://www.birditcorp.com/pierson-training/

http://www.stickyminds.com/sitewide.asp?ObjectId=12529&Function=edetail&ObjectType=ART
Chart on left hand side of page at: http://www.cogenit.fr/ressources/livres-bleus/smv-agile-method-for-it-projects/

http://silicontaiga.org/home.asp?artId=3394

http://www.sophist.de/en/requirements/studies.html

https://softwareengineering.stackexchange.com/questions/93974/criteria-for-good-architecture-analysis-and-design

page 11 of: http://media.wiley.com/product_data/excerpt/84/08186773/0818677384.pdf

page 9 of: http://www.itq.ch/pdf/sqm/07/sqm_moths_pr.pdf

Title: The business and architecture challenge behind creating effective user stories

Body:
A friend of mine in another department had a problem and came to me with a question that I wasn't sure how to help him with.  He recently became promoted to architect and he was put in charge of design and leading a team of developers that are of questionable quality and little to no experience with following a project plan.  This team got in the habit of starting development as soon as possible before business needs were even evaluated, and then hacking the software to pieces when requirements finally became clear near the end of the deadline.  Because of this they have tried formulating design standards in the past but never bothered following them later in the project when the heat was turned up.

He aims to change this and asked me about the best way to handle these challenges.  My perspective is that the project is doomed before they start because management sets a tight deadline before the requirements are clearly known or understood.  Dithering from the client exacerbates the problem further. I told him that Agile was MADE for these kinds of problems, formulate user stories based on the customer requirements as you are aware of them now, and then as more user stories or as they change just add to the backlog and readjust your sprint plan accordingly.

But then I got thinking about what really is the best way to handle this?  The client has no way of knowing exactly what they want from the software now, but they know they want it and are willing to pay for it and they want at least some kind of working release by a specific date.  They are given a quote with a breakdown of what will be delivered (it is a guess for both vendor and client), price is agreed upon.

When formulating the quote a deadline of some kind must exist even though it is soft at this point.  User stories aren't even known and certainly not tasks and the ability to provide a reasonable estimation either.  How do you approach this challenge?

When this quote is taken and agreed upon is it normal to use the rough deliverables as outlined in the quote as a basis for formulating your user stories?

Further do you have any advice on how to "keep the design patterns and documents alive" throughout the project as requirements change drastically?

EDIT: It seems many people assume that the client involved should be the one to provide the user stories as if it were a given.  I don't have any personal experience with a client willing to put this kind of effort into being involved with the development process.  Due to this, it seems to make sense that because of their lack of input into the development process, they are not a very good stakeholder for the project itself.  The stakeholders at this point become the business analysts and application managers who are supposed to squeeze whatever trickle of information they can get from the client and turn it into usable information for the developers.  This is clearly not working though so perhaps the ONLY way that Agile or Kanban can work is to have direct client involvement in user stories or else the project is doomed to failure?


答:
There's nothing wrong with a purely academic example like mammals.  I also like the rectangle/square example because it points out why real-world taxonomies don't always directly translate to the inheritance relationship you'd expect.

In my opinion, the most canonical every day example is a GUI toolkit.  It's something everyone has used, but that beginners may not have reasoned about how they work under the hood.  You can talk about what behaviors are common to all containers, all widgets, events, etc. without requiring detailed knowledge of any given implementation.


问:
Are developers more productive at night?
I personally stay awake late at night, coding and enjoying working on personal projects. My other colleagues also feel the same and like coding at night. However, it's not about being passionate about personal hobbies, rather, I really feel that I'm more productive at night.

I think that there is something about night, maybe its darkness, maybe its silence, maybe another attribute that makes developers become more productive.

Is there some truth to this? Why do some developers believe that they are more productive at night? Is there any scientific proof to justify this proposition? Maybe something like "in night, monitor light is less harmful" or "the natural air in night has more oxygen, thus is more suitable for thinking process", or anything like that.

Moderator Note:

The question is asking for scientific proof and otherwise cited information on this subject. Answers that do not provide supporting references will be removed. This is not a poll where you should share when you wake up and what parts of the day you personally are productive.

答: Personally I'm up at 6, out the house at 6:30, at work at 7 and away at just after 3.  I am definitely not a night owl.  All the bonuses of less distractions in the evening can equally be applied to the mornings.</p>


答:
This sounds like a situation where your friend is accepting a fixed price contract without a fixed scope which is a recipe for disaster no matter what process you use.  You need to at least have an understanding of the minimum value to be delivered for a fixed price scenario to work - which it sounds like sort of exists, but not in a usable way.  If you can't get that up front, then you need to have a plan for negotiating the scope and know when the last responsible moment is that this can happen.

I'm a huge fan of using Kanban in scenarios like this for a number of reasons, but mostly because it acts as a catalyst for change.  There are several benefits I see to using Kanban in this situation.

Bottlenecks are obvious and visible.  If you notice that a lack of user stories is a bottleneck, this is hard data you can take back to your customer to make a change early, when you still have a chance of delivering.

Kanban is great for helping teams who traditionally struggle with process to become better.  I have read several accounts where inexperienced or less-than-stellar teams became some of the best teams in the company because of the visibility afforded by a Kanban system.  Basically, there was no where for people to hide which helps the team help themselves.  Further, because you are constantly shipping and can see progress happening, it boosts morale which helps the team even more.

The team follows the process on the board.  So a story can't be coded, for example, until after it's been through the other steps - e.g. analysis, design, peer review.  The team decides the gates between phases and because it's visible, accountability is easier to do.

Hand in hand with Kanban is Kaizen, "continuous improvement".  This attitude is one of the things that helps make mediocre teams great.

As far as keeping design patterns and documents alive... why create them at all?  Since things are in flux, the documentation should be in a format that is easily changeable.  Wiki is great for this, whiteboards and paper/pen is even better.  Documentation strategies like the Refreshed System Metaphor and architecture haiku are great for this scenario.  The goal is to have lightweight ways of capturing information that are comprehensive and can change easily, and that can be recorded more formally later when you are preparing for hand-off, maintenance, and moth-ball mode.


答:
I too am way more productive at night.  It varies from person to person but, if I could, my ideal working hours would be 3-11pm or 4-midnight. I find that during those hours I am able to do a lot more for a variety of reasons.  Some of them are:

Most business is almost over with.  There is a lot more peace and quiet at that time. No annoying sales calls and most of the customer issues are in for the day.

I have already been awake for a few hours. This is big for me.  I am horrible with hopping out of bed and going directly to anything.

It's cooler...as in temperature. I loathe being hot when I'm working.

I just get an overall feeling of doing my work and not having to have the constant 9-5 with the boss peering over my shoulder nagging me for constant updates.

With all of that being said, I work at a place where I have to do the 8-5 thing...which kind of stinks because I feel like I beat my head off of a wall some days until noon.


问:
What naming anti-patterns exist?
There are some names, where if you find yourself reaching for those names, you know you've already messed something up.

For example:

XxxManager

This is bad because a class should describe what the class does. If the most specific word you can come up with for what the class does is "manage," then the class is too big.

What other naming anti-patterns exist?

To clarify, I'm not asking "what names are bad" -- that question is entirely subjective and there's no way to answer it. I'm asking, "what names indicate overall design problems with the system." That is, if you find yourself wanting to call a component Xyz, that probably indicates the component is ill concieved. Also note here that there are exceptions to every rule -- I'm just looking for warning flags for when I really need to stop and rethink a design.

答:
From Microsoft on naming, I can provide this list for bad names:

They are not semantic, which means that they have names which instead of emphasizing on what it does, emphasize on the technology it uses or the pattern it's based on.

They don't follow a syntactical consistency. For example, part of names are camel cased, while other part is pascal cased.

They are abbreviations, which are hard to understand, like ScrollableX instead of CanScrollHorizontally

They're chosen such that they mess with the keywords of that environment.

Title: What naming anti-patterns exist?