答:
My experiences with Agile failure have had nothing to do with economics but with corporate/departmental/personal politics.

On a personal level, there are simply some people who’s personalities will clash. Forcing them into an Agile team, or even worse a paired programming team, will escalate their dislike of each other to a boiling point. This can get very nasty, very quickly and result in things like acts of sabotage worthy of a reality show, turning scrum meetings into a circular firing squad of blame or even worse.

Above that, there’s development management. I’ve seen this go wrong in two different ways.

First is ‘cargo cult Agile’ where the manager insists upon following the manifesto and whatever class/book/website they read exactly without understanding the reason why  and when to use them and when to improvise. It’s as if the Agile manager is waiting for the magic to happen because they’re following the spell exactly. This procrustean implementation of Agile can result in a number of problems that will lead to project failure.

The other is ‘Agile In Name Only’ where the terminology like sprints and scrum are used but are really just labels over old practices like micro-management, dishonesty going both up and down the chain of command, lengthy useless status meetings and other such stuff. Projects fail just like they used to but now Agile can be blamed for it rather than poor management.

Above that is a lack of buy-in by the client/customer of the project.  These people will have their own departmental priorities and can be resistant to working with a development team unless it’s made clear that it’s an essential part of their job by their management. This can be made worse by departmental politics or corporate policies. For example, both operations and marketing have input into a project and your team ends up spinning their wheels since the two sides cannot agree on anything. Another example is when corporate policy on time management and billing causes conflicts. I’ve actually found that external customers were easier to deal with than internal ones. They liked the attention they got from the process and knew they were getting their money’s worth.

Title: What do you need to succeed with Agile?


问:
License placement curiosities
Ruby gems have LICENSE file with the license text in each gem. Cocoa[Touch] open source frameworks (say ShareKit, StackKit, etc.) have license at the very beginning of each file (.h and .m). I am not sure about .NET or other interpreted languages (except ruby), but I'm pretty sure there are own choices at hand. I am wondering what are the reasons behind placing license into open source software source packages like this. Why not LICENSE file everywhere or at the beginning of every source file?

答:
The choices seem very different, but aren't actually. The common practice is to put a notice (boilerplate) stating the license and its short form at the beginning of every source file to (a) make the licensing terms clear explicitely and (b) make sure the license isn't left out accidentally in copying. The license notification you find at the start of a file is usually not the full license, because the full GNU license covers many pages and would bloat source files quite a lot.

The full license is included in the LICENSE file to fulfill GPL's requirement that the license is distributed with the project. It suffices to have one file per project here. The LICENSE file also fills the role of a fall-back license: If you omit the boilerplate at the start of some file, the code is still covered by the project-wide license.

ContentLicense: CC BY-SA 3.0

Title: License placement curiosities


问:
What do you need to succeed with Agile?
Agile adoption can fail in some organizations, I even worked for a company where waterfall was the only (the true) way but only because they tried Agile on a project and failed.

When I asked the people who still remembered that (I was a junior) I was shut down hard, like I was reminding them a bad nightmare that really happened.

I don't know why the project failed. There are resources found on the web why Agile fails is some companies but the reason are mostly economic. So I thought I ask here fore some feedback.

What are the reasons Agile adoption fails in some organizations? Or, another way of putting it.. What do you need to succeed with Agile?

答:
I can only give my advice from my own personal experience.

One employer I had totally failed at Agile. Work was done on an ad-hoc basis, testing was non-existent, and requirements were documented in emails and meeting minutes. The only development method used was anarchy, or 'fire-and-forget coding'. Implementing some kind of software engineering method would have been impossible as developers were too overworked to set up some kind of story-tracking project management software.

At another employer, our team had a heroic member who desperately tried to establish some Agile best practices - we had a Kanban board, issue tracking, we used TDD and BDD (while not Agile in themselves, they tend to be present in Agile groups). Unfortunately, we lacked things like story points, estimation sessions, capacity planning, burn-down charts, velocity graphs - the kind of useful Agile project-management stuff that allows work to flow through smoothly. As a classic symptom of Agile going wrong, when our Kanban board got too full, we bought a bigger board :/

The place I'm currently in uses story points as a way of planning capacity with two-week iterations, TDD, daily standups, iteration-by-iteration timeboxed retrospectives and pair programming on most things. This is as a result of total management buy-in and client education.

It think that in order for Agile to succeed at a company, you need the following things:

Project managers who understand Agile and who will use the tools appropriately.

Developers who understand Agile, who are open and honest, with the discipline Agile requires

Buy-in from the client. They need to recognise the benefits of Agile and be willing to listen to advice from their developers with regards to what can be developed in a given time-frame.

EDIT: It's also vital to make sure you have a good understanding of -why- things like daily stand-ups and short iterations are useful.

Title: What do you need to succeed with Agile?


问:
Software license restricting commercial usage like CC BY-NC-SA
I want to distribute my software under license like Creative Commons Attribution - Non commercial - Share Alike license, i.e.

Redistribution of source code and binaries is freely.

Modified version of program have to be distributed under the same license. Attribution to original project should be supplied to.

Restrict any kind of commercial usage.

However CC does not recommend to use their licenses for software. Is there this kind of software license I could apply? Better if public license, but as far as I know US laws says that only EULA could restrict usage of received copy?

答: The Aladdin free public license (AFPL) is a typical license prohibiting reselling your code (but using it in-house in a commercial enterprise is allowed). Use with care, though, because of the legal caveats the comments have mentioned, and because most distributions will (for good reason) never include a program licensed under the AFPL.</p>


问:
Server OS/Software Requirements For asp.NET Framework 4.0
The Background:

Me and my colleague are opening a new website design & development company.

We have designed and implemented a website on Microsoft Visual Studio 2010 using Web forms in .NET Framework 4.

Because I was new to asp.NET at the time, I wasn't sure what Database to use. Therefore I created a new "Microsoft SQL Server Database File" and added all the tables etc.

I then worked with this configuration until the website was complete. The website works like a dream in Visual Studio.

The Problem:

We were supposed to be buying a server from a local source that cannot be named, and this server was supposed to have Microsoft SQL server 2005 for the database, and I'm assuming IIS to configure the server and handle requests etc (please keep in mind that my knowledge of servers is limited)

And this company were going to configure everything blah blah blah, get everything set up so all we have to do is put our website on it, and life is sweet.

The problem is, this company have messed us about, told us this and that and it turns out they're very unreliable and untrustworthy.

We've already spent a large sum of money with them and they are dragging their feet giving us the money back, saying what we asked is impossible, that we cant have SQL running on an old server yada yada yada.

The Question:

I have an asp.NET website with a SQL server database ( .mdf file, if that helps anything ) and we need to know what do we need to get it on the internet.

we've considered buying our own computer, putting MS server software on it, installing SQL server 2005, installing IIS and running it off that. But we don't know what to do or how to do it.

Before all this server hastle kicked off, i tried installing a copy of IIS on my computer, and hosting it from there as a test to get me used to the software, however I tried multiple tutorials, and all sorts and could not get our website to host!

There may be examples of this all over the internet but i cannot find an answer. I dont understand most of the things people are talking about on these articals.

I know I've rambled, But basically.

I just need to know HOW to put an asp.NET application on the internet, and what minimum requirements I need.

Do i even need SQL server software on my server? or is that purely for interacting with the sql database?

答:
You shouldn't need SQL Server to put an ASP.NET application online.  If your site requires database persistence, then yes, you'll need SQL Server installed, but not necessarily on the same server.  If your requirements were that "we need to deploy a website", then there's no indication that SQL Server would be a requirement, and I would not expect them to give you access.  Many hosts, such as http://discountasp.net, provide hosting for ASP.NET applications and SQL Server databases completely separately.

One solution that you DO have is to host your ASP.NET application on the server of this company (assuming you're still on speaking terms), and host your SQL Server database on another machine somewhere completely different - they don't have to be on the same machine.  Your web.config file will let you change your connection string so you can have them separately.

I don't know the specifics of the conversation, but unless you tell them that you specifically need SQL Server (though most web applications do have a database of some kind and you can pretty well assume it's needed), hosting companies still reserve the right to give/sell SQL Server separately.  If you have admin access to your hosting machine, I would suggest just installing SQL Server Express unless you need some of the more serious SQL features.  Most of the time the reason hosts sell SQL Server databases/install separately is the EXTREMELY hefty license price tag of the the non-express version.

I hope this helps, and leave a comment if I need to go into more detail in a particular area.


答:
Given your inexperience with servers, their maintenance and the requirements for keeping websites alive (let alone machines, backup, networking, etc), you may very well be better served by using a purchased hosting provider. There are all kinds of hosting providers who offer site plans capable of hosting multiple websites and databases depending on your needs.

Don't forget that a major cost of a server isn't the hardware/software but the time and labor required to set it up and maintain it. If you are inexperienced with this, this cost can be prohibitive. It will take you far longer to perform these tasks than a comparable development task simply because you have to learn first.

That being said, I know HP and Dell both have "out of the box" server installations that simply need to have the first time configuration run on them and they should perform properly. Adding a proper server-level database software will be an add-on purchase/task, but it should still be fairly easy. Since .Net 4.0 can be run on a common desktop, the system requirements should be geared more towards the database you intend to run on the server and the actual load it is going to be serving.

My answer to your final 2 questions: I would recommend SQL server, but I would recommend having it as part of a plan from a hosting provider. I think you will have much more success if you model your business plan to focus on your existing talents and leave areas of potential weakness to services who specialize.

Title: Server OS/Software Requirements For asp.NET Framework 4.0

Body:
The Background:

Me and my colleague are opening a new website design & development company.

We have designed and implemented a website on Microsoft Visual Studio 2010 using Web forms in .NET Framework 4.

Because I was new to asp.NET at the time, I wasn't sure what Database to use. Therefore I created a new "Microsoft SQL Server Database File" and added all the tables etc.

I then worked with this configuration until the website was complete. The website works like a dream in Visual Studio.

The Problem:

We were supposed to be buying a server from a local source that cannot be named, and this server was supposed to have Microsoft SQL server 2005 for the database, and I'm assuming IIS to configure the server and handle requests etc (please keep in mind that my knowledge of servers is limited)

And this company were going to configure everything blah blah blah, get everything set up so all we have to do is put our website on it, and life is sweet.

The problem is, this company have messed us about, told us this and that and it turns out they're very unreliable and untrustworthy.

We've already spent a large sum of money with them and they are dragging their feet giving us the money back, saying what we asked is impossible, that we cant have SQL running on an old server yada yada yada.

The Question:

I have an asp.NET website with a SQL server database ( .mdf file, if that helps anything ) and we need to know what do we need to get it on the internet.

we've considered buying our own computer, putting MS server software on it, installing SQL server 2005, installing IIS and running it off that. But we don't know what to do or how to do it.

Before all this server hastle kicked off, i tried installing a copy of IIS on my computer, and hosting it from there as a test to get me used to the software, however I tried multiple tutorials, and all sorts and could not get our website to host!

There may be examples of this all over the internet but i cannot find an answer. I dont understand most of the things people are talking about on these articals.

I know I've rambled, But basically.

I just need to know HOW to put an asp.NET application on the internet, and what minimum requirements I need.

Do i even need SQL server software on my server? or is that purely for interacting with the sql database?


问:
Challenges to the Agile approach on government projects
A previous Agile discussion here had good answers specifying what is critical to the success of implementing Agile methodology in software development.  Most of the points were the typical organizational and management challenges, but one point worries me and it is that the client must be involved throughout the process.

The client is the one thing that you cannot control realistically, perhaps your business model gears you to government contracted work for instance where an intensely strict contract obligates the company to:

Provide X features exactly as requested

Feature requests will be thrown over a wall, don't bother us we don't want to hear it.

There is no concept of feature priority in the customer's mind, they are all important or we wouldn't have asked for them.

The project will cost no more and no less than Y regardless of overruns or deadlines.

Absolute, strict, final and non-negotiable deadline for complete delivery of all work.

We have never worked with such a client before but the money on the project is just too good to pass up.  We need this work.

I came here and worked HARD to change processes within to move towards Agile development and here I don't know how to reconcile where this project fits into our new process.   I have never before had the luxury of open-minded hands-off management that trusted me to lead the development team and processes down this path and now that we are here I can't honestly tell myself that this project will truly be done in an Agile way.  I feel like management trusted me to lead this path and that I let them down because this situation we are in now so clearly calls for Waterfall.  I am afraid that I might lose their trust if I backtrack now.

Other answers like the one here say Agile is impossible with this kind of client, do you agree?  Have any of you been in a similar situation and made it work?  What strategies did you implement to make Agile happen successfully?

答:
In a project like this, they have tied your hands on scope, resources, and time.  The only thing you have left to manage is quality.  So...

You aren't going to get most of the benefit from an agile approach that you might otherwise, but you can do your best to mitigate quality risks and be able to inform the client of problems earlier rather than later.

So be as agile as you can:

Go through the requirements and prioritize them best on technical risk.  Set the prioritized requirements as your backlog.

Work through the backlog in sprints--design, test, and code the
features for the sprint.  You're missing client interaction, so the requirements document has to represent the client for this activity.

Invite the client to each sprint review--they can say no, but they
might say yes.  And you'll get feedback sooner rather than later.

If you start running against the deadline, you'll be able to show what's done, and perhaps at that point the client, knowing he's not going to get everything, will prioritize enough to tell you what he does want.  You should have the riskiest stuff done, too, meaning that the tasks at deadline time are the easiest to cram in working extra hours.


问:
Obtaining the best of both worlds: MVC and WebForms
Rather than asking a general question about WebForms vs MVC (such as in ASP.NET v/s ASP.NET MVC), I have a specific quesiton.

It appears the main differences between the two approaches are

WebForms is Event Driven and uses pre built components

MVC has a built in layer that WebForms does not: the Model

MVC has the Controllers in a separate folder than the Views while the WebForms Controller is the CodeBehind

One could easily add a folder to a WebForm project called "Model" that stores all the business logic which used in the Code Behind (decoupling the two).  The main argument against WebForms is that it's "easy" to write business logic in the CodeBehind.  But you could easily add business logic in your MVC controller completely violating the separation of concerns.

Now for the question:  Isn't it the case that you could write a WebForms project in such a way that the business logic is separate from the Controller/Code Behind which would have all the benefits of MVC (separation of concerns) while keeping the benefits of WebForms: rich controls, Event driven (if you like events)?

答: The biggest difference between MVC and webforms is not separation of concerns, but how it handles state.  Webforms tries to model desktop application development by working hard to hide the stateless nature of HTTP and the web.  In the process a lot of unnecessary bloat in the form of generated HTML and ViewState gets passed around, making pages slowers and more brittle.  Client-side (ie, AJAX-style) development is handicapped as well due to unnecessarily generated HTML elements, and ids generated by WebForm's proprietary naming scheme.  MVC removes all this oddness and bloat, embraces the true stateless nature of the web, allows the developer full control over html, and thus inter-operates well with client-side scripts and libraries.</p>


问:
Should I tell someone that their commit caused a regression?
When you track down and fix a regression—i.e. a bug that caused previously working code to stop working—version control makes it entirely possible to look up who committed the change that broke it.

Is it worth doing this? Is it constructive to point this out to the person that made the commit? Does the nature of the mistake (on the scale of simple inattentiveness to fundamental misunderstanding of the code they changed) change whether or not it's a good idea?

If it is a good idea to tell them, what are good ways to do it without causing offense or causing them to get defensive?

Assume, for the sake of argument, that the bug is sufficiently subtle that the CI server's automated tests can't pick it up.

答:
Good traction on your question! Everyone's told you what do. Should you tell? YES! Anytime the question asks "should I communicate more?", the answer is almost always YES!

But to add something different: your premise is flawed.

A co-worker made a commit that didn't break CI, but lead you to
  discover a problem.

Congrats! You found a new bug, not a regression. Seriously, do you manually test every scenario and line of code not covered by automated (or standardised manual) testing when you commit?

By all means, get your colleague involved in the fix, with tests to ensure it can't happen again. You are both heroes! But if you let slip any blame in word or action, you are responsible for perpetuating one of the worst organisational diseases: accountability without responsibility.

If you really need to find a villian, think about the guy who committed the original code that broke, and left a trap for your unsuspecting buddy (obviously without sufficient test coverage). Hopefully that wasn't you!


问:
Ruby isn't a PHP generator, right?
My boss was looking down on me about learning Ruby because "It's just a PHP generator" which I can't find anything about it being so. Is this the case?

I understand that the Rails framework can be used to generate PHP code, but isn't Ruby in-and-of-itself its own programming language?

答:
Dilbert's principle in action.

No, ruby isn't a PHP generator. It is a language that has nothing to do with PHP except some usages.

Title: Ruby isn't a PHP generator, right?


答:
Yes. Ruby is in-and-of-itself its own programming language

http://www.ruby-lang.org/en/

Ruby is...

A dynamic, open source programming language with a focus on simplicity and productivity.

Title: Ruby isn't a PHP generator, right?

Body:
My boss was looking down on me about learning Ruby because "It's just a PHP generator" which I can't find anything about it being so. Is this the case?

I understand that the Rails framework can be used to generate PHP code, but isn't Ruby in-and-of-itself its own programming language?


答:
Ruby is a full-fledged language.

As far as the statement made by your boss is concerned, if Ruby is "just a PHP generator," then so is C, Java, C#, Clojure, etc.

Ruby is a good language because it you can express things in the Functional Paradigm (for example, Ruby has lambdas).

Learn Ruby.  It will change how you see problems.:)

Title: Ruby isn't a PHP generator, right?


答:
Why don't I see a single answer here that reflects the top voted comment on the question??

Yes, absolutely tell them about it, but don't do it in front of the entire team

Approach the developer 1:1 and point out the bug. Don't make a big deal of it. I always thought that pointing out the error in front of the entire team was a bad idea. It might work for some developers, but its not for everyone and can have a negative effect. Remember, we've all been in their shoes at some point or another, and as the 2nd top voted answer says, you learn from your mistakes

I usually find it works best when you start with a compliment and then get to the error... something like "the fix you implemented works great, BUT it seems to have broken x,y,z", or "thanks for doing a,b,c, BUT it seems to be causing x,y,z"

Title: Should I tell someone that their commit caused a regression?

Body:
When you track down and fix a regression—i.e. a bug that caused previously working code to stop working—version control makes it entirely possible to look up who committed the change that broke it.

Is it worth doing this? Is it constructive to point this out to the person that made the commit? Does the nature of the mistake (on the scale of simple inattentiveness to fundamental misunderstanding of the code they changed) change whether or not it's a good idea?

If it is a good idea to tell them, what are good ways to do it without causing offense or causing them to get defensive?

Assume, for the sake of argument, that the bug is sufficiently subtle that the CI server's automated tests can't pick it up.


问:
Knowledge base / questionarie / desicion-tree / decision-making platform
I am looking for a software platform/programming framework which can do the following:

INPUT: a user inputs some text

PROCESS/REFERENCE DATA: the user is then asked to answer a list some questions regarding the INPUT and attribute the answers either to the whole INPUT or to some parts of the INPUT

OUTPUT: the list of answers attributed to the original INPUT

Some clarifications:

re: REFERENCE DATA: the list of questions should allow for a sub/follow-up question

re: PROCESS: the answering process should be as flexible as possible (user should be able to skip questions, provide his or her own answers, etc)

this is NOT meant to be an automatic/machine learning tool - the user (the human) will be classifying the INPUT himself/herself based on the REFERENCE DATA

答: It sounds like you want something like an expert system.  Expert systems are typically used as classification tools, and are programmed (or trained) to do exactly what you describe: take a fact, then gather additional information in a systematic way to (hopefully) identify or classify the fact.  You could probably code up a simple one in a couple of days, the real challenge is encoding and navigating your knowledge base.  There are lots of "rules engines" that are made for this, but they tend to be fairly complex, I'd recommend trying to write your own first.</p>


问:
Is software development an engineering discipline?
Can software development be considered engineering? If no, what are the things that it lacks in order to be qualified as an engineering discipline? Related to this is this question on Stack Overflow about the difference between a programmer and a software engineer.

There is the Software Engineering Institute at Carnigie Mellon University that prescribes and maintains the CMMI standards. Is this something that will turn development into engineering?

答:
I wouldn't consider the term "engineering" as the most appropriate to describe software development, for 2 main reasons :

It conveys a lot of old ideas, concepts and so-called "golden rules" originating in traditional engineering disciplines such as industrial, civil, naval, or mechanical engineering. I'm talking about rules in labour division, production processes, quality standards... These most often only marginally apply to software.

It fails to describe in a satisfying way what programming has more than other disciplines (and I believe it has a lot more and a lot different), and what new challenges developers have to face on a day to day basis compared to their counterparts in traditional enineering domains. Software's virtual and immaterial nature plays a huge role in that.

Software development has long been seen as "just another engineering discipline". Considering the failure rates of software projects we have known ever since they were measured, it's high time we recognized develoment as an entirely new animal, code as a really special material and application lifecycle as a totally different kind of production cycle, and stop desperately trying to apply old recipes to them.

OwnerDisplayName: Vaibhav Garg


问:
What is it called when you set properties on object initialization?
What is it called when you set properties on object initialization?

```<code>var customer = new Customer() {RequestID = request.ID, AddressID = 5};
</code>```

Is it considered good practice?

答:
It's called object initializer or object initialization expressions, in C# at least.  Its implementation was necessary for LinQ, to dynamically create anonymous types in a convenient manner.

Whether it's a good practice or not depends on how you use it. Read Jon Skeet's thoughts about them on stackoverflow to gain some more insight. Jimmy Hoffa also wrote an excellent answer on codereview. He proposes to base the decision for or against object initializers on the question:

Is the object safely usable if the properties are null?

If so, then object initializers provide a very convenient and readable way to create an object.


答:
Is it considered good practice?

I would suggest that it's not "bad" practice, being that it's mainly just a convenience feature.  There is no difference between

```<code>var customer = new Customer() {RequestID=request.ID, AddressID = 5 };
</code>```

or

```<code>var customer = new Customer();
customer.RequestId = request.ID;
customer.AddressID = 5;
</code>```

Other than ceremony.

Body:
What is it called when you set properties on object initialization?

```<code>var customer = new Customer() {RequestID = request.ID, AddressID = 5};
</code>```

Is it considered good practice?

Body:
Is it considered good practice?

I would suggest that it's not "bad" practice, being that it's mainly just a convenience feature.  There is no difference between

var customer = new Customer() {RequestID=request.ID, AddressID = 5 };

or

var customer = new Customer();
customer.RequestId = request.ID;
customer.AddressID = 5;

Other than ceremony.


答:
Yes, it's good practice.  It's more readable because you don't have the repetition of customer. and =.   It may seem like a minor point, but it takes time and energy to scan those lines and verify that indeed they are all initializing customer.

And consider this:

```<code>var customer1 Customer();
customer1.RequestId = request.id1;
customer1.AddressId = 3;
customer1.Name = 'Nick Nicely'

var customer2 = new Customer();
customer2.RequestId = request.id2;
customer2.AddressId = 5;
customer1.Name = 'Poor Nick!'
</code>```

Repetitive code is prone to cut-and-paste errors.  It's much better to express a simple thought (Create a new customer) in a single sentence (line of code) whenever possible.

Title: What is it called when you set properties on object initialization?

Body:
Yes, it's good practice.  It's more readable because you don't have the repetition of customer. and =.   It may seem like a minor point, but it takes time and energy to scan those lines and verify that indeed they are all initializing customer.

And consider this:

var customer1 Customer();
customer1.RequestId = request.id1;
customer1.AddressId = 3;
customer1.Name = 'Nick Nicely'

var customer2 = new Customer();
customer2.RequestId = request.id2;
customer2.AddressId = 5;
customer1.Name = 'Poor Nick!'

Repetitive code is prone to cut-and-paste errors.  It's much better to express a simple thought (Create a new customer) in a single sentence (line of code) whenever possible.


答:
I understand that the Rails framework can be used to generate PHP code

That's not generally true. I suppose somebody somewhere may have made this happen, but their mental health problems would not be insignificant.

In general, Rails applications are written in a mixture of languages underpinned by Ruby, the others including HTML, CSS, Javascript. While HTML may be replaced by, for example, HAML, and Javascript (recently) by Coffeescript, with compilation steps occurring as needed, I've never seen Ruby being "compiled" down to PHP.

Ruby and PHP both appeared at about the same time, according to Wikipedia (here and here). Ruby was a fairly general-purpose scripting language that erupted into the Web World with the advent of Rails in 2004, whereas AFAIK, PHP was designed for web development.

Title: Ruby isn't a PHP generator, right?


答:
It's a nice bit of syntactic sugar and isn't really "good" or "bad" practice so much as it is a matter of style. The approach you should always go for is what improved readability.

Generally I will use this form whenever assignments are straightforward, whenever an assignment becomes more than giving in a value or a possibly a value and a quick trim() I will take it out and assign it to the object explicitly.

I also find it's helpful when I have to make a larger number of assignments and do it like:

```<code>var customer = new Customer(){
    RequestID = request.ID,
    AddressID = 5,
    Firstname = "Bob",
    Lastname = "Jones",
    FavouriteColor = "Blue",
    someOtherProperty = "Maybe"
}
</code>```

I find the indentation and codeblock brackets just help make it more explicit and easier to skim through your code.

Body:
It's a nice bit of syntactic sugar and isn't really "good" or "bad" practice so much as it is a matter of style. The approach you should always go for is what improved readability.

Generally I will use this form whenever assignments are straightforward, whenever an assignment becomes more than giving in a value or a possibly a value and a quick trim() I will take it out and assign it to the object explicitly.

I also find it's helpful when I have to make a larger number of assignments and do it like:

var customer = new Customer(){
    RequestID = request.ID,
    AddressID = 5,
    Firstname = "Bob",
    Lastname = "Jones",
    FavouriteColor = "Blue",
    someOtherProperty = "Maybe"
}

I find the indentation and codeblock brackets just help make it more explicit and easier to skim through your code.


答: One point nobody has mentioned - if Ruby were a PHP generator (spoiler alert - it's not), who cares?  C is "just an assembly generator", so I guess we should look down on people who learn C.

Title: Ruby isn't a PHP generator, right?


答:
Copyright law is extremely complicated. Having software on the Internet developed and used by people worldwide makes it even worse as you have to comply to all copyright laws world-wide. You may not have to put the license in the headers and/or a LICENSE file. In some legislations this might even be irrelevant but the clearer you make it the more likely it becomes that it will be respected (from a legal way respected, not by every user ;-) ).

Aside from that: Software often doesn't contain only self-written code but bundle third party libraries. Having the header in the file makes it clear when you are using foreign copyright as well as when your code is being used by others.

Title: License placement curiosities

Body: Ruby gems have LICENSE file with the license text in each gem. Cocoa[Touch] open source frameworks (say ShareKit, StackKit, etc.) have license at the very beginning of each file (.h and .m). I am not sure about .NET or other interpreted languages (except ruby), but I'm pretty sure there are own choices at hand. I am wondering what are the reasons behind placing license into open source software source packages like this. Why not LICENSE file everywhere or at the beginning of every source file?


问:
Are Quines useful as anything more than a programming puzzle?
Quines, which are programs that generate their own code as part or all of their output are a neat idea for a programming puzzle. However, do they have any use beyond that?</p>

答:
After some Googling, the surprising answer is that there is at least some theoretical academic effort to use them to make code self repairing, apparently.

One of my search terms was "genetic programming", if anyone wants to look further - it's the only potentially useful related programming area I could think of.

EDIT - Just found the use of Quines in an English outline of a Mathematical proof (Ron Maimon's answer) of Godel's Theorem.

ContentLicense: CC BY-SA 4.0


答:
The only time I ever heard of any practical use for quines is when Ken Thompson used it to hide a Trojan horse in the Unix login program.

The Trojan consisted of something like if (login == "Trojan") login(); (more probably written in proper C), but something like that would be too obvious in the code. So what he did was to embed it in a quine and hide it in the binaries of the C compiler.

The quine's self replicating properties were enough to ensure that even though there was no trace of this backdoor in any source code, it would effectively compile every time a C compiler would come across a Unix login() function.

I guess clearer explications could come from reading the paper. It's a good paper.

See also: Is Ken Thompson's compiler hack still a threat?

Title: Are Quines useful as anything more than a programming puzzle?

Body: Quines, which are programs that generate their own code as part or all of their output are a neat idea for a programming puzzle. However, do they have any use beyond that?</p>


问:
Functional programming: Writing a small interpreter
I'm working on a small Unix shell, and am contemplating the idea of writing a script interpreter. While reading about the subject I inevitably hear of functional programming, lambda calculus, and find out about the whole fascination around Lisp.

Before I jump into this I have some questions.

Which language should I use?

I am curious about functional programming, so that would be a great opportunity to start. I want my shell to have as little 3rd party dependencies as possible. I am wondering whether I should look for a compiled language. I would like being able to distribute it more easily. Is this a correct approach? if so, which language would you recommend?

How do you embed an interpreter in your program?

The way I see it is having the interpreter run in a second separate process. As far as I know, two processes communicating, are either listening to a pipe or sending signals to one another. Is this a realistic approach? Is there a particular language that handles this part? Are there other ways of embedding the interpreter?

答:
You should probably use ANSI C.  It's universal across all platforms.  It's low level and has system-level interfaces for everything on all platforms which will be required for a scripting runtime or programming language.

To write a script interpreter, I would suggest reading the Dragon Book [1] first.  It's pretty math heavy but the basics are easy enough to pick up.  If you are interested in LISP/Scheme, read SICP [2].  Both books describe interpretation and compilation in depth in two different contexts.  SICP will change your life if you are interested in programming languages.

Regarding embedding, your script interpreter should probably have an "eval" function which takes a string in your language, executes it and returns a result.  That is the only entry point you should need for embedding.

UNIX/Linux/OSX does all the communication stuff for you using pipes etc.  Just concentrate on something which talks to stdin and stdout and you will be sorted.  Even works (mostly) on Windows.

Start really simple.  This is as simple as you need to start ([3]).  It implements a complete LISP interpreter in C in not much code at all.

[1] http://en.wikipedia.org/wiki/Compilers:_Principles,_Techniques,_and_Tools

[2] http://mitpress.mit.edu/sicp/full-text/book/book.html

[3] http://www.sonoma.edu/users/l/luvisi/sl3.c

OwnerDisplayName: rahmu

OwnerDisplayName: Chris Smith


答:
You might want to acquire a copy of "Writing Interactive Compilers and Interpreters" by P.J. Brown, now considered a classic in the field (published in 1982).  New copies are expensive, but   you can pick a used copy for under $5.

Another book on the same topic is Writing Compilers and Interpreters: A Software Engineering Approach by Ronald Mak, published in 2009.

Title: Functional programming: Writing a small interpreter

Body:
I'm working on a small Unix shell, and am contemplating the idea of writing a script interpreter. While reading about the subject I inevitably hear of functional programming, lambda calculus, and find out about the whole fascination around Lisp.

Before I jump into this I have some questions.

Which language should I use?

I am curious about functional programming, so that would be a great opportunity to start. I want my shell to have as little 3rd party dependencies as possible. I am wondering whether I should look for a compiled language. I would like being able to distribute it more easily. Is this a correct approach? if so, which language would you recommend?

How do you embed an interpreter in your program?

The way I see it is having the interpreter run in a second separate process. As far as I know, two processes communicating, are either listening to a pipe or sending signals to one another. Is this a realistic approach? Is there a particular language that handles this part? Are there other ways of embedding the interpreter?


答: It's new with VS2008. If you need to write portable code that also compiles under VS2005 and earlier mono, refrain from using it.</p>


问:
Gremlin -- do I have to know Java/Groovy
This is the excerpt from the project's Github page.

Gremlin provides graph traversal related syntactic sugar to Groovy. Groovy provides dynamic language syntactic sugar to Java. Realize that anything you can do in Java or Groovy can be done in Gremlin.

The documentation keeps referring to Groovy & Java.

I need to learn it but I am not a member of Java family -- and will likely never be. Can I still learn Gremlin?

Can someone point me to some docs/articles that explain Gremlin without assuming Groovy or Java acquaintance?

答:
The key here is Groovy, check out its Wikipedia entry.

Very Basically, you could say that Groovy is "on top" of Java and that Gremlin is on top of Groovy.

While using Groovy you have access to a new more compact syntax (but it really is not the only feature) and also to the full power of Java since you can use any Java library available. The most interesting feature though, and what really is important in the context of Gremlin is that Groovy is a scripting language for Java. You write Groovy/Java code as if you were using some shell script and the code you write is dynamically compiled and executed on the JVM.

Now, what the developers of Gremlin have done is "extend" the syntax of Groovy with some graph traversal related syntax (as well as provide a graph traversal API of course). They do not forbid you to use Gremlin from Java. You may still use Gremlin in a "standard" Java application, but as the example shows it, it is not its primary intended usage.

To resume, in order to use Gremlin (from the minimum requirement to the most optimal requirement):

You have to know Groovy or Java (or you will need to :-)

If you are a long-time pure Java programmer you have the advantage of knowing parts of the JDK, and many other existing libraries or frameworks such as Apache Commons, or Spring for example (Spring supports Groovy!). You don't know the more compact Groovy syntax, but you will be alright.

If you know Groovy...you most probably know Java :-) but not necessarily. You will do alright.

If you both know Java and Groovy, you are God. No, not really. But you will have no trouble at all.

Note that for points 2-3-4 you will of course need to go through Gremlin's documentation.


问:
Will my communication skills be wasted in a software engineering career?
I've been in the financial engineering arena (after BA Math and BA Computer Science) for about 5 years (20% analysis/programming, 80% communicating) and take pride in my ability to communicate with people and discuss technical problems (i.e. interacting with a team).  I love this part of my job.  Going to the white board to draw abstract ideas and brainstorm.

However, for many reasons, I want to transition my career into a technology company (software engineering) but I'm deeply afraid that I will fall into a stereotypical programming job where programmers code with big headphones on.  I certainly know this is only a stereotype but I've witnessed similar environments before (at startups) and it scares me to think that I would be migrating to a career of isolation.

I love coding and thinking algorithmically, but I don't want to give up interacting with people. I understand that having communication skills is only a positive, but am I setting myself up for career-happiness failure by transitioning into software engineering.  I'd love to hear any clarifications and/or advice.

答:
Since you have separated programming from your interpretation of communicating (discussing with people) and want to talk to people 80% of the time, programming is not a good choice. Maybe if you get into a situation where you can be a full-time analyst, architect, manager or client liasons (You get to talk to clients and programmers, you're the intepreter (Sorry a little Office Space humor.).

There are phases of projects where you could spend the whole day at the board, but eventually, you have to write code. It is a form of communication, but not as you described. Maybe in a pair-programming shop you can chat a lot while you code. Most of the time, you need to be focused at the keyboard. Wearing headphones means you're surrounded by too many people who are not.


问:
How to tell if an employer has been banned from Apple's App Store?
I have a potential employer who desperately wants to produce an app, but for some reason they are refusing to get a $99 company dev account, saying the application process would be too difficult and tedious. And yet they want me to create a single-person account. I think they've been banned from the Apple's app store but how can I verify it?

Thanks.

答: You could offer to fill out the application for them, using their information. That removes the obviously bogus 'difficult, tedious' argument. If they still refuse, tell them that you won't work with or for them if you can't trust them, and ask them for an honest explanation.</p>


答:
I've used Quine-like techniques in web pages in the past.  Mind you, this was in 1998-99...

I had what we now call a "web app", a set of CGI-BIN programs, some of which performed some time-consuming interactions with mainframes. In order to save doing the time-consuming part twice, in certain cases I would send along JavaScript that could re-write the original page into a form to send back pre-computed information to "reserve a spot in the future". I can't recall what peculiarity of JavaScript interpretation at the time required it, but Quine-like encoding, and decoding on output, of the "reserve a spot in the future" HTML and associated JavaScript became necessary.


问:
How do I avoid the complexity concerns of frameworks while keeping my team marketable?
When deciding upon how to design a software project with my colleagues, most suggestions tend to be for using specific frameworks "because it's popular in the job market" or "that's the framework that gets recruiters on the phone," and never what I'm looking for which is, "because it's a good fit for the project as it makes the system more adaptive to future changes and makes life easier for developers."

I didn't start looking at projects in this way until I started reading up on domain-driven design. I've found that the actual domain is hidden deep under the frameworks used and it's hard to learn the business processes that have been implemented by the software product.

Is there a way to marry the two competing goals: getting exposure as a development team while still being able to avoid complexity? Are frameworks that compromise, or are there other solutions out there?

答:
Are frameworks the catalyst of many of the over engineered projects out there

No.

or is it something much more simple?

Yes.

If you'd encountered these issues in a software project, how have you dealt with it?

Ignore it.

Are there any good key indicators to look out for when a project is being over engineered?

Yes.

Would you like some suggestions?

Or was the question merely rhetorical?

One leading indicator of over-engineering is people complaining about over- engineering.  Seriously.  Other people complaining.

Over-engineering means this:

Extra features are thrown in for which there are no requirements.

Flexibility, Scalability, Availability and all the other non-functional requirements are often thrown into a project because users (or product owners) only care about functional requirements.

Some folks really like to discuss non-functional requirements in a great deal of depth.  Adding all kinds of things.

Some folks like to deprecate the non-functional requirements.  Removing essential features to make the software "lighter-weight" or "more transparent" or some such.

One person's essential is another person's optional.

Since everyone's wrong, everyone's also right, too.  There's a middle ground somewhere.

What's important is that frameworks provide a standard suite of non-functional requirements at essentially zero cost.  Clearly, that's no fun.  Who wants to focus on the user's confusing requirements?

Avoiding a framework means all the standard suite of non-functional requirements must be built from scratch.  Clearly, that's more fun.  Avoiding the user's actual requirements to focus on non-functional requirements is more like real programming.


答:
I don't think frameworks are a cause of over-engineering. More often than not, frameworks remove boilerplate code and simplify the codebase that you are left to maintain.

I also agree with Thorbjorn's comment that it's a bad idea to expect an API for everything. Much better to have the runtime environment focus on the things that appear in almost every application and be flexible enough to allow frameworks to be added where other common problems are solved.

However, I have seen instances (outside the Java world) where frameworks are used for the sake of using a framework. I see why you think this is bad, and if it overcomplicates the product then it is. But it should be kept in mind that if a developer is given room to improve his CV, they're going to see more reason to stick around and learn even more.

As long as a developer is likely to back down if he finds that a framework is not helping, there are good reasons to let them have a go.

But in reading your story, I see a bigger problem -- not understanding the business domain. Too many products are written without any regard to actual business problems, just attempting to produce something that developers think should help. This is not the fault of frameworks in any sense, it's the fault of developers, but it needs fixing somehow.

How you do that depends very much on the structure of the team. But make lots of comments along the lines of "Do you not think we would be more satisfied in our jobs if we thought we were writing software that would make people's lives better?"

Or arrange for developers to sit in with the people who will use the software and see the problems that they face every day and offer solutions.

Or, if it comes to it, play to the career angle. I mean who wants to go to their next interview and say "yeah, we did our best, but it was never the product the customer wanted," rather than "so I went out into the business and investigated the model and used DDD techniques to turn that into a software model"?

Title: How do I avoid the complexity concerns of frameworks while keeping my team marketable?

Body:
When deciding upon how to design a software project with my colleagues, most suggestions tend to be for using specific frameworks "because it's popular in the job market" or "that's the framework that gets recruiters on the phone," and never what I'm looking for which is, "because it's a good fit for the project as it makes the system more adaptive to future changes and makes life easier for developers."

I didn't start looking at projects in this way until I started reading up on domain-driven design. I've found that the actual domain is hidden deep under the frameworks used and it's hard to learn the business processes that have been implemented by the software product.

Is there a way to marry the two competing goals: getting exposure as a development team while still being able to avoid complexity? Are frameworks that compromise, or are there other solutions out there?


问:
Steps to ensure important details aren't edited out of technical documents?
Like many here, I'm sure, my company has a person that acts as liason between development and most other areas of the company, as well as our clients. Most communication regarding new releases, fixes, known issues, etc. goes through this person.

However, because this person is not a developer and not deeply involved in the development projects, sometimes what developers submit for dissemination is edited for brevity or simplicity, and in the process, key details or subtleties are lost.

I've been pushing for a review process that includes the author of the original document, whatever it was, before the material is released. Among other things this would, I feel, allow the person with the greatest technical knowledge about what's being talked about (the one who actually wrote the code for the new program, feature or fix) to weigh in on anything that may have been oversimplified or been given a factual error by the editing process.

The person handling the communication, for their part, feels that the problem is education; the person is relatively new to the company and doesn't have extensive experience with all of the software applications and other products that development produces and supports. The person feels that as they gain this experience through training and reading the material that comes through their hands, the problem will resolve itself. They also feel that the back-and-forth would waste time.

I think there's merit both ways. What do you guys think?

答: So agree to stop having the reviews when the reviews stop finding anything useful.  However, in my experience people come to value them after a certain amount of time.  To help at first, make it clear that reviews aren't an indictment of any individual, just a recognition that diverse viewpoints tend to create a stronger outcome.</p>


答:
I'm not sure that the two sides of the debate are really saying different things.

If the developer that writes the release notes reviews the edited version before they go out, that feedback is one of the most efficient ways for the coordinator to learn about all the applications that the company produces and supports.  That will help the coordinator learn about where there is complexity in the product line and where it is easier to summarize and simplify descriptions.  Over time, as the coordinator learns what they can simplify and what they cannot, the developers are going to spend less and less time reviewing the documentation so less and less time will be spent on the back-and-forth.  Once the coordinator is completely up to speed, developers will probably give a casual glance to the edits before approving them in the vast majority of cases.

Title: Steps to ensure important details aren't edited out of technical documents?

Body:
Like many here, I'm sure, my company has a person that acts as liason between development and most other areas of the company, as well as our clients. Most communication regarding new releases, fixes, known issues, etc. goes through this person.

However, because this person is not a developer and not deeply involved in the development projects, sometimes what developers submit for dissemination is edited for brevity or simplicity, and in the process, key details or subtleties are lost.

I've been pushing for a review process that includes the author of the original document, whatever it was, before the material is released. Among other things this would, I feel, allow the person with the greatest technical knowledge about what's being talked about (the one who actually wrote the code for the new program, feature or fix) to weigh in on anything that may have been oversimplified or been given a factual error by the editing process.

The person handling the communication, for their part, feels that the problem is education; the person is relatively new to the company and doesn't have extensive experience with all of the software applications and other products that development produces and supports. The person feels that as they gain this experience through training and reading the material that comes through their hands, the problem will resolve itself. They also feel that the back-and-forth would waste time.

I think there's merit both ways. What do you guys think?


答:
A quine was used to seed Tierra, a digital organism simulator, and life then evolved from it. The quine was used because it guaranteed that the first generation would produce viable offspring.

The evolution led to many interesting results, including parasitic and symbiotic life forms, and even meta-parasites. Might that be considered 'useful'?


问:
How can dev teams prevent slow performance in consumer apps?
When I previously asked what's responsible for slow software, a few answers I've received suggested it was a social and management problem:

This isn't a technical problem, it's a marketing and management problem.... Utimately, the product mangers are responsible to write the specs for what the user is supposed to get. Lots of things can go wrong: The product manager fails to put button response in the spec ... The QA folks do a mediocre job of testing against the spec ... if the product management and QA staff are all asleep at the wheel, we programmers can't make up for that. —Bob Murphy

People work on good-size apps. As they work, performance problems creep in, just like bugs. The difference is - bugs are "bad" - they cry out "find me, and fix me". Performance problems just sit there and get worse. Programmers often think "Well, my code wouldn't have a performance problem. Rather, management needs to buy me a newer/bigger/faster machine." The fact is, if developers periodically just hunt for performance problems (which is actually very easy) they could simply clean them out. —Mike Dunlavey

So, if this is a social problem, what social mechanisms can an organization put into place to avoid shipping slow software to its customers?

答:
Sadly, I find the biggest issue is you can't do everything.  You have a ship date, and you know it's slow, but you NEED to get features X,Y,Z out to market.

In your mind, slow you can fix later, but the app at least works.

So, you worry about functionality and aesthetics (because users focus on aesthetics all to often).  Next release you'll fix performance.

But the PM just gives you a list of Features, and no time to fix the performance.

And the vicious circle continues.


答:
I've said it before, but I'll say it again: I think one of the best ways to handle this is to simply have your developers work on (relatively) trailing edge hardware.

For your typical programmer, most official performance considerations are secondary to simply: "is it annoying when I try to run it?" If they find it annoying, they'll (at least try to) fix it. If they're happy with the way it runs, the very best you'll get is a half-hearted attempt at fixing. This also helps in finding problems early, before they become much more expensive to fix.

If it gets to the point that QA has to enforce rules the developers really don't believe in because they think performance is adequate, chances are pretty good that most of the "fixes" you get will get creative ways of getting around the rules, not real fixes that improve life for the end user.

At the same time, I should add that I've rarely seen this as a problem. If anything, I've seen developers spending far too much time trying to improve performance where I really didn't matter enough to bother (a sin of which I'm often guilty as well).

Title: How can dev teams prevent slow performance in consumer apps?

Body:
When I previously asked what's responsible for slow software, a few answers I've received suggested it was a social and management problem:

This isn't a technical problem, it's a marketing and management problem.... Utimately, the product mangers are responsible to write the specs for what the user is supposed to get. Lots of things can go wrong: The product manager fails to put button response in the spec ... The QA folks do a mediocre job of testing against the spec ... if the product management and QA staff are all asleep at the wheel, we programmers can't make up for that. —Bob Murphy

People work on good-size apps. As they work, performance problems creep in, just like bugs. The difference is - bugs are "bad" - they cry out "find me, and fix me". Performance problems just sit there and get worse. Programmers often think "Well, my code wouldn't have a performance problem. Rather, management needs to buy me a newer/bigger/faster machine." The fact is, if developers periodically just hunt for performance problems (which is actually very easy) they could simply clean them out. —Mike Dunlavey

So, if this is a social problem, what social mechanisms can an organization put into place to avoid shipping slow software to its customers?


问:
WinRT and the server (ASP.NET, Azure, etc)
Has Microsoft made any indication of WinRT's current or future relationship with server development (such as ASP.NET)?

While it's been made clear that WinRT is the intended future of Windows UI programming, it also includes a substantial library of common features like networking and data processing (like JSON). If these libraries are to the the future of Windows development, it seems to me like it's only natural that they will eventually move into the world of server development (WinRT is already supported by "Server 8").

(I realise that ASP.NET isn't going anywhere and that MVC, for example, could potentially be completely gutted without affecting the programming model. I'm just curious)

答:
I will quote here Steve Rowe's answer from SO:

Most WinRT APIs are only usable inside Metro style apps. ASP.Net or
  any server programming for that matter, is done in the context of a
  desktop application. Thus a large amount of WinRT is not usable there.
  If you look at the WinRT reference, you will see that most of what is
  present is aimed at consumer apps, not server applications.

Microsoft has not said what will happen in the future, but for Windows
  8/Server 8 WinRT is not aimed at server development.


答: I think you would find that 99% of the time the problem is the scope creep.  With the dvr for example.  You would think this is easy but then TIVO or a competitor introduces a new feature that is well received.  Next thing you know a new feature is on the plate.  It may or may not becompatible with the existing product and we are not redoing the existing product that will take to long.  So the feature gets jammed in and it sucks performance.  Sure the data is there to get the infromation but if there was not thought to getting that information then there is a good chance it will not be easy to get.  So now it has a complex process to build that information everytime you go near the program list.</p>


答:
I think the most general answer to this problem is also the most difficult to manage, which is that every programmer should be mindful of performance with anything they do.  I realise also that's a bit of a cop out.

Depending on the size of the project, and corresponding team, I believe there can be a lot of value in having dedicated performance programmers.

As an example, I have worked on a team where the project team (including about 30 devs) had at least 2 people dedicated to performance optimisation.  This particular app was also quite prone to performance issues as there were multitudes of interoperability components, not only over web services but also in terms of legacy layers with various data mapping and adapter components.


答:
The problem(?):

The customer (or end-user) does not complain about it (enough)

Thus the project(/product) manager does not consider it a requirement

Thus the developer does not get the time to fix it.

You have to start at the beginning, educate the customers. But if they buy the iPhone instead of a faster, less shiny phone, the developers are right to spend their time on looks instead of performance. The organization is not the problem.

Of course, some things can help anyway. Waiting for automated tests is annoying, so if you have automated tests the developers have constant feedback about performance issues, and they will be more likely to solve it (as a technical issue, not as a feature).

But you can't do everything. It's optimize or add features, and those who spend the money decide.

But some good news: I've noticed that SaaS/Cloud/Buzzword-applications help a lot here. When people choose between a few similar web-applications and get to test live instead of first creating artificial lists of 'required' features, they are more quickly influenced by responsiveness, and thus performance will get more attention.


答:
With correctly written and complete requirements, there is no such a thing as a distinction between bugs and poor performance. Because you specify the performance as a non-functional requirement, poor performance becomes a bug just like any other bug, and will be caught by QA and solved by developers before release.

Is there a social problem? I don't think so. The major issue is that requirements are incomplete. Working for years as freelancer, I never ever saw a non-functional requirement telling that a specific task must perform in maximum N seconds on average. If the manager/customer/stakeholder or whatsoever doesn't bother about performance asset, why I, as a developer, would bother about it, since people who must care about it don't care at all?

There is another factor which influences poor performance: the fact that developers work on expensive PCs which perform well. When you're working for years on a quad-core PC with 8 GB of RAM, a high end SSD, the latest OS, etc., it's very difficult to imagine how your application will run on Windows XP on a dual-core PC with 512 Mo of RAM and an old hard disk filled at 90% and not defragmented for years. Unfortunately, in some countries, the last case is the one we see for most consumers of an app. The larger the gap between developer PCs and consumer PCs, the more complicated it is for a developer to take care of performance of his app.


问:
Writing use cases for a rather complex scenario
I'm trying to improve my use-case writing skills but I'm stuck on a certain scenario.

The idea is that there are a bunch of entries in a task list (some kind of todo list). Now the user wishes to process the list (divide it amongst other lists). He can do this by answering a series of questions / completing extra data. Based on the choices of the user the system perform different actions on the task.

I'm really confused on how to write this down in a use case.

What I was thinking is something like (I'm only writing down the main success scenario):

```<code>Use Case: Process Inbox
Primary Actor: User

1. User indicates he/she wants to sort his/her inbox
2. System presents the next question and provides possible actions
3. User makes choice

_steps 2-3 get repeated until inbox is empty_
</code>```

The problem with this is that it's not specific enough so something else I was thinking of is to make sub use-cases for all the different steps in the question process like:

```<code>Use Case: Handle Project
Level: Sub Use-case
Primary Actor: System

1. System requests additional information (description, due date) from user.
2. User completes data
3. System classifies the task as a Project
</code>```

What I'm puzzled about here is:

How to include this sub use-case in my main scenario in a proper way

How to indicate that after this action, the user starts again from step 2 in the main use case.

I was thinking of using extensions in which I include the different sub use-cases but it's getting pretty confusing.

So to bundle this request into one question:

Can someone clear up how you would usually tackle this kind of scenarios and/or provide me a basic possible solution for this example?

Thanks in advance ;)

If anyone is interested, the flowchart of questions I'm intending to use is from David Allen's book Getting Things Done: link to diagram

答:
You could have a Use Case for each decision that the user must make. For example:

The "What is the Next Action Use Case" would be the user decides what the next action is and what to do about it.

Then the flow would continue to one of the next Use Cases: "Do it", "Delgate it"...


答:
I agree with others, that we should find ways to make developers care more about the problem, like making them test on slower hardware, and having performance goals.
That's all fine, but really, when it comes to performance tuning --

People Gotta Know How - And They Don't

They may think they do, but just look through all the performance-related questions and answers on StackOverFlow and on this forum.
It's painful how many show very little common sense about performance.

It's not something to just talk about, people need to learn by doing it.
The only time they are in that mode is when they are taking a class, or learning new things from a book or blog.

So the only way I can think of to solve this problem is to get hold of the people who teach programming, and teach them how to do it.

Heaven knows, I've tried on these forums, as in -

The basic super-simple method

A 43x speedup - do that with your profiler

The reasons why, in nauseating detail

Anyone can do it. They just need to actually do it.


答:
Ignoring the developers that don't seem to care...

I think that often times the developers that work on the code don't have the tools to measure performance on a continuous basis.

e.g. If it is possible to measure the response time for your app (e.g. its a web based application, or queries a database, etc.) - Are you currently getting notifications (email, SMS, whatever) that indicate the "top 10" worst performing (or over a determined threshold) responses?

In many, many cases - developers are not getting this info from the "real-world" deployments and as a result its very easy to ignore the information that you don't see.

If however, every day/few hours you get an email that indicates that screen "x" takes 13 seconds to load and it is running the following SQL query SELECT TOP 1.... JOIN... OUTER JOIN... OUTER JOIN... CROSS JOIN... you'd better believe that a developer could (and hopefully would) be all over fixing it.

Thus although I'd like to believe that all programmers do take performance seriously I think that lack of visibility to the issue(s) is often the culprit.

Note: I think this is something that both the developers should be requesting access to (or even developing such a feature) and management should be providing/funding such tools.


答: Yes. Ask the person to review the fix you made to the code. Sometimes I have found that someone else's bug was actually a tricky part of the code with some other unseen consequences if the bug was simply fixed. </p>


问:
What is a better word for aligning your nesting?
I was taught by an old-time programmer who called this nested code

```<code>if(condition){
  <div>
    <b>text <u>text</u></b><br/>
    <table>
      <tr>
         <td>a</td>
         <td>b</td>
      </tr>
    </table>
  </div>
} else {
  log();
}
</code>```

as opposed to this code which was considered to be not nested

```<code>if(condition){<div>
<b>text
    <u>text</u></b>
    <table><tr><td>a</td><td>b</td></tr></table>
    </div>
} else {log();}
</code>```

When I started reading tutorials I found early on that I had the wrong definition to nested.

Messy vs clean is not sufficient for this because messy code encompasses other problems that I am not talking about, for example confusing flow of logic, using static initializers inappropriately, poor use of variable names, using twice the code to get the job done in a more confusing manner, etc.

What is the right word for this, where the first example is ... and the second example is not ...?

答:
"Indented / indentation" may be the word you're looking for ?

... indent style is a convention governing the indentation of blocks of code to convey the program's structure... Indent style is just one aspect of programming style.

Indentation is not a requirement of most programming languages, where it is used as secondary notation. Rather, programmers indent to better convey the structure of their programs to human readers. In particular, indentation is used to show the relationship between control flow constructs such as conditions or loops and code contained within and outside them...


答:
Writing performant code is hard.  It requires a solid grasp of concepts like threading, asynchronous event handling, caching, and asymptotic complexity.  Judging by the groups of programmers I've worked with, around 20-40% of any given group doesn't understand those concepts well enough to incorporate performance considerations as a matter of course into their daily work.

However, those programmers are obviously still useful to the company, but they get assigned to tasks not considered performance critical, so you end up with a blu ray player that can play Netflix streams flawlessly without dropping any frames, but it takes 30-60 seconds to open the menu item that displays your queue.

Unless you're some hotshot software company that can afford to fire 20% of your staff and replace them with more experienced (and more expensive) developers, the only real way to fix it is developer training and filing bug reports.  I don't know how it is at other companies, but here if we developers see a performance issue that we don't have time or business priority to fix, we're fully entitled to file our own bug report on it.  It might take a couple of releases to work its way to the top of the backlog, but they usually do get addressed eventually.


问:
Challenges to the Agile approach on government projects
A previous Agile discussion here had good answers specifying what is critical to the success of implementing Agile methodology in software development.  Most of the points were the typical organizational and management challenges, but one point worries me and it is that the client must be involved throughout the process.

The client is the one thing that you cannot control realistically, perhaps your business model gears you to government contracted work for instance where an intensely strict contract obligates the company to:

Provide X features exactly as requested

Feature requests will be thrown over a wall, don't bother us we don't want to hear it.

There is no concept of feature priority in the customer's mind, they are all important or we wouldn't have asked for them.

The project will cost no more and no less than Y regardless of overruns or deadlines.

Absolute, strict, final and non-negotiable deadline for complete delivery of all work.

We have never worked with such a client before but the money on the project is just too good to pass up.  We need this work.

I came here and worked HARD to change processes within to move towards Agile development and here I don't know how to reconcile where this project fits into our new process.   I have never before had the luxury of open-minded hands-off management that trusted me to lead the development team and processes down this path and now that we are here I can't honestly tell myself that this project will truly be done in an Agile way.  I feel like management trusted me to lead this path and that I let them down because this situation we are in now so clearly calls for Waterfall.  I am afraid that I might lose their trust if I backtrack now.

Other answers like the one here say Agile is impossible with this kind of client, do you agree?  Have any of you been in a similar situation and made it work?  What strategies did you implement to make Agile happen successfully?

答:
I think the first thing to realize is that there is a difference between being Agile and being agile. Slowly rolling out agile techniques and characteristics - cross-functional teams, adaptive planning, evolutionary/incremental delivery, time-boxed iterations, and even introducing concepts from Lean are very different than introducing Extreme Programming, Scrum, or Crystal.

You explicitly mention customer involvement. Yes, many of the Agile methodologies call for customer involvement, but that's not required to be agile. In every government/defense related program, I've always had a program or project manager who was the point of contact with the customer. This person becomes the "voice of the customer". It might be slowed down as they teleconference or email or call and clarify, but you can have a single person (or a group, if you have deputy PMs as well) that is the customer representative of your team. Admittedly, it's not quite the same. But isn't being agile about being flexible and responding to change?

You also mention a few key concepts: predefined requirements, having feature requests "thrown over the wall", a lack of prioritization because "they are all important", and fixed-cost and/or fixed-schedule projects. Each of these can be addressed in different ways.

If you think you have all of your requirements up front, chances are you don't. Requirements do change. Just because you have a "finished and signed off" specification doesn't mean it is set in stone. Given whatever requirements document you have, capture them how you feel comfortable and/or in the manner specified by the contract and deliver the requirements, the design, and the architecture. In addition, see if you can treat these are living documents (a design document I saw today at work is labeled as Revision G, which means it's on it's 8th update). Ask about how much you can leave as TBD in any given iteration and how much needs to be firmed up now - there might be some give and take.

Be agile with your documentation. Don't duplicate efforts between "what your team wants" and "what the customer wants". For example, if your customer wants a traditional software requirements specification and your team wants to use user stories, try to adapt to a traditional SRS and use action items and a rolling action item list instead of user stories so that you don't spend time formulating both "the system shall..." and " must be able to  because ". This does take discipline on the part of the team, though, to adapt to differences between projects. Capture problems in reflections.

Once you get to development, you might run 5 or 6 iterations, and then invite your customer to your facility to see a subset of your implementation. Rinse and repeat this process. It's not the constant involvement demanded by some methodologies, but you do have the advantage of high visibility. If your customer says no, at least you tried. If they say yes, you can enlighten them on being agile. On one project I was on, the customer visited the site every few months (3-5 months, usually). They would watch us go through QA testing, they would discuss concerns with engineers, and business with the program/project office. It was an opportunity for everyone to get on the same page.

Testing and maintenance happen the same as on other agile project. Create your test procedures and document defects in the appropriate way, track metrics per contractual obligations, and document test results. If you want to follow TDD, go for it. Continuous integration is another good idea. During project status meetings, your project manager can use this information to say "we implemented N requirements, have M tests, X tests pass" and update on project health and status to the people with the money.

Speaking of money, we have the fixed-cost and/or fixed-schedule problem.

Dealing with a fixed schedule is fairly straightforward. Given your requirements, you know how many iterations that you can complete. Your workload for each iteration is pretty much set in stone in terms of features to implement, test, and integrate. It might be difficult, but it's not impossible to break up features and assign them to iterations in advance. This goes back to my point about inviting the customer - if you have one year and are using 2 week iterations, perhaps invite the customer quarterly (and invite them every quarter) and show them the results of the previous work. Let them see your prioritization of requirements, your future plans, and how you are going about scheduling.

Dealing with a fixed budget is similar. You know how much time you have, how many resources you have for the project, how much they cost, and therefore how many hours everyone can work per iteration. It's just a matter of ensuring that everyone keeps track of this carefully. If your company can eat the cost of overtime, go for it. Otherwise, make sure everyone works the appropriate length of time and use good time management skills and time-boxing to keep everyone productive. More productive hours is what you need to keep costs down - deliver more value-adding documents and software without the cost of meetings and overhead.

Ultimately, it's not about necessarily being Agile, but applying the things that make Agile good and being agile. Be able to respond to changes in requirements, be able to deliver frequent software even if the customer doesn't want it, only produce value-adding documentation (along with whatever you are contractually obligated to produce), and so on.


答:
First hand experience is important.  Give the developers a fast computer to compile and build on, but a really slow overloaded computer (as some percentage of users may actually have) to run their app(s) on.  (This can be done in cloud/server based development environments by partitioning VMs or servers by function.)  Give them a cell phone with a half dead battery, and require them to use only it for the days initial mobile app testing.

If the developers empathize with the customer with respect to performance and battery life, then they won't regard performance as some semi-bogus management spec to put at the bottom of the priority list. (As in: "hey, I thought it was premature optimization" until too late.)


答:
I would say well formatted html or clean code.  Like most computer languages formatting is not that important for the computer.  However, for mortals like me proper formatting makes it much easier to understand.  It doesn't take a lot of time to write clean code, but it will save you a lot of time in the long run.  If I needed to debug the second example, the first thing I would do is reformat it.

There are various tools which will reformat the text so it is much more readable.  Unfortunately, the results may show how poor the original code is.  Many code generators produce pretty poor HTML, which may be the cause of or result from failing to properly format the code.

Title: What is a better word for aligning your nesting?

Body:
I was taught by an old-time programmer who called this nested code

```<code>if(condition){
  <div>
    <b>text <u>text</u></b><br/>
    <table>
      <tr>
         <td>a</td>
         <td>b</td>
      </tr>
    </table>
  </div>
} else {
  log();
}
</code>```

as opposed to this code which was considered to be not nested

```<code>if(condition){<div>
<b>text
    <u>text</u></b>
    <table><tr><td>a</td><td>b</td></tr></table>
    </div>
} else {log();}
</code>```

When I started reading tutorials I found early on that I had the wrong definition to nested.

Messy vs clean is not sufficient for this because messy code encompasses other problems that I am not talking about, for example confusing flow of logic, using static initializers inappropriately, poor use of variable names, using twice the code to get the job done in a more confusing manner, etc.

What is the right word for this, where the first example is ... and the second example is not ...?


问:
What are good techniques for keeping your place in code?
I understand using bookmarks to remember a single point in your code. However, how does one keep track of the flow of the code they are investigating? Eg: multiple bookmarks and the order in which they were made.

Example:

Bug report: "Collisions aren't working on the corners of walls"

Reproduction of the bug puts it down to certain polygons not colliding.

The collision code was written by an unavailable dev. So investigation goes something like:

During the investigation, especially when reviewing non-code items such as Google, one may reasonably be expected to loose their place in the code (Have I already looked at this code path? or Which code path was I investigating? There are multiple that lead to this function, etc).  The same goes for unavoidable interruptions (Boss: I need [Lengthy Pointless Report] NOW, etc)

It would be useful to have a resource of techniques or tools for providing a way to keep track of one's place in the code.

Edit: The above example is meant as a potential illustration, not as an actual problem that needs answering.

Another way to phrase this question is:

When learning a new system, how do you keep track of where you are up to in learning the code? It's not about understanding why the code does what it does (which is what comments should be for), but how it does it (which is only learned through reading the code, not comments).

答: The bubbles interface attempts to solve this problem by showing a bunch of bits of code at once.  (You're stuck with your browser for Googling).  It looks amazing but I haven't tried it.  This version of the idea is a Visual Studio implementation for Visual Studio Ultimate.</p>

OwnerDisplayName: Jess Telford


问:
Methodologies/tools for when developing on your own
Suppose you have to develop a medium+ sized software, fully on your own. Like if it was a personal project you want to accomplish.

What methodologies/tools would you use to define what needs to be developed, learned and have a global idea of what the system is as well in its details?

Basically to keep yourself in track and not get lost on the way.

答: Usually I just use Mercurial, if I want a feature I just add it and if I don't want it anymore I just remove it. Also, I try to write my commit comments well so I don't get lost.</p>


答: I use the simple solution - never close anything until I am finished with the task. That means that usually one of the 50 or so open windows/tabs has something in it that will remind me what I was thinking when I get back to it.</p>

Title: What are good techniques for keeping your place in code?

Body:
I understand using bookmarks to remember a single point in your code. However, how does one keep track of the flow of the code they are investigating? Eg: multiple bookmarks and the order in which they were made.

Example:

Bug report: "Collisions aren't working on the corners of walls"

Reproduction of the bug puts it down to certain polygons not colliding.

The collision code was written by an unavailable dev. So investigation goes something like:

During the investigation, especially when reviewing non-code items such as Google, one may reasonably be expected to loose their place in the code (Have I already looked at this code path? or Which code path was I investigating? There are multiple that lead to this function, etc).  The same goes for unavoidable interruptions (Boss: I need [Lengthy Pointless Report] NOW, etc)

It would be useful to have a resource of techniques or tools for providing a way to keep track of one's place in the code.

Edit: The above example is meant as a potential illustration, not as an actual problem that needs answering.

Another way to phrase this question is:

When learning a new system, how do you keep track of where you are up to in learning the code? It's not about understanding why the code does what it does (which is what comments should be for), but how it does it (which is only learned through reading the code, not comments).


答: Both my editor and debugger can jump to a function's definition and have a multilevel "back" button like a web browser to return where I was before.  That's usually sufficient for me to keep track of a complex debugging flow.  It also helps to have source control that lets you commit a lot.  That gives me a commit message explaining why I'm trying something, as well as a quick way to back out the change if it doesn't work.  Other than that, a simple whiteboard to list potential and explored leads fills any remaining gaps for me.


答:
If performance is a requirement, test for it.

Otherwise Wally can write an infinite loop and leave early "It takes a while." He can claim.

Your software acceptance test should have a detailed acceptance test for various operation performance characteristics.

If you don't do this you're not engineering any performance into the product.

The performance ( like the resource consumption ) should get budgeted out to sub-systems.
Then the sub-system acceptance tests can check them.

Then you can test early and often for performance. Even unit tests can then check it.

So now developers have it as an acceptance criterion, and can organise their approach to suit it.

Where I'm working now, the performance stress test is 2x bigger than any customer data set we know of. It regularly breaks a new version of the product.  Good testing.


答:
Stop buying the stuff, and, comment on the poor performance on any online reviews you come across.

If the devices are still selling then the software is "good enough" not to invest more time and money in. If bad reviews about performance reduce sales significantly then the software is "not good enough" and needs fixing.

The only metrics that interests a producer of consumer goods are sales and profit per unit.


答:
Nesting is related to the enclosing of control structures one into another, and this is usually indicated through different indentation levels within the source code.

You can say the first example is Nested Source Code, and the second is not, you would be correct. If you said it was simply indented, you don't provide any additional information with regard to why it's indented.


答: With Visual Studio, in a debug session, you can use the 'Call Stack' window (you can enable it in Debug / Windows / Call Stack or with the shortcut Ctrl+Alt+c) to track of the flow of code.


答:
You can make liberal use of preconditions to your use cases.

For instance, you can have several use cases for logging in (normal login, new account creation, password recovery, etc.)

Then you can define use cases for sorting a mailbox, reading a letter, etc. Each of these can have "User is logged in" as a precondition.

If there are operations that are only possible after a mailbox has been sorted, you can has "mailbox has been sorted" as a precondition.

Title: Writing use cases for a rather complex scenario

Body:
I'm trying to improve my use-case writing skills but I'm stuck on a certain scenario.

The idea is that there are a bunch of entries in a task list (some kind of todo list). Now the user wishes to process the list (divide it amongst other lists). He can do this by answering a series of questions / completing extra data. Based on the choices of the user the system perform different actions on the task.

I'm really confused on how to write this down in a use case.

What I was thinking is something like (I'm only writing down the main success scenario):

```<code>Use Case: Process Inbox
Primary Actor: User

1. User indicates he/she wants to sort his/her inbox
2. System presents the next question and provides possible actions
3. User makes choice

_steps 2-3 get repeated until inbox is empty_
</code>```

The problem with this is that it's not specific enough so something else I was thinking of is to make sub use-cases for all the different steps in the question process like:

```<code>Use Case: Handle Project
Level: Sub Use-case
Primary Actor: System

1. System requests additional information (description, due date) from user.
2. User completes data
3. System classifies the task as a Project
</code>```

What I'm puzzled about here is:

How to include this sub use-case in my main scenario in a proper way

How to indicate that after this action, the user starts again from step 2 in the main use case.

I was thinking of using extensions in which I include the different sub use-cases but it's getting pretty confusing.

So to bundle this request into one question:

Can someone clear up how you would usually tackle this kind of scenarios and/or provide me a basic possible solution for this example?

Thanks in advance ;)

If anyone is interested, the flowchart of questions I'm intending to use is from David Allen's book Getting Things Done: link to diagram


答:
I agree that programmers should be taught better on maximizing performance, etc.

But I think the solution is not giving programmers an almost-dying hardware for daily use. How stressful it will be if your visual studio crashes twice a day, it took x seconds to build the stuff, y seconds to open the solution, z seconds to change windows. I don't think it was very cost-efficient for the company either since hardware is cheap and programmers time is expensive.

Since the next hand that will be handling the code is QA (testing) team, wouldnt it be better to teach them about the importance of performance, have a standard of whats acceptable performance standard, etc as an enterprise standard (well, in perfect world, the performance standard should be in spec but that doesnt happen very often)? (i.e regular enterprise ee-changing page/tab should happen instantly, "save update should happen in x second", if it's a critical app then...). The computer that the QA teams run in should be the typical user computer. (we dont wanna piss them off by giving them a 386, but dont give them a quad core with 8GB of ram for example). Wouldnt they vent to the programmers if they get pissed off enough with the performance?

I think client/project manager should force programmer/qa team/developer/rep of company team to do their presentation on the lowest typical hardware that they have. (the weakest computer in the company for example). If it's rewrite, they will need to gather data on how fast it is to do x process in the old software and compare it with how fast it is on the new software (it could be slower, since new software might involve extra business process but there should be an acceptable window).


答:
To be honest it sounds like you need to simplfy your use cases drastically.

Worse still, it also sounds like you have a per-conceived idea of how the system should work and are trying to get the use cases to fit.

Go back and start again using the following rules.

All use cases titles should be a goal statement.
I.E. "User gets can of cold COKE" is good "User enters money into drinks machine" is bad.

No main scenario should cover more than one A4 page.
Split long use cases into several "sub" cases.
I.E "User gets a can of cold COKE" can be split into "Machine accepts correct money", "Machine accepts Drink Selection" , "Machine delivers COKE", "Machine give change".
Note the switch of actor necessary to keep everything goal driven. Its not the users goal to give money to the machine, Its the machines (or at least its owners) goal to collect money.

Once you have a working readable use case. Aim to cut it down by 50% either by shoving some of the verbage like "list of coins accepted", "rules for giving change" into appendces. OR getting rid of unnecessary steps if the step does not lead directly to the goal, or, the system would work without it -- get rid of it.

The identification and removal of superfluous processing is the single most valuable aspect of use cases. This only works if you drop any mental models of a possible implementation and keep an open mind as to the actual requirements and functions.


答:
Can you come up with better examples where we can actually pin the blame on programmers? Apart from Eclipse, and one commenter has already pointed out that it's plugins that do it(my first install of each new Eclipse version runs like lightening, but when I add the other tools it starts to slow), your examples may not be programmer and code related but environment related.

The days of running a program on a computer in isolation and determining if it is 'fast' or 'slow' are gone. The other examples you give depend on their environment - the current network congestion,  whether the back end servers are overloaded, badly configured network cards, a faulty cable, the number of other people using it in your vicinity, or hundreds of other variables. eg. our hosting provider charged extra for server gigabit connections but eventually we determined it all went through an ancient firewall device with 10Mb ports. These problems shift around and are hard to find.

Agreed, there are lots of things programmers can do (minimizing bandwidth, UI tricks that improve responsiveness and show progress to give the impression it is fast). But when you roll out to the real world there are all sorts of circumstances that you only learn by experience (and you watch your assumptions fall apart in front of you).


答: Make performance a requirement.

Body: Make performance a requirement.


问:
What are the advantages to BDD for a solo developer?
I have found this lines below about the advantages of BDD (Behavior Driven Development)

The domain experts define what they need in the program in a way that
  the developers can not misinterpret (or at least not as much as in
  most other approaches).

Are there any more advantages apart from that?

If I'm working alone (I'm not in contact with managers that could write BDD features),

do I need to use BDD?

答:
BDD is just integration tests. That theyes may be writable by non-devs is a big draw, but incidental if there's nobody but the devs. That they're readable by non-devs, particularly the output, is a pretty big deal, since that ends up being a run-down of what the system can and cannot do, and what kind of expectations the system has.

So you're basically asking "do I really need to test that my whole system works," which hopefully you know the answer to.

OwnerDisplayName: Dave Newton