答:
I work on a code base of millions of lines of code, some dating back to the 1980's. It's just software, so it's just a matter of writing a few unit tests, so you can go and just refactor it, and make it so much better.

The key word here is just - it's a four-letter word that does not belong in any programmer's vocabulary, let alone one who is working on legacy systems.

How long do you think it takes to write a unit test, to test one hour worth of development effort? For discussion sake, let's say another hour.

How much time is invested in that million-line, 20-year-old legacy system? Let's say, 20 developers for 20 years times 2000 hours / annum (they worked pretty hard). Let's now pick a number - you have new computers and new tools, and you are so much more clever than the guys who wrote this piece of $%^^ in the first place - let's say you are worth 10 of them. Have you got 40 man years, well, have you...?

So the answer to your question is there is much much more. For instance, that routine that's 1000 lines (I have a few that are over 5000), it is overly complex and is a piece of spaghetti. It would only (yet another four letter word) take a couple of days to re-factor it into a few 100 line routines and a few more 20 lines helpers, right? WRONG. Hidden in those 1000 lines is 100 bug fixes, each one an undocumented user requirement or an obscure edge case. It's 1000 lines because the original 100-line routine did not do the job.

You need to work with the mind set "if it ain't broke, don't fix it". When it is broke, you need to be very careful when you fix it - as you make it better, that you don't accidentally change something else. Note that "broke" may include code that is unmaintainable, but working correctly, that depends on the system and its use. Ask "what happens if I screw this up and make it worse", because one day you will, and you will have to tell the bosses' boss why you chose to do that.

These systems can always be made better. You will have a budget to work to, a timeline, whatever. If you don't - go and make one. Stop making it better when the money/time has run out. Add a feature, give yourself time to make it a little better. Fix a bug - again, spend a little extra time and make it better. Never deliver it worse than it was when you started.

Title: What are the key points of Working Effectively with Legacy Code?

Body:
I've seen the book Working Effectively with Legacy Code recommended a few times.  What are the key points of this book?

Is there much more to dealing with legacy code than adding unit/integration tests and then refactoring?


问:
What are the key points of Working Effectively with Legacy Code?
I've seen the book Working Effectively with Legacy Code recommended a few times.  What are the key points of this book?

Is there much more to dealing with legacy code than adding unit/integration tests and then refactoring?

答:
The key problem with legacy code is that it has no tests. So you need to add some (and then more...).

This in itself would take a lot of work, as @mattnz noted. But the special problem of legacy code is that it was never designed to be testable. So typically it is a huge convoluted mess of spaghetti code, where it is very difficult or downright impossible to isolate small parts to be unit tested. So before unit testing, you need to refactor the code to make it more testable.

However, in order to refactor safely, you must have unit tests to verify that you haven't broken anything with your changes... This is the catch 22 of legacy code.

The book teaches you how to break out of this catch by making the absolute minimal, safest changes to the code just to enable the first unit tests. These aren't meant to make the design nicer - only to enable unit tests. In fact, sometimes they do make the design uglier or more complex. However, they allow you to write tests - and once you have unit tests in place, you are free to make the design better.

There are lots of tricks to make the code testable - some are sort of obvious, some are not at all. There are methods I would have never thought about myself, without reading the book. But what is even more important is that Feathers explains what precisely makes a code unit testable. You need to cut dependencies and introduce barriers into your code, but for two distinct reasons:

sensing - in order to check and verify the effects of executing a piece of code, and

separation - in order to get the specific piece of code into a test harness first of all.

Cutting dependencies safely can be tricky. Introducing interfaces, mocks and Dependency Injection is clean and nice as a goal, just not necessarily safe to do at this point. So sometimes we have to resort to subclassing the class under test in order to override some method which would normally e.g. start a direct request to a DB. Other times, we might even need to replace a dependency class/jar with a fake one in the test environment...

To me, the most important concept brought in by Feathers is seams. A seam is a place in the code where you can change the behaviour of your program without modifying the code itself. Building seams into your code enables separating the piece of code under test, but it also enables you to sense the behaviour of the code under test even when it is difficult or impossible to do directly (e.g. because the call makes changes in another object or subsystem, whose state is not possible to query directly from within the test method).

This knowledge allows you to notice the seeds of testability in the nastiest heap of code, and find the minimal, least disruptive, safest changes to get there. In other words, to avoid making "obvious" refactorings which have a risk of breaking the code without you noticing - because you don't yet have the unit tests to detect that.

ContentLicense: CC BY-SA 3.0


问:
Where can I get a definition of how the code is laid out in VB.NET 2010?
I am just starting out learning Visual Basic 2010. I have books and videos. The books all seem to be written for people who have some programming experience, even the books that say they are for beginners.

The videos were great until they started talking about variables. I got the basics of them but they started into complicated variables and I don’t see the need for them right away.  Where can I go to see code for fairly intricate applications written out, with an over lay of definitions of which part of the code is a method as opposed to a class and so on?

Also, I am working at a company that does not use SQL. So I need to use Access 2007 for all of my tables. Is there much of a difference to the coding?

答:
You question is a bit unclear, but I will give the answer a try. VB.Net is an OO language. It allows you to create classes. A class could contain one or more of the following:
Field, Property, Method. Fields and Properties are probably what you refer to as variables. They hold data of some type. Methods are constructs that allow you to perform operations, they may use fields or properties.

SQL Server and Access are Relational Database management systems. They both use SQL. VB.NET uses ADO.NET to connect to either. SQL Server syntax is mostly similar to MS-Access SQL for many simple cases but the syntax can be said to be not the same for all statements specially ones that create database tables and ones that does complex queries.

MS-Access has its own language VBA and has a built in report generator where SQL server does not support VBA and has its own reporting engine.

If you are only writing SQL, you need to get used to the datatypes and the database engine you use quite much to get your work don.

Make sure you learn both VB.NET and MS-Access before you start serious development. Also, you really need to justify this technical architecture since it is not quite the trend these days.


问:
How do you end up with event-sourcing if you use a xDD approach?
When working in a TDD or BDD manner your unit tests are supposed to drive your design. But how do you end up with event-sourcing using a xDD techniques? As I see it event sourcing is something you need to adopt early on to take full advantage of it.

Lets say that you start without event-sourcing and do a release. Later on when you are releasing version 2.0 you realize that it would be great to use event-sourcing, but at that point you alread have missed all the events from version 1.0 so it makes it much harder to implement. Or do you take some kind of backup of your db from before event-sourcing and use that as base line and then add event-sourcing on top of that?

答:
Personally I think event sourcing comes in the category of 'architectural styles' - and it's never going to be easy to switch styles mid-project. That said it is possible (I've done it myself in the past). Here's a series of blog posts starting with this one that outlines one possible approach.

Both TDD and BDD are really 'requirements first' and generally you'll get enough requirements to have a feel for which architectural style is likely to be good fit. Getting this decision wrong can be very expensive - and without falling into the trap of 'big design up front' - this decision is one you'll want to spend some time over.

One a more practical level you can generate one or more initialising events from your existing data.


问:
Stuff every programmer needs while working
I've been tasked with creating a fun and relaxing environment, one thing I know that I want is ergonomic mice and keyboards, others have suggested exercise balls and bands.

What is it that every programmer needs while working? What might not be necessary but would be nice to have anyway?

Note: this question was asked previously, but has been recommended to be posted here. See this link for the previous responses: https://stackoverflow.com/questions/3911911/stuff-every-programmer-needs-while-working-closed

答: A Model M keyboard.

ContentLicense: CC BY-SA 2.5

Body: A Model M keyboard.


问:
migrating product and team from startup race to quality development

Possible Duplicate:

  A simple ways to improve the release quality in RAD environment

This is year 3 and product is selling good enough. Now we need to enforce good software development practices. The goal is to monitor incoming bug reports and reduce them, allow never ending features and get ready for scaling 10x.
The phrases "test-driven-development" and "continuous-integration" are not even understood by the team cause they were all in the first 2 year product race. Tech team size is 5.

The question is

how to sell/convince team and management about TDD/unit testing/coding standards/documentation - with economics.

train the team to do more than just feature coding and start writing test units along - which looks like more work, means needs more time!

how to plan for creating units for all backlog production code

答:
You need to do this incrementally. A "big bang" approach is going to cause more disruption and potential problems than the solution (TDD/Unit testing etc.) is designed to solve.

Take one problem at a time and deal with that. If it's too big, break it down into a series of smaller problems.

You need to show both your co-workers and management that the problem is real and is costing the company money - either directly or in increased development times. Then you need to demonstrate that the solution will solve this problem and, equally importantly, not cause any additional problems along the way.

By doing this you will gain the support of everyone and hopefully get their ownership of the solution. This should make them more willing to try it in the first place and keep going with even if it's not showing immediate improvements.

Your colleagues have probably spotted these problems themselves and are (hopefully) doing the same as you - wondering how they can be solved. Even the simple act of talking about them can go a long way.


问:
What are the essential things one needs to know about UML?
I want my scribbles of a program's design and behaviour to become more streamlined and have a common language with other developers.

I looked at UML and in principle it seems to be what I'm looking for, but it seems to be overkill. The information I found online also seems very bloated and academic.

How can I understand UML in plain-English way, enough to be able to explain it to my colleagues? What are the canonical resources for understanding UML at a ground level?

答:
I would say that if you know UML then all diagrams give you different views of your application. Many books are available.

If you don't know UML the easiest is to only create class/sequence diagrams which have been reversed from existing code. You just need to reverse the existing code into UML and add your own notes inside the class/sequence diagrams.
Class diagrams will give a static view of your application, sequence diagram will describe methods flows and therefore application behavior.
UML Job done and no mistake :)


问:
How to interview a natural scientist for a dev position?

Original Question

I already did some interviews for my company, mostly computer scientists for dev positions but also some testers and project managers. Now I have to fill a vacancy in our research group within the R&D department (side note: “research” means that we try to solve problems in our professional domain/market niche using software in research projects together with universities, other companies, research centres and end user organisations. It’s not computer science research; we’re not going to solve the P=NP problem).

Now we invited a guy holding an MSc in chemistry (with a lot of physics in his CV, too), who never had any computer science lesson. I already talked with him about half an hour at a local university’s career days and there’s no doubt the guy is smart. Also his marks are excellent and he graduated with distinction. For his BSc he needed to teach himself programming in Mathematica and told me believably that he liked programming a lot. Also he solved some physical chemistry problem that I probably don’t understand using his own software, implemented in Mathematica, for his MSc thesis. It includes a GUI and a notable size of 8,000 LoC. He seems to be very attracted by what we’re doing in our research group and to be honest it’s quite difficult for an SME like us to get good people. I also am very interested in hiring him since he could assist me in writing project proposals, reports, doing presentations and so on. He would probably fit to our team, too.

The only question left is: How can I check if he will get the programming skills he needs to do software implementation in our projects since this will be a significant part of the job?

Of course I will ask him what it is, that is fascinating him about programming. I’ll also ask how he proceeded to write his natural science software and how he structured it. I’ll ask about how he managed to obtain the skills and information about software development he needed. But is there something more I could ask? Something more concrete perhaps? Should I ask him to explain his Mathematica solution?

To be clear: I’m not looking for knowledge in a particular language or technology stack. We’re a .NET shop in product development but I want to have a free choice for our research projects. So I’m interested in the meta-competence being able to learn whatever is actually needed.

I hope this question is answerable and not open-ended since I really like to know if there is a default way to check for the ability to get further programming skills on the job. If something is not clear to you please give me some comments and let me improve my question.

Update to reflect the answers given until 2011-12-01

What answer I accepted and why

Thank you all for your answers, most of them are quite helpful, so I upvoted a lot! Although Tom Squires' answer got the most votes, I'm going to accept the answer given by Prince Goulash. Of course Tom is objectively correct, but Prince's answer is just more helpful for me and I double-checked the FAQ that this is the criterion to accept an answer.

What I am going to ask him during the interview

I'll let him explain some simple assignments like the example in The Camel Has Two Humps mentioned by Chris Burt-Brown

I'll ask him to explain some more advanced control flows maybe in a graphical notation.

I'll check his understanding of recursion using a math example.

I'll let him explain an algorithm of his choice in natural language.

I'll let him explain his Mathematica solution, in particular I'll ask for his procedure model, usage of tools, structuring of code and software in general as well as different abstraction layers.

To check his motivation I will ask for his software development fascination.

I'll ask him if he is aware of what he will need to learn about enterprise software development. Especially I want to turn the discussion into the direction of working in teams, pair programming, TDD since I expect him not to know a lot about this after working on his MSc alone.

Sounds like it's going to be a long interview ;)

Update after the interview 2011-12-09

Again thank you all for your good answers. He passed the interview with flying colours. I never was more satisfied with an applicant. His Mathematica solution seems to be structured  quite well. He was able to explain where he used higher-order functions, although he didn't know that these are referred like this. He answered my math-based recursion questions as well as simple assignments and control flow things from The Camel Has Two Humps. When he was explaining some algorithms I learned a lot about non-linear fitting ;) Also he honestly said that of course he can't guarantee that he will be able to learn things about professional software development that he doesn't know so far. But he believably statet that he was always good in learning new concepts -- even by himself -- and is really interested in software development. He also asked for the technology stack of the project, he would be applied to first, to have a look at it at home. He was curious about pair programming and team work, too. Now I hope that the employment contract will be concluded.

答: I would start with some basic algorithm questions and basics to see if he is into the logic of algorithms and programming. If he is capable of understand what an algorithm is, he can eventually develop the skills needed to do concrete things afterwards. </p>


答:
This is year 3 and product is selling good enough. Now we need to
  enforce good software development practices.

You are not sure of the quality of the processes and the product and it is still selling? Lucky! No. i didn't want to really criticize you, but my point is that, the fact that your product is doing ok in market, it is a positive sign. Don't throw away things yet!

What you, need really is to slowly make things formal. In my opinion, it is not important to do best fit with respect to some standard process; rather you need to use that suits the team.

I am not very much aware how much maturity you have got in some of this, but make it really work for the team. First of all, you must ensure 4 essential things: a. Version control, b. Bug tracking and c. effective release management. d. Build the suit of regression tests.

In the answer here - i have enumerated some good and simple practices, if followed builds good momentum in the people and it helps bring trustworthy code as the key focus.

The same small step-by-step improvement criteria applies if you want to automate the testing process and move towards continuous integration - start with what most people agree that can be trivially and reliably automated (after a while people will begin to think, why did we ever did this manually).

Finally, about the documentation and code review process. I guess, most programmers wants to do a good job at this one; Issue is there are no consensus, best is try to bring purely a peer driven approach to a larger question: what do all of us think is a good code and documentation! (read this) As you evolve, again people will slowly convert into more of a personal responsibility than policy dodging activity.

This truth is, there are no great alternatives to "small-step-by-step" way of evolving code. Call it TDD, agile, iterative or whatever; these steps is what make it possible that team can fathom the evolution of the code and in all likelihood, try to accelerate to their maximum speed.

Once, people see success in these small steps, and finds the ownership, their biggest commitment to learn better practices and improving even further rapidly increase - leave them with this ownership and you will see wonders!

Title: migrating product and team from startup race to quality development

Body:
Possible Duplicate:

  A simple ways to improve the release quality in RAD environment

This is year 3 and product is selling good enough. Now we need to enforce good software development practices. The goal is to monitor incoming bug reports and reduce them, allow never ending features and get ready for scaling 10x.
The phrases "test-driven-development" and "continuous-integration" are not even understood by the team cause they were all in the first 2 year product race. Tech team size is 5.

The question is

how to sell/convince team and management about TDD/unit testing/coding standards/documentation - with economics.

train the team to do more than just feature coding and start writing test units along - which looks like more work, means needs more time!

how to plan for creating units for all backlog production code


答:
How can I check if he will get the programming skills he needs

You can't. It's impossible to accurately test for a skill he doesn't have yet. You have to make a judgment call based on his intelligence and attitude. It's ultimately always going to be a risk.

From personal experience I can say it's very possible to transition from science to programming. They both basically boil down to using your brain to solve complex puzzles.

Title: How to interview a natural scientist for a dev position?

Body:
Original Question

I already did some interviews for my company, mostly computer scientists for dev positions but also some testers and project managers. Now I have to fill a vacancy in our research group within the R&D department (side note: “research” means that we try to solve problems in our professional domain/market niche using software in research projects together with universities, other companies, research centres and end user organisations. It’s not computer science research; we’re not going to solve the P=NP problem).

Now we invited a guy holding an MSc in chemistry (with a lot of physics in his CV, too), who never had any computer science lesson. I already talked with him about half an hour at a local university’s career days and there’s no doubt the guy is smart. Also his marks are excellent and he graduated with distinction. For his BSc he needed to teach himself programming in Mathematica and told me believably that he liked programming a lot. Also he solved some physical chemistry problem that I probably don’t understand using his own software, implemented in Mathematica, for his MSc thesis. It includes a GUI and a notable size of 8,000 LoC. He seems to be very attracted by what we’re doing in our research group and to be honest it’s quite difficult for an SME like us to get good people. I also am very interested in hiring him since he could assist me in writing project proposals, reports, doing presentations and so on. He would probably fit to our team, too.

The only question left is: How can I check if he will get the programming skills he needs to do software implementation in our projects since this will be a significant part of the job?

Of course I will ask him what it is, that is fascinating him about programming. I’ll also ask how he proceeded to write his natural science software and how he structured it. I’ll ask about how he managed to obtain the skills and information about software development he needed. But is there something more I could ask? Something more concrete perhaps? Should I ask him to explain his Mathematica solution?

To be clear: I’m not looking for knowledge in a particular language or technology stack. We’re a .NET shop in product development but I want to have a free choice for our research projects. So I’m interested in the meta-competence being able to learn whatever is actually needed.

I hope this question is answerable and not open-ended since I really like to know if there is a default way to check for the ability to get further programming skills on the job. If something is not clear to you please give me some comments and let me improve my question.

Update to reflect the answers given until 2011-12-01

What answer I accepted and why

Thank you all for your answers, most of them are quite helpful, so I upvoted a lot! Although Tom Squires' answer got the most votes, I'm going to accept the answer given by Prince Goulash. Of course Tom is objectively correct, but Prince's answer is just more helpful for me and I double-checked the FAQ that this is the criterion to accept an answer.

What I am going to ask him during the interview

I'll let him explain some simple assignments like the example in The Camel Has Two Humps mentioned by Chris Burt-Brown

I'll ask him to explain some more advanced control flows maybe in a graphical notation.

I'll check his understanding of recursion using a math example.

I'll let him explain an algorithm of his choice in natural language.

I'll let him explain his Mathematica solution, in particular I'll ask for his procedure model, usage of tools, structuring of code and software in general as well as different abstraction layers.

To check his motivation I will ask for his software development fascination.

I'll ask him if he is aware of what he will need to learn about enterprise software development. Especially I want to turn the discussion into the direction of working in teams, pair programming, TDD since I expect him not to know a lot about this after working on his MSc alone.

Sounds like it's going to be a long interview ;)

Update after the interview 2011-12-09

Again thank you all for your good answers. He passed the interview with flying colours. I never was more satisfied with an applicant. His Mathematica solution seems to be structured  quite well. He was able to explain where he used higher-order functions, although he didn't know that these are referred like this. He answered my math-based recursion questions as well as simple assignments and control flow things from The Camel Has Two Humps. When he was explaining some algorithms I learned a lot about non-linear fitting ;) Also he honestly said that of course he can't guarantee that he will be able to learn things about professional software development that he doesn't know so far. But he believably statet that he was always good in learning new concepts -- even by himself -- and is really interested in software development. He also asked for the technology stack of the project, he would be applied to first, to have a look at it at home. He was curious about pair programming and team work, too. Now I hope that the employment contract will be concluded.


答:
How can I check if he will get the programming skills he needs to do software
  implementation in our projects since this will be a significant part of the job

Honestly, I am pretty sure you won't get this information out of a one-or-two hour interview. Give him a programming assignment in C# (something not too technical) and one or two weeks to solve. That should be enough time to learn the basics of the language for someone who has already learned programming with Mathematica. Then make a code review with him and decide on that base.


答:
I am very biassed here because I started as a software developer a few years
ago with a PhD in physics, but very little coding experience (amounting to an undergraduate course on Fortran). Clearly it
depends on the type of software you are developing, but my view is that coding
skills are very easy to pick up by anyone with half-decent
scientific/problem-solving skills. I don't intend that as an insult to
life-long programmers who have studied computer science: of course there are technical
aspects that take serious training in order to master (e.g. multi-threading and very
low-level architecture) but I assume that's not the position you are
trying to fill.

For my technical interview for my current position, I was faced with a
reasonably complex mathematical problem and asked to design a program to solve
it. The emphasis was on writing an algorithm that, once implemented, would
solve the problem. I could write an answer purely using words to describe my solution, but I was allowed to write some code in a language of my choice
if I so wished. The test was more about
    problem-solving ability and whether I was able to "think like a programmer".
    Obviously if there were candidates of equal ability and one had more direct
    coding experience, then he would have come out on top, but that seems fair
    enough to me.

The bottom line is: examine the candidate for the skills you are hiring him for, not for ideals that you hope he will achieve.


问:
Would you use UML if it kept stakeholders from requesting changes frequently?
As much as programmers hate to document their code/system and draw UML (especially, Sequencing, Activity and State machine diagrams) or other diagramming notation, would you agree to do it if it kept managers from requesting a "minor change" every couple of weeks?

IOW, would you put together visual models to document the system if it helped you demonstrate to managers what the effect of changes are and why it takes so long to implement them?

(Edited to help programmers understand what type of answer I'm looking for.)

2nd edit: Restating my question again, "Would you be willing to use some diagramming notation, against your better nature as a programmer, if it helped you manage change requests?"

This question isn't asking if there might be something wrong with the process. It's a given that there's something wrong with the process. Would you be willing to do more work to improve it?

答: I use Topcased. It is able to generate code from UML diagrams and preserves changes you made in generated code when you generate a second time.</p>


答: http://www.amazon.com/Working-Effectively-Legacy-Michael-Feathers/dp/0131177052 may help you a lot in this situation. Not exactly does it help to sell the idea of TDD/agile (you should use other sources explaining its advantages like nearly constant, low cost of change, reduced fear of change, etc., for this I would use Kent Beck's "Extreme Programming: Explained"), but it helps exactly with the process of moving legacy code to the agile process - isolating pieces of the code, make them a module, unit-testify it, then peossibly rewrite to new version developed by TDD and replacing the old with the new - this is what the book is about.</p>


答:
I have a BSc in Material Science but have worked all my career in software development.

I would suggest that your candidate will probably not have problems with the basic programming and algorithms, but when it comes to the more "engineering" type requirements he may need some guidance. By that I mean structuring his code well, not having 500 line functions, testing effectively, designing for efficiency...

Most of this can be taught, but you may want to design some questions to chekc this out.


问:
What web oriented language would work best with binary data?
I want to create a service where people can upload files. However, since file storage costs money, I want to compress the files so they take less space. I would want to write my own compression algorithm, however, PHP doesn't have good ways to handle binary data (which is needed for many compression algorithms). So I wondered, what would be a better language to create such a website in?

I have knowledge of PHP (and Javascript, HTML and CSS) but no experience with other things like Ruby, Perl, Python, and other web development languages.

答:
In truth you best bet it to use a pre existing compression package. Really you are not going to do better than gzip or bzip2 or the like.

Also remember if they are uploading images, sound or video then the files are already compressed so you will not be able to compress them farther.

That being said if you want to work with Binary data check out Erlang. It is an amazing langauge and it has really cool syntax for working with bits.

Disclaimer: I wrote a book on Erlang


问:
Backward compatibility with event-sourcing
How do you stay backward compatible with event-sourcing? Let say you release a version that has one kind of event, let call it X. You know how to handle that event in all the systems that extracts the events from the event source. In a later release you make a change to event X or delete it, how do you stay backward compatible with that?

To have a fully functional system you need to be able to handle the old event as the same time as you need to handle the updated version. Or if you delete that event type, then you will be stuck with code that is only there to handle legacy events which in my head can be a little bit messy in the long run.

答:
IMHO there's no such thing as really changing an event - if that happens you've really created a new event type. Once an event has happened in production, it's happened.

The cleanest way to handle this is to version your events and have an 'event upgrader' somewhere in your pipeline before the events get applied - we do it just after the events are deserialised. That way your application only needs to know about the latest version of the events. The upgrader can translate any changed attributes, remove unused ones or apply sensible defaults if you add any.


答:
I don't have any secondary sources verifying this paper so I can't vouch for it but:

The Camel Has Two Humps

http://www.eis.mdx.ac.uk/research/PhDArea/saeed/paper1.pdf

We have found a test for programming aptitude, of which we give
  details. We can predict success or failure even before students have
  had any contact with any programming language with very high accuracy,
  and by testing with the same instrument after a few weeks of exposure,
  with extreme accuracy.


问:
Developing a feature which sole purpose to be taken out?
What is the name of the pattern in which individual contributors (programmers/designers) developed an artifact for the sole purpose is to serve as a diversion so that management can remove that feature in the final product?

This is a folklore I heard from an ex-colleague who used to work at a large game development company. At that company, it is well known that middle management is pressurized to "give inputs" and "make changes" to the product otherwise they risk being seen as not contributing to the project. This situation have delayed many projects because of these superfluous "management inputs".

In one project at the above company, the artists and developers created a supernumerary animated character that appears in every cutscene and sticks out like a sore thumb. They designed it in such a way that it can be easily removed before the game is shipped (this was when games were still sold in physical media and not a downloadable product). Obviously the management then voted to remove the animation. On the positive side, management didn't introduced any unnecessary changes that would have delayed the project because they have shown that they provided constructive inputs to the product.

This process pattern has a name among game programmers that work in corporates, but I forgot what was the actual name. I believe it's duck-something.  Anybody can help pointing out the name and perhaps some rather credible reference to how the pattern develops?.

答:
I simply see it as management validating their own purpose on a project by extending out scheduled work as long as possible or creating meaningless busy work to keep people busy or working.

I have seen this personally in five different types:

Government projects - Many times if a manager's project runs underbudget or time, then it will work out bad for him/her in the future.  They may get praise for good work, but run the risk in the future that their budget will be reduced next year if they can't justify it.  Because of how budgeting works in government, this is why government projects aim to utilize as much of their assigned budget as possible.

A possibly obsolete manager who has a large team and responsibility for software that is relatively easy to maintain or write.  The danger is real in the corporate world that when they try to shed dead weight they will look for the middle managers with the least real responsibility and move from there.  They feel that by overestimating and creating unnecessary scope that they protect their positions.

Some software companies are basically Good Ol' Boy clubs where they have simple or legacy software that corners a lucrative yet niche market.  Typically the money is relatively easy, ambitions relatively low, and all of the managers are best friends who try to validate each others purpose while taking home big paychecks.  Room for advancement is impossible in such companies unless you are connected.  They will often try to validate their own importance by creating meaningless busy work into an already well solved problem.

Some contract language requires regular releases and continuous improvement in the software.  For a well solved problem, finding unique and new features may be difficult or impossible.  Often busy work will be assigned, perhaps maybe to add something then mostly remove it in the next release.

The manager is legitimately concerned with keeping the team together, either out of guilt or just trying to be nice.  He will try to validate the purpose of his own team to keep them employed under him.


问:
Are there any GUI or user interface design patterns?
I was curious about GUI design patterns, so I searched and got some information, including a list of UI patterns for the web. This UI patterns website says that:

UI Patterns is a growing collection of User Interface Design
  Principles and User Interface Usability Patterns present on web
  applications and sites today.

Are there any other design patterns for constructing websites or other user interfaces? Are there any books that describe these patterns? I'm particularly interested in patterns for Windows desktop development and web development in the .NET platform.

答:
Is there any Design patterns for constructing Website/Software GUI or not?

Yes.

Any book available for GUI Design patterns/ User Interface ??

I can personally recommend Don't Make Me Think, which has some great insights into web pages design. However, there are numerous other good books out there: This closed StackOverflow question has a lot of good examples.


答:
There are a number of patterns and rules that correspond to usability principles. They aren't as concrete as other patterns, since there is variation in the user interface, think web applications versus desktop applications versus mobile devices versus kiosks, each with their own quirks. Users expect different things from different devices, so part of usability is matching user's mental models and expectations.

A few examples of usability rules include the 80/20 rule, Fitts' Law, Hick's Law, and the Rule of Thirds. There are also techniques, such as applying the Golden Ratio, form following function, and monitoring the singal-to-noise ratio, that can be used to enhance user interfaces. There are plenty more - that's just what I can remember off the top of my head from my software usability course.

For books, I would recommend Universal Principles of Design. It discusses a number of usability and user interface concepts that are abstract enough for any application, either desktop or web. Donald Norman's The Design of Everyday Things is also a classic text in interface design, although the focus is on physical objects and not computer-human interfaces.

These should be coupled with the user interface design guidelines for the target platform, if there is one.

Title: Are there any GUI or user interface design patterns?

Body:
I was curious about GUI design patterns, so I searched and got some information, including a list of UI patterns for the web. This UI patterns website says that:

UI Patterns is a growing collection of User Interface Design
  Principles and User Interface Usability Patterns present on web
  applications and sites today.

Are there any other design patterns for constructing websites or other user interfaces? Are there any books that describe these patterns? I'm particularly interested in patterns for Windows desktop development and web development in the .NET platform.


答: Another department where I work uses a variation on our standard test. The first task is to reverse the words in a string in place. Then, use that code to reverse the order of words in the string, still in place. Instead of using a programming language, they have the candidate design the algorithms on paper and run them using a Scrabble board.</p>


答:
Since he is still in a university or only recently finished, he is used to study. Get him to read and understand Design Patterns book and after (or during) a month, have a thorough discussions with him on the topics. (I think that) this can tell you a lot about his abilities  (not only hard ones (those too), but also how he handles grasping new concepts, understanding their use, seeing pros and cons etc.).
But it'll cost you one month of time.</p>


答: I would ask to describe (using natural language) an algorithm for calculating something from physics. Something a bit more complicated that a simple formula and then I would ask how would he see his calculation encapsulated in objects (no need for OOP knowledge, you could explain what is your expectation of an object). In this way you can see his logical thinking. This is more important than any programming skills.</p>


答:
There are a couple of UI / UX design pattern libraries on the web:

Quince, by Infragistics, has a large catalog of design patterns for both the desktop and the web.

The Yahoo! Design Pattern Library is smaller and appears to not be actively maintained.  Unlike Quince, it includes a section on social patterns.


答:
This is the reason for a decoupled system. Contracts should exist via an interface with consumable systems both internally and externally.

If the system is propagating a new event, then the code should be adjusted accordingly to consume the new event if need be. If the old event is being wrapped in an argument type, the handler should operate as it did before unless you have introduced new properties within the argument which would force the need to make an adjustment within the handler anyways.

You can only prepare to a given degree before you are preparing for something that may not come and the time wasted could have been spent better elsewhere.

Title: Backward compatibility with event-sourcing

Body:
How do you stay backward compatible with event-sourcing? Let say you release a version that has one kind of event, let call it X. You know how to handle that event in all the systems that extracts the events from the event source. In a later release you make a change to event X or delete it, how do you stay backward compatible with that?

To have a fully functional system you need to be able to handle the old event as the same time as you need to handle the updated version. Or if you delete that event type, then you will be stuck with code that is only there to handle legacy events which in my head can be a little bit messy in the long run.


问:
How do you structure your branches in TFS
My group at work has been trying to come up with a good process that we can use with TFS. I'm just wondering if some of you guys had some successful strategies with using TFS across multiple sites using multiple branches.

One specific issue that we have is probably our release engine. On the simple side, a developer should be able to check in his/her changes into the DEV Branch, and then ok certain date (say a freeze date) the DEV Branch will be "reverse integrated" into the Main Trunk (QA) in which then the changes will be pushed to the Production branch. The issue arose when a user check into the DEV Branch, but he doesn't want those changes to be moved into QA (because maybe other portion of the code is not done yet) ... any thoughts on that?

答:
MS issued a white paper that covers one approach with detail on why.

http://tfsbranchingguideiii.codeplex.com/ (this is the 2008/2010 version, there is also a 2005 version).

That link is now outdated, and the advice has been updated. Please see https://blogs.msdn.microsoft.com/visualstudioalmrangers/2016/07/18/the-new-branching-guidance-for-team-foundation-server-team-services-and-others/

ContentLicense: CC BY-SA 4.0


答:
My personal favorite link for design patterns is http://www.welie.com/patterns/. Not only does it have a large list of patterns, but (more importantly) it discusses what usability problems the pattern solves (instead of just showing you a screen shot, which .. is terrible).

(This might not be a fully fledged answer, but I don't have enough clout on this stack exchange at the moment to leave comments, so oh well.)


答:
In VB methods are either written as a function or a sub depending on if they return a value. Classes are essentially a container for related methods and their related variables.
I would recommend you try to get a copy of
VB.NEt 2010 Step By Step
 as this series is written pretty well for beginners to programming and the Microsoft technologies.</p>

Title: Where can I get a definition of how the code is laid out in VB.NET 2010?

Body:
I am just starting out learning Visual Basic 2010. I have books and videos. The books all seem to be written for people who have some programming experience, even the books that say they are for beginners.

The videos were great until they started talking about variables. I got the basics of them but they started into complicated variables and I don’t see the need for them right away.  Where can I go to see code for fairly intricate applications written out, with an over lay of definitions of which part of the code is a method as opposed to a class and so on?

Also, I am working at a company that does not use SQL. So I need to use Access 2007 for all of my tables. Is there much of a difference to the coding?


答:
Also he solved some physical chemistry problem that I probably don’t
  understand using his own software, implemented in Mathematica, for his
  MSc thesis. It includes a GUI and a notable size of 8,000 LoC.

Sounds to me like the candidate already knows how to program, granted they might not have as much experience doing it as a dedicated developer but they have a demonstrable project that they have completed that required a non-trivial amount of work to be completed. As such, you might be able to interview the candidate the same way that you would a developer who uses a different language than the one you shop uses, namely:

Core Competencies - Does the candidate understand basic programmatic logic, flow control, basic data structures.

Advanced Competencies - Does the candidate understand object oriented programming and design, advanced data structures, interfaces, abstract classes, etc.

Problem Solving Skills - Given a problem, does the candidate demonstrate solid problem solving skills.

The language that Mathematica uses is fairly advanced and someone that is good at writing software for Mathematica should be fairly competent in other realms so focusing on that experience and using that as a basis for coding experience could be a good way to approach the interview.


问:
How do I learn Python from zero to web development?
I am looking into learning Python for web development.

Assuming I already have some basic web development experience with Java (JSP/Servlets), I'm already familiar with web design (HTML, CSS, JS), basic programming concepts and that I am completely new to Python, how do I go about learning Python in a structured manner that will eventually lead me to web development with Python and Django?

I'm not in a hurry to make web applications in Python so I really want to learn it thoroughly so as not to leave any gaps in my knowledge of the technologies involving web development in Python. Are there any books, resource or techniques to help me in my endeavor? In what order should I do/read them?

UPDATE:

When I say learning in a structured manner, I mean starting out from the basics then learning the advanced stuff without leaving some of the important details/features that Python has to offer. I want to know how to apply the things that I already know in programming to Python.

答:
Web development always comes back to one thing: and that is the browser. Learn HTML, CSS and JavaScript very well, and it will serve you though any language change.

Www.w3schools.com is a great place to learn these things, but when it comes to CSS, its often very useful to just sit down and play with it. Find a cool web design and implement it in HTML by hand. This is a very, very neccecary skill if any of your server side code results in HTML.

Next, I like your logical approach, but it might not be the best way to go about it. A more rewarding approach may be to establish a goal that you want to accomplish, and learn on the way.

Starting with django may not be the best idea, however. Many of the decisions that they made when designing the framework would only make sense if you'd experienced the problems that they solve first hand. My first web language was php, and the most effective way I understood best practices was to write crappy, brittle code, realizing that there was a problem, and resarching solutions. If I was to research a solution before I understood the problem, I wasn't able to apply it effectivly.

If you're willing to take your time on this, perhaps starting with a less abstract technology set such as php may be a great learning experience.


答:
Speaking as an Aerospace Engineering graduate turned programmer, it is certainly possible to make the leap from the natural sciences to programming. However, be warned, being able to solve problems does not always correlate with the ability to write code. You seem to realize this and that is a good thing.

To me, the most important concepts to make sure he grasps are control flow and recursion (and looping in general as a subset of this). Before hiring a candidate, even somebody who is clearly very intelligent be sure he can write out a plain words algorithm to solve problems. Make sure he can take that plain words algorithm and turn it at least into pseudo-code. You may even probe to see if he can at least understand the concept of polymorphism, though I'm not sure this is requisite knowledge in this circumstance.

Also beware the ability to solve science problems in Mathematica/MatLab/Whatever does not mean he can write good code. It merely means he is able to apply basic (sometimes extremely basic) programming principles, usually if/else statements. Learning to be a good programmer will generally take both a personal and employer commitment to somebody at this stage. Warning: I've met very intelligent people who were/are good engineers that couldn't program their way out of a paper bag and honestly could not grasp basic language fundamentals.

Personal Experience

I graduated from school with an engineering degree and a little bit of programming experience under my belt. I had worked with a very small amount of C, quite a bit of MatLab and some VB + Access. It took me about 3 months of studying to become truly useful as a programmer in a VB.NET shop. It took me another 9 months to become fully proficient. However, I can, with a fair degree of confidence say that my problem solving skills are superior to 99% of other programmers I have met in my job. My employers have consistently considered me one of their more valuable assets.

Conclusion

It's a risk/reward proposition but often times taking on somebody who has the pure problem solving skills can pay off in the long run as long as they are capable of learning the programming concepts and you are both willing to invest the time in expanding his programming knowledge. However, I firmly believe that he must posses at least a basic understanding of the fundamentals of programming before you offer him a job. In my experience, once you're at this point, you can go much further with it.


问:
Why high-tech OSs (like UNIX family) are mostly command based (rather than GUI based)?
DR-DOS, Plan, BSD, Sun Solaris, HP/UX, OpenServer.....and so on.

Why high-tech OSs (like UNIX family) are mostly command based (rather than GUI based)?

答: I'd say that it's because they expect their users to invest the time and resources it takes to learn the command line. After that, the command line gives you power to express actions, which may be much more time-consuming with a GUI (e.g. "change all users with email from "@domain.com" to inactive"). A bash prompt is much faster than a mouse, when you know how to use it.</p>

OwnerDisplayName: Vladislav Zorov


答:
Try explaining in an email, or by phone, how to interact with a GUI.

Try explaining in an email, or by phone, how to interact with a command line. It is considerably easier: you could copy & paste the command inside the email.

(Variant, try to explain by email or by phone how to lace your tie or your boots)

Our brains work well on languages, including textual formal ones like command lines.

Body:
DR-DOS, Plan, BSD, Sun Solaris, HP/UX, OpenServer.....and so on.

Why high-tech OSs (like UNIX family) are mostly command based (rather than GUI based)?

OwnerDisplayName: Basile Starynkevitch


答:
GUI is more difficult to build than CLI (command line interface).

CLI is easier to agree on standards, as it's much simpler.

GUI requires a graphical subsystem (more hardware and software components on servers which don't need it at all).

CLI is easier to automate (scripts), simplifies administration.

CLI allows express much more commands than GUI. E.g. my linux has 3500 commands, each of them has a lot of parameters. Do you imagine how complex the GUI would be? Much more complex than Microsoft Word.

Less traffic to transfer when you need manage remote servers (more responsive on slow networks).

Easier to communicate about CLI commands than buttons/menus/inputs/etc. Much more easier to send a command line text than bunch of screenshots.

CLI allows compose commands easier. So you could an output from one command feed into an another command, and usually it works out-of-box. For GUI one thing is only clipboard, and maybe some technologies as OLE, ActiveX, etc, it works much worse than simple CLI text passing.

Title: Why high-tech OSs (like UNIX family) are mostly command based (rather than GUI based)?

OwnerDisplayName: kan


答:
Agree with Vladislav, the use of the command line gives the administrator the power to do almost everything, the only problem with the commands are that you have to know them and the GUIs are much more Instinctive, but most of the time you have to navigate throw windows to reproduce a simple command line...

After you know the commands, its really practical to use them...

OwnerDisplayName: Matias Caamaño


答:
First, they are probably quite smart, so worst case scenario they can learn to be a good programmer with guidance.  However, if you need them to jump in and be a decent programmer from the get-go, have them send in some sample code that they've wrote.

Is it one or two giant multi-purpose functions or did they encapsulate functionality at the appropriate levels of abstraction?  Are magic-numbers hard-coded throughout?  Is the code DRY?  Did they give variables reasonable names or is everything an undecipherable abbreviation or single letter variable?  Can you mostly follow the logic of their code?  Do they understand OO basics?

Ask what they use for version control (git/hg/svn/cvs/bzr, etc.).  Have they ever profiled code or used a debugger, and if so which ones or what's their generic debugging strategy?

If they fail this test and you need a good coder from the get-go, skip this person.  Otherwise, hire them, suggest they read some software engineering books (e.g., Code Complete) in addition to generic programming/CS books.

(For the record I'm also physical scientist turned programmer.)


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

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

```
Made custom outgoing queue

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

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

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

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

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

Server
-Moved adminExists to Controller

PluginExecutor
-Minor testing added, will be removed later

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

Various NB project updates and changes

---

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

Yea....

So for questions:

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

How can you prevent such commits? Please give specifics

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

答:
The Single Responsibility Principle.

Every source control commit should serve only one purpose. If you have to put the word "and" or "also" in your summary, you need to split it up.

It's very common to end up with lots of separate unrelated or semi-related changes in your working copy. This is called the "tangled working copy problem," and it's actually very hard to avoid even for disciplined developers. However, Git and Mercurial both give you tools to resolve it -- git add -p or chunk selection and Mercurial Queues in TortoiseHg respectively.


答:
How can I check if he will get the programming skills he needs?

It's very simple.  Give him the skills.

Now, that's not a very satisfying answer, but let me elaborate.

I came to programming after doing 3 years in Civil Engineering.  That's a pretty solid background in applied physics and mathematics.  It's not the theoretical math that a CS degree would give, but it's worth something.  What I drew from the engineering experience was a solid background in problem solving.  Anyone with a math background already appreciates the concept of elegance when talking about a solution to a problem.  They've already got an education in refactoring since they've spent the time taking six pages of chicken scratch and converting it into an elegant half page proof for submission.

Anyone who's studied physics has developed an intuitive approach to cobbling together a solution from basic frameworks.

And what is programming outside of these skills? -- Language, Idiom, Patterns and Frameworks.  These are easy to teach.  It's problem solving that you can't.  If you are able to provide instruction in these areas, then you'll end up with a good developer.

The question then becomes "How long can you wait for him to get up to speed?"

tl;dr;  You can teach typing.  You can't teach smart.


答:
There are two key points to take away from the book.

Legacy code is any code that does not have test coverage.

Whenever you have to change legacy code, you should make sure it has coverage.

As other responders have pointed out, trying to pre-emptively update your existing legacy code is a fool's errand. Instead, whenever you have to make a change to legacy code (for a new feature or a bug fix), take the time to remove its legacy status.


问:
What's the key innovation in the realization of the "cloud?"
I'm trying to figure out what are the key technological innovations or inventions that the "cloud" introduces as an improvement over web pages; or maybe over SAAS.

Seems to me that "cloud" is merely a new marketing word for technology that's been around for a while.

答:
It depends on who you ask.

In cloud computing, your application is still being hosted on a virtual server with failovers in a massive data center.  Technically there is nothing being done there that can't be done within an on-site datacenter, but the cost savings with the cloud are that you don't need to run a datacenter, buy and maintain hardware or hire people to support it.

Of course the massive datacenter requires money to run a datacenter, purchase and maintain hardware and hire support personnel, however a single small datacenter might require 8 employees to maintain, a massive one hosting cloud applications requires perhaps a few hundred but replaces a 1000 small datacenters.  Net job deficit = smaller costs = smaller month to month operation fees for clients.  Further these massive data centers bully themselves into regions (Eg. Texas) that will not charge them any taxes and sometimes even provide subsidies for the massive amounts of electricity they consume.  This further lowers their bottom line.

EDIT: Removing unnecessary personal information, and prejudices.


答:
Back around the turn of the century, there was a big todo about the concept of an ASP (Application Service Provider). The idea was that a third party would host your software for you and you pay monthly licensing fees.

Cloud computing is basically taking that concept to another level. Rather than buying the hardware or provisioning it from a traditional web host, a Cloud Provider can provide you the hardware to run your application on demand. If you see a sudden spike in usage, you can crank up the capacity and when it goes back to normal levels you can dial it down.

This allows you to avoid the upfront costs to prepare for high volumes enabling what is called utility computing. That is you pay for what you use. Of course, like many things in technology, this is nothing new. Large companies with mainframes used to rent out horsepower to other companies under a similar model called timesharing which is exactly what it sounds like.

Title: What's the key innovation in the realization of the "cloud?"

Body:
I'm trying to figure out what are the key technological innovations or inventions that the "cloud" introduces as an improvement over web pages; or maybe over SAAS.

Seems to me that "cloud" is merely a new marketing word for technology that's been around for a while.


问:
Why isn't Java more widely used for game development?
I'm not a game developer or anything, but I know that Java is not very widely used for game development. Java should be fast enough for most games, so where's the catch? I can think of some reasons:

Lack of game developers with expertice in Java

Lack of good game development frameworks

Programmers don't want to accept Java as a games programming language. Most only accept C++ as that?

No support for game consoles (though the PC market still exists)

It could of course be something else. Could someone who knows the business better than me explain why Java isn't getting momentum when it comes to game development?

答: For some people reason has nothing to do with speed, libraries, or availability. It is simply because of the language itself. Some people simply do not like Java the language. Other people would rather use their favorite programming language instead of using Java to make games.</p>


答: cloud computing is nothing new, what is new the the availability of high speed internet allowing companies to market cloud concepts to people who don't need it at a low enough cost that they buy it anyway and companies make tons of money from it. similar to text messaging.</p>


答:
IIRC Amazon introduced the cloud concept. They build an infrastructure of scalable, commodity hardware for their peak shopping season. Then commercialized it. Since then every marketing department anywhere have re-branded themselves with a cloud.

To me the key point is the cloud is a set of cheap, unreliable resources. Your solution has to be built to keep running when the resources fail, and have a scalable architecture that can utilize additional resources as they are added.


答: For the consumer version of the cloud -- that is some take on "My content lives in the sky and can rain down to any device by magic" -- the key driver was cheap, ubiquitous bandwidth, both wireline and wireless. None of the other technologies involved matter a lick if you can't get your data anywhere anytime.</p>


答: Personally, I always have Sopranos episodes running in the background or on the screen beside me, its always great when you hit a road block to just tune in for a few minutes to clear your head with some Paulie Walnuts!</p>

Title: Stuff every programmer needs while working

Body:
I've been tasked with creating a fun and relaxing environment, one thing I know that I want is ergonomic mice and keyboards, others have suggested exercise balls and bands.

What is it that every programmer needs while working? What might not be necessary but would be nice to have anyway?

Note: this question was asked previously, but has been recommended to be posted here. See this link for the previous responses: https://stackoverflow.com/questions/3911911/stuff-every-programmer-needs-while-working-closed


问:
What are the key points of Working Effectively with Legacy Code?
I've seen the book Working Effectively with Legacy Code recommended a few times.  What are the key points of this book?

Is there much more to dealing with legacy code than adding unit/integration tests and then refactoring?

答:
Quick ways to get the key points of Working Effectively With Legacy Code

Read Michael Feathers' 12-page PDF, written 2 years before the book.

Look at Michael Feathers' presentation: 68 slides

Listen to a podcast interview with Michael Feathers. E.g. this 30-minute Hanselminutes episode.


问:
Are there any resources on how to identify problems that could best be solved with templates?
I decided to improve my knowledge in template meta-programming. I know the syntax and rules and been playing with counteless examples from online resources.

I understand how powerful templates can be and how much compile time optimization they can provide but I still cant "think in templates", I can't seem to know by myself if a certain problem could be best solved with templates and if it can, how to adapt that problem to templates.

Is there some kind of online resource or book that teaches how to identify problems that could best be solved with templates and how to adapt that problem?

答:
Books:

Modern C++ design

C++ Template Metaprogramming

Being familiar with recursion and functional programming is a huge plus, as that's what a lot of tmp involves. It's turing complete and so essentially anything is possible, although usually it boils down to applying pure functions to constants or generating types from other types.

Warning: tmp is an ugly monster that turns nice code into spaghetti. The more you use it the less you will like C++. It is an evil thing.


答:
Learn Haskell or some other pure functional language (Lisp, Scheme, OCaml to name a few, you can find more on Wikipedia).

Considering Haskell, you can find more information about it's metaprogramming facilities here.

Template programming follow much the same rules actually.

Title: Are there any resources on how to identify problems that could best be solved with templates?

Body:
I decided to improve my knowledge in template meta-programming. I know the syntax and rules and been playing with counteless examples from online resources.

I understand how powerful templates can be and how much compile time optimization they can provide but I still cant "think in templates", I can't seem to know by myself if a certain problem could be best solved with templates and if it can, how to adapt that problem to templates.

Is there some kind of online resource or book that teaches how to identify problems that could best be solved with templates and how to adapt that problem?


答: Just because you can do something with templates doesn't mean you should.  Practically speaking unless when you are designing you think this is an awesome job for templates, its probably better to not use them. if you think too much in templates you just create insanely abstracted code that is just as bad as a single giant function.</p>


答:
You might look at Practices for programming in a scientific environment? (on Stack Overflow) to get some idea of what the programming culture of the natural sciences looks like. That way you're in a position to compare his preparation to that of his peers.

For that matter, you might ask him to describe the programming practices he's used to in order to learn if he is aware that there are other ways to do it.

There are a lot of "good programmers" in my business whose qualification is being able to hold enough state in their head to cobble together some working code, but whose work tends to be un-structured and hard to maintain. Generally they can be taught, but...they have to be taught.


答:
You should definitely look into templates in C++! This will greatly help you to understand topics like Design Patterns and Generic Programming. Do compare them with what other languages offer you. In precise you should use templates particularly in the following scenarios:

Generalization & Code Reuse

Flexibility

Time & Budget Constraints

Lack of expertise for a certain task

Here is a good online resource for you: http://en.wikipedia.org/wiki/Generic_programming#Templates_in_C.2B.2B


问:
How does a website like Mathway work?
I recently found a website called Mathway

Basically, it works by allowing you to choose your "level of math" (which it uses to determine what tools it should provide to you) and then allows you to input a math problem which it then solves for you, and gives you detailed solutions (you have to try it, it's really cool).

I was wondering how it worked on two levels. First off, how would they parse the math problem (and all the sometimes foreign mathematical operators)? How do they get from text to numbers, variables, and operators?

Second, how do they generate the explanations? While you have to pay for the detailed solutions (which are explanations of how they solved the problem), I've seen their preview screenshots, and it looks very detailed. The explanations are given in full, accurate sentences. How would they generate something like that?

答: As far as I know, Macsyma was the first system for automatically performing symbolic math.       That would be a good place to start your research.</p>

Title: How does a website like Mathway work?


答:
No software in the world can work all by itself until and unless it receives inputs from the user or another system. Once inputs are received, then they are processed into a form that is acceptable by the processor to process them further for the desired output. For example, data types are converted in other data types which we refer as casting. This is the answer to your question: How do they get from text to numbers, variables, and operators?

Also there is something what we call functional decomposition or stepwise refinement when analysing a certain complex process in programming. I would advise you to use the website further , jot down individual features, simplify them by breaking them up further and then research on those bits and pieces.

For performing Maths calculations, there are built-in maths libraries available for the said purpose. Also look into operator overloading. Have you ever tried adding two complex numbers in C++?

Title: How does a website like Mathway work?

Body:
I recently found a website called Mathway

Basically, it works by allowing you to choose your "level of math" (which it uses to determine what tools it should provide to you) and then allows you to input a math problem which it then solves for you, and gives you detailed solutions (you have to try it, it's really cool).

I was wondering how it worked on two levels. First off, how would they parse the math problem (and all the sometimes foreign mathematical operators)? How do they get from text to numbers, variables, and operators?

Second, how do they generate the explanations? While you have to pay for the detailed solutions (which are explanations of how they solved the problem), I've seen their preview screenshots, and it looks very detailed. The explanations are given in full, accurate sentences. How would they generate something like that?


问:
What should go in atom:author for autogenerated content in an Atom feed?
I've recently started digging into Atom syndication feeds and are planning to migrate some web services we're running into an more standardized model using Atom Syndication and the Atom Publishing Protocol.

The content of most of the syndication feeds are not created by a concrete user though, but rather auto-generated using data from various databases. I'm probably just a little stuck my head right now, but I simply can't decide what should go in the mandatory atom:author fields.

The spec states:

```<code>A Person construct is an element that describes a person,
corporation, or similar entity(...)
</code>```

So should the author field contain the name of our company, the developer(s) who wrote/maintain the generator, or something completely else? What would be the most semantically correct?

答:
Given the Copyright Work for Hire rule, your company would be the most logical, and possibly legally required choice.

You may want to consider extending it with the name of the system producing the content such as MY_COOL_COMPANY - BOILER_TEMPS_FEED_CREATOR.  That way if multiple systems run to the same feed you'll know where specifically the content comes from.


答:
Keep in mind that templates being the best solution is very rare.  I've only defined my own once in the last 5 years, and my peers that reviewed that code had never done it.  The cases where templates make a lot of sense have mostly already been implemented in standard libraries.

For generic programming, the thing to look out for is that you are copying and pasting functions to make only minor changes, like in constants or types, and can't figure out a clean way to use something like inheritance or function parameters to avoid repeating yourself.

One fairly common way templates are used is for type safety, if you have types that behave the same, but for whatever reason you don't want them accidentally mixed up.

For compile time calculation using templates, the thing to look out for is resource-intensive calculations where all its inputs are known at compile time, but where different constant inputs are used in different places throughout the code.  However, keep in mind this will slow down your compiles every single time, so often it is preferable to just hard code the results manually, if they don't change very often.

Some advocates use templates for micro-optimizations like avoiding virtual table lookups using static polymorphism, or for loop unrolling, but in my opinion the complexity usually outweighs performance gains unless your code is very performance-critical.


答:
Basically, there are several good reasons to use templates :

You have a function or a class that has the same functionality for different types. Good example of good templates use is the boost library

you want to use static polymorphism, and get compile errors, instead of run-time errors

you want to get a specific behavior depending on some static parameters. For example, boost::type_traits provides very good examples.


答:
A simple indicator of when a template would improve your code, is when you see that your code is frequently requiring you to cast an object to a different type.  An example I found in my own Java code, which triggered me to convert an existing method signature to a template:

```<code>    public MsgBase getLastSentMessage(Class<? extends MsgBase> msgBaseClass)
</code>```

My client code always looked like this:

```<code>    OrderResponse response = (OrderResponse) getLastSentMessage(OrderResponse.class);
</code>```

and whenever I used that method, I had to cast the result to the correct subclass of the MsgBase type.  The improved method signature was:

```<code>    public <T extends MsgBase> T getLastSentMessage(Class<T> clazz)
</code>```

Now the client code was:

```<code>     OrderResponse response = getLastSentMessage(OrderResponse.class);
</code>```

So to summarize, if you find yourself doing a lot of casting which seems unnecessary, you may have a good case where a template will clean up your code.

Update: a better way to generalize the above statement:

When your source class will be used by objects of many different types, and the source class can interact with those types at a higher (more abstract) level, but your client classes want to interact with specific subtypes, that is a case for using templates. (Container/List classes being the well-known example).

Body:
A simple indicator of when a template would improve your code, is when you see that your code is frequently requiring you to cast an object to a different type.  An example I found in my own Java code, which triggered me to convert an existing method signature to a template:

    public MsgBase getLastSentMessage(Class<? extends MsgBase> msgBaseClass)

My client code always looked like this:

    OrderResponse response = (OrderResponse) getLastSentMessage(OrderResponse.class);

and whenever I used that method, I had to cast the result to the correct subclass of the MsgBase type.  The improved method signature was:

    public <T extends MsgBase> T getLastSentMessage(Class<T> clazz)

Now the client code was:

     OrderResponse response = getLastSentMessage(OrderResponse.class);

So to summarize, if you find yourself doing a lot of casting which seems unnecessary, you may have a good case where a template will clean up your code.

Update: a better way to generalize the above statement:

When your source class will be used by objects of many different types, and the source class can interact with those types at a higher (more abstract) level, but your client classes want to interact with specific subtypes, that is a case for using templates. (Container/List classes being the well-known example).


答:
It first breaks it into tokens using a lexer.  In an expression like 3 + 5, the tokens are 3, +, and 5.  Those tokens are fed into a parser, which knows the context and the relationships between all the tokens, and can call the appropriate functions.

For example, when the parser encounters the expression 3 + 5, it sees the + token and looks up in a table that says it should call a function named add with the tokens of 3 and 5 as arguments, which does the math and returns an 8.

If you don't want to evaluate an expression, but maybe want to solve an equation, the add function will do something different.  For example, in the equation x + 5 = 8, the add function might follow the rules we learned in algebra and subtract 5 from the right hand side.

As for generating the explanations, as part of the add function, it simply records what it is doing:  "Subtract 5 from the right hand side."  The computer has to take those steps in order, so writing it out in English isn't that much additional work.

Add a few thousand much more complex "add" functions and voilà, you have Mathway.  Obviously, that's a vast oversimplification, but that's what computer science courses are for.

Title: How does a website like Mathway work?


问:
iOS Guidelines for Free vs. Paid apps
A few months back, I was doing some recreational reading at the iOS Dev Center, and I came across a small list of guidelines for free vs. paid apps. It included guidance along these lines:

How not to promote a paid version within a free version

Not displaying "placeholder" buttons in a free version that "work" in a paid version

I can't remember much more than that, and I cannot find it anymore on the iOS Dev Center. It's possible I imagined it entirely, but I doubt it - does anyone have a link to this information, or have a set of guidelines for free vs. paid apps in the App Store?

答:
You will find quite a few apps on the app store that do not quite follow those rules, especially games. The second point has been addressed by in app purchases.

The list you seem to be looking for is:
https://developer.apple.com/appstore/resources/submission/tips.html

(You click on the right side of the iOS Dev Centre homepage, on Prepare for App Submission, and then on the left on the Tips section, just for your interest)

Title: iOS Guidelines for Free vs. Paid apps


问:
Good, simple reasons for having multiple environments
Throughout my career I had worked at companies that had a collection of different environments for different purposes. We always had more or less our desktop environment, a test environment, a QA environment, a staging environment and a production environment. This went for both servers/applications and any data sources we were using.

When I started at my current company I found that 90% of the apps were either developed on a desktop environment against production data sources or developed directly on the production server depending on the platform. This wasn't particularly surprising, as I was hired in part to make changes to improve the way the development team functioned, which was clear from my interview process. We slowly started to turn the philosophy and pretty soon, most of the apps could be run in either a desktop, test or production environment. Not too long after that staging came around as well.

Now most of our developers see the benefit of this methodology and defend it vigilantly. However, we have a number of legacy apps that never got migrated. We also have a number of legacy programmers who think of this as a waste of time. Unfortunately, we got lip service but never full buy-in from management. We got what we thought was a commitment to invest substantially in this about a year ago, but nothing materialized despite the considerable planning that we put into it. Now we are finding that we need more and more environments. We need help from the server/network administration teams for setup and we need participation from the business stakeholders to support the release cycle. We are at a place now where a project can function what reasonable developers would consider "normally" only if you have the right people on the project and the time to set up the proper environments.

I'd love to present a complete argument, but management really has no time and interest in hearing me out until there is a critical issue. I can't really articulate the benefits simply as it always just seemed second nature to me. I was wondering if there are any good, simple, irrefutable reasons for the separation of environments that would get managers lacking development experience to support this idea?. Are there any good resources/literature on the topic?

答:
Here's one:  testability.

Having a testing environment gives you the freedom to perform tests on a database that would be inadvisable to perform in a production environment.


问:
Does this list of management behaviors actually appeal to software developers?
I came across this list of management behaviors (http://suven.posterous.com/dos-and-donts-leading-software-development-te).

I think it has some gems, but I'm not 100% on some of them. I've marked those ones with italics and my name.

Do you, as a software developer, think that these are appealing? Which three would be your TOP "gotta have 'em" items from your management?

Don't

Don't scale teams vertically by adding more people

Don't create a team with more that 10 people

Don't call people resources, its not cool and is really offensive

Don't assume that people in teams are interchangeable

Don't compare teams to each other when highlighting weaknesses

Don't pitch teams against each other

Don't create fake deadlines

Don't force standardisation of tools and processes across teams (I think this one can be argued for some situations - Todd)

Don't hire product managers who don't have a clue about software development

Don't exclusively use KPI's to drive your teams (Not only is it ineffective, but developers will find ways to drive the KPI metrics - "You want lines of code? I've got your lines of code!" - Todd)

Don't force your teams to work overtime, even asking is bound to create tension

Don't assume that double the people equals half the time

Do

Do scale horizontally by creating more teams of about 5-8 people

Do have a vision for the product and team

Do appreciate that every team is different, so allocate projects appropriately

Do motivate your teams (Wow - that is one slippery, hard-to-define one. I agree with the sentiment, but it's like saying "Be effective" with no guidelines. -Todd)

Do allow people to move between teams

Do have sessions to discuss the product vision, strategy, technology and process

Do involve the team when determining the team/product name

Do allow your teams to make their own decisions especially if they are the ones with the expertise

Do involve your team on any decision that impacts how or what they work on

Do encourage a development methodology that matches the team and the project

Do pay attention to every individual's personal development plan

答:
My guess is this list actually appeals to software developers because it validates their self-image as pampered creative divas rather than hard-as-nails problem-solvers (a là Winston Wolf) and expect to be treated professionally as a result.

I also suspect if we improved software development techniques to the point where our trade was certifiable like that of architects, lawyers, medical professionals and the like, we would be better able to direct how software developers are managed.


答:
It sounds like you have all the "right" arguments already in place.  Instead, you are experiencing a "red-herring", if you will.  Or, "chasing the carrot"

management really has no time and interest in hearing me out until
  there is a critical issue

That's what I consider to be the real problem.  In my experience, if a company has sub-par development practices as poor as you describe.  It's not simply a matter of "we didn't know any better".  Rather, its a compilation of technical debt caused by an upper management team that doesn't know (care?) about the problems it presents.

In such cases, a good pep-talk is not going to suddenly swing things your direction.  Maybe a severe trauma (product failure visible to client and directly tied to poor practices), but I'm sure sane savvy techies before you have tried the talk thing.

My suggestion is to either suck it up and take things for what they are or look for a new position.

Title: Good, simple reasons for having multiple environments

Body:
Throughout my career I had worked at companies that had a collection of different environments for different purposes. We always had more or less our desktop environment, a test environment, a QA environment, a staging environment and a production environment. This went for both servers/applications and any data sources we were using.

When I started at my current company I found that 90% of the apps were either developed on a desktop environment against production data sources or developed directly on the production server depending on the platform. This wasn't particularly surprising, as I was hired in part to make changes to improve the way the development team functioned, which was clear from my interview process. We slowly started to turn the philosophy and pretty soon, most of the apps could be run in either a desktop, test or production environment. Not too long after that staging came around as well.

Now most of our developers see the benefit of this methodology and defend it vigilantly. However, we have a number of legacy apps that never got migrated. We also have a number of legacy programmers who think of this as a waste of time. Unfortunately, we got lip service but never full buy-in from management. We got what we thought was a commitment to invest substantially in this about a year ago, but nothing materialized despite the considerable planning that we put into it. Now we are finding that we need more and more environments. We need help from the server/network administration teams for setup and we need participation from the business stakeholders to support the release cycle. We are at a place now where a project can function what reasonable developers would consider "normally" only if you have the right people on the project and the time to set up the proper environments.

I'd love to present a complete argument, but management really has no time and interest in hearing me out until there is a critical issue. I can't really articulate the benefits simply as it always just seemed second nature to me. I was wondering if there are any good, simple, irrefutable reasons for the separation of environments that would get managers lacking development experience to support this idea?. Are there any good resources/literature on the topic?


答:
How many groups of people plan to be working on the app at a time? Usuaslly I've seen one environment for each group of people. This is the Developers (they get a DEV environment and a DEV Integration environment - some would say not 100% necessary, I'd say it varies by project), two testing environments (one group of testers doing very detailed testing, the other for high-level QA testers - usually they are actual business users, not trained testers). There is also usually an isolated Performance testing environment (so you can test huge volumes of data, simulate huge volumes of users, etc... g).

Why all these environments? So different groups can test different features without stepping on each others' toes. If developers and testers work in the same environment, it's a nightmare: a tester can open a defect on a feature that is actively being changed every minute by a developer. If there are two levels of testing, they can focus on different activity and not worry about messing up each other's data. Having an isolated performance environment allows you to run tests which may hang the machine, but if it's isolated, no other testers will be impacted.

When too many people try to do too many different things in the same environment, you end up with a lot of wasted time as one group waits for another group's test to finish so they can run theirs. And that wastes time, and wasted time can lead to wasted money, which Stargazer712 pointed out could make the strongest arugment.

Another reason (not as common) is data: if your application has sensitive personal data or credit card data, you usually cannot put that into test environments, and there is usually masking requirements for everything except the QA and Production environments.


答:
The answer: Money

I don't care what the actual reason is. Money MUST be at the root of all of your reasoning, especially when dealing with management.

If we both sat in a room for 2 hours, we could come up with dozens of reasons why it is better to have multiple environments.

Here's the problem: If the reasons are not based on money, then none of them matter.

Programmers are not hired to be smart. They're not hired to be creative. They're hired to increase revenue -- either by earning money or saving money. If you're not doing either one of those, you'd better get your resume together.

When looking at it from that standpoint, the answer is simple:

Having only one environment increases our downtime and results in
  lost revenue. Multiple environments allows us to protect our profits
  by giving our users a front-end that is just as reliable and
  dependable as our company.

Repeat it every day.

There are some great comments below that add some real value to this answer, so I'll mention them:

Karl Bielefeldt had a great point when he mentioned that Cost/Benefit analysis is an important factor. An economist might refer to it as the opportunity cost of pursuing multiple environments. While it may be surprising to hear, there are scenarios where multiple environments may not be the answer! If the website of your company is a very minor addition, then unexpected downtime may actually be the more cost effective way of doing business. This doesn't sound like the position you are in, but it is worth mentioning.

BlairHippo had a good point in that you should feel free to make it seem like a catastrophe (and if you lose your data, it is!). Liability is a great tool for persuading managers, but still for the same reason--lawsuits are expensive. Avoiding them saves money.

As an addendum, I found this article to be quite good. It doesn't directly answer your question, but enables you to recognize how programmers are viewed to management, which in turn, leads to this answer. Good read.


答:
Single Point of Failure

By not having a development or staging environment you have a Single Point of Failure for those legacy applications. Management will hear you if you describe the legacy applications in those terms.

You need to be able to pitch your message in sound bytes that makes sense to them. Take the "Programmer Speak" out of the discussion and replace it with "Manager Speak". Also pretend you have a 30 second elevator ride to get your point accross.

I had a situation where my boss was an Infantry Marine. I kept telling him I needed software tools and computer training for my Marines in order to be more productive. He didn't get it. I finally went into his office one day and told him things were f'd up.

I said something to the effect... "If I was fighting a war I'd be using sticks, rocks and tree branches. What I need are grenades, bazookas and machine guns." He got the message.


问:
Is it bad to join open-source projects as an amateur?
I've thought for about six months now that I should join an open-source iPhone or iPad project to hone my skills in Objective-C, but every time I go to do it I see thousands of lines of code on huge projects that I end up convincing myself I would never understand. I always think that my commits would just end up being a hassle for project admins and more senior contributors, so I always back out at the last second.

My question essentially is, is it a hassle when an intermediately-experienced programmer joins an open-source project?

答:
Go for it.  There's tons of beginners doing the same.  The project lead can help find you things to work on that aren't out of your league.  You gradually grow into the rest.

Oh, and just because you don't understand the code doesn't mean it's good.  I've seen some seriously horrible code out there.  Some of it's hard to understand because it's poorly written and made to be much more complex than it should be.