问:
Usage of Pirated software at a company
I started to work at a company as an engineer a couple of months ago. It's a small company and what they basically do is answering service on phones. Now they are switching from normal phones to IP phones so that computers take more important place in the work.

However, all the computers used by workers are equipped with pirated software, including their operating systems. Moreover, they didn't even buy one license to make copies for other computers. In other words, they did not spend any money for the software in office. I am not saying copying a licensed one is legit, but the situation is too much.

There is one guy who installed the pirated software. He does not feel any sense of guilt and even justified when I asked about it. He is not even a specialist. He just searched on the internet to install pirated software. Our boss does not have any knowledge of computers, so he took the cheaper way.

What do you think about this? Since I am still new to the company, I am not doing maintenance on those cracked computers. But I have to use those software daily. And later on I will be doing support, help desk kind of stuff. I really don't want to take responsibility for operating pirated software. From an aspect of developer and engineer, pirated software is not able to get legal support and it may work unexpectedly. So, I am thinking about changing jobs.

Am I thinking too much? Should I wait until I have more credibility with the boss and try to change his policy? So far, the boss does not take any words from me. Any opinions are welcome. Thank you

答:
I would and have raised issues like this.  I don't think quitting is the answer, its not helping the situation.

Best thing to do is to educate.  There are free alternatives to practically every software out there.

Raise the point that you feel uncomfortable working with pirate software at a regular basis and highlight the alternatives.  Start with Office being swapped for LibreOffice, highlight the penalties for getting caught, plus keep it casual, non-threatening and non-judgemental over anybody already in the organisation.

The other thing is to lead by example and switch as much as you can on your computer as a proof of concept.

Title: Usage of Pirated software at a company


答:
If you don't contact some authority and report this, you are as guilty as they are. You don't even have to give your name. You obviously know this is wrong.

If you're an open source advocate, get your company to switch.

ContentLicense: CC BY-SA 2.5

Title: Usage of Pirated software at a company

Body:
I started to work at a company as an engineer a couple of months ago. It's a small company and what they basically do is answering service on phones. Now they are switching from normal phones to IP phones so that computers take more important place in the work.

However, all the computers used by workers are equipped with pirated software, including their operating systems. Moreover, they didn't even buy one license to make copies for other computers. In other words, they did not spend any money for the software in office. I am not saying copying a licensed one is legit, but the situation is too much.

There is one guy who installed the pirated software. He does not feel any sense of guilt and even justified when I asked about it. He is not even a specialist. He just searched on the internet to install pirated software. Our boss does not have any knowledge of computers, so he took the cheaper way.

What do you think about this? Since I am still new to the company, I am not doing maintenance on those cracked computers. But I have to use those software daily. And later on I will be doing support, help desk kind of stuff. I really don't want to take responsibility for operating pirated software. From an aspect of developer and engineer, pirated software is not able to get legal support and it may work unexpectedly. So, I am thinking about changing jobs.

Am I thinking too much? Should I wait until I have more credibility with the boss and try to change his policy? So far, the boss does not take any words from me. Any opinions are welcome. Thank you

ContentLicense: CC BY-SA 3.0


问:
Scrum Sprint Optimization
Looking for a systematic method for estimating and comparing the success factors of sprint configurations based on:

Team Size

Sprint Duration

Number of Stories

答:
Scrum is a simple "inspect and adapt" framework, not a methodology.

Team Size, Sprint Duration and the rest should be adapted to your particular case. You adapt it by constantly inspect your processes thanks to retrospectives and reviews.

Title: Scrum Sprint Optimization


答:
You, as an individual, must be the one who decides if something is ethical or not. But keep in mind that it might not just be about the kind of work that you do, or getting support, or things working/not working as intended. It's about being able to go home at the end of the day and sleep at night.

However, the Software Engineering Code of Ethics and Professional Practice provides some rather clear guidance:

Software engineers shall act in a manner that is in the best interests
  of their client and employer, consistent with the public interest. In
  particular, software engineers shall, as appropriate:

2.02. Not knowingly use software that is obtained or retained either illegally or unethically.

Personally, I'd not only quit, but I'd turn them in to the appropriate authorities as well.

Title: Usage of Pirated software at a company


问:
Will Java still be relevant in 5 years?
Will Java have the same importance it had in the past, or it will be less relevant than nowadays?</p>

答:
I suspect all languages eventually go through a phase where pundits will say "[Language] is the COBOL of the [insert decade here]".   </p>

<p>Java has become a standard tool, exclusively or one of the main tools, in a number of areas of software development.  Its VM is popular as a platform upon which to build new languages.   It'll be around way too long just from its massive inertia even as newer better languages become popular.  </p>

Title: Will Java still be relevant in 5 years?

Body:
I suspect all languages eventually go through a phase where pundits will say "[Language] is the COBOL of the [insert decade here]".

Java has become a standard tool, exclusively or one of the main tools, in a number of areas of software development.  Its VM is popular as a platform upon which to build new languages.   It'll be around way too long just from its massive inertia even as newer better languages become popular.


问:
Do TODO comments make sense?
I am working on a fairly big project and got the task to do some translations for it. There were tons of labels that haven't been translated and while I was digging through the code I found this little piece of code

```<code>//TODO translations
</code>```

This made me think about the sense of these comments to yourself (and others?) because I got the feeling that most developers after they get a certain piece of code done and it does what it's supposed to do they never look at this until they have to maintain it or add new functionality. So that this TODO will be lost for a long time.

Does it make sense to write this comments or should they be written on a whiteboard/paper/something else where they remain in the focus of developers?

答: IntelliJ will actually alert you if you try to commit code that has new TODOs. So, you can always interpret a TODO as "this really should happen by the time I commit".</p>

Title: Do TODO comments make sense?


问:
What is the best way to evaluate new programmers?
What is the best way to evaluate the best candidates to get a new job (talking merely in terms of programming skills)?  In my company we have had a lot of bad experiences with people who have good grades but do not have real programming skills.  Their skills are merely like code monkeys, without the ability to analyze the problems and find solutions.

More things that I have to note:

The education system in my country sucks--really sucks.  The
people that are good in this kind of job are good because they have talent for it
or really try to learn on their own.

The university / graduate /post-grad degree doesn't mean necessarily that you know exactly how to do the things.

Certifications also mean nothing here because the people in charge of the certification course also don't have skills (or are in low paying jobs).

We need really to get the good candidates that are flexible and don't have mechanical thinking (because this type of people by experience have a low performance).

We are in a government institution and the people that are candidates don't necessarily come from outside, but we have the possibility to accept or not any candidates until we find the correct one.

答:
Start with giving them FizzBuzz to solve. That should weed out the worst of them.

Then something a bit harder - for example, how to reverse a string without built in library functions. Ask them to talk while solving in order to see what their thought process is.

You can keep giving harder problems if they find these very easy, until you are convinced they can walk the walk and not just talk the talk.

ContentLicense: CC BY-SA 4.0


答:
It would be best if you embraced the idea of continuous improvement.

As far as team size goes, Scrum calls for a team size of no more than 11 people, with up to 9 people on the Development Team. There are some roles that you need to fill, as well. You're going to need a Scrum Master who is not part of the development team, a Product Owner who can be the voice of the customer and maintain the product backlog, and you're going to need at least one or two developers, so there's a team of 3-4 people right there. Depending on the project and teams involved, you might need some other people - graphic designers, usability experts, system administrators, quality specialists, marketing and sales - who might not be integrated with the development team.

For the number of stories per sprint, this will normalize over time. Prioritize your backlog, then take what your team considers a reasonable number of stories from the product backlog for the sprint backlog. After your first sprint, you have a velocity that can be used to compute the number of stories for future sprints. Compute your velocity using story points finished, the sprint's duration, and your human resource utilization. As people leave or are added to the team, you adjust your sprint length, or people have their time split between multiple projects, pick the number of stories appropriately. Address issues during your sprint retrospectives.

The Scrum Guide says that sprints are less than 1 month in length and are measured in weeks. 2-3 weeks are typical. If that doesn't work for you, adjust. Be sure to plan your sprint accordingly, in terms of available resources over the course of the sprint, the duration, and previous velocities.

Title: Scrum Sprint Optimization

Body:
Looking for a systematic method for estimating and comparing the success factors of sprint configurations based on:

Team Size

Sprint Duration

Number of Stories


问:
How can I learn practical applications of software engineering principles?
I'm having problems bringing the software engineering I learned in school into my projects at my job.

The patterns are all easy enough to apply, but coming up with architectures and general class structures is tough for me. It's so open ended and I never know how to approach my projects, with the exception of any project that cleanly fits the MVC architecture.

I've been working on some increasingly larger projects. The end product works because I know testing well, but getting there is hell and going back to add features is worse. My work usually degrades into planning from the applications entry point and thinking through the use cases. This works eventually, but I end up with low cohesion and tightly coupled code. I had enough experience coming out of school to start in a job with more responsibilities than entry level programmers, so I don't have the benefits of learning from a more experienced team.

The problem is I'm very inefficient. My boss said once that if I get these projects out faster and with the same level of testing I can make more.

So I have to teach myself software engineering. I've read a lot of books, but they are a little too abstract; I need something concrete. Where should I go to learn real project software engineering?

EDIT:
It may help to know that I sometimes end up with clean code. It either just takes me a really long time to get there, or I give up and hack it cause I know it will work. Most people will say this comes with experience, but there must be some place I can go that says: if your project is like this this and this, try these architectures.

答:
I had enough experience coming out of school to start as a Sr. level programmer (after all, a lot of older sr. level programmers don't know this stuff), so I don't have the benefits of learning from a more experienced team.

I completely and wholeheartedly disagree with what's being said here.  The exact problem you're describing is one in which you just need experience.  You may be a talented developer, you may have a lot of modern and updated skills, but "senior level" is a measure of experience.

The problem is I'm very inefficient.

This is because you're relatively new to the trade.  Nobody comes out of school as an expert.  There are things you can't learn in school and can learn only from years of experience.  You're going to write some bad code along the way.  We all do.  You're going to learn those lessons.  This is fine.  Having learned those lessons is what makes a developer "senior level."

For example, take a look at the industry-accepted design patterns in the gang of four book.  These weren't written as an academic exercise.  They weren't written because the people who wrote them were smarter than other developers.  They were written because people spent years in the industry solving problems and improving their craft, eventually arriving at re-usable patterns.

You have to go through the same thing.  There's a lot of industry knowledge already laid out that you can learn, but don't expect to be an expert right away.  Skill takes time.

OwnerDisplayName: brandon

OwnerDisplayName: David


问:
Do you keep DONE stories in the physical product backlog?
We have our Product Backlog as a physical Kanban board with TODO & DONE column.

Some of the stories are moving from the TODO column to the Sprint backlog during our planning, and then during the Sprint review back in the Product Backlog in the DONE column for the one which we completed.

I was wondering if keeping history of DONE stories on the wall was intresting at all. It's starting to take up space Sprints after Sprints and I can't see any value from it for now.

答:
You should only have your sprint backlog on the board and not your full product backlog.

I personnaly keep a certain amount of Done stories until I'm out of space, and after that I archived them (if I'm using an electronic board) or put them on each other if I use a physical dashboard.

I use those cards in my hands at the review and retrospective.


答:
Give them a problem, preferably one associated with the problem domain they'll be working on, and ask them to discuss how they would approach it. You can have them just discuss, pseudo-code or write bits of actual code depending on how confident you are in their skill level

For example, if your organization did conferences, ask them to outline how they would code a secure online registration system. They should be able to cover some of the basics and ask good questions about exactly what needs to be implemented. As you interact, you should be able to determine if they'll be a good fit for your organization and the role you need them to fill.

I'm not a big fan of programming trivia tests and brain teasers. While they can be fun for some people, they can also annoy and/or stress out other people, including people who might just be the best fit for your team. Plus, info on many such tests are readily available online and will encourage cramming for the tests and other tactics that would blunt their viability to gauge programmer ability.

Title: What is the best way to evaluate new programmers?

Body:
What is the best way to evaluate the best candidates to get a new job (talking merely in terms of programming skills)?  In my company we have had a lot of bad experiences with people who have good grades but do not have real programming skills.  Their skills are merely like code monkeys, without the ability to analyze the problems and find solutions.

More things that I have to note:

The education system in my country sucks--really sucks.  The
people that are good in this kind of job are good because they have talent for it
or really try to learn on their own.

The university / graduate /post-grad degree doesn't mean necessarily that you know exactly how to do the things.

Certifications also mean nothing here because the people in charge of the certification course also don't have skills (or are in low paying jobs).

We need really to get the good candidates that are flexible and don't have mechanical thinking (because this type of people by experience have a low performance).

We are in a government institution and the people that are candidates don't necessarily come from outside, but we have the possibility to accept or not any candidates until we find the correct one.


答:
Buy a book.

Patterns of Enterprise Application Architecture.

You might also want to start using the Seperated Interface Pattern together with an inversion of control container since it forces you to decouple your code.

Working against interfaces also makes unit tests a lot easier and to refactor parts of your code.

Title: How can I learn practical applications of software engineering principles?

Body:
I'm having problems bringing the software engineering I learned in school into my projects at my job.

The patterns are all easy enough to apply, but coming up with architectures and general class structures is tough for me. It's so open ended and I never know how to approach my projects, with the exception of any project that cleanly fits the MVC architecture.

I've been working on some increasingly larger projects. The end product works because I know testing well, but getting there is hell and going back to add features is worse. My work usually degrades into planning from the applications entry point and thinking through the use cases. This works eventually, but I end up with low cohesion and tightly coupled code. I had enough experience coming out of school to start in a job with more responsibilities than entry level programmers, so I don't have the benefits of learning from a more experienced team.

The problem is I'm very inefficient. My boss said once that if I get these projects out faster and with the same level of testing I can make more.

So I have to teach myself software engineering. I've read a lot of books, but they are a little too abstract; I need something concrete. Where should I go to learn real project software engineering?

EDIT:
It may help to know that I sometimes end up with clean code. It either just takes me a really long time to get there, or I give up and hack it cause I know it will work. Most people will say this comes with experience, but there must be some place I can go that says: if your project is like this this and this, try these architectures.


答:
Just look for passion about the job.

To quote Joel, look for people who are "Smart, and get things done."

The rest doesn't matter


答:
Regarding candidate selection, I usually go with a three-strike plan :

Regular test with FizzBuzz-like coding questions and many knowledge questions where they have to give coded examples. Depending on the position, it can be OO principles, SQL design principles, etc. I increment the difficulties of questions across the test to see how far they can go. The idea is not really to have all the questions answered (if they do, the better), but also to see if they can acknowledge when they don't know something. Trust is essential, and I don't want to have someone lying to me in my team.

Return on the test with the candidate, and discussion around the answers. Possible extension of the questions to reach the candidate's limits. This can be extensive, and the more extensive it is, the better.

Last part but not the least, The Code Review. I ask the candidate to bring a piece of code (I generally space the previous test/discussion and this review by a few days, to let them write and polish one piece of code). Then we do a regular code review of it with two people : one person that will directly work with the candidate and the person that reviewed the test with the candidate previously. Regarding the code review you can read this article from JohnFX.

At the end of all this, you should be able to decide if you want this candidate to be part of your team or not.


答: Try to go Lean here. If keeping the DONE stories past the completion of a given sprint is taking up space on the wall and not adding any value, it's a waste and it's time to make a process improvement. I'd hesitate to just throw them away until you are sure you don't need them, but I'd consider archiving them, either physically or electronically. That way, if you need to consult or refer to the stories, you have the information. In the future, if you don't use this archive, then you can talk about the next step of getting rid of the archive.</p>

Title: Do you keep DONE stories in the physical product backlog?

Body:
We have our Product Backlog as a physical Kanban board with TODO & DONE column.

Some of the stories are moving from the TODO column to the Sprint backlog during our planning, and then during the Sprint review back in the Product Backlog in the DONE column for the one which we completed.

I was wondering if keeping history of DONE stories on the wall was intresting at all. It's starting to take up space Sprints after Sprints and I can't see any value from it for now.


答:
I had enough experience coming out of school to start as a Sr. level programmer

I am not sure if this is your ego running away with your common sense or if you are just being naive?  Maybe both.  Learning academic principles is completely different than actually living through a situation where a good process clearly helped you or the team or an anti-pattern cost you dearly.  You realistically don't know and can't claim to be an expert at anything.

My boss, being pretty savvy, knew this and hired me in between entry level and sr level pay

This sounds terribly conceited... please consider revising this.

Where should I go to learn real project software engineering?

Your there.  Real software engineering isn't anything like what you experienced in Academia, it is the process of engineering software in conformance with good practices, standards and quality to solve real world problems.

This does not include pontification on the pro's and con's of Djikstras algorithm for a few milliseconds of performance, nor other various academic forms of mental masturbation.  You need to learn through direct experience what things work, what things don't work, and what can be done with limited resources and time.


问:
How can you use an LGPLv2.1 licenced AS3 library in a proprietary Flex app without "giving away the farm"?
Consider a Flex (actually AIR) application that is considered proprietary, but needs to use an LGPLv2.1 AS3 library, so that it is considered a "work that uses the Library" according to the license text and is thus required to be distributed according to the terms of Section 6 of the LGPL. What provision in AS3 or Flex is there for using a "suitable shared library mechanism" (Section 6b) to create the executable to use the library, allowing the end user to replace the library (somehow) and debug the new lib's use, thus not requiring that all the source for the proprietary app to be supplied (Section 6a,c,d,e) for recompiling/relinking?

I've already had a false start with RSL's, because replacing the RSL causes "Flex Error #1001: Digest mismatch with RSL".

答:
One way around this would be to provide your program in SWC form, along with a Makefile and a pointer to the Flex SDK tools. The user is then free to link up a new version of your program with a different SWC for the LGPL'd library you want to use.

Bottom line, whatever way you choose, the primary freedom you need to preserve to comply with the LGPL is that of your users to swap in new versions of the LGPL'd library at any time of their choosing. It sounds like RSLs can't do what you want, and your users don't get the freedom they were promised by the LGPL'd library's copyright holder with any solution involving your server. (e.g. You can't just let users upload a .swc for you to relink into their special hosted version of your Flex app, since that puts your users at your mercy: if your server breaks or you go away, your users' ability to take advantage of their promised freedom under the LGPL also goes away.) You either have to give your end users the freedom to relink the program themselves, or don't use LGPL'd code.

Maybe this sounds unfair to you, but this is exactly the sort of thing the library's copyright holder had in mind when he chose the LGPL.

You might be worried about how this impacts security, but I assure you that the fully-compiled and optimized Flex .swf sitting on your web server is just as easily disassembled as a pile of .swc files. If you're worried about people stealing your stuff, you shouldn't be using Flash at all. Compiled Flash files are scarcely more secure against prying eyes than obfuscated Javascript.

OwnerDisplayName: Warren Young


答:
In my industry, developers are encouraged to make JIRA (or etc) entries instead of todo comments because not everybody gets a chance to see the // todo entries.  But sometimes in large projects a custom attribute gets defined along the lines of:

```<code>[AttributeUsageAttribute(AttributeTargets.All, AllowMultiple = true)]
public class DeveloperNote : Attribute
{
    public DateTime EntryDate { get; set; }
    public string Description { get; set; }
    public DeveloperNote(int year, int month, int day, string desc)
    {
        EntryDate = new DateTime(year, month, day);
        Description = desc;
    }
}
</code>```

And then a method can be decorated in this way...

```<code>[DeveloperNote(2011, 12, 13, "Make the db connection configurable")]
</code>```

And the higher ups can come along and harvest these automatically.  It may be overkill for the simple // todo reminder, but it's effective.  Also it requires a .NET platform.

Title: Do TODO comments make sense?

Body:
I am working on a fairly big project and got the task to do some translations for it. There were tons of labels that haven't been translated and while I was digging through the code I found this little piece of code

```<code>//TODO translations
</code>```

This made me think about the sense of these comments to yourself (and others?) because I got the feeling that most developers after they get a certain piece of code done and it does what it's supposed to do they never look at this until they have to maintain it or add new functionality. So that this TODO will be lost for a long time.

Does it make sense to write this comments or should they be written on a whiteboard/paper/something else where they remain in the focus of developers?

Body:
In my industry, developers are encouraged to make JIRA (or etc) entries instead of todo comments because not everybody gets a chance to see the // todo entries.  But sometimes in large projects a custom attribute gets defined along the lines of:

[AttributeUsageAttribute(AttributeTargets.All, AllowMultiple = true)]
public class DeveloperNote : Attribute
{
    public DateTime EntryDate { get; set; }
    public string Description { get; set; }
    public DeveloperNote(int year, int month, int day, string desc)
    {
        EntryDate = new DateTime(year, month, day);
        Description = desc;
    }
}

And then a method can be decorated in this way...

[DeveloperNote(2011, 12, 13, "Make the db connection configurable")]

And the higher ups can come along and harvest these automatically.  It may be overkill for the simple // todo reminder, but it's effective.  Also it requires a .NET platform.


问:
Differences between Design by Contract and Defensive Programming
Could Designing by Contract (DbC) be a way to program defensively?

Is one way of programming better in some cases than the other?

答:
Design by Contract and defensive programming are in some sense opposites of each other: in DbC, you define contracts between collaborators and you program under the assumption that the collaborators honor their contracts. In defensive programming, you program under the assumption that your collaborators violate their contracts.

A real square root routine written in DbC style would state in its contract that you aren't allowed to pass in a negative number and then simply assume that it can never encounter a negative number. A real square root routine written defensively would assume that it is passed a negative number and take appropriate precautions.

Note: it is of course possible that in DbC someone else will check the contract. In Eiffel, for example, the contract system would check for a negative number at runtime and throw an appropriate exception. In Spec#, the theorem prover would check for negative numbers at compile time and fail the build, if it can't prove that the routine will never get passed a negative number. The difference is that the programmer doesn't make this check.


问:
How to deal with people who don't want to share knowledge?

Possible Duplicate:

  How do you deal with an information hoarder?

Often, in IT teams knowledge equals power. This is fine as long as (IT-)knowledge is equally accessible by all members of the team and company specific know-how is well documented. Sometimes personnel in an IT department build up a tremendous amount of know-how without documenting it. By doing so they think that they ensure their position. Often these people like it when people specifically have to ask them how to do a job.

How do you get these programmers, database administrators or other IT staff to DOCUMENT their work and make it accessible to the company they work for?

EDIT:
It's a relief that so many of you know this type of person. That it is not me bumping into them everywhere I do projects. On the other hand it makes me sad, such talented people but in many ways behaving as a child. I have seen the behavior in men and women btw. It is hard to pick one answer as the best and accept. Will do after more re-reads.

答:
Ask Them Repeatedly and Nicely.

If that doesn't work most likely nothing will.

They will give you excuses, explaining why they cant, or don't have time. Even if you debunk them excuse they still wont do because that was just an excuse. the'll come up with 6 more while slowly getting angry and aggressive.) It is also likely to make things worse.

For example : If he says "I've too much other work to do", So you take some of his responsibilities away, and give to someone else to free up his time. This will only further threaten his job and he will tighten him up more and become somewhat disgruntled. The docs will not get done

So just have someone else figure it out and document it. If someone else can't, the code is shit and needs to be re-written anyhow. Then make sure this person is never in a position to blackmail the company again.


答:
When you consider the "TODO" as a semantic label for your comment I think they do make sense.

In my company's coding standards, we specify that the initials of the developer responsible must be included with the TODO (i.e., I would type "SAA TODO:").  I think this is useful, at least as a convention, because otherwise there is the temptation for leaving substandard code with the TODO note for some future developer to deal with.

Helpfully, many IDEs can be configured to add these comments to a task list, allowing them to be treated similarly to build wrnings and not forgotten indefinitely.

Title: Do TODO comments make sense?


答:
I'm primary a .NET developer, although I do work with other languages (including Java) as needed to get the task at hand. As such, based upon my own experience working with the language, I don't think it's going away anytime soon, here's why:

Current Install Base - There are enough programs out there that are going to need long term support that there is a reason for new developers to learn the language.

Use in the Academic Setting - Most colleges and universities are using as one of their introductory languages to teach OOP and other fundamental concepts, this means that there will continue to be new developers graduating and entering the workforce that will be familiar with the language when they get started.

It's Cross-Platform Nature - An obvious one, but the fact that it is cross-platform is a big deal, even more so as smart phones at support for Java to new devices. The prospect of only having to maintain one code base, but being able to deploy (i.e. sell) apps for multiple platforms is going to be a bit deal. Can you imagine if iOS and Droid both supported apps written in Java?

No Strong Competitor - At this point in time I can't name a language that I consider a strong competitor to Java. Sure C# is starting to show up on more platforms thanks to Mono, but that's not quite the same as having the same cross platform that Java has. Granted there are a number of languages that do what Java does (and it some cases better) they tend to be tailored to what they are doing and for some large projects it doesn't make sense to have a ton of languages to maintain if you can accept any performance hit that Java might have.

Title: Will Java still be relevant in 5 years?

Body: Will Java have the same importance it had in the past, or it will be less relevant than nowadays?</p>


问:
What's the point of camel-case-navigation?
I heavily use CTRL+ to jump between tokens in code (the _s are the navigation points):

```<code>_fooBar _+ _barFoo_;
</code>```

Some editors, like the one in the current version of QtCreator, have (by default or optionally) camel case navigation, which goes like this:

```<code>_foo_Bar _+ _bar_Foo_;
</code>```

What is the rationale behind this? I remember some people back in school saying "cool" and "fancy", but is that the whole story? I do not think it is cool, I find it very annoying actually.

答:
I would say it's a matter of personal choice, I do work with both settings, in home and in work, and I must say, that altough I think I prefer whole word jumping (1st example), 2nd one sometimes is convenient. From time to time I tent to have longer variable names, for example when I name maps<> or Dictionaries<>: fooBarByZar. when I want to c&p substring from this name, or jump to a word I am interested in changing, for example - renaming, it's easy to do with 2nd setting, especially when ctrl+short will not only jump 1 "subword" but also select it for copying.

Btw. the best things are simple. Simple things can be useful and complicated ones can just get into your way, so implementation simplicity is not something a feature should be judged for in my opinion.


答:
Professionals who value this kind of work ethic should not be hired in the first place, but it might be hard to figure this out during an interview.

If a company already has a professional like this, they should be encouraged to be more transparent by having them work as part of a team. They should never be allowed to work alone. A team setting naturally forces people to be more transparent because you often have to collaborate on problems and/or explain things to your peers. The bad part is... this kind of professional will make anybody's life a nightmare since they will fight to the nail to give the others the least amount of information possible. Best to let them go if they refuse to collaborate.

Title: How to deal with people who don't want to share knowledge?

Body:
Possible Duplicate:

  How do you deal with an information hoarder?

Often, in IT teams knowledge equals power. This is fine as long as (IT-)knowledge is equally accessible by all members of the team and company specific know-how is well documented. Sometimes personnel in an IT department build up a tremendous amount of know-how without documenting it. By doing so they think that they ensure their position. Often these people like it when people specifically have to ask them how to do a job.

How do you get these programmers, database administrators or other IT staff to DOCUMENT their work and make it accessible to the company they work for?

EDIT:
It's a relief that so many of you know this type of person. That it is not me bumping into them everywhere I do projects. On the other hand it makes me sad, such talented people but in many ways behaving as a child. I have seen the behavior in men and women btw. It is hard to pick one answer as the best and accept. Will do after more re-reads.


答:
Information wants to be free

Sometimes they do it for job security, sometimes they do it because they are perfectionists and the thought of somebody else possibly making a mistake frightens them.  Sometimes they just like to have power over others.

Sometimes it is legitimate... certain knowledge might be considered sensitive, or knowledge about how to do something relatively simple can expose that person to sensitive information.  Eg.

HIPAA protected data

Sensitive client data

FBI and other law enforcement databases

Military, CIA or other government data only obtainable with a security clearance.

Don't be so quick to judge, that DBA may purposely be doing you a favor by keeping you ignorant or unable to do certain things.


答:
I think there great, but not alone. For example:

```<code>//TODO: ADD MY CLICK EVENT LOGIC
throw new Exception();
//Even a simple messageBox could suffice
</code>```

This approach works pretty nice sparingly. Although I would have to say that making it a habit of throwing exceptions to remind you to complete some code is not really the most professional approach. But it has saved me in some cases where you think you completed something and even wrote down you completed when you haven't.

Title: Do TODO comments make sense?

Body:
I think there great, but not alone. For example:

//TODO: ADD MY CLICK EVENT LOGIC
throw new Exception();
//Even a simple messageBox could suffice

This approach works pretty nice sparingly. Although I would have to say that making it a habit of throwing exceptions to remind you to complete some code is not really the most professional approach. But it has saved me in some cases where you think you completed something and even wrote down you completed when you haven't.


答:
Could Designing by Contract (DbC) be a way to program defensively?

Yes.

"Defensive Programming" is often an excuse to waste time.  It often wastes time checking for things that will cause ordinary exceptions.  Instead of the exceptions, extra IF statements are written instead of exception-handling clauses.

Define the contract and be done with it.

When someone violates the contract, the program will -- in the normal course of events -- break and raise normal exceptions which can be normally  handled.

"Defensive programming" and "Error prevention" can be shown to add errors (because the error prevention checks are themselves erroneous) rather than prevent errors.

Exception handling can silence, log and handle an exception far better than "Defensive Programming".

Title: Differences between Design by Contract and Defensive Programming

Body:
Could Designing by Contract (DbC) be a way to program defensively?

Is one way of programming better in some cases than the other?


答:
In my experience, there are two types of people who keep information. I like to think of them as the knowledge gatekeepers and the information hoarders.

Knowledge gatekeepers are people who have been with the company for a long while and have experience on many mission critical paths. I find that these people are super busy b/c of that experience.

I find that these people need time. They don't document the information they know b/c they don't have the time to do it. They don't sit down and teach others b/c it takes them less time to do it themselves.

If this is the case you need to work with them when they have the time. Make sure you write down everything and ask them to double check your understanding either via email or company wiki or something fast that they can look over and leave their feedback. If you are in a position of power, give them some time each week to start documenting things and training others.

The information hoarders have a 'saving my job' type of mentality. Getting information from those people is like pulling teeth. Any information that I was able to get out of them, I documented. Any information I was able to figure out on my own, I documented. It's slow going, but in the end you are saving yourself and anyone after you from going through it again.


问:
Are there any studies on the Efficiency/Effectiveness of Agile vs Waterfall
In a meeting the other day a claim was made that agile was only 60% as efficient in development time when compared to waterfall.  I am not looking to validate or refute this claim.  I am interesting in finding out if there have been any studies comparing the 2 methodologies.

Are there any studies out there comparing the two?

答:
As much as I dislike the title, I believe that Balancing Agility and Discipline: A Guide for the Perplexed might contain some information that is relevant to you. This book by two software engineering process and software project management experts - Barry Boehm and Richard Turner. This book looks at various aspects of the agile and plan-driven methodologies, compares and contrasts them, and also discusses integrating them to achieve a "best of both worlds" situation.

Appendix E of Balancing Agility and Discipline contains a wealth of empirical information regarding the costs and benefits of various agile and plan-driven methods. However, there doesn't appear to be any data regarding time effectiveness. But glancing through the data, it appears (as I suspected) that this isn't an either/or choice - some projects experienced decreased effort, faster schedules, and lower defects when applying agile methods. However, other projects that used. The section discusses a number of different projects in different industries, the type of process they used, and what they experienced over the course of the project.

There are plenty of case studies cited in Appendix E that yields this data. There are far too many for me to just start naming randomly, since many are focused in a particular industry or even within a particular organization. If you are going to look at cases, I would suggest finding those that are similar in nature to your team, project, organization, and industry to draw reasonably valid conclusions.

In Rapid Development: Taming Wild Software Schedules, Steve McConnell identifies a number of factors to consider when choosing a lifecycle methodology: level of understanding of the requirements, level of understanding of the architecture, desired reliability, risk management, schedule constraints, amount of process overhead, mid-project "course corrections", ability to provide the customer with visibility, ability to provide management with visibility, and sophistication of the development team and management. There are others, as well, such as organizational culture, so there probably isn't an exhaustive list anywhere.

Even given the exact same project, there is also the team factor. If you take a team that has consistantly delivered software using the plan-driven spiral methodology and throw them into Scrum, they are going to experience a decrease in productivity, an increase in thrashing, and have to overcome a new process model before they can come around to being successful. Even though another methodology might be more suited, there's always the business need to actually deliver the software. That's why process improvement efforts are frequently long-term efforts and not overnight - major changes are shocking to a team and (even if the methodology might be better suited on paper) can cause a decrease in productivity.

There's a lot more than simply effeciency or effectiveness of the process, and you can't simply look at a snapshot of the same team working in a plan-driven environment and an agile environment. You need to consider the industrial and organizational context, the attributes of the project, the team, the customer, and so on when making a decision.

Based on what I read, I'm going to have to disagree with your coworkers assessment. I'm sure that you can find some case study somewhere where an agile project was 60% less efficient with regards to some performance metric than a similar plan-driven project. However, there are also studies that show that agile yields 80% less effort, 50% less time, and high customer satisfaction with the product.


答:
agile was only 60% as efficient in development time

True.

But, that's a lame measurement.

Agile methods usually deliver real value sooner.

Waterfall simply sticks to a schedule irrespective of what's delivered and often delivers nothing of value until a huge span of time has been passed.

Further.

You can measure "development time" separate from "development and test time".

Agile usually includes testing.  So it seems slower.

Waterfall development can be cleanly separated from testing.  So code is "ready to test" sooner.  But isn't "done" until much later.

So.  They're totally right.  For what they measured.

Title: Are there any studies on the Efficiency/Effectiveness of Agile vs Waterfall

Body:
In a meeting the other day a claim was made that agile was only 60% as efficient in development time when compared to waterfall.  I am not looking to validate or refute this claim.  I am interesting in finding out if there have been any studies comparing the 2 methodologies.

Are there any studies out there comparing the two?


问:
Will I ever be able to code client-side browser code in a language of my choice?
I'll be brutally honest: I hate writing client side code in JavaScript. I'm not a fan of this language, to say the least.

It seems silly to me that browsers support a programming language, rather than an intermediate virtual machine (like CIL or JVM). The latter would allow programmers to write in a language of their choice (to some extent), rather than in one fixed pre-set language. This language could evolve more rapidly, because only changes to the CIL/JVM/whatever would require every major browser to upgrade. Language features could be added without affecting old browser experience.

The massive savings of effort that intermediate langauges bring about are well known. Are there any initiatives out there to promote browser "scripting" in something other than JavaScript, and especially in an already designed, developed and optimized virtual machine? Do they have any momentum?

答:
"Any customer can have a car painted any colour that he wants so long
  as it is black."   -- Henry Ford

There are already a number of compilers that target javascript, and you can pick any language that compiles to javascript.

Your link discussing the value of intermediate languages discusses them in the context of implementing a compiler suite, not in providing code that will be shipped across a network and run on a client machine. Javascript may not be the best format for that, but whatever is, it won't look much like CIL or java bytecodes.

If you hate javascript, I suggest you move into the Embedded, Scientific, or game development space, where C, Fortran, and C++ rule the roost. Line of business apps are very much moving to the web, and that means more Javascript, not less.


问:
Is there any good reason why lines with only whitespace should be truncated?
Typically, when you hit Enter in a smart editor, it copies the indentation of the last line by inserting the same amount of spaces, so if you don't delete them, the code looks like this:

```
sub sum {
    my @numbers = @_;
   &nbsp
    my $sum = 0;
    foreach (@_) {
         $sum += $_;
    }
   &nbsp
    return $sum;
}
```

(Yes, the example is silly; that sub could be written in two or three lines. :))

To be honest, these lines make my cursor feel dizzy, so I tend to clear them out. (I admit, that this behavior generates commit noise + inconsistency.)  Plus, the whitespace are unnecessary bytes.  Well, probably none of these does matter, at least in most obvious ways.  So I wonder if there is any better (i.e. less subjective and less over-pedantic) reason why the lines should be blanked (by s/^\s+$//).

Note: And please try not to point me to the style guide. Imagine I'm the one writing the style guide: should I inherit rule "delete the extra spaces" or just bravely fight my intuition and leave those peaceful \t's and 's alone?.  Or I just want to improve my "own" guide, which I can use where "official" guide is silent or missing.

答: In general, whitespace formatting (and style guides) serve the developers by making code easier to read. If you're the only developer, then the style that makes code easier for YOU to read is the right one. Any rules put in place are highly personal and subjective - there's no definitive right or wrong answer.</p>


问:
Techniques to re-factor garbage and maintain sanity?
So I'm sitting down to a nice bowl of c# spaghetti, and need to add something or remove something... but I have challenges everywhere from functions passing arguments that doesn't make sense, someone who doesn't understand data structures abusing strings, redundant variables, some comments are red-hearings, internationalization is on a per-every-output-level, SQL doesn't use any kind of DBAL, database connections are left open everywhere...

Are there any tools or techniques I can use to at least keep track of the "functional integrity" of the code (meaning my "improvements" don't break it), or a resource online with common "bad patterns" that explains a good way to transition code? I'm basically looking for a guidebook on how to spin straw into gold.

Here's some samples from the same 500 line function:

```<code>protected void DoSave(bool cIsPostBack) {
  //ALWAYS  a cPostBack
  cIsPostBack = true;
  SetPostBack("1");
  string inCreate ="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
  parseValues = new string []{"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""};

  if (!cIsPostBack) { //.......
  //....
  //....
  if (!cIsPostBack) {

  } else {

  }
  //....
  //....
  strHPhone = StringFormat(s1.Trim());
  s1 = parseValues[18].Replace(encStr," ");
  strWPhone = StringFormat(s1.Trim());
  s1 = parseValues[11].Replace(encStr," ");
  strWExt = StringFormat(s1.Trim());
  s1 = parseValues[21].Replace(encStr," ");
  strMPhone = StringFormat(s1.Trim());
  s1 = parseValues[19].Replace(encStr," ");
  //(hundreds of lines of this)
  //....
  //....
  SQL = "...... lots of SQL .... ";

  SqlCommand curCommand;

  curCommand = new SqlCommand();
  curCommand.Connection = conn1;

  curCommand.CommandText = SQL;
  try {
    curCommand.ExecuteNonQuery();
  } catch {}
  //....
}
</code>```

I've never had to refactor something like this before, and I want to know if there's something like a guidebook or knowledgebase on how to do this sort of thing, finding common bad patterns and offering the best solutions to repair them. I don't want to just nuke it from orbit,

答: In my past experience, iteratively defining areas of functionality and extracting the relevant code into methods/functions will be the fastest way for you to get started. You can then extract code, put that code into a function, and then test to confirm that you haven't broken anything. Rinse and repeat until you're done or until you have to add new functionality. Refactoring iteratively will provide more flexibility by allowing you to take occasional breaks from refactoring, especially if you still need/want to add new code. Psychologically, an iterative approach will give you the satisfaction of seeing your codebase become more ordered, which will make it easier for you to complete this refactoring task.</p>


答:
That's not what refactoring is. Refactoring is breaking a piece of code down into its component parts (factors) in a way that improves code reuse and readability.

To improve terrible code is rewriting. So the question is how do you go about rewriting a whole application of bad code. The answer is that you start from scratch. Rewriting piecemeal is far more difficult and in the long run it will actually take longer to do properly.

Title: Techniques to re-factor garbage and maintain sanity?

Body:
So I'm sitting down to a nice bowl of c# spaghetti, and need to add something or remove something... but I have challenges everywhere from functions passing arguments that doesn't make sense, someone who doesn't understand data structures abusing strings, redundant variables, some comments are red-hearings, internationalization is on a per-every-output-level, SQL doesn't use any kind of DBAL, database connections are left open everywhere...

Are there any tools or techniques I can use to at least keep track of the "functional integrity" of the code (meaning my "improvements" don't break it), or a resource online with common "bad patterns" that explains a good way to transition code? I'm basically looking for a guidebook on how to spin straw into gold.

Here's some samples from the same 500 line function:

```<code>protected void DoSave(bool cIsPostBack) {
  //ALWAYS  a cPostBack
  cIsPostBack = true;
  SetPostBack("1");
  string inCreate ="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~";
  parseValues = new string []{"","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""};

  if (!cIsPostBack) { //.......
  //....
  //....
  if (!cIsPostBack) {

  } else {

  }
  //....
  //....
  strHPhone = StringFormat(s1.Trim());
  s1 = parseValues[18].Replace(encStr," ");
  strWPhone = StringFormat(s1.Trim());
  s1 = parseValues[11].Replace(encStr," ");
  strWExt = StringFormat(s1.Trim());
  s1 = parseValues[21].Replace(encStr," ");
  strMPhone = StringFormat(s1.Trim());
  s1 = parseValues[19].Replace(encStr," ");
  //(hundreds of lines of this)
  //....
  //....
  SQL = "...... lots of SQL .... ";

  SqlCommand curCommand;

  curCommand = new SqlCommand();
  curCommand.Connection = conn1;

  curCommand.CommandText = SQL;
  try {
    curCommand.ExecuteNonQuery();
  } catch {}
  //....
}
</code>```

I've never had to refactor something like this before, and I want to know if there's something like a guidebook or knowledgebase on how to do this sort of thing, finding common bad patterns and offering the best solutions to repair them. I don't want to just nuke it from orbit,


答:
You haven't said for which language, but it is fairly easy to test someone's knowledge. It also depends on the level you are looking, but there is a fairly large pool of questions regarding the interview questions.

However you decide to hold your interview, don't asks those "lateral-thinking puzzle" interview questions.


答:
I would do something like the following:

Wrap as much of your code into classes as you can, grouping it by functionality, but leaving it otherwise untouched for now. This will allow you to triage your code.

Create a database layer using PDO.

Convert your code to the MVC pattern, taking special care to weed out any PHP code that is needlessly generating HTML and transferring that to the view. Your controllers should determine which model and which view to load, and your models should contain everything else.

Refactor your remaining classes, one by one. Tackle the most pervasive classes first. Look for classes that do multiple things and split them up. Get rid of repeated code. Make single responsibility methods.

Add unit tests as you go along. This will make your code more stable over the long-haul. If you need to refactor it again in the future, you will then have a contract that specifies how the code is supposed to perform. PHPUnit is one test framework that you can use, but there are others as well.


答: I would start by covering as much of your code with automated tests as you can.  It might be boring and tedious, but it lets you capture the current behavior of your system.  Then, as you iteratively clean things up and rewrite/refactor parts of your codebase, you can feel more confident about not introducing a ton of regressions.  You will also hopefully be able to introduce finer grained tests then you could before.  This has always helped me in the past.</p>


答:
OK, most of the answers and comments are addressing to whether or not you should remove the blank lines... but I see from the question and the regex that what you are really referring to is truncating lines which contain ONLY whitespace to just blank lines.

For example (\t tab and \n newline characters added for clarity):

```<code>foo(){\n
\t  int blah\n
\t  \n
\t  blah = 0;\n
\t  \n
\t  return blah;\n
}\n
</code>```

would be stripped to:

```<code>foo(){\n
\t  int blah\n
\n
\t  blah = 0;\n
\n
\t  return blah;\n
}\n
</code>```

I personally leave in those extra tabs.  Let's say I am on line 2 and decide to go down to line 3 and add some code.  The cursor will already be in the right place.  While hitting enter on line 2 would create a new line with the appropriate indent, I may not be at the end of the line when I want to go down to the next one and add something, so I would prefer to down arrow rather than [End][Enter].

But maybe that's just my habit.

Title: Is there any good reason why lines with only whitespace should be truncated?

Body:
Typically, when you hit Enter in a smart editor, it copies the indentation of the last line by inserting the same amount of spaces, so if you don't delete them, the code looks like this:

```
sub sum {
    my @numbers = @_;
   &nbsp
    my $sum = 0;
    foreach (@_) {
         $sum += $_;
    }
   &nbsp
    return $sum;
}
```

(Yes, the example is silly; that sub could be written in two or three lines. :))

To be honest, these lines make my cursor feel dizzy, so I tend to clear them out. (I admit, that this behavior generates commit noise + inconsistency.)  Plus, the whitespace are unnecessary bytes.  Well, probably none of these does matter, at least in most obvious ways.  So I wonder if there is any better (i.e. less subjective and less over-pedantic) reason why the lines should be blanked (by s/^\s+$//).

Note: And please try not to point me to the style guide. Imagine I'm the one writing the style guide: should I inherit rule "delete the extra spaces" or just bravely fight my intuition and leave those peaceful \t's and 's alone?.  Or I just want to improve my "own" guide, which I can use where "official" guide is silent or missing.

Body:
OK, most of the answers and comments are addressing to whether or not you should remove the blank lines... but I see from the question and the regex that what you are really referring to is truncating lines which contain ONLY whitespace to just blank lines.

For example (\t tab and \n newline characters added for clarity):

foo(){\n
\t  int blah\n
\t  \n
\t  blah = 0;\n
\t  \n
\t  return blah;\n
}\n

would be stripped to:

foo(){\n
\t  int blah\n
\n
\t  blah = 0;\n
\n
\t  return blah;\n
}\n

I personally leave in those extra tabs.  Let's say I am on line 2 and decide to go down to line 3 and add some code.  The cursor will already be in the right place.  While hitting enter on line 2 would create a new line with the appropriate indent, I may not be at the end of the line when I want to go down to the next one and add something, so I would prefer to down arrow rather than [End][Enter].

But maybe that's just my habit.


答:
The candidates must be given a real world problem to solve with the freedom to use any technology.

If she comes out in flying colors, she's In !


答:
I don't have a study but I'd like to communicate my experience.

The effectiveness of any of the mentioned methodologies highly depends on the analysts.

When you've got a great product owner, then SCRUM for example is certainly faster than a waterfall approach with a bad spec.

Agile with a bad product owner is certainly slower than waterfall with a great specification.

However, more often than not, we don't know the exact requirements early enough and agile methodologies have faster feedback cycles. This means, that in uncertain terrain agile is a better method to deliver a high quality product within reasonable costs. There're numerous other advantages, for example, agile projects are easier to cancel when they don't work out and thus can reduce loss to a minimum.

One could say that agile methodologies reduce risk, while waterfall, even if it may be faster sometimes, can be quite a monetary gamble.


答:
The book "Making Software: What Really Works and Why we Believe It" has some chapters on Agile methods including XP, Scrum, Dynamic Software Development, and Lean, with good scientific backing. It's high quality, as you would expect from O'Reilly.  One of the editors was the excellent Greg Wilson, a trusted computer science author, editor and presenter.

The book itself summarizes multiple research studies, including many on agile.  One section summarizes research including "Are Two Heads Better Than One? On the Effectiveness of Pair Programming" by Dybå, T.;   Arisholm, E.;   Sjøberg, D.I.K.;   Hannay, J.E.;   Shull, F.; and "Empirical Studies of agile software development: A systematic review" by Tore Dybå and Torgeir Dingsøyr.

The general sense is that most agile practices are beneficial, but that the effects of pair programming and TDD and other agile tenants are not as strong as one might hope. There's even a disturbing footnote that TDD may in fact be somewhat addictive*.

The book is a great way to get access to a lot of research that's been done, all in one cohesive whole.  There are a few blogs and other sites on the web that review the book.

*This isn't necessarily my opinion!


问:
How does the license work for the LGPL open source framework?
Without knowing anything I wrote a big application, almost 1 year coding.

It does Video/Audio such as softphone for commercial use (we sell it). I used a framework which was licensed under the LGPL, lesser Gnu Public License.  Now before I release it to production, since I used the H.264 video codec and a 'LGPL' framework, what should I know and what should I do? Or I do not need to do anything? This is my employer releasing and selling the application, I just did my job making the application and getting it to run without crashing.

Do I need to apply for a license to court? Or do I apply for license to the framework programmers? How do I make myself valid before I let it go to my company management.

Follow up:

H.264 Encoder has GPL license

H.264 Decoder has LGPL license

Where do i buy encoder license? http://www.x264licensing.com/features

Where do i buy decoder license? http://www.mpegla.com/main/programs/AVC/Pages/AgreementExpress.aspx

How much does it cost me license? http://www.zdnet.com/blog/bott/h264-patents-how-much-do-they-really-cost/2122

答:
1) If you're in a country where software patents are upheld, your company is required to pay licensing royalties for the use of the H.264 codec since you are a commercial user.

2) If you used a framework that was licensed under the LGPL, then it depends on how you used it. If you developed a module, or a library, or a plugin that the framework uses, then I believe you're good and don't have to do anything. If you have modified the framework itself and used that as a base for this application, then you are required to freely share the source-code for your derived work. (Which would make it hard to sell.)


问:
Alternatives to pulling updates off the website
So, I think it look pretty bad when you release an update and pull it off the web.  I'm pretty sure this has happened for at least two of the the last three Delphi XE2 updates.  I'm not complaining because I'd do (and have done) the same thing.

The only problem is, how do you do this gracefully?  And, how do you alert the 10-20 facilities ( 500-2000 end users ) who downloaded your awful software that what they downloaded is no good, but what they're going to download is super awesome?

The reason I ask it is because I work for a small business, Embarcadero is a big(ger) business and we do the exact same dumb thing when our release is found to be deficient.  The problems might be as simple as a file missing or even a legal problem, the code might be perfect and there still might be problems with the app.

答:
Well, the alternative is to not put it up on the web in the first place, by not releasing untested software. Your automated testing should catch "stupid" mistakes like replacing all your select statements with delete statements, and it just shouldn't get that far without at least some smoke testing.

But if it gets out the door, I don't really see any alternative to pulling it down, communicating to your customers that they should roll back to the previous release, and publishing a fixed (and fully-tested) release ASAP.


答:
If you're ok with being a bit manipulative, when they ask for more than two days off in a row, tell them that their special knowledge is too valuable for them to be away from the company that long. If they want to take more than two consecutive days off, they have to prep other memebers of the team to cover for them. This gives them a positive reason (getting time off) to distribute the knowledge. Also they have an incentive to give QUALITY information because they know if things go wrong while they're gone, that's the end of their chances of having three or more days off in a row ever again.

Of course there are many ways this could backfire so use with caution and only with the most diehard information hoarders. And be sure it doesn't violate company policy.


答: Code reviews. I don't believe that code reviews should ever be used punitively, but I do think that they can be an effective way to get someone to explain the work that they've done. Someone who refuses to use other means to share what they know should expect to find themselves in the hot seat more often than someone who clearly documents what they've done, or who willingly explains things when asked.


问:
How can I retain knowledge about new technologies I don't use every day?
At work we mostly do WinForms development and it’s not a secret that it is already very outdated. I have a passion to learn new stuff like WPF, MVVM and want to use full advantages of C# 4.0. There is no way I can push my bosses to change “well-recommended” and “proven” technologies like WinForms to something else.

I have up to two hours a day which I can dedicate to self-learning but I simply don’t know the most efficient way to study. I tried to read couple of books and even wrote a simple WPF application but think that it’s not enough.

How can I manage my time learning new things in a way that sticks, even if I don't use it on a daily basis?

答:
The big picture idea here is to learn by emphasizing coding rather than reading whole books at a time before coding.
Then capture that coding so that you can go back to study what you did, how you did it, and explain all that.

So here's a plethora of proposals:

Configure a personally-owned computer as dedicated development
machine

Locally Source control all your experimentation

whether on your personal machine or at-work machine.

version (or tag, whatever) as you go along so you can later review the evolution of your changes

Extensively comment in-line. Even "obvious" things.

This is for future review and quick re-learning so be verbose

documenting separate from your code is futile in the end.

"Code Kata" - research this concept on the internet.

Borrows the martial arts idea of repetitious practice and applies it to coding.

Learn by teaching

"If you want to learn something, teach it" - a time-tested truism.

Create your own on-line blog.

Write up things you're learning as if you're teaching someone else.

Originality is not a prerequisite. We don't care if 10,000 others have explained your subject here. This is for you in words you
understand.


答:
Evaluating programming intelligence is a form of Turing Test.  Thus there are (currently) no closed form evaluation procedures that are guaranteed to work.  It takes intelligent programmers to recognize other intelligent programmers, but only with some reasonable probability.

Your chances will be better if you have interviewers on your team who can smell snow jobs, and instinctively dislike working with stupid people (even the ones who are good looking, have impressive looking resumes, and can spout all the usual canned solutions from memory).

(One possibility methodology that would help the quality of stackoverflow as a side-effect is to dig up old stackoverflow questions, related in some way to your job requirements but that in your opinion have inferior answers; ask the interviewee how they would answer, and have them post it if it's a good answer.  Similar to a recapcha for crowd-sourced OCR.)


答: Generally we have found it more successful to release an update to the update and flog that rather than pull the thing down. Pulling things down typically generates bad press and consternation. Multiple updates just make people think you are cool like google.</p>

Title: Alternatives to pulling updates off the website

Body:
So, I think it look pretty bad when you release an update and pull it off the web.  I'm pretty sure this has happened for at least two of the the last three Delphi XE2 updates.  I'm not complaining because I'd do (and have done) the same thing.

The only problem is, how do you do this gracefully?  And, how do you alert the 10-20 facilities ( 500-2000 end users ) who downloaded your awful software that what they downloaded is no good, but what they're going to download is super awesome?

The reason I ask it is because I work for a small business, Embarcadero is a big(ger) business and we do the exact same dumb thing when our release is found to be deficient.  The problems might be as simple as a file missing or even a legal problem, the code might be perfect and there still might be problems with the app.


答: Depending on the type of work that your team does, one effective approach to information hoarders is to provide an incentive for them to provide good information & documentation. One way is to prevent hoarders from rolling off of their current projects into new projects. They're effectively "stuck" until they share their knowledge. This approach may not work in teams that are in maintenance mode, but for teams that frequently develop new initiatives or enhancements, the inability to work on new stuff may be sufficient incentive for some hoarders. </p>


答: 10-20 people? Why not manually distribute a beta to 10, 20 people and then get their feedback before going online?</p>


答:
I don't know anything about H.264 licensing, but Philip addresses that point.

On the LGPL side though, if your application uses an LGPL library, then you must make the source code to that library available for download, if you include the binary of the library in your application download. If you have made any enhancements to the library, then the source code to those enhancements must be made available. This is the simple bit.

Next is the tricky subject of derivation or aggregation. If you statically link a GPL library to your application then you are producing a derived product and so your product must be licensed as LGPL or under a compatible license (such as GPL).

If you dynamically link the LGPL library to your application, then you are aggregating, so your application may have whatever license you wish. The tricky point here is that it should be possible for anyone to compile their own version of the library, substitute your dynamically linked library with their own and for your application to use that library as if it were the one you originally supplied.

The question Can I legally incorporate GPL & LGPL, open-sourced software in a proprietary, closed-source project? has a few answers which touch on some of these things, but I think the answers by Dark Shikari, Jonathan Mitchell and Mark Bessey are the most relevant.

Title: How does the license work for the LGPL open source framework?

Body:
Without knowing anything I wrote a big application, almost 1 year coding.

It does Video/Audio such as softphone for commercial use (we sell it). I used a framework which was licensed under the LGPL, lesser Gnu Public License.  Now before I release it to production, since I used the H.264 video codec and a 'LGPL' framework, what should I know and what should I do? Or I do not need to do anything? This is my employer releasing and selling the application, I just did my job making the application and getting it to run without crashing.

Do I need to apply for a license to court? Or do I apply for license to the framework programmers? How do I make myself valid before I let it go to my company management.

Follow up:

H.264 Encoder has GPL license

H.264 Decoder has LGPL license

Where do i buy encoder license? http://www.x264licensing.com/features

Where do i buy decoder license? http://www.mpegla.com/main/programs/AVC/Pages/AgreementExpress.aspx

How much does it cost me license? http://www.zdnet.com/blog/bott/h264-patents-how-much-do-they-really-cost/2122


答:
The axiom that you're looking for to describe this is:

Knowledge shared is power lost.

It can be hugely difficult, if not impossible, to overcome.

Asking nicely (and perhaps sweetening the pot financially) is one method. Rotating responsibilities across team members is another (though this isn't always a workable proposition).

One (somewhat expensive) method is to hire a junior developer for the same area as a knowledge-hoarder, and make them responsible (with HR/financial repercussions/incentives) for developing that team member's knowledge of systems. Make documentation one of the junior developer's responsibilities. I've seen this approach work before.

The last-resort method is simply letting them go, and taking the hit that comes with that. Obviously, this should only be used in the most extreme cases, as it runs the risk of being a case of cutting off your your own nose to spite your face.

I guess my overall advice would be to make sharing knowledge more attractive than not sharing knowledge.


问:
What's the best way to learn the MS Business Intelligence stack?
What's the best/easiest way to get into the MS BI stack on my own (preferably with a [kindle] book)?  Specifically, I'd like to learn more about SSIS, SSRS, and SSAS in that order.  I've tried looking at books on amazon, but I really have no idea.

Some background:  I just graduated with my bachelor's in computer science, and am going back for my masters in comp sci.  I work right now as a C# developer, with some web and database background.  I don't necessarily want to become a BI master, but I'd like to gain an intermediate-level understanding of the platform.

答:
There are multiple aspects to the Microsoft BI stack. You have Reporting Services (useful for building dashboards and structured reports over data), Analysis Services (for creating cubes), and PowerPivot (let's you slice and dice data on the fly) to name the 3 big components.

O'Reilly has a great series of books focused on data modeling and management including the Data Model Resource Book (I linked to one of 3 volumes and highly recommend them as starting points for any data modeling), The Data Warehouse Toolkit (teaches the concepts of data warehousing from the ground up), and finally what you're looking for is The Microsoft Data Warehouse Toolkit which covers how to apply what you learned from the second book specifically on the Microsoft stack.


答: You need to convince the person holding on to some piece of knowledge that it is safe for them to give it up without being at risk of being fired.  employees will hold on to things if they feel that giving up everything puts them at a larger risk if being fired, you should try to find out if they feel like their work is appreciated and their value to the team is recognized. If you can show them that sharing their knowledge is more beneficial than hording it, they will likely be willing to share it. Also keep in mind that some of their knowledge they may not realize is specialized knowledge that they have because they have been doing it long enough that they do it subconsciously, like if you play a lot of video games you just know that the left stick moves you and the right stick controls where you look.</p>


问:
Should I learn java for mobile application development or will C# just do?
I'm looking forward to delving into the .NET framework but most mobile applications seem to be developed in Java. I'll most probably be targeting the less pricier phones like Nokia and motorolla not android or iphone OS. Can I do these stuffs in C#?</p>

答: No, C# won't do. You need to learn Java, and not J2SE but the J2ME because most low-end mobile phones only support J2ME. However, you might want to consider Android again because it's really becoming popular even with low-end phone. Anyway, the language for J2ME and Android is both Java.</p>

OwnerDisplayName: Alexander Suraphel


答:
Interesting how so far all answers focused on "fixing" the problem with the developer that doesn't want to share knowledge. While I'm sure some of the problems are personal, I think you also need to view the organization and team dynamics and corporate culture.

I have a friend working for a company where people are constantly out to get each other. They sabotage projects and work nights/weekends to make their team mates look bad.  I'm sure they also withhold information.

On the other hand, In my team we want to help and teach each other because when your teammates know more/have better skill, they will likely do less damage which will cause the "person with knowledge" to go fix stuff.  I certainly heard of these things, but with my team, I can't even imaging that we would have a developer that wouldn't want to share information.  So maybe promote a different culture and encourage collective ownership?


问:
What's the term for "while(true)" loop with "break" inside?
Suppose I have a loop in C++ or C# that goes like this:

```<code>while( true ) {
    doSomething();
    if( condition() ) {
        break;
    }
    doSomethingElse();
}
</code>```

This is commonly called "infinite loop". Yet it is not technically infinite - it will stop once control flows through break.

What's the term for such loop - that has "loop forever" loop control statement and "break" inside?

答:
The very first course in CS at Stanford (Programming Methodology by Mehran Sahami) refers to this as a loop and a half. And it is not necessarily bad programming practice. Consider this example on collecting user input (taken from The Art and Science of Java by Eric Roberts, where Roberts also calls it a-loop-and-a-half):

```<code>prompt user and read in the first value
while (value != sentinel) {
    process the data value
    prompt user and read in a new value
}
</code>```

And then the same thing solved using the loop and a half idea to avoid duplicate code:

```<code>while (true) {
    prompt user and read in a value
    if (value == sentinel) break;
    process the data value
}
</code>```

Body:
The very first course in CS at Stanford (Programming Methodology by Mehran Sahami) refers to this as a loop and a half. And it is not necessarily bad programming practice. Consider this example on collecting user input (taken from The Art and Science of Java by Eric Roberts, where Roberts also calls it a-loop-and-a-half):

prompt user and read in the first value
while (value != sentinel) {
    process the data value
    prompt user and read in a new value
}

And then the same thing solved using the loop and a half idea to avoid duplicate code:

while (true) {
    prompt user and read in a value
    if (value == sentinel) break;
    process the data value
}


答:
Make the documentation a task and make this task part of their performance evaluation.
Before this can happen, you must define a documentation framework, allocate time for this task and educate people about the value of this work.</p>


问:
Choosing the type of Index Variables
We use Integer type represent index variables most of the time. But in some situations, we're forced to choose

```<code>std::vector<int> vec;
....

for(int i = 0; i < vec.size(); ++i)
....
</code>```

This will cause the compiler to raise the warning that mixed use of signed/unsigned variables. if I make the index variable as for( size_t i = 0; i < vec.size(); i++ ), (or an unsigned int )it will sort out the issues.

When it come more specific to use windows types, most of the Windows APIs are dealing with DWORD (which typedef-ed as unsigned long).

So when I use similar iteration, will again cause the same warning. Now if I rewrite it as

```<code>DWORD dwCount;
....

for(DWORD i = 0; i < dwCount; ++i)
....
</code>```

I find this a bit weird. It might be the problem withe perceptions.

I agree that we are supposed to use the same type of index variable to avoid the range problems can happen with the index variables. For e.g if we're using

```<code>_int64 i64Count; //
....

for(_int64 i = 0; i < i64Count; ++i)
....
</code>```

But in the case of DWORD, or unsigned integers, are there any problems in rewriting it as

```<code>for(int i = 0; (size_t)i < vec.size(); ++i)
</code>```

How most of the people are working with similar issues?

答:
A new option for C++11, you can do things like the following

for(decltype(vec.size()) i = 0; i < vec.size(); ++i) {...}

and

for(decltype(dWord) i = 0; i < dWord; ++i) {...}

While it repeats a little more than the basic for-loop would, it's not nearly as long-winded as pre-'11 ways of specifying values, and using this pattern consistently will work for most, if not all, possible terms you'd want to compare against, which makes it great for code refactoring. It even works for simple cases like this:

int x = 3; int final = 32; for(decltype(final) i = x; i < final; ++i)

Furthermore, while you should use auto whenever you're setting i to some intelligent value (like vec.begin()), decltype works when you're setting to a constant like zero, where auto would just resolve that to int because 0 is a simple integer literal.

To be honest, I'd like to see a compiler mechanism for extending the auto type-determination for loop incrementers to look at the value being compared against.

Title: Choosing the type of Index Variables


问:
Worth it to Learn an Archaic Language?

Possible Duplicate:

  Is COBOL still worth learning?

One of my better college professors often talked about the advantages of learning an archaic language (COBOL or SAP ABAP for example) in one's free time because of the advantages it provides when looking for high-paying jobs, or if you find yourself out of the job and in need of temp work(consulting, etc.). I was curious what your thoughts are on this, especially if you work with these languages, and whether the time investment could really pay off for future job hunts.

For a little background, I am a junior software developer relatively fresh out of college, with knowledge of mostly just Java, SQL, and web programming (JS, HTML, CSS, etc.) which have provided me with no lack of job opportunities thus far.

UPDATE: I thought this was interesting. I am currently looking for jobs (always a good thing to do in my opinion, and DICE makes it simple), and was just approached by a company for an SAP ABAP position where training in the language would be part of the job. Thank you everyone who responded, I will certainly take your advice into consideration!

答: You're also taking an opportunity cost by learning them. You could be learning something modern and directly useful, but you're not - you're learning COBOL instead. If you already have all the skills and knowledge you need for your field, that might be worth it as a hedge or curiousity, but you're a junior developer. You still have core skills and tools to learn</p>

Title: Worth it to Learn an Archaic Language?


问:
Best design for Windows forms that will share common functionality
In the past, I have used inheritance to allow the extension of Windows forms in my application. If all of my forms would have common controls, artwork, and functionality, I would create a base form implementing the common controls and functionality and then allow other controls to inherit from that base form. However, I have run into a few problems with that design.

Controls can only be in one container at a time, so any static controls you have will be tricky. For example: Suppose you had a base form called BaseForm which contained a TreeView which you make protected and static so that all of the other (derived) instances  of this class can modify and display the same TreeView. This would not work for multiple classes inheriting from BaseForm, because that TreeView can only be in one container at a time. It would likely be on the last form initialized. Though every instance could edit the control, it would only display in one at a given time. Of course, there are work-arounds, but they are all ugly. (This seems to be a really bad design to me. Why can't multiple containers store pointers to the same object? Anyhow, it is what it is.)

State between forms, that is, button states, label text, etc., I have to use global variables for and reset the states on Load.

This isn't really supported by Visual Studio's designer very well.

Is there a better, yet still easily maintainable design to use? Or is form inheritance still the best approach?

Update
I went from looking at MVC to MVP to the Observer Pattern to the Event Pattern. Here is what I am thinking for the moment, please critique:

My BaseForm class will only contain the controls, and events connected to those controls. All events that need any sort of logic to handle them will pass immediately to the BaseFormPresenter class. This class will handle the data from the UI, perform any logical operations, and then update the BaseFormModel. The Model will expose events, which will fire upon state changes, to the Presenter class, which it will subscribe (or observe) to. When the Presenter receives the event notification, it will perform any logic, and then the Presenter will modify the View accordingly.

There will only be one of each Model class in memory, but there could potentially be many instances of the BaseForm and therefore the BaseFormPresenter. This would solve my problem of synchronizing each instance of the BaseForm to the same data model.

Questions:

Which layer should store stuff like, the last pressed button, so that I can keep it highlighted for the user (like in a CSS menu) between forms?

Please criticize this design. Thanks for your help!

答:
I don't know why you need static controls. Maybe you know something I don't. I've used a lot of visual inheritance but I've never seen static controls to be necessary. If you have a common treeview control, let every form instance have its own instance of the control, and share a single instance of the data bound to the treeviews.

Sharing control state (as opposed to data) between forms is also an unusual requirement. Are you sure FormB really needs to know about the state of buttons on FormA?Consider the MVP or MVC designs. Think of each form as a dumb "view" that knows nothing about the other views or even the application itself. Supervise each view with a smart presenter/controller. If it makes sense, a single presenter can supervise several views. Associate a state object with each view. If you have some some state which needs to be shared between views, let the presenter(s) mediate this (and consider databinding - see below).

Agreed, Visual Studio will give you headaches. When considering form or usercontrol inheritance, you need to carefully weigh the benefits against the potential (and probable) cost of wrestling with the form designer's frustrating quirks and limitations. I suggest keeping form inheritance to a minimum - use it only when the payoff is high. Keep in mind that, as an alternative to subclassing, you can create common "base" form and simply instantiate it once for each would-be "child" and then customize it on-the-fly. This makes sense when differences between each version of the form are minor compared to the shared aspects. (IOW: complex base form, only-slighty-more-complex child forms)

Do make use of usercontrols when it helps you prevent significant duplication of UI development. Consider usercontrol inheritance but apply the same considerations as for form inheritance.

I think the most important advice I can offer is, if you don't currently employ some form of the view/controller pattern, I strongly encourage you to start doing so. It forces you to learn and appreciate the benefits of loose-couping and layer separation.

response to your update

Which layer should store stuff like, the last pressed button, so that I can keep it highlighted for the user...

You can share state between views much like you would share state between a presenter and its view. Create a special class SharedViewState. For simplicity you can make it a singleton, or you can instantiate it in the main presenter and pass it to all views (via their presenters) from there. When the state is associated with controls, use data binding where possible. Most Control properties can be data-bound. For example the BackColor property of a Button could be bound to a property of your SharedViewState class. If you do this binding on all forms which have identical buttons, you can highlight Button1 on all forms just by setting SharedViewState.Button1BackColor = someColor.

If you aren't familiar with WinForms databinding, hit MSDN and do some reading. It's not difficult. Learn about INotifyPropertyChanged and you're halfway there.

Here's a typical implementation of a viewstate class with the Button1BackColor property as an example:

```<code>public class SharedViewState : INotifyPropertyChanged
{
    // boilerplate INotifyPropertyChanged stuff
    public event PropertyChangedEventHandler PropertyChanged;
    protected void NotifyPropertyChanged(string info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }

    // example of a property for data-binding
    private Color button1BackColor;
    public Color Button1BackColor
    {
        get { return button1BackColor; }
        set
        {
            if (value != button1BackColor)
            {
                button1BackColor = value;
                NotifyPropertyChanged("Button1BackColor");
            }
        }
    }
}
</code>```

Body:
I don't know why you need static controls. Maybe you know something I don't. I've used a lot of visual inheritance but I've never seen static controls to be necessary. If you have a common treeview control, let every form instance have its own instance of the control, and share a single instance of the data bound to the treeviews.

Sharing control state (as opposed to data) between forms is also an unusual requirement. Are you sure FormB really needs to know about the state of buttons on FormA?Consider the MVP or MVC designs. Think of each form as a dumb "view" that knows nothing about the other views or even the application itself. Supervise each view with a smart presenter/controller. If it makes sense, a single presenter can supervise several views. Associate a state object with each view. If you have some some state which needs to be shared between views, let the presenter(s) mediate this (and consider databinding - see below).

Agreed, Visual Studio will give you headaches. When considering form or usercontrol inheritance, you need to carefully weigh the benefits against the potential (and probable) cost of wrestling with the form designer's frustrating quirks and limitations. I suggest keeping form inheritance to a minimum - use it only when the payoff is high. Keep in mind that, as an alternative to subclassing, you can create common "base" form and simply instantiate it once for each would-be "child" and then customize it on-the-fly. This makes sense when differences between each version of the form are minor compared to the shared aspects. (IOW: complex base form, only-slighty-more-complex child forms)

Do make use of usercontrols when it helps you prevent significant duplication of UI development. Consider usercontrol inheritance but apply the same considerations as for form inheritance.

I think the most important advice I can offer is, if you don't currently employ some form of the view/controller pattern, I strongly encourage you to start doing so. It forces you to learn and appreciate the benefits of loose-couping and layer separation.

response to your update

Which layer should store stuff like, the last pressed button, so that I can keep it highlighted for the user...

You can share state between views much like you would share state between a presenter and its view. Create a special class SharedViewState. For simplicity you can make it a singleton, or you can instantiate it in the main presenter and pass it to all views (via their presenters) from there. When the state is associated with controls, use data binding where possible. Most Control properties can be data-bound. For example the BackColor property of a Button could be bound to a property of your SharedViewState class. If you do this binding on all forms which have identical buttons, you can highlight Button1 on all forms just by setting SharedViewState.Button1BackColor = someColor.

If you aren't familiar with WinForms databinding, hit MSDN and do some reading. It's not difficult. Learn about INotifyPropertyChanged and you're halfway there.

Here's a typical implementation of a viewstate class with the Button1BackColor property as an example:

public class SharedViewState : INotifyPropertyChanged
{
    // boilerplate INotifyPropertyChanged stuff
    public event PropertyChangedEventHandler PropertyChanged;
    protected void NotifyPropertyChanged(string info)
    {
        if (PropertyChanged != null)
        {
            PropertyChanged(this, new PropertyChangedEventArgs(info));
        }
    }

    // example of a property for data-binding
    private Color button1BackColor;
    public Color Button1BackColor
    {
        get { return button1BackColor; }
        set
        {
            if (value != button1BackColor)
            {
                button1BackColor = value;
                NotifyPropertyChanged("Button1BackColor");
            }
        }
    }
}


答:
This is one of those areas where you'll be richly rewarded by first learning the theory before learning a particular tool stack.

The twin bibles of data warehousing theory are Bill Inmon's Building The Data Warehouse and Ralph Kimball's The Data Warehouse Toolkit. There's a lot of platform-war kerfuffle amongst BI insiders who treat these like religious texts. Stay out of that as much as you can...the fight is more about personal style than technical correctness.

Bird's-eye view, I'd recommend going with Inmon if you're a "measure twice, cut once" type of developer who likes to plan carefully, then build. Conversely, I'd recommend Kimball if you like to jump in feet first and start prototyping.

Either one of these books will serve perfectly well to teach you the basics of BI theory and practice.

After that, since your primary interest is in SSIS - the ETL component in Microsoft's stack - I'd recommend Kimball's The Data Warehouse ETL Toolkit. This will teach you why you're doing ETL and what the common practices are. You could potentially skip the first two recommendations and jump straight to this one if you thrive on a steeper learning curve, but I strongly recommend attacking this book before doing a Microsoft-specific one.

From there, there are half a dozen books about SSIS 2008 specifically, or you could get The Microsoft Data Warehouse Toolkit. All of these have Kindle editions, as do the SSIS-specific books from most publishers (Wrox, Wiley, etc.)

Title: What's the best way to learn the MS Business Intelligence stack?

Body:
What's the best/easiest way to get into the MS BI stack on my own (preferably with a [kindle] book)?  Specifically, I'd like to learn more about SSIS, SSRS, and SSAS in that order.  I've tried looking at books on amazon, but I really have no idea.

Some background:  I just graduated with my bachelor's in computer science, and am going back for my masters in comp sci.  I work right now as a C# developer, with some web and database background.  I don't necessarily want to become a BI master, but I'd like to gain an intermediate-level understanding of the platform.


问:
Where can I find an algorithm for creating 3D anaglyphs using a depth map image?
I'm looking for a generic algorithm to calculate a red/cyan anaglyph starting from the original image and its black/white depth map, as in this example?

That algorithm is used, for example, in Photoshop but I can't find a readable explanation to reproduce it.

答:
This paper might be helpful. It focuses on outdoor/landscapes scenes.
The following is an excerpt from the paper's abstract:

This paper presents a new unsupervised technique aimed to generate
  stereoscopic views estimating depth information from a single input
  image. Using a single input image, vanishing points/lines are extracted
  using a few heuristics to generate an approximated depth map. The depth
  map is then used to generate stereo pairs.


问:
Does Groovy follow Tennent's Correspondence Principle?
Here's an interesting discussion of Tennent's Correspondence Principle, and a brief description from Neal Gafter:

The principle dictates that an expression or statement, when wrapped in a closure and then immediately invoked, ought to have the same meaning as it did before being wrapped in a closure. Any change in semantics when wrapping code in a closure is likely a flaw in the language.

Does the Groovy language follow this principle?

答: Not quite, but almost.  All the variables accessible in the outer scope are accessible in the closure, including 'this' and class data members.  However, a return statement returns from the closure, not from the enclosing function.  I'm not even sure that is a violation of TCP; I don't know of any C-style language where return in a closure returns from the enclosing scope.  I have had no surprises using Groovy closures.