答:
I think you've hinted a bit at a cross-over point that limits the existence of Ultra High Level languages - at some point we don't identify them as programming languages anymore.

The best example of this specific phenomena that I am aware of, and which is perhaps of great potential interest here, is Unified Modeling Language. Indeed, there are specific software application stacks that have been developed to specifically do what you are asking. It meets many of your requirements, but not necessarily in the way you are thinking. Still, it is extremely educational for this situation, as I have felt similarly and my experience (which follows) has changed the way I think about this problem.

I will personally here speak of IBM's Rational Software Architect, which is an attempt to really allow Ultra High Level development. The goal is that you are able to create the philosophical business concept as an object, such as an Actor or Class, give the entities attributes, define connections, define how information might flow through the system as it is being worked on, and do this all with a GUI.

You might for instance drag a DataStore object, an Actor, a form, a few relevant Classes (like Customer, etc), draw some connection lines between objects using graphs and such, and boom: when you are done you publish a working program. (this is obviously extremely simplified)

Indeed, what has been done is the formation of a complex GUI, a very thorough implementation/interpretation of UML, and then it compiles to Java/C#/VB code with full XML documents holding the UML graphing info, and they also implement/enable Round-Trip Engineering so you can go back and forth between Model and Code so you can control things at both a very high nose-bleed philosophical level and very low level platform-specific code.

It's everything you want, and more, and you give up nothing in the exchange! Right?

Why doesn't everyone use it?!?!

...well, see, that's the thing. What you actually end up with is a monolithic undertaking, everything involves a whole lot of moving parts and magic, everything is - or sometimes isn't - effected by a change in any of many different places (in the GUI, XML, lower level code, UML models which are themselves created/defined/maintained in many different model levels).

It's all really cool to play with, but it is...how to put this...it has an extremely high learning curve, is designed with multiple disciplines in mind, and you really have to treat it as an utterly new thing that allows little - very little - generalizability for other skills you already have.

And the bottom line is - even then, with millions upon millions poured into the project from dozens of companies and some very big names behind it, you still end up with C-style code at the executable layer which has to be edited directly at times, because some things just don't make the translation between Object Oriented Class Descriptions and UML down to programming/machine level, and the automation just can't quite complete.

My experience was that it was an incredibly complicated way to generate scaffolding. That is probably the cruelest thing I will ever say about such an immense technological undertaking, but that's what I got from it.

From the people in industry I've talked with, they sadly said the same thing. Their feeling was they did a lot of work creating documentation, countless diagrams, models, meetings, analysis, over months and months, and then they threw it all out and the development team just wrote the code for it and often just treated it as Yet Another Specification Binder (That No One Ever Reads Anymore). So now they just use Java and some special-purposes diagramming/visualization software, and Agile, and that's the end of that story.

Maybe this is unfair, and it works when you do it right. Maybe, but from consultants and professors I've talked with they claimed to have spent many hours in special multi-week development workshops working to learn the system, and going back for more training, and quite literally spending years to learn how to make it work and what goes where.

But maybe it's all programmers fault, that they just refuse to accept the system works so well and yet is nothing like computer programming at all. Maybe pure code programmers just resist having their jobs replaced, like the candle makers and weavers of old, and so refuse to just do their limited task of Implementation To Specification and this makes everyone else get so frustrated they throw it out and say bad things, and it Almost Was Perfect.

But...I think there may be some truth in that, yet I think mostly it just doesn't really work that well. I think it turns something that Isn't Really That Hard Most Of The Time (computer programming), and makes it even harder to the point that if it works it'd be great, but holy crap you have a long time with nothing to show for it to get there!

Maybe it would work only in an enterprise with thousand+man teams, and maybe we just aren't there yet.

I dunno.

However, a study of what is right, and wrong, with this approach to Ultra High Level Languages - and I think UML kind of needs to be included in such a consideration - really must consider things like Rational Software Architect, so as to avoid a potential fools errand.

Or maybe we just have to give it another 20-50 years of hard work. I am no longer optimistic that a programming language is the constraint, any more.

And if programming languages were the constraint before, that's why improvements gave us a potential order of magnitude improvement. If they aren't such a constraint any more, then any innovation is much more likely to be unable to provide such an order of improvement. But I can't tell the future! So I shall assume the rest is not "in the works", but certainly "too soon to tell".


问:
In scrum, how do you give an estimate for a backlog item that is primarily research?
A few sprints ago I was assigned a task that was primarily research.  I had to figure out how to get our product to interoperate with a very complex black box that we did not develop.

I couldn't think of a way to estimate this work.  Even if I got the ball rolling and knew the immediate problem I faced, I could not get a sense of how many other problems I'd have to solve after that.  I could never tell if I was almost done or far from it.  How am I supposed to estimate a backlog item like this?

I want to elaborate the nature of this assignment.  I knew what calls I had to make to interoperate with the black box.  That was the easy part.  But the API took a very, very complex object as a parameter.  Calling the API would throw an error and it was not easy to figure out what that error was trying to tell me.  The black box wouldn't tell me all the problems wrong with my request, it would just tell me the first problem it found.  This made it very difficult to know how much work I had left.

答:
if you can't estimate - and in this scenario it sounds like there really is no way to know in advance how long any particular part of the process will take - then the next-best option is to time-box the effort: how much time you're willing to spend on it, whether you get anywhere or not

once you get into it, you may have a better idea of how to estimate the remaining effort

ContentLicense: CC BY-SA 3.0


问:
Are there any ultra high level languages out there?
Historically a HLL is something like C, Fortran or Pascal and a VHLL is something like Ruby or Python. I am familiar with the terms 4GL, 5GL, DSL and LOP, and those who aren't should read Wikipedia for the definitions. I'm looking for UHLLs.

My question is: are there any computer languages out there which are another order of magnitude more productive, and is anyone working on them?

More productive means less authored code and less programmer time to achieve a result, less bugs and less debugging, closer conceptual link between code and requirements, less effort to modify and maintain.

The main domain that interests me is general-purpose business and consumer applications, with a GUI or browser front end, data persistence and connections to other systems such as printing and email. Other people might well focus elsewhere.

I recognise that some of those languages might be domain-specific, and that they might be little more than the configuration capability of a large and capable application. Excel spreadsheets fall into this category.

I recognise that some of those languages might appear general, but might still be narrow in scope and unsuited to many problems. For example, Matlab might not be a good choice for a program that deals mainly with user interaction and textual data.

I know some of the features that might be in a UHLL, by analogy with VHLL. I would expect to find one or more of the following (and feel free to add to the list):

A drawing of a GUI form IS the program for a GUI form

A table containing rows, columns and headers IS the program for a table in a database

Declarative logic says what should be done and when, with no IF statements

Operations on sets of data, with no FOR loops

Non-sequential execution eg data driven, pattern matching, tree walking

The motivation for the question is that I am increasingly fed up with the sheer hard work of translating relatively simple business requirements into large quantities of code to cater for what the computer wants or needs. The question is really about finding others out there who share my pain and are working on raising the level of languages and getting the computer to do more of the hard work. This was a major focus in the 1970s-80s, but is it still happening?

These are some suggested answers to my question, provided here to to summarise or enumerate languages I know about, and which in my view fall short.

There are many languages that are HLL or VHLL and contain individual features that belong to a higher level. I've used most of them (often badly). They include

Lisp, with its macros and ability to self-modify

Haskell, with data dependency and pattern matching

SQL, which deals in rows and tables

Rebol, which seems clever but I don't really get it

APL (and J), with its multi-dimensional arrays and ultra-compact operators

C# with LINQ

AWK/Perl/Python/Ruby with wonderful collections and regexes built in

These languages have too many low level features to be UHLL. The programmer still has to write many low level constructs for any useful program.

There are RAD/4GL packages. I've used some:

dBase/Foxpro

Dataflex/Powerflex (my product)

Access

PowerBuilder

And lots more I haven't used. Mostly the language is HLL at best but the package contains a framework and privileged connections between language and package so that applications can be built fast. I'm not sure why this approach ran out of steam, but in any case UHLL this is not.

There are raw frameworks/libraries. I've used a few:

Rails

Java awt and swing

.NET Windows Forms, WPF and ASP.NET.

These are currently the state of the art. They leave the programmer firmly trapped in the mire of the implementation language, dealing with complexity at every turn. This is not UHLL, but a UHLL might conceivably be built on top of one of these.

There are design tools, like UML and Rational's toolset, which I don't know well. As far as I can see they help articulate business requirements but can never replace the programming step. I don't want to eliminate programmers, just get more done per unit of time and effort.

So having eliminated all contenders I can think, I hope someone else can provide a better candidate.

Late Edit: I think I have an answer: Wolfram Language. http://www.wolfram.com/wolfram-language/

答:
If you think about it for a while, higher level programming is basically being able to compose smaller parts that are readily available and proven. Up to the point where your program is very simple glue code of various libraries. Maybe the glue is a very expressive DSL. You can do this in about every programming language.

Personally, I'm more and more beginning to sense that the solution to composability is - contrary to what you may instinctively feel - not found in object-oriented programming. This paradigm, as well as imperative programming, provides too much freedom to programmers which in turn makes it too hard to write code that is easy to reuse.

Rather, I think that functional programming provides primitives which are much better suited for composability. Pure functional programming languages also do not allow you to define functions that have side-effects, which not only reduces bugs or facilitates spotting them, but also makes it easier to build on them (compose them to a bigger system).

If functional programming interests you, you may have a look at modern functional languages like Haskell. I think that the Parsec module provides a nice high level DSL (it's called a combinator library in functional jargon) to parsing. There are also functional reactive programming frameworks for Haskell that allow you to build powerful GUI's with a few lines of code.


问:
Is there a better way of writing unit tests than a series of 'AssertEquals'?
Here's a basic example of what my unit test needs to be, using qunit:

```<code><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

<link rel="stylesheet" href="qunit/qunit-1.13.0.css">
<script src = "qunit/qunit-1.13.0.js"></script>
<script src = "../js/fuzzQuery.js"></script>

<script>

test("Fuzz Query Basics", function()
        {
            equal(fuzzQuery("name:(John Smith)"), "name:(John~ Smith~)");
            equal(fuzzQuery("name:Jon~0.1"), "name:Jon~0.1");
            equal(fuzzQuery("Jon"), "Jon~");
            //etc

        }
    );

</script>
</head>
<body>
    <div id="qunit"></div>
</body>
</html>
</code>```

Now I was thinking this is a bit repetitive.

Could put all the inputs/outputs into an array, and loop through it.

```<code>test("Fuzz Query Basics", function()
        {
            var equals = [
                           ["name:(John Smith)", "name:(John~ Smith~)"],
                           ["name:Jon~0.1", "name:Jon~0.1"],
                           ["Jon", "Jon~"]
                           ];

            for (var i = 0; i<equals.length; i++)
                {
                    equal(fuzzQuery(equals[i][0]), equals[i][1]);
                }

        }
    );
</code>```

And this works fine.

The single advantage I can think of for this second method, is that if it turns out that you don't actually want to use equal it's easier to make that change in one spot.

In terms of readability, I don't think it's conclusive either way, though I probably prefer the second.

Abstracting it further, you could put the input/output cases into a separate CSV file, which might make it easier to modify.

Question is - what are the general conventions around writing these kinds of unit tests?

Is there a reason you shouldn't put them into arrays?

答:
You are repeating yourself less by using the array which is more maintainable. One approach I like to use is to have a separate method which arranges, acts and asserts the tests, but accepts the input parameters I'm testing with so I have 1 test method per input set.

This allows me to instantly tell which test / inputs are failing.


答:
Estimates are not single numbers.  An estimate is a range that has a high end, a low end and a confidence.  With the initial question of "how long will it take you" an estimate is not "it will take me 14 hours" but rather "it will take me between 10 and 18 hours".

As you refine the process, you can get a tighter and tighter range on the estimate

(source: construx.com)

Note that this shows the variability of the estimate, not that "it converges at the average".  An estimate may start out at "it will take me 10 to 18 hours" and then be "it will take me 14 to 18 hours" and then "it will take me 16 to 18 hours" as you get further along in the task.

One of the most often cited books in estimation is Software Estimation: Demystifying the Black Art by Steve McConnell.

Start out with a very wide estimate that has the best case and the worst case.  Then shortly into the research, do another estimate, and then another and another.  Don't make a commitment as to when it will be done with one number and then try to make it.

There are a number of different techniques for generating an estimate.  Use historical data from past estimates. Try to get an idea of how big it is, the complexity and work from that (the list goes on, there's an entire book written about this).

Title: In scrum, how do you give an estimate for a backlog item that is primarily research?

Body:
A few sprints ago I was assigned a task that was primarily research.  I had to figure out how to get our product to interoperate with a very complex black box that we did not develop.

I couldn't think of a way to estimate this work.  Even if I got the ball rolling and knew the immediate problem I faced, I could not get a sense of how many other problems I'd have to solve after that.  I could never tell if I was almost done or far from it.  How am I supposed to estimate a backlog item like this?

I want to elaborate the nature of this assignment.  I knew what calls I had to make to interoperate with the black box.  That was the easy part.  But the API took a very, very complex object as a parameter.  Calling the API would throw an error and it was not easy to figure out what that error was trying to tell me.  The black box wouldn't tell me all the problems wrong with my request, it would just tell me the first problem it found.  This made it very difficult to know how much work I had left.

ContentLicense: CC BY-SA 4.0


答:
Two ways I'm using:

The deliberate discovery approach: start with two stories (in reverse order):

how much time you'll need to figure the system out

how much time you'll need to estimate how much time you need to figure the system out - keep that one very short on purpose

The key is that any of those is limited by the value of the feature. It doesn't make sense to spend a year figuring out a system in order to deliver feature X, if in half that time you could deliver feature Y and Y has more business value. Your PO should be able to give you a number: 'if you need more than two months to figure it out, it's not worth it'. Refine the estimate for the first story when you complete the second one.

The discover as you go approach:

how to get our product to interoperate with a very complex black box that we did not develop.

This is way to big a story. What is the first thing/feature/aspect you're going to work on (which one is the most valuable?). It might be as simple as 'log in the black box'. This is a simple story, the integration points shouldn't be that bad, and is reasonably easy to estimate with minimal research. Estimate that. Put any other story at it's business value boundary and refine as you learn more.

Either approach is problematic regarding long term planning. When you get started, you just can't tell when you'll have all features done. That's ok - you'll just start by having reliable predictions for tomorrow, then next week, then next month, then 6 months as you build expertise.


答:
While many research tasks can be open-ended, this one has a clear(ish) requirement: "how to get our product to inter-operate with a ... black box".

We are good at estimating jobs that are similar / related to jobs we have done before. Since you haven't done it before, you can only break the job into chunks and give each chunk a time-box. Such a job can go on forever, at the end of each time-box progress and tasks remaining should be reevaluated. In extreme cases this is when a go / no-go decision should be made.

When I work on such jobs, I define a 5 step process

(1) Initial planning. Make an initial guess at (2) what needs to be done to get started, and define (3) a bunch of iterations / stages, each followed by (4) a review and (5) re-plan step. For example:

Getting started tasks. In this case it might be "get the black box specs", "study the specs", "obtain a black box", "obtain sample software", "establish support link".

Iteration 1. Maybe "Test basic operations. Setup basic debugging environment. Review. Re-plan."

Iteration 2 ... and so on, with at least 3 but no more than 5 or maybe 7 iterations before a big progress review.

How long will each iteration take? Time box them - such jobs will go on forever if you don't. Only you can say if the boxes should be an hour, a day, a week, ... .

Also, be flexible: as you learn, the plan may have to change. Don't punish yourself. This kind of job is like debugging - you have to teach yourself. But also like debugging, it can help to get input from others. And like debugging, you cannot do it while multi-tasking.


问:
Team Git workflow working with a multi-project Sitecore solution using TDS
We are a team of 8-10 developers working on different parts of a Sitecore instance. In the past we've used SVN and more recently (and successfully) Hg, but are moving to using Git as our primary source control. We're working with Sitecore 7, and using the latest TDS from Hedgehog. In case it matters we're also using the Glass.Mapper.sc lib from Mike Edwards.

The problem we're running into, especially compared to how easy it was with Hg, is that merges are a nightmare. It doesn't help that most of our team is new to Git, but most of us have at least used Hg so it's not a huge leap. We've had so many problems that we moved to a merge-master setup, where the team leads are handling all the merges.

My question is this: From people using these tools, what would you suggest is the best workflow and supporting configuration? A team member suggested rebasing to reduce conflicts, but that doesn't seem to matter.

Our Hg workflow, which worked very well was: 1) Commit local changes as many times as needed. 2) Pull changes from the server, and update to the remote branch after any merge. 3) Sync TDS. We do this after the pull so that we're not overwriting the .scproj file in the merge 4) Commit the merge and TDS sync 5) Push the results back to remote

We didn't have merge nightmares and tds was kept very clean. We tried to adapt something similar with Git and have wasted a lot of time each week to resolve issues.

We currently have each dev working in their own branch because of the merge errors working with everyone in master. The type of merge issues I'm seeing seem to mostly come from what Git merges automatically. I definitely don't want to merge everything by hand every time, but I wouldn't mind doing project file merges by hand. We're using Sourcetree and I have BeyondCompare Pro.

Any suggestions, especially coming from successful implementations, would be greatly appreciated. If there are simply config changes that can be made or a change to our workflow to make the process more reliable I'd love to learn about them.

答:
So there's a lot of things in this question I don't know about, but I feel like proper application of a .gitattributes file might solve many of the conflicts. http://git-scm.com/book/ch7-2.html

For example, there are some files we have where people are always adding lines, rarely removing them. So a line in similar to *.tds merge=union can help take care of all the conflicts. Without understanding Sitecore and TDS a bit more I'm just guessing on your exact needs, but this hopefully should get you started down the right path.


答: I think REBOL may fit all of your criteria. You can make relatively sophisticated GUI apps in several lines of code - however its "speciality" is DSL creation.</p>

Title: Are there any ultra high level languages out there?

Body:
Historically a HLL is something like C, Fortran or Pascal and a VHLL is something like Ruby or Python. I am familiar with the terms 4GL, 5GL, DSL and LOP, and those who aren't should read Wikipedia for the definitions. I'm looking for UHLLs.

My question is: are there any computer languages out there which are another order of magnitude more productive, and is anyone working on them?

More productive means less authored code and less programmer time to achieve a result, less bugs and less debugging, closer conceptual link between code and requirements, less effort to modify and maintain.

The main domain that interests me is general-purpose business and consumer applications, with a GUI or browser front end, data persistence and connections to other systems such as printing and email. Other people might well focus elsewhere.

I recognise that some of those languages might be domain-specific, and that they might be little more than the configuration capability of a large and capable application. Excel spreadsheets fall into this category.

I recognise that some of those languages might appear general, but might still be narrow in scope and unsuited to many problems. For example, Matlab might not be a good choice for a program that deals mainly with user interaction and textual data.

I know some of the features that might be in a UHLL, by analogy with VHLL. I would expect to find one or more of the following (and feel free to add to the list):

A drawing of a GUI form IS the program for a GUI form

A table containing rows, columns and headers IS the program for a table in a database

Declarative logic says what should be done and when, with no IF statements

Operations on sets of data, with no FOR loops

Non-sequential execution eg data driven, pattern matching, tree walking

The motivation for the question is that I am increasingly fed up with the sheer hard work of translating relatively simple business requirements into large quantities of code to cater for what the computer wants or needs. The question is really about finding others out there who share my pain and are working on raising the level of languages and getting the computer to do more of the hard work. This was a major focus in the 1970s-80s, but is it still happening?

These are some suggested answers to my question, provided here to to summarise or enumerate languages I know about, and which in my view fall short.

There are many languages that are HLL or VHLL and contain individual features that belong to a higher level. I've used most of them (often badly). They include

Lisp, with its macros and ability to self-modify

Haskell, with data dependency and pattern matching

SQL, which deals in rows and tables

Rebol, which seems clever but I don't really get it

APL (and J), with its multi-dimensional arrays and ultra-compact operators

C# with LINQ

AWK/Perl/Python/Ruby with wonderful collections and regexes built in

These languages have too many low level features to be UHLL. The programmer still has to write many low level constructs for any useful program.

There are RAD/4GL packages. I've used some:

dBase/Foxpro

Dataflex/Powerflex (my product)

Access

PowerBuilder

And lots more I haven't used. Mostly the language is HLL at best but the package contains a framework and privileged connections between language and package so that applications can be built fast. I'm not sure why this approach ran out of steam, but in any case UHLL this is not.

There are raw frameworks/libraries. I've used a few:

Rails

Java awt and swing

.NET Windows Forms, WPF and ASP.NET.

These are currently the state of the art. They leave the programmer firmly trapped in the mire of the implementation language, dealing with complexity at every turn. This is not UHLL, but a UHLL might conceivably be built on top of one of these.

There are design tools, like UML and Rational's toolset, which I don't know well. As far as I can see they help articulate business requirements but can never replace the programming step. I don't want to eliminate programmers, just get more done per unit of time and effort.

So having eliminated all contenders I can think, I hope someone else can provide a better candidate.

Late Edit: I think I have an answer: Wolfram Language. http://www.wolfram.com/wolfram-language/


答:
Incredibly simple: It's always 3 points.

(or pick a different constant).  This is the approach we took at our last job and I think it worked out relatively well.

The idea is that you have a backlog full of actual stories and one of them happens to be an integration story with a device you know nothing about.  If someone asked me to size that story(actual integration) without any more knowledge, I would give a very conservative estimate. If I did similar integrations in the past, I might pick a story points on high end.  If I never did similar work and don't even know where to begin, I would just pick a million points.

So then obviously product owner comes back and says, we can't have a million points, so let's create another story about research.  The goal of the research story IS NOT to code the integration.  It IS NOT about solving every possible problem you might face.  The primary and only goal of the research story is to give better point estimate for the actual work story.  Don't get lost trying to figure out how to use every single API call and come up with actual integration design/code.  Instead, approach it from a high level to understand the complexity that's ahead of you.

At the end of the research story, your #1 deliverable (along with possible research notes, prototypes... etc) is a point estimate for the integration and possibly break down of integration story into several smaller parts.  Keep in mind that each of those still has an unknown component given enough research, you should be able to control for that unknown part (i.e. you read about usage of some API and it looks like its going to be 5 points, well, pick 8 just to be safe).

What we found is that the developer assigned the research task always runs out of steam at almost a constant number of hours (obviously there is some fluctuation, but it averages out at the end).  After that you could spend twice as many hours, but your integration story estimate won't get any better.


问:
Is it better to use $filehandler or FILEHANDLER?
It seems like FILEHANDLER is more commonly used as a handler naming convention than $filehandler.
But it can give a bareword error if one forgets to use *FILEHANDLER in some constructions.

What are advantages and disadvantages of HANDLERS and $handlers?

Which naming convention is a better practise, and why?

答:
I assume you're talking about using a FileHandle object versus a namespace/bareword or glob?

Using FileHandle gives you an object.  If your surrounding code is OO, it makes sense.  It also makes it more readable as to when it is in scope, and how it is used.  See IO::Handle

Perldoc http://perldoc.perl.org/perlop.html#I%2fO-Operators

I agree with stevenl, <>

If you're using -w or use strict; there are issues with BAREWORDS.  Safer to have a reference.


答:
Your refactored tests have a smell: Conditional Test Logic.

The reasons you should avoid writing conditional logic in your tests are two-fold. The first is that it undermines your ability to be confident that your test code is correct, as described in the linked xUnit Patterns article.

The second is that it obscures the meaning of the tests. We write Test Methods because they put the logic for testing a given behaviour in one place, and allow us to give it a descriptive name (see Dan North's original BDD article for an exploration of the value of good names for tests).
When your tests are hidden inside a single function with a for loop, it obscures the meaning of the code for the reader. Not only does the reader have to comprehend the loop, they also have to mentally unravel all the different behaviours being tested within the loop.

The solution, as always, is to move up a level of abstraction. Use a test framework which gives you parametrised tests, like xUnit.NET or Contexts do (disclaimer: I wrote Contexts). This allows you to group triangulating tests for the same behaviour together in a natural way, while keeping tests for separate behaviours separate.

Title: Is there a better way of writing unit tests than a series of 'AssertEquals'?

Body:
Here's a basic example of what my unit test needs to be, using qunit:

```<code><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>

<link rel="stylesheet" href="qunit/qunit-1.13.0.css">
<script src = "qunit/qunit-1.13.0.js"></script>
<script src = "../js/fuzzQuery.js"></script>

<script>

test("Fuzz Query Basics", function()
        {
            equal(fuzzQuery("name:(John Smith)"), "name:(John~ Smith~)");
            equal(fuzzQuery("name:Jon~0.1"), "name:Jon~0.1");
            equal(fuzzQuery("Jon"), "Jon~");
            //etc

        }
    );

</script>
</head>
<body>
    <div id="qunit"></div>
</body>
</html>
</code>```

Now I was thinking this is a bit repetitive.

Could put all the inputs/outputs into an array, and loop through it.

```<code>test("Fuzz Query Basics", function()
        {
            var equals = [
                           ["name:(John Smith)", "name:(John~ Smith~)"],
                           ["name:Jon~0.1", "name:Jon~0.1"],
                           ["Jon", "Jon~"]
                           ];

            for (var i = 0; i<equals.length; i++)
                {
                    equal(fuzzQuery(equals[i][0]), equals[i][1]);
                }

        }
    );
</code>```

And this works fine.

The single advantage I can think of for this second method, is that if it turns out that you don't actually want to use equal it's easier to make that change in one spot.

In terms of readability, I don't think it's conclusive either way, though I probably prefer the second.

Abstracting it further, you could put the input/output cases into a separate CSV file, which might make it easier to modify.

Question is - what are the general conventions around writing these kinds of unit tests?

Is there a reason you shouldn't put them into arrays?


问:
Self-Executing Anonymous Function vs Prototype
In Javascript there are a few clearly prominent techniques for create and manage classes/namespaces in javascript.

I am curious what situations warrant using one technique vs. the other. I want to pick one and stick with it moving forward.

I write enterprise code that is maintained and shared across multiple teams, and I want to know what is the best practice when writing maintainable javascript ?

I tend to prefer Self-Executing Anonymous Functions however I am curious what the community vote is on these techniques.

Prototype :

```<code>function obj()
{
}

obj.prototype.test = function() { alert('Hello?'); };
var obj2 = new obj();
obj2.test();
</code>```

Self-Closing Anonymous Function :

```<code>//Self-Executing Anonymous Function
(function( skillet, $, undefined ) {
    //Private Property
    var isHot = true;

    //Public Property
    skillet.ingredient = "Bacon Strips";

    //Public Method
    skillet.fry = function() {
        var oliveOil;

        addItem( "\t\n Butter \n\t" );
        addItem( oliveOil );
        console.log( "Frying " + skillet.ingredient );
    };

    //Private Method
    function addItem( item ) {
        if ( item !== undefined ) {
            console.log( "Adding " + $.trim(item) );
        }
    }
}( window.skillet = window.skillet || {}, jQuery ));
//Public Properties
console.log( skillet.ingredient ); //Bacon Strips

//Public Methods
skillet.fry(); //Adding Butter & Fraying Bacon Strips

//Adding a Public Property
skillet.quantity = "12"; console.log( skillet.quantity ); //12

//Adding New Functionality to the Skillet
(function( skillet, $, undefined ) {
    //Private Property
    var amountOfGrease = "1 Cup";

    //Public Method
    skillet.toString = function() {
        console.log( skillet.quantity + " " +
                     skillet.ingredient + " & " +
                     amountOfGrease + " of Grease" );
        console.log( isHot ? "Hot" : "Cold" );
     };

}( window.skillet = window.skillet || {}, jQuery ));
//end of skillet definition

try {
    //12 Bacon Strips & 1 Cup of Grease
    skillet.toString(); //Throws Exception
} catch( e ) {
    console.log( e.message ); //isHot is not defined
}
</code>```

I feel that I should mention that the Self-Executing Anonymous Function is the pattern used by the jQuery team.

Update
When I asked this question I didn't truly see the importance of what I was trying to understand. The real issue at hand is whether or not to use new to create instances of your objects or to use patterns which do not require constructors/use of the new keyword.

I added my own answer, because in my opinion we should make use of patterns which don't use the new keyword.

For more information please see my answer.

答:
Here is how I would go about this IIFE SelfExecutingFunction to extend the Myclass with Myclass.anotherFunction();

```<code>MyClass = (function() {
     var methodOne = function () {};
     var methodTwo = function () {};
     var privateProperty = "private";
     var publicProperty = "public";

    //Returning the anonymous object {} all the methods and properties are reflected in Myclass constructor that you want public those no included became hidden through closure;
     return {
         methodOne = methodOne;
         methodTwo = methodTwo;
         publicProperty = publicProperty;
     };
})();

@@@@@@@@@@@@@@@@@@@@@@@@
//then define another IIFE SEF to add var function=anothermethod(){};
(function(obj){
return obj.anotherfunction=function(){console.log("Added to Myclass.anotherfunction");};
})(Myclass);

//the last bit : (function(obj){})(Myclass); obj === Myclass obj is an alias to pass the Myclass to IIFE

var myclass = new Myclass();
myclass.anotherfunction(); //"Added to Myclass.anotherfunction"
</code>```

Body:
Here is how I would go about this IIFE SelfExecutingFunction to extend the Myclass with Myclass.anotherFunction();

MyClass = (function() {
     var methodOne = function () {};
     var methodTwo = function () {};
     var privateProperty = "private";
     var publicProperty = "public";

    //Returning the anonymous object {} all the methods and properties are reflected in Myclass constructor that you want public those no included became hidden through closure;
     return {
         methodOne = methodOne;
         methodTwo = methodTwo;
         publicProperty = publicProperty;
     };
})();

@@@@@@@@@@@@@@@@@@@@@@@@
//then define another IIFE SEF to add var function=anothermethod(){};
(function(obj){
return obj.anotherfunction=function(){console.log("Added to Myclass.anotherfunction");};
})(Myclass);

//the last bit : (function(obj){})(Myclass); obj === Myclass obj is an alias to pass the Myclass to IIFE

var myclass = new Myclass();
myclass.anotherfunction(); //"Added to Myclass.anotherfunction"


问:
How to Know When to Stop Designing?
First some backgrounds, I'm interning at a company that makes parallel processing hardware.

We're currently working out the design for a component of our driver that is supposed to evolve over a few generations of our products. The next gen is still in simulation phase and the specification we have now may change when we actually get the hardware.
Our module is supposed to work on the current gen and all future gens.

I've always been under the impression that a design should be as future-proofing as possible. In this case, we know exactly what to do for current gen hardware but are unclear on some fronts for the next gen.

So my question is:

When do you know that you should stop designing for the future and just keep it simple and correct for what you know right now?

答:
Typically we design such software in layers, each with it's own interface. Each layer encapsulates the one below.  Layers may be very thin, and depending on the language used, compile down to code with no runtime cost (eg C or asm macros, or C++ templates).

The highest or outermost layer presents the interface your clients use to interact with your product, and changes as little as possible. Inner layers address implementation issues and change whenever they must.

How to design for the future? The hardware team must have some kind of road-map for where it's going. Consult with them. Whatever the extent of their future planning (which cannot be guaranteed to remain unchanged) is the limit of your future planning.

The key is to limit the costs of future change, and that's what those layers of abstraction do. The current lowest layer will address the current simulation. If the simulation changes then that bottom layer will also, but hopefully not the next layer up.

How to know when to stop designing? When you have a design that addresses the known future variation.

Title: How to Know When to Stop Designing?


问:
Why "Fork me on GitHub"?
I understand how GitHub works, but one thing I've been confused about is, why almost every OSS project lately has a "Fork me on GitHub" link on their homepage. For example,

http://jqtjs.com/, http://www.daviddurman.com/flexi-color-picker/, and others.

Why is this so common? Is it that they want/need code validation, checking for security/performance improvements that they may not know how to do?

Is it meant to show that this is a collaborative project - you're welcome to add improvements?

Do they work for GitHub, or want to promote their service? Oddly enough, I don't think I've seen a "Fork project on Bitbucket" logo recently.

My first reaction to that logo was that the project probably needs to be modified (forked) in order to integrate it with anything useful - or that they are encouraging fragmented codebase, encouraging everyone to make their own fork of the project. But I don't think that is the intent.

答: You're probably best off just taking the simplest answer: they want you to know the code is freely available on GitHub. I think your hypotheses are a bit overthought.</p>

Title: Why "Fork me on GitHub"?


问:
Licensing question regarding no derivatives
I am working on a project where I'd like these licensing terms:

Allow unmodified redistribution, with attribution to the author

Disallow modified redistribution

Non-commercial use

Now the CC BY-NC-ND 4.0 license is perfect for this... however, it does not cover any software topics, and CC themselves say that you shouldn't really use the CC licenses for software projects.

So what should you use in a case like this instead? LGPL comes close, but it does allow commercial use. Standard copyright, without a license, also comes close again, but allows commercial use while disallowing redistribution.

BTW, I understand you guys aren't lawyers. But you might have experience with licensing to know what kind of license you should be looking for with my needs.

答:
You may redistribute if you attribute in accordance with this license.

You may not redistribute under terms that are different from the terms specified in this license.

This software may only be used for non-commercial purposes [specify what non-commercial means]


问:
Arrow => in Perl
What does the => mean in Perl?

```<code>my $CreateArray = [
objectClass => [ "top", "person", "organizationalPerson", "inetOrgPerson" ],
cn => "Jane User",
uid => "0000001",
sn => "User",
mail => "JaneUser@mycompany.com"
];
</code>```

produces

```<code>CreateArray:
0  'objectClass'
1  ARRAY(0x104ef40)
  0  'top'
  1  'person'
  2  'organizationalPerson'
  3  'inetOrgPerson'
2  'cn'
3  'Jane User'
4  'uid'
5  0000001
6  'sn'
7  'User'
8  'mail'
9  'JaneUser@mycompany.com'
</code>```

It seems that even numbers are keys and odd numbers are values. Why don't they use hashes? Because they aren't ordered? Is there a name for this strange structure?

Thank you.

答:
Agreed, see perlop (perldoc perlop) for details.

For more discussion, here's a decent thread.  Don't confuse the key=>value notation as being significant to a hash...

For example:

```<code># no =>
my %hash = (
  mykey, 'blah',
  yourkey, 'blah2',
  seehere, 'blah3',
  90, 'see further -- try putting a 0 in front of my key');

foreach my $key (sort keys %hash) {
  print qq#$key: $hash{$key}\n#;
}

exit(0);
</code>```

But arrows will do just as well, without quotes, avoid unquoted octals.

Reference: http://www.perlmonks.org/?node_id=381320

Title: Arrow => in Perl

Body:
Agreed, see perlop (perldoc perlop) for details.

For more discussion, here's a decent thread.  Don't confuse the key=>value notation as being significant to a hash...

For example:

# no =>
my %hash = (
  mykey, 'blah',
  yourkey, 'blah2',
  seehere, 'blah3',
  90, 'see further -- try putting a 0 in front of my key');

foreach my $key (sort keys %hash) {
  print qq#$key: $hash{$key}\n#;
}

exit(0);

But arrows will do just as well, without quotes, avoid unquoted octals.

Reference: http://www.perlmonks.org/?node_id=381320


答:
All the responses saying that this is collaborative beg the question: why not say "Clone me on GitHib" or "Download .zip from GitHub"?

On GitHub you can see a count of the number of forks.  But, to my knowledge, not a count of the number of clones or zip downloads.

So, I'd say it is partly to encourage collaboration, partly to get feedback and validation that people are using your code.

P.S. I'm fairly new to GitHub so if this is totally wrong of off base kindly let me know.

Title: Why "Fork me on GitHub"?

Body:
I understand how GitHub works, but one thing I've been confused about is, why almost every OSS project lately has a "Fork me on GitHub" link on their homepage. For example,

http://jqtjs.com/, http://www.daviddurman.com/flexi-color-picker/, and others.

Why is this so common? Is it that they want/need code validation, checking for security/performance improvements that they may not know how to do?

Is it meant to show that this is a collaborative project - you're welcome to add improvements?

Do they work for GitHub, or want to promote their service? Oddly enough, I don't think I've seen a "Fork project on Bitbucket" logo recently.

My first reaction to that logo was that the project probably needs to be modified (forked) in order to integrate it with anything useful - or that they are encouraging fragmented codebase, encouraging everyone to make their own fork of the project. But I don't think that is the intent.


问:
Suggestions designing an XML polling deamon in python
I'm about to take on a new project for a client designing a server-side python program that will poll a number of XML streams at regular intervals and populate a Postgresql database with results. The system will basically act as an XML cacheing daemon and populate a database. That database will then be accessed by a separate program which will serve that data in JSON to a public-facing website.

I'm wondering if anyone has suggestions as to the high-level design of the python caching/polling program. I'm thinking something class-based where a number of classes (one for each XML stream to be polled) descend from a common parent class, check for new content and then grab any if found. I'm thinking to have a table for each of the XML streams on the database, a column for each of the XML fields, and another table to keep track of the "last access" for each stream.

For this I'm planning on using Python 2.7, pyscopg, and ElementTree for XML processing.

Does anyone have any thoughts or criticism on my design or toolchain at this point? Is parsing my XML values to  store in a Postgres database more work than is worthwhile? The front-end program that will be serving that data will be turning it into JSON rather than XML by the way.

答:
I think using PostgreSQL makes sense, perhaps more than most databases.  One of the great luxuries of PostgreSQL is that you have a stored procedure language PL/Python [http://www.postgresql.org/docs/9.3/static/plpython-data.html] and also has good JSON in/out support [http://www.postgresql.org/docs/9.3/static/functions-json.html].

I don't want to comment on your specific implementation, but if you're comfortable with Python, then you can use stored procedures to store your data efficiently, and use the database server to give them back in JSON to any client.  Though, as mentioned, once they're in JSON, probably best to keep them that way [as opposed to XML].


问:
Can the GitHub pull request process constitute an electronic signature of a CLA?
I appreciate the need for a Contributor License Agreement (CLA) in open source software projects and even understand that some tools are starting to make this process easier (like the low-friction CLAHub for GitHub and Project Harmony). However, rather than requiring a third-party form submission for an electronic signature, would adding an extra sentence and the CLA itself to CONTRIBUTING.md, which GitHub links to when a contributor files a pull request (displayed as "Please review the guideline for contributing to this repository"), allow for a valid electronic signature (e.g. "Submitting a pull request to this repository on GitHub with your name and email constitutes your agreement to and electronic signature of the following Contributor License Agreement...")? Perhaps that argument hinges on the definition of "electronic signature" (ESIGN, UETA, etc.):

"Electronic signature" means an electronic sound, symbol, or process attached to or logically associated with a record and executed or adopted by a person with the intent to sign the record.

And I would like to propose that the GitHub pull request "process" is "logically associated" with the CONTRIBUTING.md/CLA "record" and that the contributor has the "intent to sign" by adopting the process...

(Since the Open Source Licensing Q&A site is still a just a proposal, I will accept IANAL answers here.)

答:
Probably not.  A pull request is just an automated "please take this and use it" communication, rather than a real electronic signature.  While you can definitely state that a pull request consituttes agreement to your site's CLA, you won't be able to say that it's been "signed."

This matters because you may want to do what the FSF does, and have your contributors actually transfer their copyright to you so you don't have to chase them down and get a signature when you want to sue someone for taking your work and using it against the terms of your project's license.  Transfers of copyright, as per the US Copyright Office, have to be "in writing and signed."

Any or all of the copyright owner’s exclusive rights or any
  subdivision of those rights may be transferred, but the trans
  fer of exclusive rights is not valid unless that transfer is in
  writing and signed by the owner of the rights conveyed or
  such owner’s duly authorized agent.

If you care about tracking electronic signatures, you probably want to go with something explicit.  (And if you're not tracking sig's and just being implicit, there's no reason to track anything.)


问:
Best practice or design patterns for retrieval of data for reporting and dashboards in a domain-rich application
First, I want to say this seems to be a neglected question/area, so if this question needs improvement, help me make this a great question that can benefit others! I'm looking for advice and help from people who have implemented solutions that solve this problem, not just ideas to try.

In my experience, there are two sides of an application - the "task" side, which is largely domain driven and is where the users interact richly with the domain model (the "engine" of the application) and the reporting side, where users get data based on what happens on the task side.

On the task side, it's clear that an application with a rich domain model should have business logic in the domain model and the database should be used mostly for persistence. Separation of concerns, every book is written about it, we know what to do, awesome.

What about the reporting side? Are data warehouses acceptable, or are they bad design because they incorporate business logic in the database and the very data itself? In order to aggregate the data from the database into data warehouse data, you must have applied business logic and rules to the data, and that logic and rules didn't come from your domain model, it came from your data aggregating processes. Is that wrong?

I work on large financial and project management applications where the business logic is extensive. When reporting on this data, I will often have a LOT of aggregations to do to pull the information required for the report/dashboard, and the aggregations have a lot of business logic in them. For performance sake, I have been doing it with highly aggregated tables and stored procedures.

As an example, let's say a report/dashboard is needed to show a list of active projects (imagine 10,000 projects). Each project will need a set of metrics shown with it, for example:

total budget

effort to date

burn rate

budget exhaustion date at current burn rate

etc.

Each of these involves a lot of business logic. And I'm not just talking about multiplying numbers or some simple logic. I'm talking about in order to get the budget, you have to apply a rate sheet with 500 different rates, one for each employee's time (on some projects, other's have a multiplier), applying expenses and any appropriate markup, etc. The logic is extensive. It took a lot of aggregating and query tuning to get this data in a reasonable amount of time for the client.

Should this be run through the domain first? What about performance? Even with straight SQL queries, I'm barely getting this data fast enough for the client to display in a reasonable amount of time. I can't imagine trying to get this data to the client fast enough if I am rehydrating all these domain objects, and mixing and matching and aggregating their data in the application layer, or trying to aggregate the data in the application.

It seems in these cases that SQL is good at crunching data, and why not use it? But then you have business logic outside your domain model. Any change to the business logic will have to be changed in your domain model and your reporting aggregation schemes.

I'm really at a loss for how to design the reporting/dashboard part of any application with respect to domain driven design and good practices.

I added the MVC tag because MVC is the design flavor du jour and I am using it in my current design, but can't figure out how the reporting data fits into this type of application.

I'm looking for any help in this area - books, design patterns, key words to google, articles, anything. I can't find any information on this topic.

EDIT AND ANOTHER EXAMPLE

Another perfect example I ran across today. Customer wants a report for Customer Sales Team. They want what seems like a simple metric:

For each Sales person, what is their annual sales to date?

But that is complicated. Each sales person participated in multiple sales opportunities. Some they won, some they didn't. In each sales opportunity, there are multiple sales people who are each allocated a percentage of credit for the sale per their role and participation. So now imagine going through the domain for this...the amount of object rehydration you would have to do to pull this data from the database for every Sales person:

Get all the SalesPeople->

  For each get their SalesOpportunities->

  For each get their percentage of the sale and calculate their Sales amount

  then Add up all their SalesOpportunity Sales amount.

And that's ONE metric. Or you can write a SQL query which can do it quickly and efficiently and tune it to be fast.

EDIT 2 - CQRS Pattern

I've read about the CQRS Pattern and, while intriguing, even Martin Fowler says it's not tested. So how has this problem BEEN solved in the past. This has to have been faced by everyone at some point or another. What is an established or well-worn approach with a track record of success?

Edit 3 - Reporting Systems/Tools

Another thing to consider in this context is reporting tools. Reporting Services/Crystal Reports, Analysis Services and Cognoscenti, etc. all expect data from SQL/database. I doubt your data will come through your business later for these. And yet they and others like them are a vital part of the reporting in a lot of large systems.
How is the data for these properly handled where there is even business logic in the data source for these systems as well as possibly in the reports themselves?

答:
It's typical to separate operational/transactional data stores from reporting.  The latter may have requirements to keep data for legal reasons (e.g. seven years of financial data for financial auditing), and you don't want all that in your transactional data store.

So you'll partition your transactional data by some time measure (weekly, monthly, quarterly, yearly) and move older partitions out into your reporting/history data store via ETL.  It may or may not be a data warehouse with a star schema and dimensions.  You'd use data warehousing reporting tools to do ad hoc queries and roll ups and batch jobs to generate periodic reports.

I would not recommend reporting against your transactional data store.

If you prefer to press on, here are more thoughts:

"Best" is subjective and what works.

I'd buy a reporting product rather than write them myself.

If you're using a relational database, then SQL is the only game in town.

Stored procedures depend on whether you have the skills to write them.

Project management software that you use in house?  I'd buy before I'd build.   Something like Rally and Microsoft Project.

OwnerDisplayName: Richard DesLonde

OwnerDisplayName: duffymo


答:
This is a very glib answer, but getting right to the heart of the matter:

In terms of DDD maybe think of reporting as a Bounded Context?, so rather than thinking in terms of "THE" domain model, you should be willing to think that it's okay to have more than one model.  So yes it's okay if the reporting domain has reporting business logic in it, just as it's okay for the transactional domain to have transactional business logic in it.

As to the question of, say SQL stored procedures vs. domain model in application code,  the same pros and cons apply for the reporting system as for the transactional system.

Since I see that you added a bounty to the question, I read the question again and noticed that you are asking for specific resource on this, so I thought I'd start with suggesting that you look at other Stack Overflow questions on the matter, and I found this one https://stackoverflow.com/questions/11554231/how-does-domain-driven-design-handle-reporting

The general gist of that one is to use CQRS as a pattern for your system, which is consistent with DDD,  and rely on the query side responsibilities as a way to get reporting done,  but I'm not sure that is a helpful answer in your case.

I also found this http://www.martinfowler.com/bliki/ReportingDatabase.html,  which I found linked from here: http://groups.yahoo.com/neo/groups/domaindrivendesign/conversations/topics/2261

Here's an interesting article from ACM on the matter: http://dl.acm.org/citation.cfm?id=2064685  but it's behind a paywall so I can't actually read it (not an ACM member :( ).

There's also this here answer on a similar question: https://stackoverflow.com/questions/3380431/cqrs-ddd-synching-reporting-database

and this one: http://snape.me/2013/05/03/applying-domain-driven-design-to-data-warehouses/

Hope this helps!

Title: Best practice or design patterns for retrieval of data for reporting and dashboards in a domain-rich application

Body:
First, I want to say this seems to be a neglected question/area, so if this question needs improvement, help me make this a great question that can benefit others! I'm looking for advice and help from people who have implemented solutions that solve this problem, not just ideas to try.

In my experience, there are two sides of an application - the "task" side, which is largely domain driven and is where the users interact richly with the domain model (the "engine" of the application) and the reporting side, where users get data based on what happens on the task side.

On the task side, it's clear that an application with a rich domain model should have business logic in the domain model and the database should be used mostly for persistence. Separation of concerns, every book is written about it, we know what to do, awesome.

What about the reporting side? Are data warehouses acceptable, or are they bad design because they incorporate business logic in the database and the very data itself? In order to aggregate the data from the database into data warehouse data, you must have applied business logic and rules to the data, and that logic and rules didn't come from your domain model, it came from your data aggregating processes. Is that wrong?

I work on large financial and project management applications where the business logic is extensive. When reporting on this data, I will often have a LOT of aggregations to do to pull the information required for the report/dashboard, and the aggregations have a lot of business logic in them. For performance sake, I have been doing it with highly aggregated tables and stored procedures.

As an example, let's say a report/dashboard is needed to show a list of active projects (imagine 10,000 projects). Each project will need a set of metrics shown with it, for example:

total budget

effort to date

burn rate

budget exhaustion date at current burn rate

etc.

Each of these involves a lot of business logic. And I'm not just talking about multiplying numbers or some simple logic. I'm talking about in order to get the budget, you have to apply a rate sheet with 500 different rates, one for each employee's time (on some projects, other's have a multiplier), applying expenses and any appropriate markup, etc. The logic is extensive. It took a lot of aggregating and query tuning to get this data in a reasonable amount of time for the client.

Should this be run through the domain first? What about performance? Even with straight SQL queries, I'm barely getting this data fast enough for the client to display in a reasonable amount of time. I can't imagine trying to get this data to the client fast enough if I am rehydrating all these domain objects, and mixing and matching and aggregating their data in the application layer, or trying to aggregate the data in the application.

It seems in these cases that SQL is good at crunching data, and why not use it? But then you have business logic outside your domain model. Any change to the business logic will have to be changed in your domain model and your reporting aggregation schemes.

I'm really at a loss for how to design the reporting/dashboard part of any application with respect to domain driven design and good practices.

I added the MVC tag because MVC is the design flavor du jour and I am using it in my current design, but can't figure out how the reporting data fits into this type of application.

I'm looking for any help in this area - books, design patterns, key words to google, articles, anything. I can't find any information on this topic.

EDIT AND ANOTHER EXAMPLE

Another perfect example I ran across today. Customer wants a report for Customer Sales Team. They want what seems like a simple metric:

For each Sales person, what is their annual sales to date?

But that is complicated. Each sales person participated in multiple sales opportunities. Some they won, some they didn't. In each sales opportunity, there are multiple sales people who are each allocated a percentage of credit for the sale per their role and participation. So now imagine going through the domain for this...the amount of object rehydration you would have to do to pull this data from the database for every Sales person:

Get all the SalesPeople->

  For each get their SalesOpportunities->

  For each get their percentage of the sale and calculate their Sales amount

  then Add up all their SalesOpportunity Sales amount.

And that's ONE metric. Or you can write a SQL query which can do it quickly and efficiently and tune it to be fast.

EDIT 2 - CQRS Pattern

I've read about the CQRS Pattern and, while intriguing, even Martin Fowler says it's not tested. So how has this problem BEEN solved in the past. This has to have been faced by everyone at some point or another. What is an established or well-worn approach with a track record of success?

Edit 3 - Reporting Systems/Tools

Another thing to consider in this context is reporting tools. Reporting Services/Crystal Reports, Analysis Services and Cognoscenti, etc. all expect data from SQL/database. I doubt your data will come through your business later for these. And yet they and others like them are a vital part of the reporting in a lot of large systems.
How is the data for these properly handled where there is even business logic in the data source for these systems as well as possibly in the reports themselves?


问:
When using the Apache license, is there still a need for a Contributor License Agreement (CLA)?
I can certainly see the need for CLAs with a terser license like MIT or BSD, but the more verbose Apache seems to already have that type of verbiage in it. I would prefer to not add this level of complication an open source project if it is not necessary with the Apache 2.0 license.

CLAs seem to primarily grant a copyright license and a patent license from the contributor to the project, both of which are already in the text of the Apache 2.0 license (sections 2 and 3). If I am using the Apache license, do I really need to also add the extra requirement for contributors to sign a CLA? I basically want to get the general benefits of a CLA (like the non-ambiguous right to relicense, though the contributor maintains ownership) without making contributors fill out a bunch of information and sign a contract in some third-party form.

Doesn't the act of cloning a repository, modifying code, and sending a pull request indicate agreement to the terms of the associated license? Section 5 of the Apache 2.0 License explicitly states that contributions shall also be under Apache 2.0:

Submission of Contributions: Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.

When combined with Sections 2 & 3 regarding grant of copyright license and patent license "...to reproduce, prepare Derivative Works of, sublicense..." it would seem that Apache 2.0 already covers the project's bases regarding submissions. Or am I misunderstanding a possible difference between a "sublicense" and actually changing the license of the project?

(Since the Open Source Licensing Q&A site is still a just a proposal, I will accept IANAL answers here.)

答:
IANAL but my understanding is that a CLA ensures (among other things) that the contributors have the rights to share the Intellectual Property in any contribution they make to your project.

This is especially critical if you offer commercial licences but is also important for a pure Apache project because if there is proprietary code in your project you are infringing a copyright.


问:
Scaling up Git to Team Usage
For the last 3 years I have used git on an almost daily basis for all my pet projects and at work for small projects that were not in the global SVN repository. My workflow is quite similar to the famous git branching model from http://nvie.com/posts/a-successful-git-branching-model to sum it up:

I work in branches, one branch for one feature (I.e. not mixing up the bugfix with the new feature, etc.)

I commit really really often, often just 2-5 lines, biggest commits are usually new functions etc. I heavily use the interactive committing tool to semantically organize my commits (i.e. while fixing an import declaration and something in a function, I tend to split that up in two commits when the changes are not related).

Finally I tended to use git merge with the --no-ff option, because I kind of like the visual branch-history graph in gitk.

Never really used rebasing (except for fixups)

Of course this workflow never had to face merge conflicts as serious as teams working on the same codebase face.

Now I have read here and there, that some projects are very concerned about keeping a "fast-forward" history. Why is this important? What is your choice in that respect?

I can imagine that a 'linear' history is easier to handle when looking at histories, but: It is also valuable to have the true history in my opinion. The linear history without fast-forwards is more similar to SVN histories maybe, but my git commits are usually a lot smaller than the average SVN commit, these are - I think - more comparable to a branch-merge in git (at least my usage). Working without -no-ff would kind of "clutter" the history in master (This is my concern about fast forward merges).

答:
There are some common best practices when working with a shared Git repository. The ones I am familiar with are these:

One commit per feature

No commits that break the build

Try to rebase everything onto the master branch

How different teams work may vary, so I don't think there is a single answer to this question. Different teams will choose to be less strict about breaking the build for example.

The main thing, in my opinion, is to try to always leave the repository in a working state. Your co-workers should be able to check out any commit and start working from there without build problems or other obvious bugs. Build and test everything before commit.

To have a good overview of a shared repository it is a good idea to only add one bugfix or new feature per commit. Some features do need more commits but then the commits should be organized per sub-feature if possible (for example one commit could add new API endpoints needed for feature X, then another commit adds the actual feature in the frontend application). This also helps with not breaking the build, as half-implemented features are bug magnets.

Having a linear commit history simplifies a lot of things but is not required. I think this will vary a lot between projects. Some will likely require you to always rebase your changes on the tip of master, while others will accept feature branches. Having a linear history helps immensely with keeping track of build/version numbers. Git describe can be used without the short hash if you have a linear history, for example.

Title: Scaling up Git to Team Usage


问:
Is it good approach to open a keyboard at Actvity start where only one EditTextbox is present
I am working with Forgot password, where I have single EditTextBox and a single submit button.

So whenever I am opening this Forgot password page, my keyboard is opened at the start of this page.

In my mind there is a question that it is not a smart choice to open a keyboard at the start of the Forgot password Activity.

答:
The Handling Input Method Visibility page in the Android developer docs has this to say about showing the input method on activity start:

Although Android gives focus to the first text field in your layout when the activity starts, it does not show the input method. This behavior is appropriate because entering text might not be the primary task in the activity. However, if entering text is indeed the primary task (such as in a login screen), then you probably want the input method to appear by default.

These guidelines make it fairly clear that this behaviour doesn't contradict any rules (and it might make it easier for the user to navigate your activity).

That said, it really depends on what you have in your activity - in particular, whether the keyboard obstructs any important information you're trying to give to your users.

As that page says, there are plenty of options you can set in your layout to control the input method and the UI behaviour, but whatever you do, it's worth looking at the accessibility guidelines to make sure your app is accessible.


问:
How should I validate code when there is no one to do code review?
I'm used to working in a large development environment where code is peer reviewed and tested by the client, who is usually an IT person themselves. I am now working at a very small company where I'm not just the only developer, but the only IT person at all.

I'm inclined to have my coworkers and/or boss take a look at my work every time I finish a agile story, so they can either accept it or reject it, as is the pattern I'm used to. However, too often my coworkers either don't understand my work well enough to judge it or they misunderstand it and accept bad code or reject good code based on surface looks alone, like the color of links.

So I'm wondering how I should decide when to accept/reject tests now? Should I try to assess my own code like an outside person? Should I just skip it and accept everything? Should I try to educate my coworkers a bit and get them to do proper tests?

答:
I'm not just the only developer, but the only IT person at all. I'm inclined to have my coworkers and/or boss...

Sometimes in that situation it is useful to invite a friend even if he knows absolutely nothing about computers. You could meet at home, or another place, and you can show him your code, or he can show you his code. In my experience he was my friend, and usually poked at a piece of code, whereafter I often found an error.

Also a good approach can be that you just try to forget somehow what the code does. Just sleep, go for a walk, or even change the project. When you completely forget the completed task, try to get back into the project, read the code and reconstruct the purpose of the code. Try to understand the code again, you will see many new ideas, and even mistakes in it. Don't wait too long, though!

This approach can also be applied when you write an article.


问:
Is it good to create static method at Visual Studio refactoring?
There are various refactoring options in Visual Studio to use at the time of coding. When we extract and create a new method. Then Visual Studio decide whether the new method will be static or instence depending on the usage inside the new method. If that method use some intence member of the class then it creates as instence method, if it does not use any instence member of the class then it creates the method as static. I can understand that if there is no instence member usage then it is better to declare that method as static to prevent initialization for every object. Static method initilize only once at the time of class load.

But the question is if there are many static methods inside various classes of a application, then performance will hurt? Because many object of that class will share same static method of that class? Should we do thread safety management to that static method? Or in this kind of setuation it is better to simplily create instence method if there are no usage of instence member of the class?

答:
It's not so much a performance issue but a thread safety issue. If you have static methods that mutate static data then yes, these will need to lock access to that data (though granted this could cause performance issues), this of course is also true of non static methods. </p>

<p>However it is much more common for static methods to be pure functions in the first place, in this case no locks may be required. </p>

Body:
It's not so much a performance issue but a thread safety issue. If you have static methods that mutate static data then yes, these will need to lock access to that data (though granted this could cause performance issues), this of course is also true of non static methods.

However it is much more common for static methods to be pure functions in the first place, in this case no locks may be required.


答:
But the question is if there are many static methods inside various classes of a application, then performance will hurt?

Absolutely not, quite the opposite, since static methods don't have a "this" parameter, so calling a static method will be a little bit faster than calling a non-static method, since there is one parameter less to be pushed on the stack. In most real world cases, however, the speed difference is negligible.

Because many object of that class will share same static method of that class?

For objects, "sharing a method" is like "sharing immutable data" - a thread-safe form of "sharing".

Should we do thread safety management to that static method?

You should add thread safety management to any method mutating data which might be shared between threads (like static data). A method being static does in no way imply the need for putting any locks in there. Its only shared data which can cause threading problems, and it does not matter if the method accessing that data is itself static or not.

So the VS refactoring "Extract method" does in no way introduce any performance- or thread safety issues into your code. At least, none which had not been in the code before the refactoring.

Title: Is it good to create static method at Visual Studio refactoring?

Body:
There are various refactoring options in Visual Studio to use at the time of coding. When we extract and create a new method. Then Visual Studio decide whether the new method will be static or instence depending on the usage inside the new method. If that method use some intence member of the class then it creates as instence method, if it does not use any instence member of the class then it creates the method as static. I can understand that if there is no instence member usage then it is better to declare that method as static to prevent initialization for every object. Static method initilize only once at the time of class load.

But the question is if there are many static methods inside various classes of a application, then performance will hurt? Because many object of that class will share same static method of that class? Should we do thread safety management to that static method? Or in this kind of setuation it is better to simplily create instence method if there are no usage of instence member of the class?


问:
How To Know When To Stop Testing?
I know this is a very very basic question. For some software applications there are a large almost infinitely high number of test cases for an application. It is not practical to test all those test cases. How do we decide when to stop testing? (other than "when money runs out"). </p>

答: When the date of shipping has arrived. There is no end to testing for a software. But then again there is something known as schedule. You will have to test most of your functionality in the scheduled time and fix the bugs that you encounter. There is no way you can guarantee that the software is perfect. </p>

ContentLicense: CC BY-SA 2.5

Title: How To Know When To Stop Testing?


答:
The simple answer is it depends on the system.  If you're writing embedded software for a heart monitor or safety monitoring tools for a nuclear reactor then the standard is far higher than if you're writing a blogging platform.

This is really a question for a good system tester (and I'm not one) but I'll give it a shot.

Your basic measure is going to be test coverage: How much of the application has actually been tested (both by unit test and functionally).

You need to assess each potential use case (and parameters for that use case) for likelihood of it actually being used (so you may drop edge cases), complexity (simpler things being less likely to contain bugs, or rather less likely to contain hard to find bugs), cost to test (in terms of time) and potential impact of a defect if discovered in that area (this is where the nuclear reactor vs. blogging platform comes in).

Based on that assessment you need to work out which of those are going to be tested and in how much detail.  Once you have a list like that the team (including a product manager / project manager / user representative) can go through that list and prioritise based on the constraints you have.

One useful technique to think about is that you may also vary the use cases that are tested with each release.  For instance you might have a list of non-critical test cases and test half of them with one release and half with the next (then alternate).  This way you're increasing the total test coverage you get for the effort (though at the risk of regression bugs being introduced).

This could also extend to platform testing - if you support two database back ends (or multiple browsers) test half the app on one, the other half on the other and then swap next release.

(I think this is referred to as striping but don't quote me on that.)

And then the final thing to think about is not what you test but what you actually fix when issues are discovered.  It's common to say "fix all bugs" but the reality is that there are time pressures and not all bugs are equal.  Again, regular bug scrubs with all the relevant parties are the best way forward.  This is particularly relevant where a bug fix may be particularly intrusive as the additional work in retesting and regression testing it generates may outweigh the benefit of the fix.

Title: How To Know When To Stop Testing?

Body: I know this is a very very basic question. For some software applications there are a large almost infinitely high number of test cases for an application. It is not practical to test all those test cases. How do we decide when to stop testing? (other than "when money runs out"). </p>


答:
I always refactor to static methods if possible just because of what it communicates:

It does not mutate state on an instance of the class.

Therefor it can easily be moved to another class (Move refactoring).

Getting a large number of static methods can be a sign some other class is trying to get out.

Static method invocation is faster then instance method invocation, although the difference tends to be is insignificant (see this question).

When also using static state in the static method you need to be careful with re-entrancy. It's more common to change the static method to an instance method, so it can use members on the instance, then it is to introduce static state.

When in doubt leave the static out.


问:
Advantages and disadvantages of building a single page web application
I'm nearing the end of a prototyping/proof of concept phase for a side project I'm working on, and trying to decide on some larger scale application design decisions.  The app is a project management system tailored more towards the agile development process.  One of the decisions I need to make is whether or not to go with a traditional multi-page application or a single page application.

Currently my prototype is a traditional multi-page setup, however I have been looking at backbone.js to clean up and apply some structure to my Javascript (jQuery) code.  It seems like while backbone.js can be used in multi-page applications, it shines more with single page applications.  I am trying to come up with a list of advantages and disadvantages of using a single page application design approach.  So far I have:

Advantages

All data has to be available via some sort of API - this is a big advantage for my use case as I want to have an API to my application anyway. Right now about 60-70% of my calls to get/update data are done through a REST API.  Doing a single page application will allow me to better test my REST API since the application itself will use it.  It also means that as the application grows, the API itself will grow since that is what the application uses; no need to maintain the API as an add-on to the application.

More responsive application - since all data loaded after the initial page is kept to a minimum and transmitted in a compact format (like JSON), data requests should generally be faster, and the server will do slightly less processing.

Disadvantages

Duplication of code - for example, model code.  I am going to have to create models both on the server side (PHP in this case) and the client side in Javascript.

Business logic in Javascript - I can't give any concrete examples on why this would be bad but it just doesn't feel right to me having business logic in Javascript that anyone can read.

Javascript memory leaks - since the page never reloads, Javascript memory leaks can happen, and I would not even know where to begin to debug them.

There are also other things that are kind of double edged swords.  For example, with single page applications, the data processed for each request can be a lot less since the application will be asking for the minimum data it needs for the particular request, however it also means that there could be a lot more small request to the server.  I'm not sure if that is a good or bad thing.

What are some of the advantages and disadvantages of single page web applications that I should keep in mind when deciding which way I should go for my project?

答:
Disadvantages I often see with Single Page Web Applications:

Inability to link to a specific part of the site, there's often only 1 entry point.

Disfunctional back and forward buttons.

The use of tabs is limited or non-existant.

(especially mobile:)

Take very long to load.

Don't function at all.

Can't reload a page, a sudden loss of network takes you back to the start of the site.

All of these can be worked around, but from what I've seen, most of the sitebuilders don't.


答: If you wait till the project finishes, you'll indeed have a very large numbers of test cases. If you deliver continously, focusing on small deliveries, you'll have less test cases at each iteration and you'll be able to test everything. If you can't do small deliveries, then prioritize and start testing from the greatest priority and go testing untill you have to stop.</p>

Title: How To Know When To Stop Testing?


问:
Is OrientDB document-database? or graph-database?
Some document says OrientDB is document-database, some others talks it's graph-database. What's right?</p>

答: Orient DB is Document-Graph (and/or) DBMS. According to the comparison with MongoDB, OrientDB can store data as JSON type documents but with one (out of many) added benefit of keeping track of relationships as links, to form a graph. </p>


问:
What's the easiest (quickest) way to share one dataset in my app with someone else
I have some javascript that creates a canvas image that I want users to be able to share. I simply need to save the image somehow. Nothing else.

I've been contemplating using bits and pieces of ruby and activerecord, or perhaps sinatra but I feel like both would be over kill for this simple task.

Ideally I'd like to do it with JavaScript but I don't feel like including all of node. Any suggestions?

答:
Simplest way? HTTP POST/PUT the image to a server that saves it on the disk (no DB) and gives it back on a GET to it's url. The server code should be trivial in whatever language you chose.

Maybe you can do this without any server code at all if you can use a webserver (Apache etc.) that supports this scenario. WebDAV publishing comes to mind


问:
How to remove redundant code that enables button. Or "if" statement
I got probably "micro optimization" problem.

I got "History number", "Next Number", "Reset" buttons, as well "label" for text.

Every time I click At "Next number" button I would like to show random number in the label, and add this number to history array where I keep track of the past number.

Every time I click at "History number" it would randomly show one of the random numbers from history array.

Every time I click at "Reset" button, it would just clear history array.

And you can see that, that clicking at the "History number makes only sense when the history array is NOT empty.

And I wonder how to do this, without redundant "if" statement at the "history number" callback.

Or

Deactivating "history number" button at the start of the program.  Then activating it EVERY time the "next number" is clicked (which is uuugly). And deactivating this button again on "Reset" button.

This scheme on whiteboard demonstrate what I mean :

And I have JavaScript code where I implemented one of ugly solution (latter one, with deactivating and activating on appropriate callbacks).

http://jsbin.com/aJESAYu/17/edit

PS: I stumbled upon this problem writing in Objective-C, but I though, that it would be stupid to publish repository with iOS Objective-C code, while not everybody have to have Xcode.  So I done Javascript Example.  So don't restrict your answers to only on language.

PS2: I though about having two "next number" functions.

1) One that would have the line of code that enable "history number" button and

2) second without.

At the start the 1) function would be handler. And at the end of that 1) function, the handler would replace itself to the 2) function.

Also the "reset" handler would put again handler to the 1) function.

PS3: I know, this could be overkill. But I just several times struggled with this kind of situation. And I wonder if there are better solution.

Thank you very very much in advance.

答:
Setting a value to true every time you press "Next number" is not really expensive. Definitely not expensive enough to warrant even more code.
Even though your event handler switching would work it would make the code unnecessarily complex.

It's really matter of performance versus maintainability, two quality aspects that often conflict.

You could wrap your history array in an object and have it raise an event like "change". To decouple the button activation from the 'Next number' handler.

So, anyways, what happens to the label when you click 'Reset' ? :-)


问:
How to Explain Coding is not just Copy and Paste to non Software Developers?
We have 6 people in my group.  My boss and the others are all SQL developers with little understanding of programming, design patterns, good object oriented design, etc.  But, they have all taken a Java course in college.

When new projects come up, I am usually asked to give a time estimate for how long my part will take.  If this project is needed with quick turn around and they don't like the estimate I have given them, they will look at previous modules/portlets I have built and say things like, "It basically looks the same as Project X, so you should be able to just copy/paste that code and modify the SQL a little.  You should be able to do this in 1/2 the time you gave us".

Recently, it got so bad, my boss called me into a daily status update meeting with the group there, and each of the SQL developers asked me why I couldn't just copy/paste the existing code.  They even took the wiki documentation I created from the previous projects and began explaining my documentation to me.

Has anyone else ran into this?  How do you handle this?

答:
Either you are too conservative or they are too aggressive in thier estimates.  If times are different, then you will need to validate your estimates and assumptions in detail for others to view and come to consensus on.  One can't just say, "it should take 3 weeks because it looks like project X".  You will need to go deeper.

Estimates usually come in 2 forms:

High Level

Detailed

Usually esimates start in high level form.  A high level estimate is maybe T-Shirt size like XS, S, M, L, XL, and XXL.  There are usually used to define how big the project will be.  If everyone agress on the same size, then no need to go any further.

However, if you are saying medium and they are saying extra small, then you need to go into a more detailed estimate that lists out all the assumptions, desired functionality, and corresponding effort (tasks) to justify the medium effort.  This should flush out any differences so that all parties agree on the estimated effort of the project.  How deep should you go?  For estimation purpose, maybe a high level view of the proposed system that will be built, components, and broad tasks needed to build those components.

If you are doing the same things over and over again, then I would have to agree that things should take less time the second, third, fourth time around.  Certainly accessing a database should be a common component that can be re-used.  You could develop starting templates for CRUD type operations so you are not starting from scratch every time.

Also, if you justify your estimate and everyone else still says something different, then they are not being logical or reasonable.


答:
Problem with copying is that you copy the bugs also and you add new features only to the last 'current' copy.

When copying bugs over you may end up with a maintenance culture where you have to fix bugs many many times for each separate copy. As time passes and the code loses simularity bug fixing isn't 'copying' anymore. One fix won't quite fit on the other project etc.

When you add new features that you want to retrofit to a project that was source of a copy in the past the business may expect it would be easy, in practice not so much, the code bases will stray away from each other with time.

Refactoring is a big no-no, knowing that if you improve code on project A you'd still be stuck with the painful experience on all the other projects. Doing a complex refactoring 10 times? I don't think so.

If project A is only a few line changes from project B maybe you can just use project A's code as is and share between A and B. Add configuration options to differentiate between A and B. Create a framework, configurable application or service. Etc.

Having said that. I do copy code a lot, but only for scaffolding purposes. I aggressively remove any code not needed and I look for parts that could potentially be moved to a library and shared that way. This is a valid way of working if project A and project B are expected to have different axis of change (they are similar now but won't be further into the future).

Constantly looking for commonality and coming up with increasingly abstract and therefor vague components has it's limits also. Draw a line somewhere and just fork for dissimilar domains.

Title: How to Explain Coding is not just Copy and Paste to non Software Developers?

Body:
We have 6 people in my group.  My boss and the others are all SQL developers with little understanding of programming, design patterns, good object oriented design, etc.  But, they have all taken a Java course in college.

When new projects come up, I am usually asked to give a time estimate for how long my part will take.  If this project is needed with quick turn around and they don't like the estimate I have given them, they will look at previous modules/portlets I have built and say things like, "It basically looks the same as Project X, so you should be able to just copy/paste that code and modify the SQL a little.  You should be able to do this in 1/2 the time you gave us".

Recently, it got so bad, my boss called me into a daily status update meeting with the group there, and each of the SQL developers asked me why I couldn't just copy/paste the existing code.  They even took the wiki documentation I created from the previous projects and began explaining my documentation to me.

Has anyone else ran into this?  How do you handle this?


答:
From the point of view of performance, branching via an if statement is not much different from branching via a mutable event handler so I don't see the difference.

However, I would prefer the explicit if statement most of the time. Event handler are hidden, implicit state and I think its easier to read the code if I set them at the start and then don't change them anymore. (I would rather have the event handler dispatch to a mutable variable holding callback than mutating the handler itself)

// I enable this button again, EVERY TIME - it is ugly and inefficient

I think its exactly the opposite. Its the cleanest way to say that you want the button to be enabled, irrespective of whether it used to be enabled or not. And its most likely not inefficient, since you aren't doing it inside a loop.

Title: How to remove redundant code that enables button. Or "if" statement

Body:
I got probably "micro optimization" problem.

I got "History number", "Next Number", "Reset" buttons, as well "label" for text.

Every time I click At "Next number" button I would like to show random number in the label, and add this number to history array where I keep track of the past number.

Every time I click at "History number" it would randomly show one of the random numbers from history array.

Every time I click at "Reset" button, it would just clear history array.

And you can see that, that clicking at the "History number makes only sense when the history array is NOT empty.

And I wonder how to do this, without redundant "if" statement at the "history number" callback.

Or

Deactivating "history number" button at the start of the program.  Then activating it EVERY time the "next number" is clicked (which is uuugly). And deactivating this button again on "Reset" button.

This scheme on whiteboard demonstrate what I mean :

And I have JavaScript code where I implemented one of ugly solution (latter one, with deactivating and activating on appropriate callbacks).

http://jsbin.com/aJESAYu/17/edit

PS: I stumbled upon this problem writing in Objective-C, but I though, that it would be stupid to publish repository with iOS Objective-C code, while not everybody have to have Xcode.  So I done Javascript Example.  So don't restrict your answers to only on language.

PS2: I though about having two "next number" functions.

1) One that would have the line of code that enable "history number" button and

2) second without.

At the start the 1) function would be handler. And at the end of that 1) function, the handler would replace itself to the 2) function.

Also the "reset" handler would put again handler to the 1) function.

PS3: I know, this could be overkill. But I just several times struggled with this kind of situation. And I wonder if there are better solution.

Thank you very very much in advance.


答: When the risk associated with the software's use has been reduced to an acceptable level.</p>

Title: How To Know When To Stop Testing?