问:
Should I use mMember and sStatic naming convention in Android?
Android source code and many Android open-source apps and libs use m prefix for member fields and s prefix for static member fields:

```<code>private static boolean sStarted;
private long mTimestamp;
</code>```

I personally dislike this, because it looks ugly and it's redundant – my IDE already uses different color and formatting for local, member and static member variables.

What's closest to truth?

It's a good practice.

It's a bad practice but you should use it anyway in order to be consistent with the majority of Android code out there.

It's a bad practice and you shouldn't use it.

答:
The naming convention you described is very much like (if not the same as) system hungarian notation. There has been a lot of discussion about it here (Struggling not to use Hungarian notation), and obviously it is redundant.

Thus the answer to your first question, No, it isn't a good practice.

The second question is a little harder. In case you work on an existing code-base with that convention, its better to keep using it.

I personally wouldn't use this convention when creating something from scratch, even if I use libraries with that very convention. That practice is really redundant and you gain nothing from it taking into account the capabilites of IDE-s. I would instead keep consistent and accurate names in my own application, which would make it clear enough.


问:
Is rotating developers on a project a good or bad idea?
I'm working on a small team that will begin working on a large new project with another small team. The other team is currently working on a legacy system that they have been working on for years.

The manager has decided that the developers from my team will be rotating every few months to replace developers working on the legacy system. That way the other team will have a chance to work on the new project and have a better understanding of the new system.

I want to know the benefits and drawbacks (if any) of rotating the developers from the project every 2-3 months.

I know that this is a similar question to "Is rotating the lead developer a good or bad idea?", but that question focuses on a lead developer. This question is about rotating the entire team on and off the project (tech. lead for the new project may or may not be rotated -- I don't know yet).

答:
TL;DR Make it one team and then it's one team supporting 2 projects.

To echo @Aaronaught I think mixing teams can be problematic as it may take time to acclimate to new practices, processes, etc.  If you rotate too many people to quickly the team will lose it's identity.  This leads to more questions, confusion and time spent trying to make up for that identity.

On the other hand if there is a concerted effort to join the 2 teams into one team and have 1 team support 2 projects I think that works great as long as the team isn't too big.  I have been part of numerous teams which support multiple projects.  The closer in technology the 2 projects are, the easier the transition.  In my experience the higher cost in transitioning from one project to another comes when crossing languages, client/server (GUI especially), industry (medical, web, game), or other similar lines.  The trick is get different people to work on the project frequently enough to gain the benefits, but not so often that the transition cost exceeds the benefits.

Then benefits to getting more people on a project is fairly well known, as are the costs.

ContentLicense: CC BY-SA 3.0


问:
Is learning C essential for Computer Science?
I am a front-end developer who barely even see a file with .h or .c extension.
I know basic C syntax, I've learned it in Unreality but never was interested in such
low level programming because it was simply too much setup for simple things.

I am very interested in learning all aspects of Computer Science but I want to believe
I do not really have to know a specific language in order to understand most of concepts
in Computer Science. Yet when I start reading books and articles about fundamental
Computer Science concepts like Data Structures and Algorithm Design it seems that
I have to learn C, because all examples and even lessons are in C (and sometimes
Java).

My question is, is C as a programming language essential for Computer Science or
we just happened to have all of our resources in CS written in C? Can one learn
Computer Science without learning C?

答:
Can one learn Computer Science without learning C?

The answer is Yes. I have my degree in CS and was not required to learn C, but rather Java. At least in my school, the emphasis was on learning Object Oriented Programming, with some teachings on Assembly Language, Data Structures and Database Design.


答:
For a very long time, during the height of computer science as a science rather than a vocation, there were a few limited choices for a language that ran on all the systems that all the different universities used.

By far, universities tended to use Unix systems.  Conveniently, this was programed in C.  One could start with learning C on any machine, and eventually get into the unix source code in C.  At home, students could use a C compiler such as Borland Turbo C on Windows, or MPW on a Mac - it worked everywhere.

Pascal was another option, but that tended to have the problem that at a certain point in programming, it just wasn't enough of a language to do what you really needed to do (programming an OS in pascal would be painful).

Some of the older school learned Fortran, but again, it wasn't a powerful enough language in many cases to be able to teach higher level CS classes (AI theory in fortran? Doable but painful).

And so, for a long time C was the choice.

It isn't the only choice and there are many colleges now that teach in other languages to gloss over some of the internals and learn higher level concepts without having to deal with the ugliness of memory management and the like.  Some think this is good, some think this is bad.

So no, learning C isn't essential to learning computer science.  You can find many other books out there that teach computer science from Java or Python.  Its just that for a long time, C was the choice and academic books move slowly.

Title: Is learning C essential for Computer Science?

Body:
I am a front-end developer who barely even see a file with .h or .c extension.
I know basic C syntax, I've learned it in Unreality but never was interested in such
low level programming because it was simply too much setup for simple things.

I am very interested in learning all aspects of Computer Science but I want to believe
I do not really have to know a specific language in order to understand most of concepts
in Computer Science. Yet when I start reading books and articles about fundamental
Computer Science concepts like Data Structures and Algorithm Design it seems that
I have to learn C, because all examples and even lessons are in C (and sometimes
Java).

My question is, is C as a programming language essential for Computer Science or
we just happened to have all of our resources in CS written in C? Can one learn
Computer Science without learning C?


答:
The programming language you use to discuss the science of computing is largely irrelevant to the task of learning the means and science of computing.

The (arguably) seminal work on Computer Science, The Art of Computer Programming, does not use any existing language to inform the subject. Instead, Donald Knuth chose to define a fictional computer and a fictional machine language (and an associated assembly language) in terms of which he discusses all topics.

Another highly regarded work on the subject, The Structure and Interpretation of Computer Programs, took a similar approach, devising a simplified dialect of the LISP programming language to act as its own context. This language is what we know now as Scheme.

Yet another very good work on Computer Science, The Elements of Computing Systems (which is actually equal parts Computer Engineering and Computer Science, and very brief), takes the more fundamental approach of teaching digital logic, from which it builds the machine, the tools, and the language, before teaching elementary Computer Science.

So, no, C is not necessary for an understanding of Computer Science. What matters is your understanding of the core concepts of algorithms and their application.


答:
I'm going to go against the flow here and say yes, you do have to learn C. I actually agree with the points in many of the other answers, but you make the very strong statement that

I am very interested in learning all aspects of Computer Science but I
  want to believe I do not really have to know a specific language in
  order to understand most of concepts in Computer Science.

(emphasis mine)

Well, operating systems and network stacks are two huge aspects of Computer Science, and all the dominant operating systems and network stacks are written largely in C. If you want to understand those, you should learn C. Yes, some schools do manage to teach their OS classes in Java, but it's like reading Homer in English.

Besides, C is not that big of language. If you really want to learn all aspects of computer science you should shrug and say 'meh', 'what's one more language?'


答:
It really depends on what you want to do with what you're learning. It's definitely true that a lot of algorithms are given in C, or descendent thereof. However, over the years I've seen more C++, C#, and Java examples. What CS is meant to teach is a general understanding of computing, and therefore how to pick up or create a language appropriate for the task at hand.

However, there are still a lot of people whose first and last language is some variation of C or Java, and not all of them are going to have the training to understand any-given language that a CS degree provides. Even some CS graduates have trouble with programming. So you may need to have a good enough understanding of those languages that you can communicate with them, depending on your career path. If you plan to stick to academia, then you'll have even more language barriers to content with, especially in interdisciplinary areas (where people use prolog, lisp, haskell, mathematica, etc.)


问:
How do you validate need for documentation?
I once was on a project where a non-tech manager had the team spending half of every hour documenting what they just did so that someone with zero understanding of the tech would be able to understand the tech. Personally, I thought this was a huge waste, but there was no way to validate this was or was not waste.

Is there a light-weight means of validating need for documentation before committing to produce the documentation?

Example 1: Say the team is using an off-the-self software without customization. The test might be posting a job description on a monthly basis to access the likelihood that an expert in the software might be found at an acceptable cost level.

Example 2: Automatically pull variables, functions, etc from the code, and two weeks after the code is written, generating questions that automatically assess the developers own knowledge of their own code without access to the code. If the developer is unable to answer the questions, then they must explain the code to another developer, and that developer decides if documentation must be produced.

Example 3: Another way would be to take the likelihood that the code is used based on runtime analysis and cross reference it both with the volatility of input/output and historical likelihood of bugs/error being reported from that section of code and/or customer based requests to update the code.

Honestly, don't believe those are great examples, but are more of an attempt to give the general gist of what I'm after, and that the goal is the most generally useful bare-bones method for doing this.

答:
You have a few options:

Paired programming.  Have the people who don't understand the tech pair with the people who do.  Might slow your velocity down a bit, but it's more effective than writing reams of documentation.

Consult with the product owner, what are the criteria for acceptance that the product owner has established.  Perhaps the product owner is unaware that this individual is spending project cycles on this.

Write good x-unit tests.  Well written tests should provide ample documentation for the system being written.

Provide them with the Stack Exchange url  ;)

Documentation that is truly necessary emerges, it is not the result of a contrived, forced effort.

Cheers!


问:
The Relative Cost Efficiency of (Acceptance) Test Driven Development
I would like to know what the overall impact of resource planning on a software project is, where the requirements and design of the project are driven by automated acceptance tests and unit tests, in contrast to a more "traditional" approach to software development.

What, in your experience, is the overall effect on resource requirements for completing a software project under TDD, as opposed to more "traditional" development methodologies?  It seems self-evident to me that quality would increase, and the amount of uncertainty decreases because testing is done earlier, but requiring tests up front seems like it would require more developer hours to accomplish.  How much does the development effort increase, or does it actually decrease due to the up-front elimination of bugs?

How much more effort is required from the customer?  Do they have to change the way they relate to the project, especially if they are used to big design up front?  Does the number of hours required of the customer overall increase, or does it actually decrease?

I would imagine that time estimates would be very vague in an iterative TDD process at the beginning of a TDD project (since there is no Software Development Plan).  Is there a point, say, 20% into a project, where confidence increases enough that a more or less stable time and money estimate can eventually be provided to the customer?

Note: I'm not looking for subjective opinions or theories here, so please don't speculate.  I'm looking more for real-world experience in TDD.

答:
Resource Requirements

What, in your experience, is the overall effect on resource requirements for completing a software project under TDD, as opposed to more "traditional" development methodologies?

In my experience the cost of requiring upfront tests is immediately mitigated by both defining a clear acceptance criteria up front, and then writing to the test.  Not only is the cost of the up front testing mitigated I've also found it generally speeds up overall development.  Although those speed improvements may be wiped out by poor project definition, or changing requirements.  However, we are still able to respond quite well to those kinds of changes without severe impact.  ATDD also significantly reduces developer effort in verifying correct system behavior through it's automated test suite in the following cases:

large refactors

platform/package upgrades

platform migration

toolchain upgrades

This is assuming a team who is familiar with the process and practices involved.

Customer Involvement

How much more effort is required from the customer?

They have to be much more involved on an ongoing basis.  I've seen a huge reduction in up front time investment, but a much greater demand ongoing.  I haven't measured, but I'm fairly certain is a larger time investment for the customer.

However, I've found the customer relationship greatly improves after 5 or so demos where they are seeing their software slowly take shape.  The time commitment from the customer decreases somewhat over time as a rapport is developed everyone get's used to the process and the expectations involved.

Project Estimation

I would imagine that time estimates would be very vague in an iterative TDD process at the beginning of a TDD project (since there is no Software Development Plan).

I have found that's usually a question of how well defined the ask is and if the technical lead(s) are able to card out (including card estimation) the project.  Assuming the project is well carded and you have a reasonable velocity average and standard deviation we've found it's easy to get a decent estimate.  Obviously the larger the project the more uncertainty there is which is why I generally break a large project into a small project with a promise to continue later. This is much easier to do once you've established a rapport with the customer.

For example:

My team's "sprints" are a week long and we have a running average and std. deviation of the last 14 weeks.  If the project is 120 points we have a mean of 25 and a std. deviation of 6 then estimating the completion of a project is:

```<code>Project Total / (Mean Velocity - (2 * Std. Deviation) = 95% Time Estimate
120           / (25            - (2 * 6             ) = 9.2 weeks
</code>```

We use the 2 Std. Deviation rule of thumb for our 95% confidence estimate.  In practice we usually complete the project under the first std. deviation, but over our mean.  This is usually due to refinements, changes, etc.

Body:
Resource Requirements

What, in your experience, is the overall effect on resource requirements for completing a software project under TDD, as opposed to more "traditional" development methodologies?

In my experience the cost of requiring upfront tests is immediately mitigated by both defining a clear acceptance criteria up front, and then writing to the test.  Not only is the cost of the up front testing mitigated I've also found it generally speeds up overall development.  Although those speed improvements may be wiped out by poor project definition, or changing requirements.  However, we are still able to respond quite well to those kinds of changes without severe impact.  ATDD also significantly reduces developer effort in verifying correct system behavior through it's automated test suite in the following cases:

large refactors

platform/package upgrades

platform migration

toolchain upgrades

This is assuming a team who is familiar with the process and practices involved.

Customer Involvement

How much more effort is required from the customer?

They have to be much more involved on an ongoing basis.  I've seen a huge reduction in up front time investment, but a much greater demand ongoing.  I haven't measured, but I'm fairly certain is a larger time investment for the customer.

However, I've found the customer relationship greatly improves after 5 or so demos where they are seeing their software slowly take shape.  The time commitment from the customer decreases somewhat over time as a rapport is developed everyone get's used to the process and the expectations involved.

Project Estimation

I would imagine that time estimates would be very vague in an iterative TDD process at the beginning of a TDD project (since there is no Software Development Plan).

I have found that's usually a question of how well defined the ask is and if the technical lead(s) are able to card out (including card estimation) the project.  Assuming the project is well carded and you have a reasonable velocity average and standard deviation we've found it's easy to get a decent estimate.  Obviously the larger the project the more uncertainty there is which is why I generally break a large project into a small project with a promise to continue later. This is much easier to do once you've established a rapport with the customer.

For example:

My team's "sprints" are a week long and we have a running average and std. deviation of the last 14 weeks.  If the project is 120 points we have a mean of 25 and a std. deviation of 6 then estimating the completion of a project is:

Project Total / (Mean Velocity - (2 * Std. Deviation) = 95% Time Estimate
120           / (25            - (2 * 6             ) = 9.2 weeks

We use the 2 Std. Deviation rule of thumb for our 95% confidence estimate.  In practice we usually complete the project under the first std. deviation, but over our mean.  This is usually due to refinements, changes, etc.


问:
How can I improve upon this "pattern"?
I have a series of method calls that all share similar qualities.  The basic layout is

```<code>public void CallDataBase()
{
   Utility sqlHelper = new Utility();

   StringBuilder query = new StringBuilder(200);
   query.Append(@"update " + Environment.NewLine);//or insert, select
   query.Append(@" table " + Environment.NewLine);
   //...
   utility.ConnectAndExecuteNonQuery(query);//or query, scalar
}
</code>```

I'm not a big fan of the StringBuilder in this case, but it does help readability to have line breaks in the inline SQL.

Stored Procedures are not an option (way too much work to convert, have higher priorities).
LINQ and EF are not options.  Company is on SQL 2000 and there are no concrete plans to upgrade.

答:
I find SQL within C# code rather horrifying. It looks inelegant with all those string concatenations, is hard to modify, hard to reuse queries, and hard to test because you can't just copy the query from the source code and paste it into a database tool like SSMS.

I prefer to put all SQL in one or more resource files (Add --> Resource File). I usually name it "sql.resx".

Rather than:

```<code>connection.Execute(
    "DECLARE @TmpTable TABLE (ID INT) " +
    "INSERT Session(ServerIP, PartName, Config_Data_Modified, LatestRecord, IsRunning, Stopped) " +
    "OUTPUT Inserted.SessionID INTO @TmpTable " +
    "VALUES (@ServerIP, @PartName, @Config_Data_Modified, @LatestRecord, @IsRunning, @Stopped)" +
    "SELECT @SessionID = ID FROM @TmpTable", p);
</code>```

I like code to look more like:

```<code>connection.Execute(sql.InsertStuffIntoSomeTable, p);
</code>```

With the resource file storing the copyable, editable, reusable, testable SQL text without all that + "junk" +.

```<code>    DECLARE @TmpTable TABLE (ID INT)
    INSERT Session(ServerIP, PartName, Config_Data_Modified, LatestRecord, IsRunning, Stopped)
    OUTPUT Inserted.SessionID INTO @TmpTable
    VALUES (@ServerIP, @PartName, @Config_Data_Modified, @LatestRecord, @IsRunning, @Stopped)
    SELECT @SessionID = ID FROM @TmpTable
</code>```

Title: How can I improve upon this "pattern"?

Body:
I find SQL within C# code rather horrifying. It looks inelegant with all those string concatenations, is hard to modify, hard to reuse queries, and hard to test because you can't just copy the query from the source code and paste it into a database tool like SSMS.

I prefer to put all SQL in one or more resource files (Add --> Resource File). I usually name it "sql.resx".

Rather than:

connection.Execute(
    "DECLARE @TmpTable TABLE (ID INT) " +
    "INSERT Session(ServerIP, PartName, Config_Data_Modified, LatestRecord, IsRunning, Stopped) " +
    "OUTPUT Inserted.SessionID INTO @TmpTable " +
    "VALUES (@ServerIP, @PartName, @Config_Data_Modified, @LatestRecord, @IsRunning, @Stopped)" +
    "SELECT @SessionID = ID FROM @TmpTable", p);

I like code to look more like:

connection.Execute(sql.InsertStuffIntoSomeTable, p);

With the resource file storing the copyable, editable, reusable, testable SQL text without all that + "junk" +.

    DECLARE @TmpTable TABLE (ID INT)
    INSERT Session(ServerIP, PartName, Config_Data_Modified, LatestRecord, IsRunning, Stopped)
    OUTPUT Inserted.SessionID INTO @TmpTable
    VALUES (@ServerIP, @PartName, @Config_Data_Modified, @LatestRecord, @IsRunning, @Stopped)
    SELECT @SessionID = ID FROM @TmpTable


问:
Algorithm for compression of a dictionary (words and definitions)
The theoretical situation is this:

Let's say that we have a digital dictionary (by which I mean a traditional list of words and definitions, not an associative array). For the sake of simplicity, let's also say that each word can be replaced by its exact definition, and still make sense in a sentence; for example, if this dictionary holds the definition of the word "ocean" to be "large body of salt water", then the following passage:

```<code>"We ourselves feel that what we are doing is just a drop in the ocean."
</code>```

could be modified to:

```<code>"We ourselves feel that what we are doing is just a drop in the large body of salt water."
</code>```

without any loss of logic or meaning. Now my question is this: given a dictionary with all of the words in the English language, what is an algorithm that could be applied to compress the dictionary, through the replacement of all the occurrences of a given word with its definition, and in doing so find a base set of words through which all of the meanings of the original language could be expressed?

To clarify even more; if "sadness" is defined as "an unhappy emotion", then the word sadness can be completely removed from the dictionary by replacing all instances of the word "sadness" that occur in the definitions of other words with its definition. The definition of "depression", for example, might change from "a sustained period of sadness" to "a sustained period of an unhappy emotion". In this way, the algorithm would eventually arrive at a base set of words from which all other words could be represented.

Are there any algorithms that exist that can do this, or something similar? How might this be done programmatically, without using brute force? Any insight is appreciated.

答:
You can model this is a directed graph. Each vertex in the graph represents a word, an outgoing edge represents the words used to define the word, and an incoming edge represents other words that uses this word in their definition.

You can eliminate non-recursive vertex by connecting the vertices from incoming edges to the vertices in the outgoing edges. In pseudocode:

```<code>all_words = ...
current = select_node_to_eliminate(all_words)
for n1 in current.incoming_edges:
    for n2 in current.outgoing_edges:
        if n1 != n2:
            add_edge(n1, n2)
            remove_edge(n1, current)
            remove_edge(current, n2)
if len(current.incoming_edges) == 0 and len(current.outoing_edges) == 0:
    all_words.remove(current)
</code>```

The problem is that the end result of "a base set of words from which all other words could be represented" would be highly dependent on how you write select_node_to_eliminate().

You would need to define additional criteria for "minimal dictionary". Do you want the smallest dictionary as in the smallest number of words, even at the cost of lengthy, incomprehensible definitions; or do you want to include the size of the definitions when calculating the size of the dictionary.

Body:
You can model this is a directed graph. Each vertex in the graph represents a word, an outgoing edge represents the words used to define the word, and an incoming edge represents other words that uses this word in their definition.

You can eliminate non-recursive vertex by connecting the vertices from incoming edges to the vertices in the outgoing edges. In pseudocode:

all_words = ...
current = select_node_to_eliminate(all_words)
for n1 in current.incoming_edges:
    for n2 in current.outgoing_edges:
        if n1 != n2:
            add_edge(n1, n2)
            remove_edge(n1, current)
            remove_edge(current, n2)
if len(current.incoming_edges) == 0 and len(current.outoing_edges) == 0:
    all_words.remove(current)

The problem is that the end result of "a base set of words from which all other words could be represented" would be highly dependent on how you write select_node_to_eliminate().

You would need to define additional criteria for "minimal dictionary". Do you want the smallest dictionary as in the smallest number of words, even at the cost of lengthy, incomprehensible definitions; or do you want to include the size of the definitions when calculating the size of the dictionary.


问:
Parallel Class/Interface Hierarchy with the Facade Design Pattern?
About a third of my code is wrapped inside a Facade class. Note that this isn't a "God" class, but actually represents a single thing (called a Line). Naturally, it delegates responsibilities to the subsystem behind it.

What ends up happening is that two of the subsystem classes (Output and Timeline) have all of their methods duplicated in the Line class, which effectively makes Line both an Output and a Timeline. It seems to make sense to make Output and Timeline interfaces, so that the Line class can implement them both. At the same time, I'm worried about creating parallel class and interface structures.

You see, there are different types of lines AudioLine, VideoLine, which all use the same type of Timeline, but different types of Output (AudioOutput and VideoOutput, respectively). So that would mean that I'd have to create an AudioOutputInterface and VideoOutputInterface as well. So not only would I have to have parallel class hierarchy, but there would be a parallel interface hierarchy as well.

Is there any solution to this design flaw?

Here's an image of the basic structure (minus the Timeline class, though know that each Line has-a Timeline):

NOTE: I just realized that the word 'line' in Timeline might make is sound like is does a similar function as the Line class. They don't, just to clarify.

答:
Are some of your clients interested chiefly in Line as a Timeline, and others interested in it chiefly as an Output? If so, consider sprouting classes or interfaces from Line that stand between it and clients,  each of these new classes wraps a pointer to a Line and abstracts away implementation while focusing the API.

At first, the feels like a facade for a facade, but it opens up new refactoring horizons. You can pull methods from Line to the new classes. You may discover new helper classes you can extract. Perhaps one of your implementation classes will turn out to belong here as well.


答:
I don't have any research papers or statistics to give you, but I'll relate my experience from working in a team/organization that historically had low-to-average unit test coverage and no end-to-end tests, and gradually moving the bar to where we are now, with more of an ATDD (but, ironically, not traditional TDD) approach.

Specifically, this is how project timelines used to play out (and still play out on other teams/products in the same organization):

Up to 4 weeks of analysis and implementation

2 weeks of regression testing, bug fixing, stabilization, and release prep

1-2 weeks of fixing known defects

2-3 weeks of code cleanup and post-production issues/support (unknown defects/unplanned outages)

This seems like ridiculous overhead but it's actually very common, it's just often masked in many organizations by missing or ineffectual QA. We have good testers and a culture of intensive testing, so these issues are caught early, and fixed up front (most of the time), rather than being allowed to play out slowly over the course of many months/years. 55-65% maintenance overhead is lower than the commonly-accepted norm of 80% of the time being spent on debugging - which seems reasonable, because we did have some unit tests and cross-functional teams (including QA).

During our team's first release of our latest product, we had started retrofitting acceptance tests but they weren't quite up to snuff and we still had to rely on a lot of manual testing. The release was somewhat less painful than others, IMO partly because of our haphazard acceptance tests and also partly because of our very high unit test coverage relative to other projects. Still, we spent nearly 2 weeks on regression/stabilization and 2 weeks on post-production issues.

By contrast, every release since that initial release has had early acceptance criteria and acceptance tests, and our current iterations look like this:

8 days of analysis and implementation

2 days of stabilization

0-2 combined days of post-production support and cleanup

In other words, we progressed from 55-65% maintenance overhead to 20-30% maintenance overhead. Same team, same product, main difference being the progressive improvement and streamlining of our acceptance tests.

The cost of maintaining them is, per sprint, 3-5 days for a QA analyst and 1-2 days for a developer. Our team has 4 developers and 2 QA analysts, so (not counting UX, project management, etc.) that's a maximum of 7 man-days out of 60, which I'll round up to a 15% implementation overhead just to be on the safe side.

We spend 15% of each release period developing automated acceptance tests, and in the process are able to cut 70% of each release doing regression tests and fixing pre-production and post-production bugs.

You might have noticed that the second timeline is much more precise and also much shorter than the first. That's something that was made possible by the up-front acceptance criteria and acceptance tests, because it vastly simplifies the "definition of done" and allows us to be much more confident in the stability of a release. No other teams have (so far) succeeded with a bi-weekly release schedule, except perhaps when doing fairly trivial maintenance releases (bugfix-only, etc.).

Another interesting side-effect is that we've been able to adapt our release schedule to business needs. One time, we had to lengthen it to about 3 weeks to coincide with another release, and were able to do so while delivering more functionality but without spending any extra time on testing or stabilization. Another time, we had to shorten it to about 1½ weeks, due to holidays and resource conflicts; we had to take on less dev work, but, as expected, were able to spend correspondingly less time on testing and stabilization without introducing any new defects.

So in my experience, acceptance tests, especially when done very early in a project or sprint, and when well-maintained with acceptance criteria written by the Product Owner, are one of the best investments you can make. Unlike traditional TDD, which other people correctly point out is focused more on creating testable code than defect-free code - ATDD really does help catch defects a lot faster; it's the organizational equivalent of having an army of testers doing a complete regression test every day, but way cheaper.

Will ATDD help you in longer-term projects done in RUP or (ugh) Waterfall style, projects lasting 3 months or more? I think the jury's still out on that one. In my experience, the biggest and ugliest risks in long-running projects are unrealistic deadlines and changing requirements. Unrealistic deadlines will cause people to take shortcuts, including testing shortcuts, and significant changes to requirements will likely invalidate a large number of tests, requiring them to be rewritten and potentially inflating the implementation overhead.

I'm pretty sure that ATDD has a fantastic payoff for Agile models, or for teams that aren't officially Agile but have very frequent release schedules. I've never tried it on a long-term project, mainly because I've never been in or even heard of an organization willing to try it on that kind of a project, so insert the standard disclaimer here. YMMV and all that.

P.S. In our case, there is no extra effort required from the "customer", but we have a dedicated, full-time Product Owner who actually writes the acceptance criteria. If you're in the "consultingware" business, I suspect it could be a lot more difficult to get the end users to write useful acceptance criteria. A Product Owner/Product Manager seems like a pretty essential element in order to do ATDD and although I can once again only speak from my own experience, I've never heard of ATDD being successfully practiced without someone to fulfill that role.

Title: The Relative Cost Efficiency of (Acceptance) Test Driven Development

Body:
I would like to know what the overall impact of resource planning on a software project is, where the requirements and design of the project are driven by automated acceptance tests and unit tests, in contrast to a more "traditional" approach to software development.

What, in your experience, is the overall effect on resource requirements for completing a software project under TDD, as opposed to more "traditional" development methodologies?  It seems self-evident to me that quality would increase, and the amount of uncertainty decreases because testing is done earlier, but requiring tests up front seems like it would require more developer hours to accomplish.  How much does the development effort increase, or does it actually decrease due to the up-front elimination of bugs?

How much more effort is required from the customer?  Do they have to change the way they relate to the project, especially if they are used to big design up front?  Does the number of hours required of the customer overall increase, or does it actually decrease?

I would imagine that time estimates would be very vague in an iterative TDD process at the beginning of a TDD project (since there is no Software Development Plan).  Is there a point, say, 20% into a project, where confidence increases enough that a more or less stable time and money estimate can eventually be provided to the customer?

Note: I'm not looking for subjective opinions or theories here, so please don't speculate.  I'm looking more for real-world experience in TDD.


问:
Specific reasons to create own array class over using std::array?
What specific conditions or requirements should you create your own array over using std::array?

Here is my background:

I'm developing a small simple library that a small group of people will use and hopefully build upon. The current structure allows for both std::vector and std::array using iterators, however, a lot of the people do not like and cannot seem to use std::array and find the notation confusing to work with the library.

I have attempted to make my library work for better for std::array however, it dawned on me that maybe I should provide my own and adding in the functionality needed?

For example: library::array<int, 2> myArray; myArray.fill(1, 100); and I thought it would be a good project in order for me to develop my skills, particularly in templates and other sorting algorithms.

答:
The only reason for providing your own array class from a library is if none of the current offerings (std::array, std::vector and raw arrays) fits your requirements. For example, if you needed an array that does bounds checking without dynamic allocation, you had to write that yourself prior to the introduction of std::array.

As far as accepting array classes in your library goes, you should realize that std::array is a fairly new addition to the C++ language and there are heaps of existing libraries that have their own array classes.

To get your library accepted faster, it should, besides providing useful functionality, accept at least the lowest common denominator of all array-like types, which is the simple pointer.


答:
Agree with Aaronaught that is very strange to see how many people just don't see downsides..
Few bad thinks, that you can point very quick - code doesn't have owner and when everyone is responsible for everything is not that good for quality.
Developers aren't resources (even they are called like that very often by managers), they are people and for team is very important to know each other, rotation makes a bit chaos there.
If you work for some project for longer time you will became a expert (not only in domain, but in that project), you will know where most troubles came from, who will get you best answers or maybe some more specific domain knowledge's etc. If you are new, you will need to learn all this thinks, so it will slow progress.
But of course it's also good to know other practices in your organization, how other teams build and organize. It's especially good if your projects are related in some manner, for example one project is input for another (not necessary directly), so will get better understanding of big picture. And of course spreading expertise is good (if you will get time to get these knowledge's). </p>

Title: Is rotating developers on a project a good or bad idea?

Body:
I'm working on a small team that will begin working on a large new project with another small team. The other team is currently working on a legacy system that they have been working on for years.

The manager has decided that the developers from my team will be rotating every few months to replace developers working on the legacy system. That way the other team will have a chance to work on the new project and have a better understanding of the new system.

I want to know the benefits and drawbacks (if any) of rotating the developers from the project every 2-3 months.

I know that this is a similar question to "Is rotating the lead developer a good or bad idea?", but that question focuses on a lead developer. This question is about rotating the entire team on and off the project (tech. lead for the new project may or may not be rotated -- I don't know yet).


答:
If you're really going to learn "all aspects of Computer Science" (ambitious plan!), you'd have to deal with several different assembly languages, and at least one HDL (and practice coding on a netlist level in it).

And as a higher level step to approach these truly fundamental things you'd have to pick up something like C or Pascal, its unavoidable. Skipping steps on a ladder of abstraction is counterproductive.

Anyway, I doubt this question even worth asking. After all, C is just a tiny language. You could have learned its basics in a shorter time than you wasted reflecting on whether you have to learn C or not.


答:
I admit that one can get a well-paying job and be productive without ever touching C, but I highly recommend learning C for anybody who is serious about having solid understanding of computer science.

Although computer science is about concepts, which could be learnt irrespective of any specific programming language, there are fields which may be much better understood by learning C or by learning that field using C.

Algorithms and Data Structures. Standard C has almost none of these - having these already implemented in the language or in its standard library tend to be demotivational for students: "Why should I bother implementing something readily available?" Looking at a piece of C code, you immediately see its algorithmic cost, since everything in C compiles to a few machine instructions only. High-level languages (e.g. Perl or Python) often use advanced data structures under the hood of lightweight syntax. Code feels light, but it is not. You already need a great deal of knowledge to correctly reason about the algorithmic complexity of those code pieces. Therefore those languages are not as suitable for learning algorithms and data structures, and many programmers who was always living on high-level languages, tend to be incapable of dealing with performace problems, when they run into them.

Operating systems. Most operating systems are written in C. How do you want to understand process creation without ever calling fork? The abstraction layer of the Java VM is no help here. And just talking about it without ever creating a process is even worse... How can you write a software like Eclipse which can redirect the standard output into one of its windows? You need to understand OS-level concepts for that, and you can touch those directly in C only.

Indirection. You cannot do C without dealing with pointers. Pointers force you to think on two-levels, and that stretches your abstraction skills.

There are also some technical advantages of C knowledge:

Cross-language interoperability. You want to integrate a great Ruby module into your Python project (substitute two arbitrary languages here). Chances are that the only way to do that, is through C, because both languages has a foreign interface to C.

Writing performance critical software. One cannot omit going low-level to do this.

I do not say, that every program should be written in C. But C can help you to knowledge, which is useful whatever language you program in.


答:
I'm also going to go against the grain here and try to make a (slightly humorous) aesthetic case for C. While some people might call it "ugly" for different reasons, such as the lack of higher-level constructs like classes or its reliance on pointers, I find that it isn't the case for me.

TL;DR: In my opinion, C is simple, good C is readable and there's a certain joy to be found in banging bits.

C is simple

Standard C defines only a few basic types and mechanisms to create functions, pointers and arrays out of them. On top of that, there's a small number of composition constructs to make more complex types out of the primitives (like structs and unions).
Notice how I described most of the language in two sentences. This means you don't have to keep too many syntactic rules and forms in your head while coding.

Simple is beautiful.

C isn't arcane

Unlike many higher-level languages, you would be hard-pressed to find a lot of weird, unintelligible symbols in C. In the C world, the main facility for both abstraction and "syntactic compression" is the function - semantically a very simple and self-explanatory construct. Good C style encourages almost poetic, readable beauty. To illustrate, let's try to read the following snippet from the Linux kernel. Even without having grasp of the underlying data structures and implementation details, we can make a lot of sense of the following:

```<code>bool kthread_freezable_should_stop(bool *was_frozen)
{
    bool frozen = false;

    might_sleep();

    if (unlikely(freezing(current)))
        frozen = __refrigerator(true);

    if (was_frozen)
        *was_frozen = frozen;

    return kthread_should_stop();
}
</code>```

The middle of the function reads "in the unlikely event that current is freezing, ask the refrigerator if freezing actually happened". Dr. Seuss couldn't have written it better.

Readable is beautiful.

C is transparent

Unless a C statement includes a function call, you can generally get a very good idea of its run-time cost and side effects. C gives the programmer control and ultimately trusts him or her to do the right thing. We can get a picture of what happens when this (slightly reformatted for SE) snippet out of the implementation of strlen() in the GNU C library runs, because every operator has well-defined semantics. There is no overloading in C.

```<code>for (char_ptr = str; ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
        ++char_ptr)

if (*char_ptr == '\0')
    return char_ptr - str;
</code>```

For the purposes of "optimizability", this property is great. Arguably, some higher-level languages make the concise expression of higher-level algorithms easier (like C++ with classes and overloading), but for the purposes C was designed for - acting as a portable assembler - C is ideal. Sometimes, upon successful execution of low-level code, a programmer might feel one with the machine, in a sense (or zero - it's an implementation detail).
This isn't to say other languages are bad, not "zen" enough or something silly like that, just that IMO C can be interesting in ways that many other languages have chosen not to be, for many valid reasons.

In my opinion, the three points presented above make manageable the creation of complex - yet efficient - systems, embodied in my mind by Linux. I find that this world appeals to my aesthetic sensibilities and I'd advise anyone considering C as his or her next target to consider these points. I feel that arguments about operating systems and whatnot are better supported by explicitly stating them because one certainly does not need to understand kernels in order to be a successful programmer, but one might find these fields compelling subjectively.

Body:
I'm also going to go against the grain here and try to make a (slightly humorous) aesthetic case for C. While some people might call it "ugly" for different reasons, such as the lack of higher-level constructs like classes or its reliance on pointers, I find that it isn't the case for me.

TL;DR: In my opinion, C is simple, good C is readable and there's a certain joy to be found in banging bits.

C is simple

Standard C defines only a few basic types and mechanisms to create functions, pointers and arrays out of them. On top of that, there's a small number of composition constructs to make more complex types out of the primitives (like structs and unions).
Notice how I described most of the language in two sentences. This means you don't have to keep too many syntactic rules and forms in your head while coding.

Simple is beautiful.

C isn't arcane

Unlike many higher-level languages, you would be hard-pressed to find a lot of weird, unintelligible symbols in C. In the C world, the main facility for both abstraction and "syntactic compression" is the function - semantically a very simple and self-explanatory construct. Good C style encourages almost poetic, readable beauty. To illustrate, let's try to read the following snippet from the Linux kernel. Even without having grasp of the underlying data structures and implementation details, we can make a lot of sense of the following:

bool kthread_freezable_should_stop(bool *was_frozen)
{
    bool frozen = false;

    might_sleep();

    if (unlikely(freezing(current)))
        frozen = __refrigerator(true);

    if (was_frozen)
        *was_frozen = frozen;

    return kthread_should_stop();
}

The middle of the function reads "in the unlikely event that current is freezing, ask the refrigerator if freezing actually happened". Dr. Seuss couldn't have written it better.

Readable is beautiful.

C is transparent

Unless a C statement includes a function call, you can generally get a very good idea of its run-time cost and side effects. C gives the programmer control and ultimately trusts him or her to do the right thing. We can get a picture of what happens when this (slightly reformatted for SE) snippet out of the implementation of strlen() in the GNU C library runs, because every operator has well-defined semantics. There is no overloading in C.

for (char_ptr = str; ((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
        ++char_ptr)

if (*char_ptr == '\0')
    return char_ptr - str;

For the purposes of "optimizability", this property is great. Arguably, some higher-level languages make the concise expression of higher-level algorithms easier (like C++ with classes and overloading), but for the purposes C was designed for - acting as a portable assembler - C is ideal. Sometimes, upon successful execution of low-level code, a programmer might feel one with the machine, in a sense (or zero - it's an implementation detail).
This isn't to say other languages are bad, not "zen" enough or something silly like that, just that IMO C can be interesting in ways that many other languages have chosen not to be, for many valid reasons.

In my opinion, the three points presented above make manageable the creation of complex - yet efficient - systems, embodied in my mind by Linux. I find that this world appeals to my aesthetic sensibilities and I'd advise anyone considering C as his or her next target to consider these points. I feel that arguments about operating systems and whatnot are better supported by explicitly stating them because one certainly does not need to understand kernels in order to be a successful programmer, but one might find these fields compelling subjectively.


问:
How can a server side developer survive in a position which expects front-end involvement?
My background is back-end server development. Very back-end.

Now I work in a position where I need to also take care of front-end. Nothing fancy but I need to be able to code for front-end as well. As I said no fancy stuff as I am not a designer.

I know some very basic stuff about html/css/js but most of the time I spend googling when I need to do something. So I am wasting time.

To give an example I needed to upload a file from the web page but I was not aware that there is an input tag specifically for file-upload. So I spend quite a while googling to figure out how to do it. So I am not sure if for example this should be something I should have known and it is a gap that I have or not.

So what I am interested in is in what should I invest time to "master" so that what I daily need to do, I will be able to do, without spending too much time searching my way.

In a nutshell I am interested to understanding on what are the core "fundamentals" I should focus.

To give an example:

In CSS I think I should invest time in attribute selectors or positioning but spending time learning fonts is a waste of time for my needs. Am I wrong?

So with this is mind I am interested in the what to must know to survive in html/css/javascript?

UPDATE

None of the answers so far are really relevant and I really need some help.

May be my post need some clarifications? Is there something not clear?

答:
That depends what you need to do - it might have been a long time ago, but you would do exactly what you did when you started learning the back-end technologies.

Start with basic tech, forget CSS etc, go straight to simple layout and simple code. Once you've got the hang of that, you can move on to a web client javascript framework. Once you've got the hang of that.. you should be in a position to know what you're missing.


问:
Is this how Simplex Noise works?
I have done a huge ton of reading up on Simplex Noise now, and after a lot of confusion and headaches I think I am able to form an idea of how Simplex Noise works now. </p>

<p>Am I right, that simplex noise (2D) is just a grid build of Simplexes, in this case triangles, where at every corner of a triangle there is a value between 0 and 1. When you ask the algorithm for a point it'll convert the 2D coordinates to the simplex grid coordinates, interpolate the noise and then return the actual value? </p>

答:
Yes. But there is slight mistake. In simplex noise, the resulting value is summed from its contributing coordinates. Perlin noise is using interpolation.

Edit:
If we look at Simplex noise demystified, then final value is calculated as :

```<code>return 70.0 * (n0 + n1 + n2);
</code>```

And according to comment, the resulting values are in range [-1;1]

Title: Is this how Simplex Noise works?

Body:
Yes. But there is slight mistake. In simplex noise, the resulting value is summed from its contributing coordinates. Perlin noise is using interpolation.

Edit:
If we look at Simplex noise demystified, then final value is calculated as :

return 70.0 * (n0 + n1 + n2);

And according to comment, the resulting values are in range [-1;1]


问:
Breadth-first graph search problem
I thought I was doing breadth-first graph search correctly, but my instructor's grading script is telling me that my answer is incorrect.

From the instructions:

Consider a breadth-first graph search on the graph below, where S is the start and G is the goal state. Assume that ties are broken alphabetically (so a partial plan S->X->A would be expanded before S->X->B and S->A->Z would be expanded before S->B->A). You may find it helpful to execute the search on scratch paper.

Please enter the final path returned by breadth-first graph search in the box below. Your answer should be a string with S as your first character and G as your last character. Don't include arrows or spaces in your submission. For example, if you believe the path is S->X->G, please enter SXG in the box.

I got and input the answer SACBG, which the grading script marked as incorrect. ("Your input was evaluated as SACBG, which is not correct.")

Here are my steps for the breadth-first graph search on the above graph using the algorithm at http://en.wikipedia.org/wiki/Breadth-first_search#Pseudocode:

Enqueue the root node S. Queue = [S], Path = []

Dequeue S and examine it. Queue = [], Path = [S]

Enqueue S's children, A and C. Queue = [A, C], Path = [S]

Dequeue A and examine it. Queue = [C], Path = [S, A]

A has no children. Dequeue C and examine it. Queue = [], Path = [S, A, C]

Enqueue C's children B and G. Queue = [B, G], Path = [S, A, C]

Dequeue B and examine it. Queue = [G], Path = [S, A, C, B]

B's only child G is already in the queue. Queue = [G], Path = [S, A, C, B]

Dequeue the goal node G and examine it. Quit the search and return. Queue = [], Path = [S, A, C, B, G]

A node is placed in the path when it is dequeued and examined.

Ties are broken alphabetically as required in the instructions.

What am I doing wrong?

答:
The problem appears to be that your answer is the order in which the nodes are evaluated by the breadth first search but what the questions asks for is the final path from S to G that the search would find.

I think the answer the question is looking for is SCG.

Easiest way to confirm would be to talk to your instructor.

(A depth first search using the same alphabetical precedence rules would return SCBG as the path.)

Title: Breadth-first graph search problem


答:
This is interesting as I read the title I wondered if the question was from one of my guys.  As the 'entrepreneur' I have run into employees who let themselves get straitjacketed by their view of the world.

What you need to learn is what you need to accomplish your job.  If you think that we can put some boundaries right now on what you need to learn then you are in my opinion doing both you and your employer a disservice.

If you ever get hired for a position and they tell you upfront that you already know everything you need to do the job then you are either working for the government or you are working for a union.  I suspect you were hired because someone thought your ability to solve problems was better then the next guy they interviewed.

I tell my guys that if they are at least daily not asking questions of the team - me or Google then the job is too easy and we need to do an intern into that task and move them to something higher valued.

Title: How can a server side developer survive in a position which expects front-end involvement?

Body:
My background is back-end server development. Very back-end.

Now I work in a position where I need to also take care of front-end. Nothing fancy but I need to be able to code for front-end as well. As I said no fancy stuff as I am not a designer.

I know some very basic stuff about html/css/js but most of the time I spend googling when I need to do something. So I am wasting time.

To give an example I needed to upload a file from the web page but I was not aware that there is an input tag specifically for file-upload. So I spend quite a while googling to figure out how to do it. So I am not sure if for example this should be something I should have known and it is a gap that I have or not.

So what I am interested in is in what should I invest time to "master" so that what I daily need to do, I will be able to do, without spending too much time searching my way.

In a nutshell I am interested to understanding on what are the core "fundamentals" I should focus.

To give an example:

In CSS I think I should invest time in attribute selectors or positioning but spending time learning fonts is a waste of time for my needs. Am I wrong?

So with this is mind I am interested in the what to must know to survive in html/css/javascript?

UPDATE

None of the answers so far are really relevant and I really need some help.

May be my post need some clarifications? Is there something not clear?


答:
I know some very basic stuff about html/css/js but most of the time I spend googling when I need to do something. So I am wasting time.

No, you're not.  You're spending time on research and self-directed training, which is the choice you or your employer made when they assigned you to do something you hadn't done before in lieu of hiring someone specifically for the front-end.  Instructor-led training may be worthwhile, especially if your organization has an existing training program.

But that's basic professionalism.  On to your question:

"What are the core fundamentals' of client-side development I should focus on?"

(In order:)

0: Whatever your organization has already done.  If most of the rest of your pages are built on Prototype, use that.  If the site you're working on is drupal-based, learn drupal.

1: XMLHttpRequest, along with XML and JSON, and how they communicate with the sever-side of the application.  <input type="file" /> is neat, but it winds up as an HTTP request of some kind in the end anyway.

2: JavaScript Events / Asynchronous Programming.  Unless your client-side is absolutely trivial, knowing how to properly attach events to the DOM and user interaction is essential.  If your client-side app grows in complexity, knowing how to raise events can keep your code DRY.

3: , <form>, <input> elements: The basic set of widgets you have for user interaction are here.  Virtually everything else in the HTML standard can be ignored as "design", until you get to complex solutions involving the  and <object> elements.

4: DOM manipulation.  You'll get a lot of mileage from knowing how the client can load or change part of a page.  createElement, appendChild, setAttribute, and insertBefore are methods that have utility in client-side programming and XML manipulation.  (Reading part of a page can help, too.)

5: CSS selectors.  Not the attributes that make up a rule, but the portion of the spec that allows you to select the set of elements that will be rules will be applied to.  Every framework I've seen uses a variation of these as its basic syntax, and, as with most of the HTML elements, the specifics of the rules can be ignored as "design"

If your organization doesn't have an existing framework choice, and you've familiarizing yourself with the five items above, then and only then should you take a look at frameworks.  jQuery is popular and mostly worth the overhead (especially if it's a public website and you have to deal with cross-browser compatibility), but like any other framework it's far more useful as a tool than a crutch.

(And if you find yourself worrying about fonts, tables, colors, or document flow, stop what you're doing and find your "designer" hat, because you've crossed the rubicon and you're doing design.)

Body:
I know some very basic stuff about html/css/js but most of the time I spend googling when I need to do something. So I am wasting time.

No, you're not.  You're spending time on research and self-directed training, which is the choice you or your employer made when they assigned you to do something you hadn't done before in lieu of hiring someone specifically for the front-end.  Instructor-led training may be worthwhile, especially if your organization has an existing training program.

But that's basic professionalism.  On to your question:

"What are the core fundamentals' of client-side development I should focus on?"

(In order:)

0: Whatever your organization has already done.  If most of the rest of your pages are built on Prototype, use that.  If the site you're working on is drupal-based, learn drupal.

1: XMLHttpRequest, along with XML and JSON, and how they communicate with the sever-side of the application.  <input type="file" /> is neat, but it winds up as an HTTP request of some kind in the end anyway.

2: JavaScript Events / Asynchronous Programming.  Unless your client-side is absolutely trivial, knowing how to properly attach events to the DOM and user interaction is essential.  If your client-side app grows in complexity, knowing how to raise events can keep your code DRY.

3: <a>, <form>, <input> elements: The basic set of widgets you have for user interaction are here.  Virtually everything else in the HTML standard can be ignored as "design", until you get to complex solutions involving the <iframe> and <object> elements.

4: DOM manipulation.  You'll get a lot of mileage from knowing how the client can load or change part of a page.  createElement, appendChild, setAttribute, and insertBefore are methods that have utility in client-side programming and XML manipulation.  (Reading part of a page can help, too.)

5: CSS selectors.  Not the attributes that make up a rule, but the portion of the spec that allows you to select the set of elements that will be rules will be applied to.  Every framework I've seen uses a variation of these as its basic syntax, and, as with most of the HTML elements, the specifics of the rules can be ignored as "design"

If your organization doesn't have an existing framework choice, and you've familiarizing yourself with the five items above, then and only then should you take a look at frameworks.  jQuery is popular and mostly worth the overhead (especially if it's a public website and you have to deal with cross-browser compatibility), but like any other framework it's far more useful as a tool than a crutch.

(And if you find yourself worrying about fonts, tables, colors, or document flow, stop what you're doing and find your "designer" hat, because you've crossed the rubicon and you're doing design.)


答:
Find a mentor, if you can. Reading books and laundry lists of "dos and don'ts" will only get you so far.

I've worked with some hardcore "back-end" developers who were able to do some excellent work when paired up with even a casual "front-ender". Left to their own devices, with no pair or code reviewer, they can still occasionally get lost or go off the rails.

I don't know what kind of an organization you're in, but you might want to suggest to your manager that designers generally cost less to hire than developers, including designers who know HTML + CSS, and although you'd like to learn more about front-end development, it is probably a waste of your time (and therefore company time/budget) to focus exclusively on that area.

If you really can't buddy up, then read a book or visit some of the questions given to you in the comments. Like I said, I'm not going to provide a list of areas or dos-and-don'ts because (a) we have no way of knowing what's most relevant to the work you'll be doing unless you tell us what that work is, and (b) the question has already been asked a dozen times here. I'm focusing on the "what should I do if I'm a back-end developer being asked to do UI work" and my answer is, don't do it alone.


问:
Setting Deadlines in software development
I have been working on a system alone for about two years. I inherited the system from a contractor who spent about two years working on it before me (alone).  The system is not particularly well designed because there is business logic, presentation logic and data logic mingled together.  It is a very complex system, which I am trying to refactor as I go along and this takes time.

A new developer was recruited but he seems to be taking more of a Project management role.  He is very direct asking exactly how long things will take; questioning all my assumptions and predictions, which is difficult because of the complexity and because I am the only expert at the moment.

I am very organised in my personal life.  For example, I was asked what time I would arrive in Manchester last week so I provided an exact time catering for accidents and road works on the way.  I find it difficult to apply the same principles at work in software development at the moment.

Don't get me wrong.  I have worked with project managers on less complex projects in the past and have had a good relationship, but then the projects were less complex and I always delivered before schedule.  I am struggling with this particular project manager and it is causing stress.

How do other developers deal with project managers who want answers and accurate deadline dates?

答:
I believe fully an agile approach to software development will always fundamentally give a more satisfying and valuable experience for both sides.

For me this means three things.
1. Sharing a vision for the product (Un-timebound understanding of what 'this thing is'. For example "The best ever salon management tool for hairdressers")
2. Defining current shared goals. (time-ideal real 'things' that make up the vision. For example "Within 6 months we will be able to handle bookings and stock")
3. Deciding what to do next. (estimated tasks for the next iteration. For example "this week I will have a list of all currently available software tools for salons". Or "this iteration we will complete user authentication").

Your iterations should be SHORT (my current preference is a week) and should result in releasable 'things' or experiments that give concrete learnings. It is then the 'clients' decision if what they have is enough. This is a key point: they have something.

Any plan is out of date as soon as it is written. It is a promise waiting to be broken. It is inflexible to change - change is a fact of life. Planning is essential, but a plan is useless. A PM (if one is ever needed - IMO it is a task not a role) can then line up the estimates and goals regularly and 'see where they are'.

Be lean, be agile. Build measure learn and trade in 'done' not 'promises and apologies'.


问:
If my team has low skill, should I lower the skill of my code?
For example, there is a common snippet in JS to get a default value:

```<code>function f(x) {
    x = x || 'default_value';
}
</code>```

This kind of snippet is not easily understood by all the members of my team, their JS level being low.

Should I not use this trick then? It makes the code less readable by peers, but more readable than the following according to any JS dev:

```<code>function f(x) {
    if (!x) {
        x = 'default_value';
    }
}
</code>```

Sure, if I use this trick and a colleague sees it, then they can learn something. But the case is often that they see this as "trying to be clever".

So, should I lower the level of my code if my teammates have a lower level than me?

答:
Well, for starters that looks like basic JS to me.

But in general -- you should not be using clever hacks, to paraphrase "debugging is twice as hard as programming.  If you write code as clever as you can, then you are by definition unable to debug it".

That does not mean that you should avoid code just because others wouldn't understand it -- you should write the code in as clear and consistent manner as you can.  But your criteria for clear should be "will I understand this on first reading in a year", not "can anyone understand it".

Write in a clear manner, that you have no difficulty understanding and let others work on increasing their skills -- don't handicap yourself in order to save others some hypothetical trouble.


答:
This is a great question with some really interesting answers. Just recently I was listening to a presentation by a really smart guy with bucket loads of back end experience; one thing that I remember was him saying that his company were dropping the backend/frontend/test engineer distinctions. The reason was that right now, all developers are expected to cross pollinate across those disciplines. The rise of MV* development client side, the growing prevalence for technologies such as node.js and the move towards dynamic webpages has meant client side development has been gradually getting more (programming) technical. Coupled with the ambitions of TDD, BDD and bare minimum CI means (and this is client side too) brings the testers into the loop. Sharing domain models over a SOA and intricacies of your RESTful architecture mean that all parties must understand somewhat of what the others do - and work together when they dont.

Anyway. I too began life and progressed fairly far as a Server Side developer before a new job expected me to start embracing more  of the complete picture. Firstly, depending what you might be expected to do, it is hard. Dropping a box of a page and making it submit form data aside, if they want you to mock up something with a few elements on it, that may trigger some small dynamic behaviour, possibly be reusable and maybe have some nod to beauty - there's a real challenge! Cross browser, cross platform, cross device, cross generation, it is a minefield. Considering page load speeds, accessibility, behaviour on portrait mobile vs latest mega resolution apple display, and the ever present, do we have to support IE7?

Maybe none of that is a concern, in which case:

Learn the super basics. There are some weird gotchas in there - self closing script tags are invalid, huh? Can I use the HTML5 doctype for everything? How many H1s on a page?

Learn about page flow and how absolute/relative positioning works. Seriously, coupled with float, clear and the various offset mechanisms (margins, padding, collapsing margins), this is a must - it is more intricate than it looks.

display: block, inline, inline-block... and how this affects page layout.

visibilty:hidden vs display:none

Learn how to include different CSS files in different situations through IE macros or media queries.

Use backgrounds rather than images, often.

Use the tools to help you. Firefox and Chrome both come with excellent developer toolkits to help you modify markup and css in the browser as well as debugging javascript code.

You've mentioned selectors, learn them, that's the easy bit. Once you've learned them learn how modern web development techniques are using them to create lightweight, readable stylesheets. (There was OO CSS and now it seems it's all about being modular - SMACSS is a great resource.

Look at libraries like Modernizr to help reduce some of the pains of legacy browser support.

Learn what HTML5 can do for you (as in the new bits). You might not need it just yet, but there is lot of good tech in there. An example might be the new File API. Then use caniuse to see what browsers support the features.

For JavaScript, at first, don't learn jQuery. A lot of the time you will not need but you'd use it anyway, and then it's just bloat. You gain a lot by understanding what you get out of the box!

Object protoypes, learn them now, it's useful knowledge later.

The event model, the single threaded nature (well, mostly), how people use elements as beacons to bind listeners to, preventing memory leaks through unbinding your functions.

Anonymous Objects.

JSON and how to use it, it's easy and everywhere.

Learn how to structure javascript, some things will catch you out - what no function overloading? The book (and related examples) by Addy Osmani is my go to refernece.

Javascript libraries are great though. They remove the majority of cross browser nonsense. Especially if you are working with Asynchronous code, do learn what these libraries give you, and reach for them when you need them.

Learn whatever your Client Side team are doing. Are they using LESS/SASS/Stylus to preprocess their CSS? Backbone to separate their model and view? A framework like jQuery? A boilerplate responsive grid or component library like Skeleton or Bootstrap?

Validate your code, use the W3C validator and tools like JS[LH]int.

Give back. Most of the guys I worked with doing complex javascript were not from programming backgrounds. You think differently, you can work together to write much more beautiful code.

None of this is a waste of time, like it lump it the web, the visible web, is a large part of the future and knowing how it works will only benefit you.

While you're learning it, write a book, there are going to be a lot of people in the same boat!


问:
What is the preferred object to store this type of data structure
I was in a conversation with someone who codes for me.  He was frustrated with my approach to a particular problem.  I am entirely self taught and very pragmatic - I am not a professional developer instead I sometimes write code to get something done and then pass it on to him to clean it up - make it robust etc.

We are reading in large txt files that use sgml tags to mark boundaries between individual documents that are related to one another.

```<code><opentagfor txt file>
<document>
<maybe some attribute tags of the document>
the
document
could be a uuencoded
could be html
or something else
can tell what type by the attribute tags
</document>
<anotherdocument>
<maybe some attribute tags of the another document>
the
document itself
could be a uuencoded
could be html
or something else
can tell what type by the attribute tags
</anotherdocument>
 .
 .
 .

 <closetagfor txt file>
</code>```

The individual documents get consumed downstream.  Sometimes they get written out to a file structure for indexing, other times some of their content is extracted and saved as 'data'.

So my approach was to create a dictionary of dictionaries.

```<code> document_dictionary = {document_position_index:{attribute-tag-1:value1,attribute-tag-2:value2,document:the\n    document itself\n    could be a uuencoded\n    could be html\n   or something else \n  can tell what type by the attribute tags}, . . .}
</code>```

document_position_index is the index position of the document in the original txt source file - has no relevant meaning at all.

now if I want to do something with the documents I can do things like

```<code>for document in document_dictionary
    if document['some-attribute-tag'] == someValue:
        do something
</code>```

The problem is this bad coding (specifically using an integer (document_position_index)) was frustrating to my developer.  He said that it is bad form.  I still after Googling for a while do not understand. So I would appreciate either a better explanation then I got from him or some pointer to the right direction.

Is this the type of question that should be asked here?

答: Why not just save it in a list? You still get positional information of what number the document is. Your usage will look exactly same. And you don't need to worry about overhead of using a dictionary and saving your own index. And you will still be saving them under numbers 1,2,3,4,etc..</p>


问:
Why don't we have a non-turing complete general purpose language yet?
Non-turing complete languages can solve every practical problem that a turing-complete language can. Also, they are much more analyzable than turing complete languages. The compiler can comprehend the program as a whole, predict/compute/cache every possible computation in advance, optimize it the most mathematically possible and even prove it has done so. It is like a super fusion between static typing and lazy evaluation in roids.

Yet nobody is trying to design a non-turing complete language like COQ that is practical and usable. Why?

答:
One effort in this direction is the Hume family of languages, the last of which is Turing complete,

HW-Hume: a hardware description language — capable of describing both
  synchronous and asynchronous hardware circuits, with pattern matching
  on tuples of bits, but with no other data types or operations [27];

FSM-Hume: a hardware/software language — HW-Hume plus ﬁrst-order
  functions, conditionals expressions and local deﬁnitions [26];

Template-Hume: a language for template-based programmimng — FSM-Hume
  plus predeﬁned higher-order functions, polymorphism and inductive data
  structures, but no user-deﬁned higher-order functions or recursive
  function deﬁnitions;

PR-Hume: a language with decidable termination — Template-Hume plus
  user-deﬁned primitive recursive and higher-order functions, and
  inductive data structure deﬁnitions;

Full-Hume: a Turing-complete language — PR-Hume plus unrestricted
  recursion in both functions and data structures.

http://www.hume-lang.org/


问:
Where to validate domain model rules that depend on database content?
I'm working on a system that allows Administrators to define Forms that contain Fields. The defined Forms are then used to enter data to the system. Sometimes the Forms are filled by a human via a GUI, sometimes the Form is filled based on values reported by another system.

For each Field, the Administrator can define a Validation Rule that limits the allowed values for the Field. The Validation Rules can be anything from "the value entered in the Field must be True or False" to "the value entered in the Field must exist in column A of table B in the database". The Administrator may at any time change the Validation Rule for the Field.

In this scenario, what in your opinion is the most suitable place for validating that each Field is filled correctly? I currently have two main approaches in mind:

Option #1: Validate in the Domain Model

Each Field object would contain the Validation Rule specified by the Administrator. The Field objects would also have a reference to an IValidator. When an attempt is made to set the value of the Field, the Field would pass the given value and the Validation Rule to the IValidator. If the given value is not valid, a ValidationException would be thrown and appropriately handled in the GUI/interface to the other system.

Pros:

Strong protection against Fields being accidentally assigned values that violate the Validation Rule

Cons:

The Data Access Layer needs to be able to bypass the validation and construct Fields that violate the current Validation Rule. Despite the Administrator changing the Validation Rule for a Field, we still need to be able to construct Field objects based on the old data e.g. when rendering a Form that was filled years ago. This could potentially be resolved by storing the current Validation Rule whenever we store the Field.

In this design, the Field model has an indirect link to the Data Access Layer/Repository via the IValidator. The injection of Services/Repositories to Domain Models seems to be generally frowned upon.

Option #2: Validate in a Service

Try to ensure that all attempts to set the value of a Field pass through a Service that ensures the Validation Rule holds. If the Validation Rule is violated, throw a ValidationException.

Of course, the Data Access Layer would not use the Service when creating Field objects that have previously been persisted in the DB.

Pros:

Does not violate the "don't inject Services/Repositories into your Domain Models"-thinking.

No need to persist the current Validation Rule when persisting the Field. The Service can simply look up the current Validation Rule for the Field; when looking at history data, the value of the Field will not be changed.

Cons:

No guarantee that all logic that should use the Service to set the Field value actually does so. I see this as a major drawback; all it seems to take is someone writing "thisField.setValue(thatField.getValue())" and the Validation Rule of thisField might be violated without anyone being the wiser. This could potentially be mitigated by ensuring that the value of the Field matches with the Validation Rule when the Data Access Layer is about to persist the Field.

I currently prefer Option #1 over Option #2, mainly because I see this as business logic and feel that Option #2 poses a greater risk of introducing bad data to the system. Which option do you prefer, or is there another design that fits this scenario better than the two options described?

Edit (Complexity of validations)

The validation cases that have come up for now are relatively simple; the Field value must be e.g. numeric, a date, a date with a time or be an existing value in a database column. However, I suspect complexity to gradually increase over time. For example, the validation solution needs to be built with internationalization in mind - things such as Dates may be input in a locale-specific syntax.

I've decided to proceed with Option #1 for now, attempting to take care not to assign too many responsibilities to the Domain Model. Those facing a similar situation may also want to check out the related questions Validation and authorization in layered architecture and Data input validation - Where? How much?.

答:
How complex are the validations?  Often validations require a combination of fields and or business rules that rely on fields to be accurately evaluated.

The more complex the validations, the harder and less performant option #2 is.

Of course the data tier could invoke the validation service at persistence time.  This could help the odd situation where data is in an invalid state due to a change in rules.

The other item worth commenting on is the ability for a change in validation rules without a qa cycle of some sort.  But that is a topic for a different thread.

Given the information above, option 1 seems the most flexible assuming you maintain discipline, separating validation and persistence.


答:
I started a career in programming by learning vb3 from the manuals that shipped with the floppy disks it came on. I learnt some java and was able to produce some respectable programs but it wasnt until I studied C at university that I felt that I really understood what was happening "under the hood". I now work only with .net and never really worry about pointers, invalid addresses or overflows - but I understand them, this informs the decisions I make on a daily basis and some of the old school stuff is still there in modern interpreted languages, flags, bit wise operations, Boolean logic, all powerful tools and very efficient.

Learn C. It will stand you in good stead. I kept a copy of the c programmers handbook for years and read Kernighan and Ritchie from cover to cover. Doesn't matter what language you end up working with Understanding C will definitely help.


问:
Does Java have a built in method to determine if an identifier is legal
Naming a variable or class, for example, must adhere to certain rules (such as not allowing keywords or reserved words as identifiers)

I really don't want to code my own method to do such a thing. Does java have something already built in?

My goal is that I am building an expression builder / code generator. It will recognize user specified variables and these must respect java's identifier rules or a warning is presented to user to rename his variable.

答: You'll want to look at JavaUtils.isJavaKeyword() ... it's not part of the Java API though, it's part of Apache Axis.

ContentLicense: CC BY-SA 4.0


答:
Guess I will borrow from JavaUtils code then :)</p>

```<code>static final Collator englishCollator = Collator.getInstance(Locale.ENGLISH);
static final String keywords[] = {
                 "abstract",  "assert",       "boolean",    "break",      "byte",      "case",
                 "catch",     "char",         "class",      "const",     "continue",
                 "default",   "do",           "double",     "else",      "extends",
                 "false",     "final",        "finally",    "float",     "for",
                 "goto",      "if",           "implements", "import",    "instanceof",
                 "int",       "interface",    "long",       "native",    "new",
                 "null",      "package",      "private",    "protected", "public",
                 "return",    "short",        "static",     "strictfp",  "super",
                 "switch",    "synchronized", "this",       "throw",     "throws",
                 "transient", "true",         "try",        "void",      "volatile",
                 "while"
             };

     public static boolean isJavaKeyword(String keyword) {
                return (Arrays.binarySearch(keywords, keyword, englishCollator) >= 0);
     }
</code>```

Title: Does Java have a built in method to determine if an identifier is legal

Body:
Naming a variable or class, for example, must adhere to certain rules (such as not allowing keywords or reserved words as identifiers)

I really don't want to code my own method to do such a thing. Does java have something already built in?

My goal is that I am building an expression builder / code generator. It will recognize user specified variables and these must respect java's identifier rules or a warning is presented to user to rename his variable.

Body:
Guess I will borrow from JavaUtils code then :)

static final Collator englishCollator = Collator.getInstance(Locale.ENGLISH);
static final String keywords[] = {
                 "abstract",  "assert",       "boolean",    "break",      "byte",      "case",
                 "catch",     "char",         "class",      "const",     "continue",
                 "default",   "do",           "double",     "else",      "extends",
                 "false",     "final",        "finally",    "float",     "for",
                 "goto",      "if",           "implements", "import",    "instanceof",
                 "int",       "interface",    "long",       "native",    "new",
                 "null",      "package",      "private",    "protected", "public",
                 "return",    "short",        "static",     "strictfp",  "super",
                 "switch",    "synchronized", "this",       "throw",     "throws",
                 "transient", "true",         "try",        "void",      "volatile",
                 "while"
             };

     public static boolean isJavaKeyword(String keyword) {
                return (Arrays.binarySearch(keywords, keyword, englishCollator) >= 0);
     }


问:
Interview question "What is virtual function"
It was funny for me, and I'm interesting the reaction for this question of the community. It was interview for C++/Qt developer, and question was asked "What is virtual function". Not something like "how polymorphism in C++ works" or "how virtual functions works" but what is. My first thought was to answer "Virtual functions(methods) are methods that have word "virtual" before it's signature", but I explained about how they works =)
What do you think, is this a proper formed question? And what will you ask for that question?

PS: I hope that this part of stackexchange are proper for this question

答:
I think it is a perfectly valid question. I'll quote wikipedia as they state it better than me:

In object-oriented programming, a virtual function or virtual method is a function or method whose behavior can be overridden within an inheriting class by a function with the same signature. This concept is a very important part of the polymorphism portion of object-oriented programming (OOP).

http://en.wikipedia.org/wiki/Virtual_function


答: Ask for the target level of confidence to be used in estimates. There will be a big difference between 50% and 90% confidence.</p>

Title: Setting Deadlines in software development

Body:
I have been working on a system alone for about two years. I inherited the system from a contractor who spent about two years working on it before me (alone).  The system is not particularly well designed because there is business logic, presentation logic and data logic mingled together.  It is a very complex system, which I am trying to refactor as I go along and this takes time.

A new developer was recruited but he seems to be taking more of a Project management role.  He is very direct asking exactly how long things will take; questioning all my assumptions and predictions, which is difficult because of the complexity and because I am the only expert at the moment.

I am very organised in my personal life.  For example, I was asked what time I would arrive in Manchester last week so I provided an exact time catering for accidents and road works on the way.  I find it difficult to apply the same principles at work in software development at the moment.

Don't get me wrong.  I have worked with project managers on less complex projects in the past and have had a good relationship, but then the projects were less complex and I always delivered before schedule.  I am struggling with this particular project manager and it is causing stress.

How do other developers deal with project managers who want answers and accurate deadline dates?


答:
Maybe if you're a non-native English speaker you'd get some amusement out of this, but it's a valid question. The interview is a test of both knowledge and communication skill - and communication doesn't only mean your ability to explain concepts, but also your ability to understand what they are asking.

The question could also be asked 'What does the virtual keyword do' or 'What is the purpose of a virtual function'; without knowing the precise answer that they are looking for it's hard to know how they should word their question for least ambiguity.

I think that questions like this can be expressed in a very open ended way ('Tell me about virtual functions') which leaves you to explain the most important concepts and demonstrate your knowledge.

Title: Interview question "What is virtual function"

Body:
It was funny for me, and I'm interesting the reaction for this question of the community. It was interview for C++/Qt developer, and question was asked "What is virtual function". Not something like "how polymorphism in C++ works" or "how virtual functions works" but what is. My first thought was to answer "Virtual functions(methods) are methods that have word "virtual" before it's signature", but I explained about how they works =)
What do you think, is this a proper formed question? And what will you ask for that question?

PS: I hope that this part of stackexchange are proper for this question


答:
What's the new developer's role? Is he working alongside you, are you mentoring him, is he senior, is he the solution owner or manager? It seems like he wants to get a grasp of the solution and understand where the complexities lie.

A new developer was recruited but he seems to be taking more of a
  Project management role. He is very direct asking exactly how long
  things will take; questioning all my assumptions and predictions,
  which is difficult because of the complexity and because I am the only
  expert at the moment.

It's normal for a new team member to ask questions. How else would you expect someone to get up to speed with the solution - the issues, the design designs made, and so on.

Your question raises more questions for me. What are you answering? If he says 'How long with x take', and you respond 'I don't know' or 'We won't know till we start', or similar, I'd be very concerned. You've been working on the solution for two years and you have a responsibility to give guidance on the project. You are, after all, the expert.


答:
Just don't go work for the Royal McBee Computer Corp then, because who's to say you're not the inexperienced programmer.

sure, its great to write code that's terse and short and it might be useful in a javascript environment (well, until someone produces a js compiler to download to browsers, but that's another story).

what is important though, is the ability for your code to live past the few minutes it took you to write it. Sure, its quick and easy and you can chunk it out and move on, but if you have to come back to it years later, that's when you might think "which muppet wrote this", and realise it was you! (I've done that, sure most people have too.. I blame the overly aggressive deadlines, honest).

This is the only important thing to bear in mind, so while I'd say yes - go with that particular operator if it works and is clear, and your 'inexperienced' devs (though, that is being derogatory to them, I know plenty of inexperienced devs who know all the operators and tricks as they've memorised various web page tutorials and references, they write the worst code even though they know every little trick... there might be more to this than coincidence)

Anyway, if you could read the story of Mel, you'd realise the tricks are not the best thing to put in any code, even though Mel was a real programmer of the first order. This puts paid to any argument where someone says they can write good code and everyone else needs to learn more to keep up.

Title: If my team has low skill, should I lower the skill of my code?

Body:
For example, there is a common snippet in JS to get a default value:

```<code>function f(x) {
    x = x || 'default_value';
}
</code>```

This kind of snippet is not easily understood by all the members of my team, their JS level being low.

Should I not use this trick then? It makes the code less readable by peers, but more readable than the following according to any JS dev:

```<code>function f(x) {
    if (!x) {
        x = 'default_value';
    }
}
</code>```

Sure, if I use this trick and a colleague sees it, then they can learn something. But the case is often that they see this as "trying to be clever".

So, should I lower the level of my code if my teammates have a lower level than me?


问:
How long is a typical modern microprocessor pipeline?
I learnt some about pipelining but those were 4-stage and 5-stage and I think that modern pipelining typical is much longer and more complicated in practice. How long are typical pipelines and how much can we expect them to increase and where is the point of reaching diminshing returns in performance gains for longer pipelines?</p>

答:
Intel had 5 pipeline stages in its original Pentium architecture.  The number of stages peaked at 31 in the Prescott family, but decreased after that.  Today, in the Core series II processors (i3, i5, and i7), there are 14 stages in the processor pipeline.

```<code>Microarchitecture   Pipeline stages
P5 (Pentium)             5
P6 (Pentium 3)          10
P6 (Pentium Pro)        14
NetBurst (Willamette)   20
NetBurst (Northwood)    20
NetBurst (Prescott)     31
NetBurst (Cedar Mill)   31
Core                    14
Bonnell                 16
Sandy Bridge            14
Silvermont              14 to 17
Haswell                 14
Skylake                 14
Kabylake                14
</code>```

Prescott achieved only modest gains in performance over its predecessor, and its more complex design demanded substantially more power relative to its performance gains.  Although there were other contributing factors to Prescott's disappointing performance, it seems clear that increasing the number of pipelining stages eventually achieves diminishing returns.

References

Prescott Pushes Pipelining Limits

The Intel Architecture Processor Pipeline

List of Intel CPU Microarchitectures

The Optimum Pipeline Depth for a Microprocessor

Body:
Intel had 5 pipeline stages in its original Pentium architecture.  The number of stages peaked at 31 in the Prescott family, but decreased after that.  Today, in the Core series II processors (i3, i5, and i7), there are 14 stages in the processor pipeline.

Microarchitecture   Pipeline stages
P5 (Pentium)             5
P6 (Pentium 3)          10
P6 (Pentium Pro)        14
NetBurst (Willamette)   20
NetBurst (Northwood)    20
NetBurst (Prescott)     31
NetBurst (Cedar Mill)   31
Core                    14
Bonnell                 16
Sandy Bridge            14
Silvermont              14 to 17
Haswell                 14
Skylake                 14
Kabylake                14

Prescott achieved only modest gains in performance over its predecessor, and its more complex design demanded substantially more power relative to its performance gains.  Although there were other contributing factors to Prescott's disappointing performance, it seems clear that increasing the number of pipelining stages eventually achieves diminishing returns.

References

Prescott Pushes Pipelining Limits

The Intel Architecture Processor Pipeline

List of Intel CPU Microarchitectures

The Optimum Pipeline Depth for a Microprocessor