问:
What are the deliverables to give to the client for a web application ?
I have completed a web application which is basically developed in PHP and is just another regular web application. Usually when I deliver the final production release I just handover the code documentation and the architecture information to the client. However, for this particular project the client insists on having the complete in and out data about the project. </p>

<p>So I'm just wondering... What are the mandatory technical and non technical docs that I can give my client apart from the code and architecture documentations ? </p>

<p>(Also it would be kinda cool to hit the client about various stats and data about the project so that he would actually know the amount of work involved and how cool the product actually is.) </p>

答:
I think the list should include:

The non-technical requirements (there was such a document, right?)

The technical requirements

A "decisions" document (if there was one) explaining why some decisions were made over others. This might already be in a different requirements or architecture document, but we usually do this separately for Big Decisions.

The code and other resources (image files, CSS, etc...)

The database model (as a diagram, document, whatever)

DDL to create the database.

DML to seed the database.

A document explaining application setup and basic trouble shooting.

A list of any important usernames and their passwords (for Admin accounts), as well as instructions on how to change the password. Ideally, when they set up the website for the first time, they should be prompted to enter a new admin password, but this is more of an architecture thing.

System requirements, and for web apps, minimum hosting requirements as well (Does the app need MySQL or PostgreSQL? How much RAM?, etc...)

Not all of these things might be available (or necessary) for every project, but I think this is a good general guide.


问:
How do I tell if a Company is really serious about Agile and Scrum?

Possible Duplicate:

  Weeding out real agile from buzzword agile in an interview

I went for an interview. The company really wants to take me on. However my sticking point is that I have not received clear information on whether they are using Agile and Scrum methodologies.

I have arranged a telephone chat with the consultant there... what questions do I ask to test to see if they are really serious about agile and scrum?

I was thinking:

Can you build and release your software in one step?

Do you use continuous integration?

Can anybody give me advice to really get the truth out of them I will only get this one chance to quiz them.

Regards,
Pete

答:
Who moderates/leads the scrum?

How large is the development team, and how are the teams divided?

Does the team adhere to the standard 2 week sprint format?

Just a few questions I could think of ...based on the topics I discussed with a company I have recently interviewed with. The scrum lead is a software architect in this case; the team is very large but broken up into smaller teams with specific focus based on the projects; it was explicitly expressed that the team, by and large, adheres to the 2 week sprint format.

Also, you can get a feel for the company's dedication to Agile by how many people interviewed you. In my case, I had 5 different people conduct 45 minute interviews. This is done to determine which team I might best fit ...in which team I might provide some missing experience, etc. This particular point is not a given ...but it also gave me the opportunity to ask each individual about their Agile format.

ContentLicense: CC BY-SA 3.0


问:
How can I sharpen my team player skills?
Currently I'm in my dream job in a research lab as the only developer in a multidisciplinary team. I'm getting a little bit worried because I'm forgetting about coding in a team (I don't have legacy code, I maintain my own code, I handle my own agenda, etc). Although I try to follow some of the the best practices like continuous delivery, TDD, and SCRUM just for me I think I'm losing my ability to work in a team of developers.

I've joined an open source project and began into the code katas and code golf. But these won't polish my team player profile.

What would be your suggestions to sharpen my team player skills?

Update: Yes, my communications skills are now better and I can talk to PhD's like never before. Like @Nicholas and  @Erick said, someday I will be facing a developing team (maybe in my current job, maybe not) and I want to keep current with those practices that makes a good developer a better team member, like pair programming or code review.

答:
On the flip side, your solo-developer skills are getting sharper every day.

You say this is your dream job. If you aren't looking to move to a different job, why worry about the skills that less-optimal jobs require?

You can't have all of your skills maximized at the same time. Throw yourself fully into the problems you face in your current job, and gain some new skills.  If the time comes when you need to work on a team again, you'll adjust quickly, having done it before.


答:
I'd consider these questions for the Scrum side:

How long are your sprints?

How long are your planning meetings, demos, and retrospectives?

Who is the Scrum Master and Product Owner?  How big is the team?

How big is the back log?

How many sprints has the team done?  How many projects have been completed using Scrum?

What is the team's velocity for a sprint?

On the Agile side, I'd probably take a step back though to ask:

Of the practices you use, which do you consider to be part of Agile? (Pair programming, XP, TDD, Prototyping would be some examples here.)

How do these practices fit with the Agile Manifesto?

How has your company defined Agile?  Is it just the manifesto or is there more to it than that?

The key is to find those questions that aren't a yes/no question where someone could just give an answer they feel sounds right but rather trying to dig deeper into things.

Title: How do I tell if a Company is really serious about Agile and Scrum?

Body:
Possible Duplicate:

  Weeding out real agile from buzzword agile in an interview

I went for an interview. The company really wants to take me on. However my sticking point is that I have not received clear information on whether they are using Agile and Scrum methodologies.

I have arranged a telephone chat with the consultant there... what questions do I ask to test to see if they are really serious about agile and scrum?

I was thinking:

Can you build and release your software in one step?

Do you use continuous integration?

Can anybody give me advice to really get the truth out of them I will only get this one chance to quiz them.

Regards,
Pete


答:
One thing is for certain, every company I accepted a position at that told me during the interview that told me something to the effect of "we are TRYING to move to Agile" turned out to be a hot mess and grotesquely mismanaged.  If you get a similar answer then I would turn around and RUN.

It is a good idea to ask them about their build and deployment practices and CI as well.  Don't pay attention so much to WHAT they say, but HOW they say it.  If you notice nervousness, agitation, incredulousness, or fear then those are huge warning signs as well.

For instance, look for signs of unusual perspiration, swift fluttering eyes, swallowing (movement of the adams apple, etc...).  If they give you an answer and their eyes shift to the left while they talk that can be a sign of deceit or information witholding.  If they look to the right or up or directly into your eyes then they are probably being truthful.

I know it sounds insane but a friend of mine in the Secret Service taught me to notice a lot of these things when interviewing people.  I have been lied to more times than I can count on interviews and I am certain that I avoided some pretty bad places by employing these techniques.


问:
How to manage time for studying while working?
I've been programming 8 years for a company. We build business intelligence software systems. Since I thought working is learning, I've always studied in terms of what I was doing at the company while working for 60 hours per week. These days, however, I am looking for a new company for employment, I can see that thought was a dumb idea because I frequently fail in job interviews mainly due to lack of knowledge on the other areas. Of course, I am still willing to improve myself and am really trying. But while working that much of time per week, I can't find good amount of study time to catch up.

I don't think I am the only one to concern about this so I would like to ask how you guys find time to study for your career? How many hours do you assign to studying other areas? Am I missing some time management skills?

答:
Working 60 hour weeks is going to make it pretty difficult to code much outside work and have anything that resembles a balanced lifestyle. That being said, you are where you are so you have to make the best of it. I would recommend that you try to leverage your domain knowledge to land your next job, rather than relying purely on coding skills. In my region at least, I see a fair amount of jobs that are in the realm of BI analyst/programmer. Surely you have learned plenty of transferable knowledge in the last 8 years, at least within your domain. This could be nothing more than a confidence issue, since that sort of experience is really pretty valuable.

Keep in mind, you really do not need to be a human hard drive of programming knowledge. Doing your current job well, using best practices, is probably enough to keep a good grip on things. If you happen to work in a language not deemed worthy by HR departments any longer, then I would recommend learning a new language or two on the side. Pick up a couple books on Python or .Net (or any HR-friendly platform) and read them a few hours a week. This will make you a bit more marketable and allow you to be exposed to some new paradigms outside of what you are used to. A few hours a week for learning can always be found, even if its the time you would normally watch TV or something else that is not too productive.


问:
Is there a name for this design pattern, using hooks/callbacks?
I've seen/used some objects that have a structure like so, designed to let children extend the functionality of functions without having to override them. Is there a name for this pattern?

code example:

```<code>class CrudModel {
  public function create($data) {
    $data = $this->pre_create($data);
    //create logic
  }

  public function delete($data) {
    $data = $this->pre_delete($data);
    //delete logic
  }

  protected function pre_create($data) { //empty }
  protected function pre_delete($data) { //empty }

}

class SpecificCrudModel extends Model {
    protected function pre_create($data) {
      //custom logic for this object.
    }

}
</code>```

答:
It looks like a template method pattern, but the methods in question are not abstract and the child class is not being forced to implement them. I'd say it's just a common use of inheritance or maybe a borderline template method pattern.

I'd rather implement such things via events/delegates/callbacks, though. It is much clearer then what you can hook up to and you can't accidentally override necessary behaviour. It's also more flexible.

@GSto

Here's an example of using callbacks with PHP. It's not as elegant as in other languages with native event support (like C# offers for example), but it's flexible and you can register such callbacks in the constructor of a child class for example. This website here told me how to implement callbacks in PHP, the heart of it is the call_user_func function of PHP. This can register as many handlers as you like and anything with a reference to the object can register handlers.

```<code>class Model {

    protected $_before_create_callbacks = array();
    protected $_after_create_callbacks = array();

    function register_before_create_handler($callback) {
        $this->_before_create_callbacks[] = $callback;
    }

    function register_after_create_handler($callback) {
        $this->_after_create_callbacks[] = $callback;
    }

    function create(){
        $this->before_create();

        //logic of create...

        $this->after_create();
    }

    protected function before_create() {
        foreach ($this->_before_create_callbacks as $callback){
            call_user_func($callback);
        }
    }

    protected function before_create() {
        foreach ($this->$_after_create_callbacks as $callback){
            call_user_func($callback);
        }
    }
}

function someFunction(){
    logSomething();
}

$anyModel->register_before_create_handler("someFunction");
</code>```

Body:
It looks like a template method pattern, but the methods in question are not abstract and the child class is not being forced to implement them. I'd say it's just a common use of inheritance or maybe a borderline template method pattern.

I'd rather implement such things via events/delegates/callbacks, though. It is much clearer then what you can hook up to and you can't accidentally override necessary behaviour. It's also more flexible.

@GSto

Here's an example of using callbacks with PHP. It's not as elegant as in other languages with native event support (like C# offers for example), but it's flexible and you can register such callbacks in the constructor of a child class for example. This website here told me how to implement callbacks in PHP, the heart of it is the call_user_func function of PHP. This can register as many handlers as you like and anything with a reference to the object can register handlers.

class Model {

    protected $_before_create_callbacks = array();
    protected $_after_create_callbacks = array();

    function register_before_create_handler($callback) {
        $this->_before_create_callbacks[] = $callback;
    }

    function register_after_create_handler($callback) {
        $this->_after_create_callbacks[] = $callback;
    }

    function create(){
        $this->before_create();

        //logic of create...

        $this->after_create();
    }

    protected function before_create() {
        foreach ($this->_before_create_callbacks as $callback){
            call_user_func($callback);
        }
    }

    protected function before_create() {
        foreach ($this->$_after_create_callbacks as $callback){
            call_user_func($callback);
        }
    }
}

function someFunction(){
    logSomething();
}

$anyModel->register_before_create_handler("someFunction");


答:
I'd probably break this up into a few document categories:

Guides:

Installation guide, the how do set this up on a server.

Administrator's guide, for how to configure and run the application for optimal performance.  Security would also be something to cover here just so that it is known what passwords does this application have and use to run.

Support:

If there are problems, what kind of procedures would you suggest?  Are you providing support for some period of time?  I'd probably still give a guide or two in this area just so someone else knows some of the easier things to try like restarting services or rebooting a server.

Integration points:

Are there 3rd party integration points for this application that make it rely on other vendors than your code?

Title: What are the deliverables to give to the client for a web application ?

Body:
I have completed a web application which is basically developed in PHP and is just another regular web application. Usually when I deliver the final production release I just handover the code documentation and the architecture information to the client. However, for this particular project the client insists on having the complete in and out data about the project. </p>

<p>So I'm just wondering... What are the mandatory technical and non technical docs that I can give my client apart from the code and architecture documentations ? </p>

<p>(Also it would be kinda cool to hit the client about various stats and data about the project so that he would actually know the amount of work involved and how cool the product actually is.) </p>


答:
I've always studied in terms of what I was doing at the company while
  working for 60 hours per week.

Simply start spending the same amount of time studying for other technologies you're interested in.

It's not clear from your questions how many hours you work per day, and how many days per week.

Anyway, I would use my evenings to read books until I'm tired, or (if you still want to sit in front of a monitor) spend some time in websites like this, they greatly increase your skills and knowledge.

Then in the weekend I would try out new things, maybe starting up some small projects to see what I learned.

Some tips and advice on how to optimize your studies:

Pick up only the best books (you can find searching "best books" on SO for example)

Learn as soon as possible the best practices

Learn as soon as possible common mistakes to avoid and coding horrors

Title: How to manage time for studying while working?

Body:
I've been programming 8 years for a company. We build business intelligence software systems. Since I thought working is learning, I've always studied in terms of what I was doing at the company while working for 60 hours per week. These days, however, I am looking for a new company for employment, I can see that thought was a dumb idea because I frequently fail in job interviews mainly due to lack of knowledge on the other areas. Of course, I am still willing to improve myself and am really trying. But while working that much of time per week, I can't find good amount of study time to catch up.

I don't think I am the only one to concern about this so I would like to ask how you guys find time to study for your career? How many hours do you assign to studying other areas? Am I missing some time management skills?


答:
Don't start with asking questions. Let the consultant first explain in detail how they work, what roles do they have, what are responsibilities of roles, how is product planned, shipped etc. Then ask complementary questions based on the consultant explanation.

If you need to help with exact questions you don't need to ask at all. If you want to judge if Scrum / Agile approach in other company is good enough you should be able to define these questions yourselves. If you are not able how can you know that answer is correct?

If you really want to test the consultant you can even ask "wrong" questions so that he must oppose you to prove that they are going agile. But be aware that this can really goes against you and they can loose interest in you.


问:
Where to start fixing a complex bug?
I'm trying to solve a complex bug in our codebase , but the problem seems to be coming from a lot of places to the point that i dont know what to change first .

do you have any procedure or guidelines todo in such a situation  ?

答:
To solve complex multiple bugs ("coming from a lot of places"):

This is the general tried and tested approach I take:

Take the section of code-base in question

Break this section into sub sections

Using an initial set of input data, cascade this data/event through this isolated sub section of code. You need to prove that the expected "effect" (return values/events) match what you expect. If this fails fix it untill it does

repeat above for the next sub-section using the "effects" (return values/events) from the previous subsection

Once all sub-sections are completed, re-assembling the sub-sections back should now fix all the multiple-bugs

Title: Where to start fixing a complex bug?


问:
What is the reason to put prefixes in new CSS features?
Is there a valid reason for the browsers to prefix new CSS features, instead of letting the webmasters use the non-prefixed version?

For example, a sample code for the background gradient looks like:

```<code>#arbitrary-stops {
  /* fallback DIY*/

  /* Safari 4-5, Chrome 1-9 */
  background: -webkit-gradient(linear, left top, right top, from(#2F2727), color-stop(0.05, #1a82f7), color-stop(0.5, #2F2727), color-stop(0.95, #1a82f7), to(#2F2727));

  /* Safari 5.1+, Chrome 10+ */
  background: -webkit-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

  /* Firefox 3.6+ */
  background: -moz-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

  /* IE 10 */
  background: -ms-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

  /* Opera 11.10+ */
  background: -o-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
}
</code>```

What's the point in forcing webmasters to copy-paste the same code four times to have the same result?

Note: one of the reasons often quoted is that prefixed styles are intended to be temporary while either the browser does not implement the spec correctly, or the spec is not definitive.

IMO, this reason is a nonsense:

If the browser engine does not implement the spec correctly, the browser will not be compliant, no matter if it does not implement it in a non-prefixed form or it does not implement it in a prefixed form.

If the spec is not definitive, it may matter when there were previous implementations with the same name. For example if CSS2 had linear-gradient, but CSS3 was intended to extend linear-gradient with additional features, it would be clever to temporary prefix the new, draft, implementation by -css3-

答:
According to this W3C note:

To avoid clashes with future CSS features, the CSS2.1 specification
  reserves a prefixed syntax for proprietary and experimental extensions
  to CSS.

Prior to a specification reaching the Candidate Recommendation stage
  in the W3C process, all implementations of a CSS feature are
  considered experimental. The CSS Working Group recommends that
  implementations use a vendor-prefixed syntax for such features,
  including those in W3C Working Drafts. This avoids incompatibilities
  with future changes in the draft.

You can follow up the state of the CSS here and here.


答:
This looks like a pretty standard case of any inheritance-based model, depending on how you use it.  It's pretty common to put any implementation specific code in virtual functions in an abstract parent, and to implement them in a child class.

This is literally the exemplar case in c++;  it looks like you're using PHP, here, and this is definitely the preferred method.  Much easier to follow than using callbacks. If you're using this in an MVC framework (Or building one) you might want to prepend a '_' to the setup utility call.

Title: Is there a name for this design pattern, using hooks/callbacks?

Body:
I've seen/used some objects that have a structure like so, designed to let children extend the functionality of functions without having to override them. Is there a name for this pattern?

code example:

```<code>class CrudModel {
  public function create($data) {
    $data = $this->pre_create($data);
    //create logic
  }

  public function delete($data) {
    $data = $this->pre_delete($data);
    //delete logic
  }

  protected function pre_create($data) { //empty }
  protected function pre_delete($data) { //empty }

}

class SpecificCrudModel extends Model {
    protected function pre_create($data) {
      //custom logic for this object.
    }

}
</code>```


问:
How to improve enterprise level application that consists of only static methods
I am new in a enterprise level application project and discovered that 99% of everything I've seen in code is static methods, static properties.

The application at hand is a distributed app consisting of about a handful of WCF services that communicate through a business layer with a data access layer. The data access component is a singleton.
There are transactions and MSMQ queues and multiple parties calling the WCF Services to notify the DB of changes, updates made in a seperate system and so forth.

First time running a little test project I got a thread related exception using EntLib5 Logging, telling me that some code was called from an unsynchronized code block.

I am curious to know how one should go about and improve an almost-all-static design.

Are there advantages to the current approach?

What are the disadvantages?

Where would you start (besides starting over) and improve all this
  mess?

Thanks for your opinions!

答:
When the application only consists of static methods it is clearly not object oriented (however, this doesn't mean that you should never have any static methods). Further more you will probably have little to no unit tests (since testing static things is almost impossible). The only advantage I can think of is that walking the call graph in the application is easy, because it is all static, but that's what where it stops.

I always favor a design around dependency injection, which enables unit testing, and enables you to plug in new functionality and cross cutting concerns (such as logging and security) more easily.

I still wouldn't exist to start all over again, because that is way too expensive (especially in an enterprise application) and it would be very hard to realistically estimate the time it would take (what would freak managers out) and you'll be wasting your bosses money.

No, instead, learn about object oriented design, unit testing, TDD, the SOLID principles, clean code, and dependency injection. After that, try improving the application in small chunks at the time. Try writing new code according to these principles and before changing old code (both for bug fixing and changing functionality) try to write automated tests for that part of the system. This way you can improve the code with more certainty.

It takes a lot of time to learn, and working this way takes a lot of time too. However, as you said yourself, you are in a mess, and not going out of this mess, means that at one point in time it will get impossible to change anything in the code base. The result will be that in the future you can make changes with more certainty and the system will get more maintainable and more resistant to change.

Good luck.

OwnerDisplayName: John

OwnerDisplayName: Steven


答:
Difficult question to answer, but the following should get you somewhere:

Static methods are not inherently evil.  If they encapsulate some functionality then it's a completely valid way of doing something.  In fact there are entire programming paradigms such as functional programming which require local state only.

However if there are any static state field or properties floating around then it's going to be problematic with respect to threading, whcih appears to be what you are experiencing as there is shared state.

I would:

Lose Enterprise Library - it's a turd in many ways.  Stick log4net in for logging.  It's not intrusive like EL.  It also hampers performance and has numerous threading issues itself.

Find any static state variables and properties and attempt to make them method scoped.  This will probably fix any threading problems related to shared state.  If you have a static method, every piece of state that it touches or returns much go in and out via the parameters or return value.

Turn all classes into non-static classes with instance methods.

Try and isolate shared class dependencies into local read only variables (to be injected later).

Extract interfaces from the classes and provide constructors which accept the dependencies.

Use a container to construct the application instead of hard dependencies.

It's not going to be easy.  Starting again if the codebase is relatively small is probably easier.

Title: How to improve enterprise level application that consists of only static methods

Body:
I am new in a enterprise level application project and discovered that 99% of everything I've seen in code is static methods, static properties.

The application at hand is a distributed app consisting of about a handful of WCF services that communicate through a business layer with a data access layer. The data access component is a singleton.
There are transactions and MSMQ queues and multiple parties calling the WCF Services to notify the DB of changes, updates made in a seperate system and so forth.

First time running a little test project I got a thread related exception using EntLib5 Logging, telling me that some code was called from an unsynchronized code block.

I am curious to know how one should go about and improve an almost-all-static design.

Are there advantages to the current approach?

What are the disadvantages?

Where would you start (besides starting over) and improve all this
  mess?

Thanks for your opinions!

OwnerDisplayName: Chris Smith


答: It sounds like very poor design.  Let's look at it from a pure CLR point of view.  There is little performance difference between instance and static object.  However there will only one type object for a static class on the managed heap therefore you can't have proper object state, a singleton in effect to the call stack.  Steve is right you also can't do any IoC and I suspect that threading will also become more of an issue.  The design is very ridged and over time will increase cost of ownership, bad ROI.  Code has to make money.  If refactoring is an option then start at front of your app and start introducing instance classes and work back.  This could end up being quiet a big composite refactor but you have little or no choice other than bin it.  There are no advantages to having a static application.  I had the same thing in a web application once, we rewrote large section of it and in the end binned it.  GOOD LUCK.</p>

OwnerDisplayName: jolySoft


答:
1) STOP!!!

2) Debug mode ON

3) Try until you reproduce the bug

4) Inspect logs and debuggers

5) Change code accordingly

6) Try to reproduce the same bug again

7) Go back to step 3 unless the bug has been fixed.

From now on, you will include this particular bug test together with your other tests, as you want to be sure it won't show up again. Forget about "But that's not gonna happen again!".

Title: Where to start fixing a complex bug?

Body:
I'm trying to solve a complex bug in our codebase , but the problem seems to be coming from a lot of places to the point that i dont know what to change first .

do you have any procedure or guidelines todo in such a situation  ?


答:
It is a lot easier for a lone wolf to get accustomed to a new pack than it is to take any other wolf out of the pack and expect it to survive.

The Lone Wolf is already tough as nails and proved it by surviving with no support.  Not everybody is cut out to be a Lone Wolf.

The biggest problems a Lone Wolf faces while adjusting to a new pack are small in comparison.

I would look at the resume of somebody who survived on their own for an extended period of time as a plus.

Title: How can I sharpen my team player skills?

Body:
Currently I'm in my dream job in a research lab as the only developer in a multidisciplinary team. I'm getting a little bit worried because I'm forgetting about coding in a team (I don't have legacy code, I maintain my own code, I handle my own agenda, etc). Although I try to follow some of the the best practices like continuous delivery, TDD, and SCRUM just for me I think I'm losing my ability to work in a team of developers.

I've joined an open source project and began into the code katas and code golf. But these won't polish my team player profile.

What would be your suggestions to sharpen my team player skills?

Update: Yes, my communications skills are now better and I can talk to PhD's like never before. Like @Nicholas and  @Erick said, someday I will be facing a developing team (maybe in my current job, maybe not) and I want to keep current with those practices that makes a good developer a better team member, like pair programming or code review.


答:
I would go with open-ended questions rather than yes/no questions.  It's like when they interview you.  They wouldn't ask, "Are you a hard worker?" or "Are you smart?" or "Can you deliver?"  They would ask you to illustrate how you embody those qualities.

So rather than your sample questions, I would ask the consultant to describe their build process and release process, for example.

Also, I'm inclined to think there is no One Way to do things, so asking open questions gives them an opportunity to describe their processes rather than see if they pass the Scrum Test.  Then you can judge whether it's something you can work with rather than whether they've checked all the scrum boxes.


答:
Just ask someone to explain their development process.

Do they actually have a process and not just some popular label the slapped onto their haphazard practices.

Can they fluently and precisly explain it? This is what they do all day for a living so they should know it in detail. The whole team should be in the know. It's an indication of having a process and actually implementing it. This is not the time to start off with, "It depends..."

Can they give you some background about this adoption process and how it fits their needs? How does it work for them and why?

What do they hate about it the most and do they feel they can fix the problem? You want to sell me something, tell me what your customers hate the most. I don't want to just see the good side of the beef.

How do they keep track of everything? Code, bugs, documentation, workload, communications, etc.

This is better than someone who claims to follow Scrum until death, but does it poorly. Know how they use it because, "If you've seen one implementation of agile development, you've seen one implementation of agile development."


答:
If the browser engine does not implement the spec correctly, the
  browser will not be compliant, no matter if it does not implement it
  in a non-prefixed form or it does not implement it in a prefixed form.

The difference is that the browser won't break compatibility when it does become compliant. If the browser's behaviour is different to the spec, then they won't break old code when they change it- because it's listed under a new name.

Title: What is the reason to put prefixes in new CSS features?

Body:
Is there a valid reason for the browsers to prefix new CSS features, instead of letting the webmasters use the non-prefixed version?

For example, a sample code for the background gradient looks like:

```<code>#arbitrary-stops {
  /* fallback DIY*/

  /* Safari 4-5, Chrome 1-9 */
  background: -webkit-gradient(linear, left top, right top, from(#2F2727), color-stop(0.05, #1a82f7), color-stop(0.5, #2F2727), color-stop(0.95, #1a82f7), to(#2F2727));

  /* Safari 5.1+, Chrome 10+ */
  background: -webkit-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

  /* Firefox 3.6+ */
  background: -moz-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

  /* IE 10 */
  background: -ms-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

  /* Opera 11.10+ */
  background: -o-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
}
</code>```

What's the point in forcing webmasters to copy-paste the same code four times to have the same result?

Note: one of the reasons often quoted is that prefixed styles are intended to be temporary while either the browser does not implement the spec correctly, or the spec is not definitive.

IMO, this reason is a nonsense:

If the browser engine does not implement the spec correctly, the browser will not be compliant, no matter if it does not implement it in a non-prefixed form or it does not implement it in a prefixed form.

If the spec is not definitive, it may matter when there were previous implementations with the same name. For example if CSS2 had linear-gradient, but CSS3 was intended to extend linear-gradient with additional features, it would be clever to temporary prefix the new, draft, implementation by -css3-


答: Is it possible to have other developers in the team work with you on projects so that you would work with other developers some of the time?  That would appear to be a better solution as what you may want is the occasional time spent working with other developers.  At the same time, don't forget that you are in a multidisciplinary team which means some of your team playing skills are getting a work out as everyone else has their specialty and may require adjustments to communicate well to them.</p>


问:
How could the first C++ compiler be written in C++?
Stroustrup claims that Cfront, the first C++ compiler, was written in C++ (Stroustrup FAQ).

However, how is it even possible that the first C++ compiler be written in C++?

The code that makes up the compiler needs to be compiled too, and thus the first C++ compiler couldn't have been written in C++, could it?

答:
The key is right here:

The first C++ compiler (Cfront) was written in C++. To build that, I
  first used C to write a "C with Classes"-to-C preprocessor. "C with
  Classes" was a C dialect that became the immediate ancestor to C++.
  That preprocessor translated "C with Classes" constructs (such as
  classes and constructors) into C. It was a traditional preprocessor
  that didn't understand all of the language, left most of the type
  checking for the C compiler to do, and translated individual
  constructs without complete knowledge. I then wrote the first version
  of Cfront in "C with Classes".

So the first version of Cfront wasn't written in C++, rather in the intermediate language. The ability to create C compilers and preprocessors directly in C led to many of the innovations (and massive security holes) in C. So you write your new preprosessor that turns your "C with Classes" code into straight C (because straight C can do anything) and then you use "C with Classes" to write a C++ compiler (not that you couldn't do it in C, just it would take awhile) and then you use that C++ compiler to write a more effecient/complete compiler in C++. Got it?


答: It was bootstrapped. As soon as a C++ feature was added to cfront, then cfront could also use that feature from that point on (but not to implement that very feature). This worked because cfront had the ability to convert C++ code to C code. So if some new platform came out, you could use cfront on another platform to convert cfront from C++ to C, and then use the new platform's C compiler to finish the compilation from C to object code.</p>

Title: How could the first C++ compiler be written in C++?

Body:
Stroustrup claims that Cfront, the first C++ compiler, was written in C++ (Stroustrup FAQ).

However, how is it even possible that the first C++ compiler be written in C++?

The code that makes up the compiler needs to be compiled too, and thus the first C++ compiler couldn't have been written in C++, could it?


答:
I think B.S. answers that question:

The first C++ compiler (Cfront) was written in C++. To build that, I
first used C to write a "C with Classes"-to-C preprocessor. "C with
Classes" was a C dialect that became the immediate ancestor to C++.
That preprocessor translated "C with Classes" constructs (such as
classes and constructors) into C. It was a traditional preprocessor
that didn't understand all of the language, left most of the type
checking for the C compiler to do, and translated individual
constructs without complete knowledge.

I then wrote the first version
of Cfront in "C with Classes".  Cfront was a traditional compiler that
did complete syntax and semantic checking of the C++ source. For that,
it had a complete parser, built symbol tables, and built a complete
internal tree representation of each class, function, etc. It also did
some source level optimization on its internal tree representation of
C++ constructs before outputting C. The version that generated C, did
not rely on C for any type checking. It simply used C as an assembler.
The resulting code was uncompromisingly fast.

First he created something he called "C with Classes" implemented by a simple preprocessor into C. It was basically C++, but the preprocessor did little or no checking. He then used that to write Cfront, the more powerful version of the translator of C++ into C, complete with type checking, symbol tables, etc.


问:
Why is DRY important?
Quite simple, why would I want to write code that works for all cases and scalable data when all I need to do is repeat the same process a few times with a few minor tweaks?

I'm unlikely to need to edit this again any time soon.

It looks like a lot of less work to just go...

```<code>function doStuff1(){/*.a.*/}
function doStuff2(){/*.b.*/}
function doStuff3(){/*.c.*/}
</code>```

And if I ever need to add something...

```<code>function doStuff4(){/*.d.*/}
</code>```

And if I need to remove it, I remove it.

It's harder to figure out how to make all of those into one straight-forward pattern that I can just feed data into and deal with all the cases, and make a bunch of changes I don't feel like I'm ever going to have to do.

Why be DRY when it looks like a quick cut+paste is going to be so much less work?

答:
Yes, don't bother about DRY if you are writing Throwaway Code.

But DRY is important of course, if you do plan to keep the code.

Title: Why is DRY important?


问:
Data services methods naming
When you work with ORM which implement UnitOfWork pattern (NHibernate's Session, Entity Framework's ObjectContext, etc.), there are two types of data services methods: those which save/commit changes and those which just modify model properties.

In some time it becomes difficult to support this mess: when you call a method you are not sure, whether it will save changes or not (if it doesn't you need to do it in some of outer methods).

How can I solve this problem? The only idea I have is a special naming. For example, AddCustomer for saving method and FillForAddCustomer for non-saving method. Any other ideas?

答:
Services which just change model properties don't sound like data services to me.  They sound like model functions, and could (probably should) be in one model class or another.  Maybe those methods weren't put in a model class because it wasn't clear where they belonged.  I avoid circular references between model classes, so I let owning models depend on owned models, but never the other way around.  Then I put methods that affect multiple models in the lowest-level class that owns all the affected models.  Alternatively, if you are wanting to propagate changes from owned models to their owners, you could let the owners observe their children.

Considering AddCustomer: what are you adding the customer to?  If the answer is 'the database', then I would just write

```<code>customer = new Customer();
customer.setProperties(...); /* Does whatever FillForAddCustomer does */
customer.save(); /* or whatever your ORM requires */
</code>```

Title: Data services methods naming

Body:
Services which just change model properties don't sound like data services to me.  They sound like model functions, and could (probably should) be in one model class or another.  Maybe those methods weren't put in a model class because it wasn't clear where they belonged.  I avoid circular references between model classes, so I let owning models depend on owned models, but never the other way around.  Then I put methods that affect multiple models in the lowest-level class that owns all the affected models.  Alternatively, if you are wanting to propagate changes from owned models to their owners, you could let the owners observe their children.

Considering AddCustomer: what are you adding the customer to?  If the answer is 'the database', then I would just write

customer = new Customer();
customer.setProperties(...); /* Does whatever FillForAddCustomer does */
customer.save(); /* or whatever your ORM requires */


问:
Difference between free and open software?

Possible Duplicate:

  Open Source but not Free Software (or vice versa)

I recently was at talk were Stallman was the keynote speaker, and he stated he hated the term open software, because it was geared to confuse people.

Now, I have since then read on to understand his stance, but I am unable to draw a line where free software becomes open source, and which licenses can be considered in each group.

For example I know that GPL, LGPL are free software licenses, but they are also open source licenses as well.

Is there a pure open source license? like MIT license? or is it all shades of grey.

Can a line be drawn?

Thanks!

答:
Stallman is proceeding from an ideological viewpoint. He is a proponent of copyleft, thus he sees things along that ideological divide (which will become clear when you read his writings). You may be confused by the term "free", which is why you'll see the phrases "free as in beer" or "free as in speech" distinctions. This collision in meanings happens because the English word "free" can mean "without cost" or "political freedom".

Think free as in free speech, not free beer.

Stallman wants you to think of "political freedom".

he hated the term open software, because it was geared to confuse people

Eliminating the term "open source" also means eliminating a competing organization (OSI) in favor of his preferred organization (FSF). By eliminating the competing vocabulary, you will only be able to "goodthink" - to think in terms of GPL. The "confusion" is that you are not using

which licenses can be considered in each group

Wikipedia has a good set of lists comparing and constrasting them.

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

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


答:
In terms of software and licenses, they are the same thing.

Open Source was coined as a new term for free software because the word "free" was scary to businesses.

The GNU Project has strongly emphasized the term free software, as they feel the focus on freedom is most important. But, as the succinctly state, "The Free Software movement and the Open Source movement are like two political camps within the free software community."

Title: Difference between free and open software?

Body:
Possible Duplicate:

  Open Source but not Free Software (or vice versa)

I recently was at talk were Stallman was the keynote speaker, and he stated he hated the term open software, because it was geared to confuse people.

Now, I have since then read on to understand his stance, but I am unable to draw a line where free software becomes open source, and which licenses can be considered in each group.

For example I know that GPL, LGPL are free software licenses, but they are also open source licenses as well.

Is there a pure open source license? like MIT license? or is it all shades of grey.

Can a line be drawn?

Thanks!


问:
Learning potentially unrelated materials on company's dime, is it acceptable?
I am facing a similar problem as the OP of this question where my environment is good, but I feel like my learning is stagnating and I don't have the ability/resources to change positions/quit my job at this time nor am I sure I would want to if I did have the ability to.

The day before yesterday, I was assigned to help fix a problem with an ASP.NET website (which I normally don't work with)  that the customer was having and I needed to look up how to implement something. It only took me a couple of minutes to fix the problem and after that I ended up spending about four hours reading more about ASP.NET and implementing some of the exercises from the book. Then I spent another hour reading about networking and configuring routers which may be used when we need to change something in our lab, however, it is highly unlikely I would be the one to do it since we have a person dedicated to that task.

Today I took off work just so I could learn more about configuring networks and to practice on my home network.

Should I be billing the company for the time learning more about ASP.NET even though it is not a common part of my job or should I be charging like 1/2 rate? Is there a certain number of hours that you feel is acceptable to charge the company for time learning something or self-improvement?

答: I don't think you should do it unless it is on your own time or approved by your manager. You are there to do a specific job. Unless they say, spend 4 hours researching ASP.NET, you are cheating your employer out of other tasks. It would be perfectly fine to ask but since you didn't and you charged for it, it is unethical. I understand that you want to learn more which is perfectly fine, but you should do it on your own time unless you are being paid to self-teach or take a class.</p>


答:
Pick an area of technology or development methodology and see if you can bring in a consutant for a day or two.
What this will demonstrate:

You can identify what you don't know.

You're able to find and evaluate talent. Not that you want to be a manager, but it's good to know you could help add to a team and/or identify strengths and weaknesses of other members.

Ability to coordiate a project and work with others.

Identify what is important.

Find improved ways to get things done.

This could be anything that can be done in a day or two or whatever amount your group can afford. This can double-up as training and consulting. It's a good way to stretch your skills and have some time with someone in your area.

I had our company bring in a database performance expert. Since he had a lot of pre-built tools, I was able to ask questions while they ran. Made sure a free lunch was brought in while I picked his brain for an hour.

There are many ways to work with a team.


答:
I would also understand if different browsers had different
  implementation formats ... [b]ut actually, this is not the case; at least all new features of CSS3 I've used so far had the same format.

This tells me that you have not been playing this game for long enough.

The problem is that web browsers never implement new features in the same manner. It is common to see a browser implement features that have not been standardized, and the result is that everything acts differently on different browsers.

Not only that, new features are often buggy (we'll avoid calling IE out by name), and so even though the syntax for various elements is the same, the result is different.

This causes a headache for developers who are tring to use new features. After they finish writing their stylesheet, they quickly realize that it renders differently on different browsers for inexplicable reasons.

Before prefixes came along, developers were forced to rely on detectable differences between browsers, often by exploiting errors in the CSS parser. This resulted in abominations such as this:

```<code>padding: 10px;
width: 200px;
w\idth: 180px;
height: 200px;
heigh\t: 180px;
</code>```

These sorts of hacks were the result of a developer's attempt to customize their stylesheet for each browser, using any sort of outlandish methods they could find.

By standardizing prefixes, it allows developers to use features that are not stable across different browsers. The -moz- and -webkit- prefixes make it abundantly clear that the author is trying to provide a style that should be applied only in certain web browsers.

Once features become stable and browsers start acting the same, you can remove the prefix and declare the feature once.

I think it is important to realize that prefixes do NOT mean that you must declare styles once for every browser. Prefixes mean that must declare additional styles any time that you find a web browser is not conforming to a standard. For example, instead of your above code, you should start with:

```<code> background: linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
</code>```

If you suddenly realize that Microsoft is unable to compute a linear gradient correctly, then you can add in a prefix to fix the problem on IE:

```<code> /* Friggin IE */
 background: -ms-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
 background: linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
</code>```

Suddenly your page looks the same in every browser, despite the fact that one of them did things differently.

You will find that this has been covered in a very comprehensive manner in this article on A List Apart.

Body:
I would also understand if different browsers had different
  implementation formats ... [b]ut actually, this is not the case; at least all new features of CSS3 I've used so far had the same format.

This tells me that you have not been playing this game for long enough.

The problem is that web browsers never implement new features in the same manner. It is common to see a browser implement features that have not been standardized, and the result is that everything acts differently on different browsers.

Not only that, new features are often buggy (we'll avoid calling IE out by name), and so even though the syntax for various elements is the same, the result is different.

This causes a headache for developers who are tring to use new features. After they finish writing their stylesheet, they quickly realize that it renders differently on different browsers for inexplicable reasons.

Before prefixes came along, developers were forced to rely on detectable differences between browsers, often by exploiting errors in the CSS parser. This resulted in abominations such as this:

padding: 10px;
width: 200px;
w\idth: 180px;
height: 200px;
heigh\t: 180px;

These sorts of hacks were the result of a developer's attempt to customize their stylesheet for each browser, using any sort of outlandish methods they could find.

By standardizing prefixes, it allows developers to use features that are not stable across different browsers. The -moz- and -webkit- prefixes make it abundantly clear that the author is trying to provide a style that should be applied only in certain web browsers.

Once features become stable and browsers start acting the same, you can remove the prefix and declare the feature once.

I think it is important to realize that prefixes do NOT mean that you must declare styles once for every browser. Prefixes mean that must declare additional styles any time that you find a web browser is not conforming to a standard. For example, instead of your above code, you should start with:

 background: linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

If you suddenly realize that Microsoft is unable to compute a linear gradient correctly, then you can add in a prefix to fix the problem on IE:

 /* Friggin IE */
 background: -ms-linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);
 background: linear-gradient(left, #2F2727, #1a82f7 5%, #2F2727, #1a82f7 95%, #2F2727);

Suddenly your page looks the same in every browser, despite the fact that one of them did things differently.

You will find that this has been covered in a very comprehensive manner in this article on A List Apart.


答:
As I understand from your question your job doesn't need you to work in a team. If and when such circumstance arises and someone joins you, you will automatically start to share, help or associate with the other person because you want to get the job right. Adjusting to circumstances is human nature and most scenarios should happen painlessly.

IMO you are thinking too much about a "what if" situation when you don't need to. The job you are in is your dream job, enjoy it while you can. Thats my 2 cents.


答:
I have to mention the problems with DRY in the relational database world. Databases are designed to perform quickly and well using set-based logic and through sargable queries. DRY principles often cause the developer to write non-Sargable queries or use Row-by-agonizing-Row logic to leverage existing code in multiple situations. DRY and performance optimization are often at odds and in the database world, performance is usually far more critical than maintainabilty. This doesn't mean that you should not use DRY principles at all, just that you should be aware of how it will affect the overall usability of the database. Application developers thing DRY first and performance second, database developers think data integrity first, performance second,security of the data third(performance and security might swap places in some systems). Maintainibilty and thus DRY is a far distant 4th.

I've noticed in general, that the more layers of abstraction you put into database queries the slower they become. I'm not saying I didn't wish the people who design the datbase programs themselves didn't do a better job of allowing developers to use DRY without affecting how well the database performs, but I don't design database software at that level, so perhaps the conflict between abstraction and performance in database is harder to fix than I suppose. However, we have to work with the systems as they are currently built. We can ask for better implementation of DRY principles in future releases that won't also kill performance (and it has gotten better through the years but is still problematic), but in the meantime we must consider if DRY is the right move for this database at this time.

But often the very features that you want to use to ensure the DRY principle is met are the ones that cause tremendous problems for the database. I'm not saying never use DRY but don't go overboard with it.

Examples of what I'm talking about. You need to do a data import of a million records once a month. Records can already be manually added through the user interface calling a stored proc. This proc, because it was designed for single record imports, only adds one record at a time. Using DRY to avoid having the insert code in two places, you write a cursor to call the proc repeatedly rather than write the set-based imports you need. Time for the import goes from the 30 minutes it would take using set-based logic to 18 hours. Now the right way to adhere to DRY in this case would be to fix the proc to handle mulitple record imports. Unfortunately, it is often impossible or very difficult to send an array to a proc (depending on the db back end) and by changing the proc, you end up breaking the application.

Scalar functions and table-valued functions are also used to implement DRY principles and again they can seriously affect performance especially if you need to use them in a way that prevents the indexes from being useful.

Views are also good for implementing DRY. However, if you implement DRY through the use of views that call views that call other views, you will quickly get to the point where the queries will timeout under load.  In fact you might end up needing to generate data sets of millions of records when you only need three at the end. So a one-level view of a complex set of joins to implement DRY can be excellent (I have one myself that we use to make sure all financial reporting uses the same base set of tables and calculations of certain things), more than two levels and you need to consider if you are creating a performance mess.

Title: Why is DRY important?

Body:
Quite simple, why would I want to write code that works for all cases and scalable data when all I need to do is repeat the same process a few times with a few minor tweaks?

I'm unlikely to need to edit this again any time soon.

It looks like a lot of less work to just go...

```<code>function doStuff1(){/*.a.*/}
function doStuff2(){/*.b.*/}
function doStuff3(){/*.c.*/}
</code>```

And if I ever need to add something...

```<code>function doStuff4(){/*.d.*/}
</code>```

And if I need to remove it, I remove it.

It's harder to figure out how to make all of those into one straight-forward pattern that I can just feed data into and deal with all the cases, and make a bunch of changes I don't feel like I'm ever going to have to do.

Why be DRY when it looks like a quick cut+paste is going to be so much less work?


问:
"It was working yesterday, I swear!" What can you do?
When you arrive in the morning, you find that your software does not work anymore, even though it did when you left yesterday evening.

What do you do? What do you check first? What do you do to stop being angry and start working on your problem? Do you blame your colleagues and go directly to them? What can be done to avoid being in such a situation?

答:
The bug may have already existed, but been hidden by external factors, or deep system issues.

This happened to me. A bug developed between 2 builds of our project. Literally, the only change we had made was to update to a more recent build of the one of the underlying libraries.

Naturally we blamed them. But the only change they had made was to refactor some headers for a faster compile. I agreed that that should not have broken the system.

After much debugging it turned out that the problem was a rogue pointer bug that had been latent in my code for years. Somehow it was never triggered until their refactoring had changed the arrangement of the executable.


问:
Is there a chart for helping me decide between open-source licenses?
The Open Source Initiative lists 9 different licenses in their list of "License that are popular and widely used or with strong communities".

I want to license my project as open-source. Unfortunately, I do not speak legalese. Is there some chart I could consult that will help me make the right choice, or at least point me in the right direction? For example a table summarizing the differences between the licenses, or perhaps a flow-graph using my requirements to guide me into the correct license for me?

I also intend to meet a lawyer, but any information to start with will help.

答:
Jeff Atwood has done a pretty good job explaining the differences among the multitude of Open Source software licenses in plain English here:

http://www.codinghorror.com/blog/2007/04/pick-a-license-any-license.html

The most important consideration affecting your decision will be your redistribution terms.  That is, will you allow your code to be used in commercial applications and if so, will you require such applications to open-source their own code?

This is where the GPL is notable: If you license your code under the GPL, anyone using your code must also license their code under the GPL. Since the GPL requires that all of your code be open-source, this pretty much excludes its use in companies that wish to keep their code proprietary.

Note that the GPL does allow you to use GPL'd code for in-house business applications, so long as you do not redistribute those applications to a third party.

See Also

http://haacked.com/archive/2007/04/04/there-are-only-four-software-licenses.aspx


问:
Why should I use an MVC pattern?
It seems everyone doing web applications nowadays wants to use MVC for everything. I find it hard to convince myself to use this pattern, however. I understand the general idea is to separate the backend logic from the frontend that represents the program. Generally, it seems that the views always depend on the controller to some extent, which ends up depending on the model. I don't see what advantage adding the controller gets me. I've read a lot of hype about "this is the way applications should be designed", but maybe I still don't understand what is supposed to go where. Whenever I talk to others about MVC it seems everyone has a different idea of what belongs in what category.

So, why should I use MVC? What do I gain by using MVC over just separating the frontend from the backend logic? (Most "advantages" I see of this pattern are gained just by separating interface from implementation, and fail to explain the purpose of having a separate "controller")

答:
You shouldn't.

Let me rephrase that. You should use an architecture that separates logic from your views. If needed, you should use an architecture that utilizes a controller (such as MVC) if there is logic required that doesn't necessarily fit into a model (such as, say, a tree traversal parsing URL chunks).

Coming from CI and Yii, I thought that having a dedicated controller was a really cool idea. However, when developing applications with proper RESTful interfaces, then the need for a controller to handle non-model-specific logic seems to lessen. Thus, when moving to Django and then Pyramid (neither of which follow the MVC architecture completely), I found that the controller was not actually a required component for the applications I was building. Note that both frameworks have "controller'ish" features, such as URL Dispatching in Pyramid, but it's a configuration thing, not a runtime thing (such as CController in Yii).

At the end of the day, what's really important is the separation of view from logic. Not only does this clean things up in terms of implementation, but it also allows FE/BE engineers to work in parallel (when working in a team environment).

(Side note: I don't develop web apps professionally, so there may be something that I'm missing)

Title: Why should I use an MVC pattern?


问:
Using template questions in a technical interview
I've recently been in an argument with a colleague about technical questions in interviews. As a graduate, I went round lots of companies and noticed they used the same questions. An example is "Can you write a function that determines if a number is prime or not?", 4 years later, I find that particular question is quite common even for a junior developer. I might not be looking at this the correct way, but shouldn't software houses be intelligent enough to think up their own interview questions? I've been to about 16 interviews as a graduate and the same questions came up in about 75% of them. This leads me to believe that many companies are lazy and simply Google: 'Template questions for interviewing software developers' and I feel there are doing themselves a disservice in taking this approach.

Question: Is it better to use a set of questions off some template or should software houses strive to be more original and come up with their own interview material?

From my point of view, if I failed an interview and went off and looked for good answers to the questions I messed up on, I could fly through the next interview if the questions are the same.

答:
I think the interview should be divided into:

Social aspect (aside from HR stuff) - Does this person fit into our organization well? Does he have the right attitude - Is he willing to follow our management style? This needs to be original since companies and teams are different.

General suitability for the role - Again this should differ from place to place

Core: Subject mater questions that focus on the main area of the job - This is scientific and  does not need to be original since it is scientific.

Day-to-Day work suitability: These are questions about subjects you expect the candidate to do on a daily basis. It may be scientific, but it better be from the real job he is expected to do. This part would vary from place to place.


答:
I feel this depends much upon the problem you are tackling. I see the separation as follows:

Model - how do we represent the data? For example, how do I go from my objects to a persistent storage such as a DB -> how do I save my 'User' object to the database?

Controller - what am I doing? This is the action that's taking place, and what, on a conceptual level, needs to be carried out. For example, what stages do I need to go through to invoice a User? N.B. this may affect any amount of objects, but does not know anything about how they are persisted to the DB.

View - how do I render the result?

The problem I feel you are seeing is that a lot of web applications are a glorified CRUD (Create-Retrieve-Update-Delete) interface to a DB. i.e. the controller is told to 'add a user', and it then simply tells the model to 'add a user'. Nothing is gained.

However, in projects where the actions you carry out do not apply directly to changes in the model a controller makes life much easier and the system more maintainable.

Title: Why should I use an MVC pattern?

Body:
It seems everyone doing web applications nowadays wants to use MVC for everything. I find it hard to convince myself to use this pattern, however. I understand the general idea is to separate the backend logic from the frontend that represents the program. Generally, it seems that the views always depend on the controller to some extent, which ends up depending on the model. I don't see what advantage adding the controller gets me. I've read a lot of hype about "this is the way applications should be designed", but maybe I still don't understand what is supposed to go where. Whenever I talk to others about MVC it seems everyone has a different idea of what belongs in what category.

So, why should I use MVC? What do I gain by using MVC over just separating the frontend from the backend logic? (Most "advantages" I see of this pattern are gained just by separating interface from implementation, and fail to explain the purpose of having a separate "controller")


答:
Well the basic reason for using an MVC structure shows up in an industry setup, where a single work process, a single model is followed for the development of any application. So, in case, if the project moves on from one module of an organization to another, it is much easier to provide a better understanding of the work scenario. It incorporates clarity of work.
 While you, as an individual would have a different approach for your application, you when working in a combined fashion with an associate, would first discuss and land upon a commonly agreed model by the two (you and your associate). And in such a case, it separates the responsibilities assigned to you and your associate respectively with a distinctive margin.

Title: Why should I use an MVC pattern?


答:
Heh. Martin Fowler agrees with your confusion about MVC:

I don't find it terribly useful to think of MVC as a pattern because
  it contains quite a few different ideas. Different people reading
  about MVC in different places take different ideas from it and
  describe these as 'MVC'. If this doesn't cause enough confusion you
  then get the effect of misunderstandings of MVC that develop through a
  system of Chinese whispers.

However, he goes on to give one of the more cogent explanations of what motivates MVC:

At the heart of MVC is what I call Separated Presentation. The idea
  behind Separated Presentation is to make a clear division between
  domain objects that model our perception of the real world, and
  presentation objects that are the GUI elements we see on the screen.
  Domain objects should be completely self contained and work without
  reference to the presentation, they should also be able to support
  multiple presentations, possibly simultaneously.

You can read Fowler's entire article here.

Title: Why should I use an MVC pattern?


答: Simply put: separation of concerns. Aside from all the talk about the "correct" way of doing things, having cleaner code, etc. you can just say that MVC allows you to more easily reuse your code. Basicaly you program your models and your controllers and you can use them indistinctly in a web app, a desk app, a service, anywhere without much effort.</p>

Title: Why should I use an MVC pattern?


问:
What are common Silverlight specific mistakes/pitfalls developers should avoid?
What are some common mistakes/pitfalls, specific to Silverlight development, that developers should avoid?

PS: Please, if you don't have hands on experience with Silverlight and want to simply state that people should just not use it, refrain from doing so.

Thank you for you time and consideration.

Here is a compilation of input from users on both StackOverflow and programmers.stackexchange.com to this question:

Thinking it's the same as WPF

Not using the MVVM design pattern

Not knowing that it doesn't support ADO.Net Connections

Not knowing that it only supports basicHttpBinding (no wsHttpBinding allowed)

Not knowing that RelativeSource bindings don't support AncestorType

Forgetting to setup IIS MIME types

Thinking that Silverlight works the same way as WPF

5mb limit on XAP files and the need for third party solutions to work around that

Not abstracting out the service layer calls.

Abstracting out the service layer calls so that the silverlight pages
  load in the designer (either Visual Studio or Expression Blend)
  without the presence of the service helps out. Especially if the UI is
  being designed in Expression Blend. Some dummy data can be returned
  without calling the service and the UI designers still get a feel for
  the look and feel of the application with data.

Not using MVVM

You can program Silverlight like a winforms app but you are in for a
  world of grief. The whole platform was designed to use MVVM and if you
  don't work with that you are going to be swimming upstream the whole
  way.

Networking: there are limits on sockets, e.g. no UDP, only the async model

Networking: two (3.0) different HTTP stack, the browser one and the client one - each has its own quirks (a lot of applications ends up using both);

Security: some API are marked as [SecurityCritical] and you won't be allowed to use them, even if it will compile just fine, at runtime (e.g. but that code has been working for years in my other application)

Security: security policies on HTTP[S] and sockets (but works so well on your own computer)

ditran.net/silverlight-common-errors

Using MVVM but not truely understanding it

blindly obeying its principles as if they were the 10 commandments,
  some people really make things hard for themselves I bet most don't
  have any separate UI design team nor are using Unit tests, so the
  benefits of MVVM would be minimal

Not grasping the Asynchronous nature of Silverlight.

Over using UserControls when they should be using a Templated control

Thank you for constructive input to the following people:
  Rachel, maple_shaft, Jesse C. Slicer, ChrisF, Jon Raynor, poupou, RKitty, DShah, AnthonyWJones

答:
Not being able to leverage existing Class Library DLLs.

Silverlight Client-Side applications must link to Silverlight Class Libraries.

This may force you to keep business logic on the server end (which works fine with regular .NET Class Libraries) - which is a good thing!


答:
I think there are those easy questions fizzbuzz, reverse a string, etc., and then there are certain questions whereas if you have not seen them before it is tough to get the intended optimal solution with the additional pressure of the interview and the short time constraints.  The worst part is that sometimes recruiters with no technical knowledge ask some of these questions and they are looking for a very specific answer....  If you do not give the optimal answer they think you are an absolute idiot.  Even if your answer works, solves the problem, and while it may not be optimal it is not too inefficient....

Some Examples:

How would you shuffle a deck of cards?  They are looking for the Fisher-Yates method http://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle other answers are "wrong".....  This is not something that you are likely to know unless you wanted to shuffle cards before and specifically looked it up.  You might stumble upon it in the course of doing the answer, but from what I have seen they expect you to know this cold so it is doubtful there will be much time given to allow finding the solution.  Another less efficient (but maybe more obvious) way is to create a new array with a pointer to the original array and a number which is a random number then sort the array by the random number.  Then use the sorted array to construct a new array of cards.  In any case, I got 0 credit for presenting that to a recruiter.

Another example is the question about how you would detect a duplicate number in a list of n numbers all from 1 to n-1.  The obvious answer (which is relatively efficient in a time perspective) is to use a hash table to insert each element and if you find one already inserted then you found the duplicate.  The optimal answer is because the numbers are between 1 and n if there are no duplicates, you can get the expected sum as n(n+1)/n.  Then if you sum up the array you get the actual sum which is n-d less than the expected sum.  So basically n - (Expected Sum - Actual Sum) = duplicate number...  It's a pretty special case....  I actually saw something before in some online post on interview problems ages ago about a related one with the same trick, so I was okay....

Another one, reverse all the words in a string without using any additional space.  I had to think about it and the recruiter was pretty impatient in the 5 minutes I thought (splitting and re-joining the string in reverse, or going word by word into a new array are both very easy).  I came up with finding the border of the last word, finding the end of the first word, and constantly shifting the entire list down by 1 and then inserting the appropriate letter.  Then repeating until you've reached the end of the list.  This method worked and the interviewer agreed (he was a bit technical), but it is pretty inefficient.  When I got home I searched for the optimal answer, and it is to just reverse the list, then reverse each individual word.  Some people might come up with that, but in five minutes with the pressure of an interview and never having seen the question before, I think it would be difficult....

Now it's true once you have seen some of these problems you can solve them easier.  Because there are some similar questions with some of the same tricks.  I know especially the n(n-1)/2 formula and number list has several variations.  But still I don't know what these questions test.  A FizzBuzz is something that everyone should be able to do (although i have seen variations that are not so simple in which case I start to question if even that is realistic for an interview situation without being able to type in/debug the code).  Some of these questions are obvious once you see them, but if you haven't seen them they are not obvious.  After all someone mentioned it took years for the first correct implementation of binary search to appear...  Right now binary search is so obvious because everyone can read about it.  But earlier it was a challenge to discover/implement it.

Nevertheless, I think the worst part is when non technical people are asking the questions because they cannot appreciate your solution is correct although not optimal.  They just know your solution is not the one presented and hence it is all wrong, you get no credit for the attempt.  Even non optimal solutions often show a knowledge of programming constructs.  Unless I am programming poker games, I do not care how well someone can shuffle a deck of cards.  And even if I was, after showing them the efficient algorithm I'm sure anyone halfway decent could follow it.

Template questions appear to just give an advantage to candidates who have been interviewing longer as they are more likely to have seen more of the template questions.  Even FizzBuzz, the first time you see it you might freak out, but as you see it over and over again you become more used to it.  The best thing you could do is give some coding challenge that requires custom business logic.  E.g. create some dataset (array of objects/records) and then create some business rules to apply to each object and return an answer..  e.g. an some type of rating, etc. but very custom rules).  While they have probably seen loop through records and apply logic a zillion times, your rules will be unique, so at the very least they would have to understand and successfully implement the rules you created.

Let's say projected Salary and a list of candidates and their top 3 video favorite video games, and perhaps a starting salary.  Candidates who like Zelda get a 300 penalty, candidates who like the little mermaid get a 200 bonus.  Candidates who like Donkey Kong and Super Mario Brothers but not Dr. Mario get a 300 bonus.  Candidates who like Metroid or Kid Icarus get a 200 bonus, etc....  It seems a bit insane but it would show you their ability to translate business rules into logical program constructs and test their understand of boolean logic as well.  Overall not much different than fizzbuzz except not using modulus and loops.  You could of course give them the list and have them loop through it and print the results to the screen using specific output criteria as well.

Title: Using template questions in a technical interview

Body:
I've recently been in an argument with a colleague about technical questions in interviews. As a graduate, I went round lots of companies and noticed they used the same questions. An example is "Can you write a function that determines if a number is prime or not?", 4 years later, I find that particular question is quite common even for a junior developer. I might not be looking at this the correct way, but shouldn't software houses be intelligent enough to think up their own interview questions? I've been to about 16 interviews as a graduate and the same questions came up in about 75% of them. This leads me to believe that many companies are lazy and simply Google: 'Template questions for interviewing software developers' and I feel there are doing themselves a disservice in taking this approach.

Question: Is it better to use a set of questions off some template or should software houses strive to be more original and come up with their own interview material?

From my point of view, if I failed an interview and went off and looked for good answers to the questions I messed up on, I could fly through the next interview if the questions are the same.


问:
Creating a Performance Model for a Legacy product
I've been given the task for creating a performance model for a legacy product. The product is about 10 years old and has never had any performance requirements or performance models before. Generally whats happened in the past is a customer will complain that a particular feature is slow or they are not getting the throughput that they want/need and the developers will investigate and see if any more performance can be squeezed out the code for the feature.

Since the product doesn't have any hard measurements and metrics for past versions I fell all I can do is create baselines for the current version and go from there. Other developers sometimes notice that memory usage is really high and ask why. Also, I am new to the product so I don't know all the feature points (which there are hundreds to thousands) and the performance cost of running each.

The program is an ASP.NET/.NET 2.0 webapp on IIS 6. I've started looking into performance counters and the CLR Profiler to start getting measurements. I've also read the following docs:

Measuring ASP.NET Performance

Improving ASP.NET Performance

So my question is: How can I create a performance model for a legacy product that I am new too and hasn't had a performance model/requirement in the past?

答:
More than likely a good part of any performance you will want to measure and improve has to do with access to the database and database performance. So your performance plan will need to consider how to measure that and what to look for in terms of pain points.

You don't say what database backend you are using but I suggest you read up on performance tuning for the database you use as your backend. Performance measurement and tuning for databases is often quite specific the the database engine you are using.

For SQL Server this would be a good book to start with:
http://www.amazon.com/gp/reader/1430219025/ref=si_aps_sup?p=random&ie=UTF8&qid=1314907292#reader_1430219025

I would also get myself up to speed on using the SQL Server Profiler if that is your back end.


答:
My interview template in pseudo code:

if question(FizzBuzz_type_question) == correct then

for each (question q in array_of_more_interesting_questions)
question(q) else

end interview.


问:
suggesting large changes/a rewrite as an intern
The context:

it's an internal project (that I don't think a lot of people use)

it's old

we're updating it

The issues:

it abuses the mvc framework (no use of models, business logic in views, etc)

what we're being asked to do is small, but because of the low cohesion we have two options:

continue to botch things

move large chunks of code around or rewrite the thing

The solutions (I see):

continue working with it, ignore best practices in favor of being done soon and not introducing new bugs by refactoring/rewriting

refactor/rewrite

I guess my question is really: if I want to make large changes to this project, how do I do propose that without insulting anyone? Or would it be better for me to simply go with the flow even if that means (metaphorical) duct-tape sometimes?

答:
I would totally make this suggestion, but only to a fellow developer. I would not bring it up with management, as I would imagine management would see that as some type of overstepping of boundaries.

After making the suggestion to a developer you're working with, they'll probably have some good reasons for how the codebase is why it is.  The reasons could range from "no, actually the code is fine, you just don't understand MVC (and that's why you're an intern)" to "that's a great idea, let's architect the new application together!"

Keep in mind that the answer to refactoring this application will more than likely be no; I would never want an intern taking over the rewrite of an internal application (what happens when your internship is done and the rewrite is only half-finished?)  Plus, there's probably more important stuff you could be working on than poking around an internal application.

But it never hurts to ask your peers, and if you do, you will learn something. And that, 7983879342, is what an internship is all about.


答:
Propose your changes. Be clear on the business case for each: Why will your proposed change help the system as a whole? If it doesn't, expect push back. Why spend money fixing something that ain't broke? Reasons such as making the system more extensible and separations of concern may be valid (depending on who you're talking to), but 99% of the time, just saying "it's not implemented correctly" will get you nowhere. Make sure that you're adding value to the project and not just proposing make work (even if it does clean up the code).

Unfortunately, in the professional world, just because something's been implemented wrong doesn't mean that it's broken, and therefore in no need of fixing. Also, in fixing it, you may introduce unforeseen knock-on issues that could impact other areas of the project.

Title: suggesting large changes/a rewrite as an intern

Body:
The context:

it's an internal project (that I don't think a lot of people use)

it's old

we're updating it

The issues:

it abuses the mvc framework (no use of models, business logic in views, etc)

what we're being asked to do is small, but because of the low cohesion we have two options:

continue to botch things

move large chunks of code around or rewrite the thing

The solutions (I see):

continue working with it, ignore best practices in favor of being done soon and not introducing new bugs by refactoring/rewriting

refactor/rewrite

I guess my question is really: if I want to make large changes to this project, how do I do propose that without insulting anyone? Or would it be better for me to simply go with the flow even if that means (metaphorical) duct-tape sometimes?


答:
You're an intern. Presumably, you're brand new. They probably suspect you for an idiot.

So as you go about making suggestions, tread lightly. Be humble and unassuming. Let your ideas flow conversationally as you allow other members to also discuss their own ideas about the codebase and what pressures they may be under (there could be very good reason why an effort hasn't been made to clean things up).

You want to earn their trust. You do this by writing good code for the tasks you are given. Write it cleanly, use the best practices that you would like to see implemented, but only on what you are assigned to do. These will probably be small things, things that the rest of the team probably thinks are insignificant. Do those things well. Brighten the corner where you are, and as the team comes to review your code favorably, your ideas will in turn also grow in stature.

Eventually, as you demonstrate your competency and knowledge, you may be able to pull off a suggestion or two.


问:
Where to Start When Making a Web Application on Your Own
I've been assigned an in-house web application that is basically an Employee and Project Management System.

I'm getting confused as to where I should really start with this assignment (I mean I'm my own development manager and I really don't have experience with making a project alone) and I'm hoping that you guys could share your experiences when you were given an assignment/project to build by yourself.

Thanks

答: I would suggest to search for some open source alternatives. If there are some alternative available which may be suitable for the defined needs, you can build on top of them and deliver much faster.</p>


答:
Reading your question, I'm actually skeptical that rewriting the application is worth it.  Maybe you didn't bother to make the full case in your question.  But how likely is it that the benefit of rewriting is worth the cost if it's an old, rarely used, internal application?  The cost of a rewrite is likely to be more than the sum of all the updates and patches it will ever have.

If you think that's not true you will need to make more of a case for it than you did here.

As for improving the application, you might have some chance for a little bit of refactoring that happens naturally in the course of your updates.


答:
Yes, the terminology on this is a mess.  It's hard to talk about because you never quite what somebody means by the terms.

As far as why a separate controller, the reason might depend on which version of controller you are talk about.

You might want a controller because when you run tests the view has a bunch of widgets that you didn't write and probably don't want to test.  Yes, you separated implementation from inheritance, so you can use a stub or mock to test other stuff, but when you test your concrete view itself it's harder.  If you had a controller that didn't have any widgets running that same code then you could test that directly, and maybe not need to test the widgets via script.

The other versions are IMHO harder to show a concrete benefit for.  I think it's mostly a separation of concerns issue - separate pure visual GUI concerns from logic that applies to the GUI but isn't part of the business model (things like, translate updates from the model into which widgets should be visible).  But in practice the two classes are likely to be so tightly coupled (even if they communicate through interfaces) that it's hard to be overly upset at merging them into just a view, and just keep an eye out for ways the functionality might be more reusable if they were split.

Title: Why should I use an MVC pattern?


问:
What are the major differences when moving from console-based to GUI-based programming?
I started, like many others, with console-based (as in terminal, not Playstation) programming. But sooner or later, one needs to touch upon GUI-based programming, whether you want to or not. This transition holds many changes in how you need to think about the frontend (and possibly also the backend).

So, what are the major differences when moving from console-based programming to GUI-based programming?

答:
The biggest difference is the design of the UI. A good GUI can make or break an application. Mac fans would draw attention to the beautifully designed GUI's of the average Mac OS X app and they've got a point, but this isn't a technology issue - it's a design/ethos/usability issue.

As for technical issues, in no particular order:

The user can do anything they want in any order at any time, unlike console program in which you're either asking for input or telling them the output. You cannot assume that they'll follow the order you hope, unless you enforce the workflow Wizard-stylee.

As already mentioned, events play a big part in this, and you can get multiple events happen while you're servicing the last one, so you can't really construct your state based on the 'current event'. Use closures or a similar mechanism to maintain context across different events. In a console app, your FSM is usually self-contained around the 'get input, process input, update output' loop. There isn't the same kind of structure in GUI programming - the 'main' is a re-entrant event-driven thing, often a ginormous switch() statement.

You need to consider different screen sizes/resolutions and allow the GUI to resize from 800x600 up to the users' monitor maximum.

You need to consider different input strategies - mouse, keyboard, touch, etc. Some technologies come for free (Mouse-wheel scrolling), others require some integration work (Ink).

Accessibility - a GUI is much more suitable for less able users who have restricted vision, hearing, motor skills or cognitive skills. A 'ding' noise is nice and obvious compared to a cryptic error message on the console.

Internationalization - i'm assuming your console app is US/ANSI only, but when you get into GUI, you can have language/resource packages that can target other languages and regions with no change to the coding, if you prepared for it from the start. For example, no hard-coded language strings in the code - everything as resource lookups.

You have lots more options for implementation technology - web-based, various GUI kits, Flash/WPF, etc.

Use of colour and animation. Console programs are generally monochromatic and don't animate much. Many modern GUI frameworks provide themed widgets and have move/size/show/hide animation effects, often for free.

Graphics. Console apps sometimes use ASCII art for diagrams, but a GUI app gives you full graphical ability. Lovely art can make a big difference too.

ContentLicense: CC BY-SA 2.5


问:
SCRUM technical artifacts
My company is introducing SCRUM for new software development. I'm currently both Product Owner and a product manager responsible for the technical aspects of the software.  The technical manager role is not part of the scrum team.

I'm finding there is some desire within the scrum team to treat the software development as a black box ie I should only care about user stories and business benefit.

This is an issue as the information needed to inform client discussions about the most appropriate architecture, deployment mechanisms, host system requirements etc isn't available (I'm responsible for this in my manager role).  For example, the dev team may develop a system that can only be used with a particular database collation.  This isn't something I'd ever anticipate so wouldn't create a user story or discuss with clients but it might be a show-stopper for the product.

What documentation and level of transparency is reasonable? The whole team is new to scrum so any advice welcome.

PS: I wonder if this dual role is a good idea. I think some team members may think the Product Owner is being a rooster which isn't my intention ;-).

答:
What documentation and level of transparency is reasonable?

"Reasonable"?

The question shouldn't about "reasonable".

It should be about "deliverable".

information ... about the most appropriate architecture, deployment mechanisms, host system requirements etc isn't available

Then, there's a problem with what the developers think is deliverable and what you think is deliverable.

On the next sprint, include these other deliverables.

Don't be silly and ask for mountains of traditional "Big Design Up Front" documentation.

Ask for the "architecture", "deployment" and "platform" descriptions.  They're easy to produce and should cover a few pages of material.

Title: SCRUM technical artifacts


问:
Architectural differences between dynamic and static languages
Are there any major architectural differences when designing applications that will be built on static languages (such as C# or Java) and dynamic languages (such as Ruby or Python)?

Which are the design possibilities that might be a good choice for one type that's a bad one for the other? Are there any useful features achievable with one type that's not with the other (in design and architecture, of course)?

Also, are there any dynamic-specific design patterns?

答: I have never thought along these lines.  So when did a Google, Peter Norvig's blog was one of the top hits.  It says some design patterns are easier to implement in dynamic languages than traditional object oriented languages such as C++.  I think there should be differences at design/architecture as well since he notes that implementation is easier in dynamic languages.  I will try to add more to the answer as I study further.</p>