问:
Class design for internationalized object
I'm looking for some pointers on class design for a global application.

Let's say I have to make a class structure  to manage products, and the products are sold in different countries.  Some of the fields for the product will have the same value across all countries (eg. product code, ERP Description) I will call these "international" fields, and some fields will be specific to a single country (eg. Local Description), lets call these "local" fields.  Of course, some "local" fields will be the same for groups of countries (es. weight : 1 kilogram / 2 pounds). Also I expect that not all countries will have values for all fields.

Which fields are "international" and which fields are "local" may change from one installation to another and I am reluctant to bake this into the design as I'm sure it will bite me later on.

So, I'm trying to figure out how to structure the objects so that I can use a product at an international level and always refer to the same "product", but also maintain and use the local information when necessary?

Just to be clear, I'm not talking about user-locale, number or date formatting etc. The source data is coming from different database schemas (one for each country). The end product will be written in C#.

I'm wondering if anyone has experience or can point me to a pattern that would provide a good solution to this before I go and reinvent the wheel?

答:
In the end I used a Product class with generic content and a detail class accessed through indexers to provide the functionality... but I'm really not sure its the right way to do it at all.

I didn't find a specific design pattern that explicitly defines how to do this (as per the original question).  Except "Factory", but that seems bit generic...

This is how I implemented it (code has been simplified):

```<code>public class Product
{
    public string Code {get;set;}
    ....
    private Dictionary<string, ProductDetail> LocalProduct= new Dictionary<string, ProductDetail>();

    public LocalDetail this[string countryCode]
    {
        get
        {
            if (LocalProducts.ContainsKey(countryCode))
                return LocalProducts[countryCode];
            else
                throw new ApplicationException(String.Format("Local product detail does not exist for {0}", countryCode));
         }
         set
         {
            if (LocalProducts.ContainsKey(countryCode))
                throw new ApplicationException(String.Format("Local product detail already exists for {0}", countryCode));
            else
                LocalProducts.Add(countryCode, value);
        }
    }
}

public class LocalDetail
{
    public string Description {get; set;}
    ....
}
</code>```

The calling code is something like this :

```<code>        Product p = new Product("123456");

        LocalDetail UKDetail = new LocalDetail();
        UKDetail.Description = "Description in English";
        p["UK"] = UKDetail;

        System.Console.WriteLine("Product {0} Description in UK Detail : {1}", p.Code, p["UK"].Description);

        LocalDetail ITDetail = new LocalDetail();
        ITDetail.Description = "Descrizione in Italiano";
        p["IT"] = ITDetail;
        System.Console.WriteLine("Product {0} Description in Italian Detail : {1}", p.Code, p["IT"].Description);
</code>```

Body:
In the end I used a Product class with generic content and a detail class accessed through indexers to provide the functionality... but I'm really not sure its the right way to do it at all.

I didn't find a specific design pattern that explicitly defines how to do this (as per the original question).  Except "Factory", but that seems bit generic...

This is how I implemented it (code has been simplified):

public class Product
{
    public string Code {get;set;}
    ....
    private Dictionary<string, ProductDetail> LocalProduct= new Dictionary<string, ProductDetail>();

    public LocalDetail this[string countryCode]
    {
        get
        {
            if (LocalProducts.ContainsKey(countryCode))
                return LocalProducts[countryCode];
            else
                throw new ApplicationException(String.Format("Local product detail does not exist for {0}", countryCode));
         }
         set
         {
            if (LocalProducts.ContainsKey(countryCode))
                throw new ApplicationException(String.Format("Local product detail already exists for {0}", countryCode));
            else
                LocalProducts.Add(countryCode, value);
        }
    }
}

public class LocalDetail
{
    public string Description {get; set;}
    ....
}

The calling code is something like this :

        Product p = new Product("123456");

        LocalDetail UKDetail = new LocalDetail();
        UKDetail.Description = "Description in English";
        p["UK"] = UKDetail;

        System.Console.WriteLine("Product {0} Description in UK Detail : {1}", p.Code, p["UK"].Description);

        LocalDetail ITDetail = new LocalDetail();
        ITDetail.Description = "Descrizione in Italiano";
        p["IT"] = ITDetail;
        System.Console.WriteLine("Product {0} Description in Italian Detail : {1}", p.Code, p["IT"].Description);


问:
Is it bad to use Unicode characters in variable names?
I recently tried to implement a ranking algorithm, AllegSkill, to Python 3.

Here's what the maths looks like:

No, really.

This is then what I wrote:

```<code>t = (µw-µl)/c  # those are used in
e = ε/c        # multiple places.
σw_new = (σw**2 * (1 - (σw**2)/(c**2)*Wwin(t, e)) + γ**2)**.5
</code>```

I actually thought it is unfortunate of Python 3 to not accept √ or ² as variable names.

```<code>>>> √ = lambda x: x**.5
  File "<stdin>", line 1
    √ = lambda x: x**.5
      ^
SyntaxError: invalid character in identifier
</code>```

Am I out of my mind? Should I have resorted for a ASCII only version? Why? Wouldn't an ASCII only version of the above be harder to validate for equivalence with the formulas?

Mind you, I understand some Unicode glyphs look very much like each other and some like     ▄ (or is that ▗▖ ) or ╦  just can't make any sense in written code. However, this is hardly the case for Maths or arrow glyphs.

Per request, the ASCII only version would be something along the lines of:

```<code>winner_sigma_new = ( winner_sigma ** 2 *
                    ( 1 -
                     ( winner_sigma ** 2 -
                       general_uncertainty ** 2
                     ) * Wwin(t,e)
                    ) + dynamics ** 2
                   )**.5
</code>```

...per each step of the algorithm.

答:
Pro: it looks nice

Con: the unicode characters and so the whole meaning might get lost in the tool chain (editor, code formatter, version control, older compiler)

How big is the risk for you? Does the gain outweigh the risk?

ContentLicense: CC BY-SA 2.5


问:
What Discrete Mathematics topics should the average computer science student know?
I know that Discrete Mathematics is a pretty broad topic that's used in a number of fields but I was just wondering what are some of the topics from it that you would expect an average computer science student to know?

Here are the range of topics from the table of contents of a book titled "Discrete Mathematics and it's Applications 6th edition" by Kenneth H Rosen:

```<code>1 The Foundations: Logic and Proofs
    1.1 Propositional Logic
    1.2 Propositional Equivalences
    1.3 Predicates and Quantifiers
    1.4 Nested Quantifiers
    1.5 Rules of Inference
    1.6 Introduction to Proofs
    1.7 Proof Methods and Strategy
2 Basic Structures: Sets, Functions, Sequences and Sums
    2.1 Sets
    2.2 Set Operations
    2.3 Functions
    2.4 Sequences and Summations
3 The Fundamentals: Algorithms, the Integers, and Matrices
    3.1 Algorithms
    3.2 The Growth of Functions
    3.3 Complexity of Algorithms
    3.4 The Integers and Division
    3.5 Primes and Greatest Common Divisors
    3.6 Integers and Algorithms
    3.7 Applications of Number Theory
    3.8 Matrices
4 Induction and Recursion
    4.1 Mathematical Induction
    4.2 Strong Induction and Well-Ordering
    4.3 Recursive Definitions and Structural Induction
    4.4 Recursive Algorithms
    4.5 Program Correctness
5 Counting
    5.1 The Basics of Counting
    5.2 The Pigeonhole Principle
    5.3 Permutations and Combinations
    5.4 Binomial Coefficients
    5.5 Generalized Permutations and Combinations
    5.6 Generating Permutations and Combinations
6 Discrete Probability
    6.1 An Introduction to Discrete Probability
    6.2 Probability Theory
    6.3 Bayes Theorem
    6.4 Expected Value and Variance
7 Advanced Counting Techniques
    7.1 Recurrence Relations
    7.2 Solving Linear Recurrence Relations
    7.3 Divide-and-Conquer Algorithms and Recurrence Relations
    7.4 Generating Functions
    7.5 Inclusion-Exclusion
    7.6 Applications of Inclusion-Exclusion
8 Relations
    8.1 Relations and Their Properties
    8.2 n-ary Relations and Their Applications
    8.3 Representing Relations
    8.4 Closures of Relations
    8.5 Equivalence Relations
    8.6 Partial Orderings
9 Graphs
    9.1 Graphs and Graph Models
    9.2 Graph Terminology and Special Types of Graphs
    9.3 Representing Graphs and Graph Isomorphism
    9.4 Connectivity
    9.5 Euler and Hamilton Paths
    9.6 Shortest-Path Problems
    9.7 Planar Graphs
    9.8 Graph Coloring
10 Trees
    10.1 Introduction to Trees
    10.2 Applications of Trees
    10.3 Tree Traversal
    10.4 Spanning Trees
    10.5 Minimum Spanning Trees
11 Boolean Algebra
    11.1Boolean Functions
    11.2 Representing Boolean Functions
    11.3 Logic Gates
    11.4 Minimization of Circuits
12 Modeling Computation
    12.1 Languages and Grammars
    12.2 Finite-State Machines with Output
    12.3 Finite-State Machines with No Output
    12.4 Language Recognition
    12.5 Turing Machines
Appendixes
    A.1 Axioms for the Real Numbers and the Positive Integers
    A.2 Exponential and Logarithmic Functions
    A.3 Pseudocode
</code>```

答:
Mathematics For Computer Science by Eric Lehman and Tom Leighton is another book that deals with this kind of stuff, although I think an average CS student doesn't know everything from that book.

It's an overview of mathematics needed for CS, written for CS students... Which is, in a way, exactly what you're looking for. I still haven't read it, I just skimmed through it, but it was recommended specifically for that purpose (having all the math you need at CS student level in one place) in an online Stanford course on design and analysis of algorithms.

ContentLicense: CC BY-SA 3.0


问:
How to inspire an intern with programming?
The situation is this - we took an intern for a summer with a mind that if he will catch up during summer, we will keep him as a part time junior developer.

We took him after his first year in university, so his knowledge was way too low to be involved into real projects(actually he programmed only in university), so my task was to push as much stuff as I can to have him ready for joining real projects in September. As long as we are remote developing team, we gave him possibility to have its internship remotely, with flexible hours.

So two months passed and I'm not impressed with his progress. I gave several tasks to implement, access to learning resources, recommended start paths and so on, agreed that he will report every couple days, we had pair sessions from time to time, reviewed his code together and etc.

Anyway, it looks like he spent less time writing code than I expected and before I would say that he didn't performed well enough to join our team, I was thinking may be that is my fault, may be I was pushing too much stuff, that is important in real life projects (like unit testing, structuring code, database stuff, etc.) and not enough fun stuff, that would hook up him on programming and that is the reason he spent less time than I hoped.

So I have ~20 days left and I can use them to inspire him with programming, question is with what and how?

答:
it looks like he spent less time writing code than I expected

Find out why - is he trying to write code, but has problems to get it working? Or is he not even spending enough time in trying?  If the former is the case, you should help him more, if it is the latter, then better let him go.


问:
Methods for testing a very large application
I have a PHP app which is very large. There are usually 2-3 developers working on it full time and we are getting to the point where we are making changes and creating bugs (cough features!). The software isn't complex per say, just there is a lot going on (35~ controllers, about the same models, etc).

Even being careful it's easy for a change in this view (tweaking an id on an element) to wreck an ajax query happening under some special condition (logged out while standing on one foot).

Unit tests are the first things which spring to mind, but we tried these on another app, and it's so easy to forget them / or spend more time writing tests then doing tests. We do have a staging environment where code gets checked over before pushing live.

Maybe we need a part time Q/A person?

Anyone have any suggestions/thoughts.

答:
Unit testing is a really good idea, especially if your project is growing. If writing unit tests becomes a habit, it'll ease your work a lot. There is a video on youtube about writing clean code, which is easier to maintain and test. </p>

<p>QA engineer is a must, too. A good QA tester will not only find bugs in functionality, but also will test if the app is user-friendly (which is almost impossible to test by yourselves).  Here is a nice article explaining how QA team will save you time and money and help deliver better software. </p>

Body:
Unit testing is a really good idea, especially if your project is growing. If writing unit tests becomes a habit, it'll ease your work a lot. There is a video on youtube about writing clean code, which is easier to maintain and test.

QA engineer is a must, too. A good QA tester will not only find bugs in functionality, but also will test if the app is user-friendly (which is almost impossible to test by yourselves).  Here is a nice article explaining how QA team will save you time and money and help deliver better software.


答:
Yes, you do need Q/A staff. Some of the many reasons include

A dedicated tester costs money, but often less money than a developer, so the benefit of not using up your time is greater than the additional expense.

A dedicated tester knows how to test things, particularly things that it's not obvious how to automate. Driving automated tests for interacting with a system through a browser is a somewhat hairy but well-established discipline. If you get someone who already knows how to do it, you don't have to spend even more time learning good tools and set-ups.

A professional tester knows how to actually find defects. They are much more likely to think like a user of the application will think, and therefore exercise those states in the system that will actually come up in production, which means that those bugs that turn out to be highly visible will tend to be found earlier, saving you embarrassment and costs for ultra-urgent patches.

Generalizing that, a tester does not think like a developer. It is hard to convey how much difference this makes if you haven't experienced it. Consciously or not, a developer doesn't want to find defects. They know how the system works and tend to avoid the typical nonsensical (to them) input or data that cause trouble in real life. If something works in an unexpected way, they know how to work around it and tend not to see this as a defect at all. They never have difficulty understanding what system responses mean, because they wrote them, even though this is a major cause of trouble in almost all real systems. In a nutshell: programmers tend to be bad at having the typical problems that users have, because they're highly trained specialists. A tester has a much easier time performing the most relevant tests.

That said, nothing beats productive cooperation between a developer and a tester for driving system quality through the roof. A developer often notices symptoms that something is wrong way before the tester would. A developer can often advise a tester how to reproduce a problem much more efficiently and how to write a proper issue report, i.e. include that details that are actually necessary to figure out the problem. But all of that requires at least one tester you can work together with.

Title: Methods for testing a very large application

Body:
I have a PHP app which is very large. There are usually 2-3 developers working on it full time and we are getting to the point where we are making changes and creating bugs (cough features!). The software isn't complex per say, just there is a lot going on (35~ controllers, about the same models, etc).

Even being careful it's easy for a change in this view (tweaking an id on an element) to wreck an ajax query happening under some special condition (logged out while standing on one foot).

Unit tests are the first things which spring to mind, but we tried these on another app, and it's so easy to forget them / or spend more time writing tests then doing tests. We do have a staging environment where code gets checked over before pushing live.

Maybe we need a part time Q/A person?

Anyone have any suggestions/thoughts.


答:
You most probably need more or better regression tests (not specificially unit tests). What kind of tests that should be you have to analyse yourself, but they should detect the bugs you are talking of. I suggest you start making a test plan and priorize those tests - and when you do this, initially don't think too much about test automation.

Afterwards, ask yourself if you can automate some or most of the tests with reasonable effort. If the answer is yes, then you should program them. If the answer is "no", and you think the "part time Q/A person" is cheaper, then it should be obviuos what you need. In most cases, it is a good idea to have both - a Q/A person for manual testing and inventing new tests, and a lot of automated regression tests, too.


答:
15 controllers and models isn't very large. It takes some time to make writing test a habit, kicking each other towards it (in a friendly way first) helps a lot.

There exist tools that can control the test coverage to some extend. Code Coverage Tools for PHP


问:
Pricing of a collaborative work
I suppose there's no straight answer to this, but what ideas come to mind for determining how much each programmer would get for participation in a collaborative project if it were to be sold?</p>

答:
It is basically depend on task(s) complexity, assigned to each developers.

Each task has difference or similarity in terms of completion time and complexity. Thus, you may need to have a complexity level determined for each task with some rough hours of expected completion. That will guide you over the process to determine the input of each project participant.

Who may determine the complexity level? - Well there should be at least Team Lead and PM in that group who defines task complexity and timing.

Title: Pricing of a collaborative work


问:
Is there much thought towards internal diagnosis testing within an enterprise application?
Imagine a discussion between four people - one a developer, one a manager, one a tester and one a deployment/operations type.

The Manager is very angry as a system has fallen over after a new version of code was deployed into production. He is looking to point fingers.

Operations person pleads ignorance - they followed the deployment steps exactly.

Tester pleads ignorance - they have functionally tested code and it worked fine in test environment.

Development person pleads ignorance - they provided good code, and claim that the system badly configured.

This situation may seem familiar to some. There's always an excuse, some mistake made along the chain - from design to deployment - that allows a system to be upgraded but doesn't work as intended.

What are the pros and cons of diagnosis testing - tests run built into the application (perhaps through a command line API or something) that would allow a system to check it's internal connections (database, middleware, filesystem etc) and confirm that everything it expects to work is correct?

This is rather than relying on an external monitoring system that may not be configured in the same fashion as the application? (new release, different properties, looking at the wrong database etc)

An example :

I'm writing a class that interacts with a database. Within this class, I create a method that interacts with the database without affecting it, say a simple select query.

In the constructor of this class, I pass to an observer a test based on the arguments passed into the constructor. This observer can be called to run all the tests it has at any time so as to test for the validity of the connection - even while the system is actually running.

答: I think enterprise grade applications or system should have monitoring and diagnostics as core design features. These non functional requirements are an absolute must. It can be achieved in many ways from passive (like writing to event logs, diagnostic logging, exposing performance counters etc.) to some kind of active Admin Dashboard and all the way to APIs as you mentioned. e.g. Microsoft's flagship StockTrader application has this kind of health monitoring built in and is a good reference architecture. Those practicing Continuous Delivery has concepts like immune system where if some predefined checks fail then an automated rollback is performed. </p>


答: I think there is only one good answer: the same share. Of course you can try to differentiate it by the effort that each programmer has put into creating the application, by the number of hours, by their skills and experience, etc. But you won't be able to measure it reliably and you won't be able to define such rules that all team members will be happy with them. So try to get guys who have similar experience and will spend similar amount of time of the project. If some of them decide to quit before the project is finished, they just don't get their share.</p>

Title: Pricing of a collaborative work

Body: I suppose there's no straight answer to this, but what ideas come to mind for determining how much each programmer would get for participation in a collaborative project if it were to be sold?</p>


答:
Hire a professional QA

This should be done if you are developing a commercial project. Having a product ready without a robust testing strategy would cost you more with bug fixes. In addition, gaining new  customers or retaining them will also depend on how good is your application tested.

Generally speaking unit testing should be applied to your code base, however integration testing and manual testing should not be discarded.


答: I think there is only one good answer: What you agreed upon before you started the work. If such things are clear from the start and people know what to expect there will be much less bad blood then if you make up some arbitrary rules when the product launches and you suddenly find out you have a pile of money to divide.</p>

Title: Pricing of a collaborative work


答:
I think it's important to define the roles and percentages before the project starts. Since I don't know what those roles are on the project, I can only make up my own here.

Scenario 1: Everyone puts in the same amount of effort and has the same skill level.

Answer: Divide the share equally.

Scenario 2: Some developers don't spend all of their time on the project, and some developers perform easy/simple tasks:

Answer:

Team Lead: n%

Full-time developers: n%

Part-time developers: n minus x%

Part-time QA: n minus y%

Part-time documentation writers: n minus z%

This could continue for all of the different scenarios available. You (and/or the team) will need to make your decisions as to what n, x, y, and z represent. The important part is to define all of this up front, and agree on relative percentages based on the role.

Title: Pricing of a collaborative work


问:
Discussions of simplicity
Recently at my company we've had a bit of a debate about abstraction vs. simplicity.  One school of thought I'd characterize as "DRY and abstraction can do no harm," and leads to code like this:

```<code>def make_foo_binary(binaryName, objFiles, fooLibsToLinkAgainst)
    make_exe_task(binaryName, objFiles.ext('.o'), fooLibsToLinkAgainst)
end
</code>```

and this:

```<code>class String
    def escape_space
        return self.gsub(' ', '\ ')
    end
end
</code>```

My point of view is that creating an abstraction like this, that's only used in one place, makes the code less readable, since you're replacing a function call that the reader is familiar with (gsub) with another that they've never seen before (escape_space), which they'll need to read if they want to understand how the code actually works.  The replacement is essentially described in English ("escape space") and english is notoriously vague.  For example, without looking at the definition, you don't know whether it escapes all whitespace, or just the space character.

There's lots of writing that sings the praises of DRY and abstraction.  Is anybody aware of sources that describe abstraction's limits?  That sing the praises and discuss the pragmatics of keeping code simple?

Edit: I can find texts that encourage simplicity in life or in (English) writing, e.g. Thoreau's "Simplify, Simplify!" or Strunk and White's "Vigorous writing is concise."  Where's the equivalent for programming?

答:
I am not familiar with the language or runtime of your examples, but gsub does not mean anything to me. However, escape_space is a lot more meaningful. I completely disagree with your argument that familiar function calls should not be replaced by calls to functions they've never seen before. If I were to take this argument to the extremes, then one should never add a new function to a program: it always abstracts familiar function calls away and always replaces them with this new unknown user-defined call.

A developer should never ever have to read the code to understand how it works. First of all, he or she should not have to care about how it works, but should be able to understand how to use it and what effects it has. If this is not the case, then there a problem with the name and signature of the function, or its documentation.

To me, the goal of abstracting is to remove inner details and provide a cleaner interface to some functionality. In the future, the inner workings of the escape_space function might be changed, or overridden. I don't care that some function gsub is called with two arguments. I do care that my spaces are escaped. So that makes the abstraction useful.

In my favorite language, C#, I always add documentation to all my functions (even private ones) describing things like the function, use, used units, thrown exceptions, input contract and types. Then, with Visual Studio's IntelliSense any developer can see more clearly what the function does without reading the code. Without a tool like IntelliSense, developers will have to be more specific in their function names, or keep additional documentation somewhere easily accessible.

I don't think abstractions should ever need to be limited, and I don't know of such a source.

Title: Discussions of simplicity


问:
What is the difference between `update` and `upgrade`
What is the difference between update and upgrade in the context of application software?

答:
Depends entirely on the installation technology, company developing the software and the whim of the person using the terms.  Generally though, updates stay within a product version (for example, hotfixes), while if you want to move to a later version, you would upgrade.

So you might install an update (hotfix) for Office 2007, or you might upgrade to Office 2010.

This page gives the definition according to Windows Installer: http://msdn.microsoft.com/en-us/library/aa370579(v=VS.85).aspx


答:
Sure:  Joel Spolsky (you may have heard of him) says:

All non-trivial abstractions, to some degree, are leaky.

Abstractions fail. Sometimes a little, sometimes a lot. There's leakage. Things go
  wrong. It happens all over the place when you have abstractions.

Also, see KISS and YAGNI which Jeff Atwood discusses:

As developers, I think we also tend to be far too optimistic in
  assessing the generality of our own solutions, and thus we end up
  building elaborate [solutions] around things that may not justify
  that level of complexity. To combat this urge, I suggest following the
  YAGNI (You Aren't Gonna Need It) doctrine. Build what you need as you
  need it, aggressively refactoring as you go along; don't spend a lot
  of time planning for grandiose, unknown future scenarios. Good
  software can evolve into what it will ultimately become.

(see the link for the exact quote)

My interpretation of these quotations:

It's really hard to create good abstractions -- it's a whole lot easier to create crappy ones.

If you add an abstraction for which there is no need, or which is wrong, now you have extra code that needs to be tested, debugged, and maintained.  And if you have to go back and refactor, you now have more dead weight dragging you down.

Title: Discussions of simplicity

Body:
Recently at my company we've had a bit of a debate about abstraction vs. simplicity.  One school of thought I'd characterize as "DRY and abstraction can do no harm," and leads to code like this:

```<code>def make_foo_binary(binaryName, objFiles, fooLibsToLinkAgainst)
    make_exe_task(binaryName, objFiles.ext('.o'), fooLibsToLinkAgainst)
end
</code>```

and this:

```<code>class String
    def escape_space
        return self.gsub(' ', '\ ')
    end
end
</code>```

My point of view is that creating an abstraction like this, that's only used in one place, makes the code less readable, since you're replacing a function call that the reader is familiar with (gsub) with another that they've never seen before (escape_space), which they'll need to read if they want to understand how the code actually works.  The replacement is essentially described in English ("escape space") and english is notoriously vague.  For example, without looking at the definition, you don't know whether it escapes all whitespace, or just the space character.

There's lots of writing that sings the praises of DRY and abstraction.  Is anybody aware of sources that describe abstraction's limits?  That sing the praises and discuss the pragmatics of keeping code simple?

Edit: I can find texts that encourage simplicity in life or in (English) writing, e.g. Thoreau's "Simplify, Simplify!" or Strunk and White's "Vigorous writing is concise."  Where's the equivalent for programming?


答:
My answer is going to go more off of personal experience, but a quick search found this blog, which looks like it goes into pretty great detail about when abstraction goes too far (not just the linked entry, but there are several related ones).

Basically, abstraction can be a good thing. However, like anything else, one can get carried away with it. Your examples are good ones where abstraction has gone too far. You're creating "pass-throughs" that basically do nothing but rename the function in question.

Now, in the case of custom functions, this might be necessary, if you're looking to deprecate an old naming scheme in favor of a new one (such as changing escape_space to escapeSpace or escWhitespace, or whatever). For library functions, though? Overkill. Not to mention counterproductive. What have you gained from making that abstraction? If that's all it's doing, then all you've gained is the headache of having to remember that function and pass that knowledge to someone else (whereas, with library functions, developers are either already aware of them, or should be able to type ruby gsub into Google and find out what it means).

I recommend being more intelligent about determining when to abstract something out. For example, things that are more than 2-3 lines, and used at least twice (even if there are slight differences, a lot of times, those differences can be parameterized), are generally good abstraction candidates. Sometimes, I'll consider large blocks of code that do a particular thing within a larger function, for the sake of readability and the "one job" principle, and abstract them out in to protected functions within the same class (often in the immediate vicinity of the function that uses it).

Also, don't forget YAGNI (you aren't gonna need it) and premature optimization. Is this currently being used more than once? No? Then don't worry about abstracting it out right now (unless doing so creates a substantial readability gain). "But we might need it later!" Then abstract it out when you actually need it somewhere else. Until then, you just end up with pointers to pointers to pointers for no real benefit.

On the other side of this coin, when you do abstract something out, do so as soon as the need becomes evident. It's easier to move and tweak two or three blocks of code than 15. Generally speaking, as soon as I find myself copying blocks of code from somewhere else, or writing something that looks very familiar, I start thinking about how to abstract it out.

Title: Discussions of simplicity


答:
When talking about abstractions, I think it's important to define two terms: Inherent and incidental complexity. Inherent complexity is the complexity of the problem that the abstraction is solving, incidental complexity is complexity that the abstraction is hiding.

Good abstractions are ones that hide lots of incidental complexity and try to solve the right problems, lowing their inherent complexity. I think what you're getting frustrated with here are abstractions that are too shallow; they don't hide much incidental complexity and it is as difficult (if not more so) to understand the abstractions as it is to understand their implementations.

Title: Discussions of simplicity


问:
How to become a web developer from scratch without a degree?

Possible Duplicate:

  Best approach to learning web programming

I am extremely interested in web development though I know very little about code. I did not read computer sciences in my college/university. Now I find myself very determined to learn the server side development and want to have a career in the field, where should I start from? I have got almost an year of free time and can work very hard, guide me please, thank you.

答:
You basically have several options to choose from depending what platform you are familiar for web development.

Here you are some options to look for:

Attend to a  Hackaton event and learn how to program in few days.

Learn .NET web development from ASP.NET

Learnpython.org's interactive Python tutorial

Beginners PHP

Learn client side programming like Javascript, jQuery or more advanced libraries like KnockoutJS

However, keep in mid that to become a well-versed software developer you would need contently learn new things and invest your personal time to it.

In addition you may reference the open-source projects. They are good to look for source code and get good practices to learn from:

http://bitbucket.org/

http://github.com/

http://www.codeplex.com/

http://sourceforge.net/


问:
Writing a new programming language - when and how to bootstrap datastructures?
I'm in the process of writing my own programming language which, thus far, has been going great in terms of what I set out to accomplish. However, now, I'd like to bootstrap some pre-existing data structures and/or objects.  My problem is that I'm not really sure on how to begin.

When the compiler begins do I splice in these add-ins so their part of the scope of the application?

If I make these in some core library, my concern is how I distribute the library in addition to the compiler--or are they part of the compiler?

I get that there are probably a number of plausible ways to approach this, but I'm having trouble with the setting my direction.  If it helps, the language is on top of the .NET core (i.e it compiles to CLR code).

Any help or suggestions are very much appreciated!

答:
The .NET Framework and all its tools form a two-part system: it has a compiler that compiles a language such as C# into an assembly with CIL code, and a just-in-time (JIT) compiler that compiles the CIL to machine code.

A big advantage of the CLR is that you can specify any type you want just by using its fully qualified name. In addition, the assembly specifies in which assemblies such types can be found. Then when later the JIT compiler comes along, it will look at the fully qualified type name, load the referenced assembly that contains the type, and use that. The type does not have to be known beforehand, and there is never an issue with circular references. So if you put some types in a core library, all you have to do is to make sure the CLR assemblies generated from your language reference your core library, and then the types in them are instantly available for use.

The JIT compiler includes only logic to handle some primitive types (32-bit integer, 64-bit integer, float, managed references and managed pointers) and knows about some very special object classes (Object, Enum, ValueType, Delegate, ...). Almost all other functionality is either simulated with the primitive types (e.g. boolean true is any integer with a non-zero value) or supported through (virtual or non-virtual) method calls (properties, methods, overloaded operators, coercions and conversions all use method calls internally). Only some core functionality that cannot be expressed (efficiently) in a managed language (such as adding integers, or allocating arrays) is integrated in the JIT compiler.


答: All of the descrete maths and do not stop at that. You cannot have enough maths skills in computing. Discrete maths is great for understanding computer specific problems but if you are into programming then chances are you might be tasked with designing or working on software with heavy maths on the requirements. Anyway, it's really, really, good for you - like porridge :)   </p>

Title: What Discrete Mathematics topics should the average computer science student know?

Body:
I know that Discrete Mathematics is a pretty broad topic that's used in a number of fields but I was just wondering what are some of the topics from it that you would expect an average computer science student to know?

Here are the range of topics from the table of contents of a book titled "Discrete Mathematics and it's Applications 6th edition" by Kenneth H Rosen:

```<code>1 The Foundations: Logic and Proofs
    1.1 Propositional Logic
    1.2 Propositional Equivalences
    1.3 Predicates and Quantifiers
    1.4 Nested Quantifiers
    1.5 Rules of Inference
    1.6 Introduction to Proofs
    1.7 Proof Methods and Strategy
2 Basic Structures: Sets, Functions, Sequences and Sums
    2.1 Sets
    2.2 Set Operations
    2.3 Functions
    2.4 Sequences and Summations
3 The Fundamentals: Algorithms, the Integers, and Matrices
    3.1 Algorithms
    3.2 The Growth of Functions
    3.3 Complexity of Algorithms
    3.4 The Integers and Division
    3.5 Primes and Greatest Common Divisors
    3.6 Integers and Algorithms
    3.7 Applications of Number Theory
    3.8 Matrices
4 Induction and Recursion
    4.1 Mathematical Induction
    4.2 Strong Induction and Well-Ordering
    4.3 Recursive Definitions and Structural Induction
    4.4 Recursive Algorithms
    4.5 Program Correctness
5 Counting
    5.1 The Basics of Counting
    5.2 The Pigeonhole Principle
    5.3 Permutations and Combinations
    5.4 Binomial Coefficients
    5.5 Generalized Permutations and Combinations
    5.6 Generating Permutations and Combinations
6 Discrete Probability
    6.1 An Introduction to Discrete Probability
    6.2 Probability Theory
    6.3 Bayes Theorem
    6.4 Expected Value and Variance
7 Advanced Counting Techniques
    7.1 Recurrence Relations
    7.2 Solving Linear Recurrence Relations
    7.3 Divide-and-Conquer Algorithms and Recurrence Relations
    7.4 Generating Functions
    7.5 Inclusion-Exclusion
    7.6 Applications of Inclusion-Exclusion
8 Relations
    8.1 Relations and Their Properties
    8.2 n-ary Relations and Their Applications
    8.3 Representing Relations
    8.4 Closures of Relations
    8.5 Equivalence Relations
    8.6 Partial Orderings
9 Graphs
    9.1 Graphs and Graph Models
    9.2 Graph Terminology and Special Types of Graphs
    9.3 Representing Graphs and Graph Isomorphism
    9.4 Connectivity
    9.5 Euler and Hamilton Paths
    9.6 Shortest-Path Problems
    9.7 Planar Graphs
    9.8 Graph Coloring
10 Trees
    10.1 Introduction to Trees
    10.2 Applications of Trees
    10.3 Tree Traversal
    10.4 Spanning Trees
    10.5 Minimum Spanning Trees
11 Boolean Algebra
    11.1Boolean Functions
    11.2 Representing Boolean Functions
    11.3 Logic Gates
    11.4 Minimization of Circuits
12 Modeling Computation
    12.1 Languages and Grammars
    12.2 Finite-State Machines with Output
    12.3 Finite-State Machines with No Output
    12.4 Language Recognition
    12.5 Turing Machines
Appendixes
    A.1 Axioms for the Real Numbers and the Positive Integers
    A.2 Exponential and Logarithmic Functions
    A.3 Pseudocode
</code>```


答:
First, have a look at this example by Robert C. Martin:

http://blog.objectmentor.com/articles/2009/09/11/one-thing-extract-till-you-drop

The reason for this kind of refactoring is consequently building abstractions to create very small functions, so that every function does just one thing. That leads to functions like the ones you showed us above. I believe this a good thing - it helps you to create code where each called function within another function is on the same level of abstraction.

If you think using names like make_foo_binary or escape_space make the code less readable, than as a consequence, you should try choose better names (for example: escape_space_chars_with_backslash) instead of abandoning the abstraction.

Title: Discussions of simplicity


答:
Sometime in the not too distant future, we'll all be using text editors / IDEs / web browsers that make it easy to write edit text including Classical Greek characters, etc.  (Or maybe we'll all have learned to use this "hidden" functionality in the tools we currently use ...)

But until that happens, non ASCII characters in program source code would be hard for many programmers to handle, and are therefore a bad idea if you are writing applications that might need to be maintained by someone else.

(Incidentally the reason you can have Greek characters but not square root signs in Python identifiers is simple.  The Greek characters are classified as Unicode Letters, but the square root sign is a non-letter; see http://www.python.org/dev/peps/pep-3131/ )

Title: Is it bad to use Unicode characters in variable names?

Body:
I recently tried to implement a ranking algorithm, AllegSkill, to Python 3.

Here's what the maths looks like:

No, really.

This is then what I wrote:

```<code>t = (µw-µl)/c  # those are used in
e = ε/c        # multiple places.
σw_new = (σw**2 * (1 - (σw**2)/(c**2)*Wwin(t, e)) + γ**2)**.5
</code>```

I actually thought it is unfortunate of Python 3 to not accept √ or ² as variable names.

```<code>>>> √ = lambda x: x**.5
  File "<stdin>", line 1
    √ = lambda x: x**.5
      ^
SyntaxError: invalid character in identifier
</code>```

Am I out of my mind? Should I have resorted for a ASCII only version? Why? Wouldn't an ASCII only version of the above be harder to validate for equivalence with the formulas?

Mind you, I understand some Unicode glyphs look very much like each other and some like     ▄ (or is that ▗▖ ) or ╦  just can't make any sense in written code. However, this is hardly the case for Maths or arrow glyphs.

Per request, the ASCII only version would be something along the lines of:

```<code>winner_sigma_new = ( winner_sigma ** 2 *
                    ( 1 -
                     ( winner_sigma ** 2 -
                       general_uncertainty ** 2
                     ) * Wwin(t,e)
                    ) + dynamics ** 2
                   )**.5
</code>```

...per each step of the algorithm.


问:
User stories as a contract definition?
I am often asked to write a requirements document for a new piece of work. I write requirements using user stories. The list of requirements is then used as a contract with the client denoting the functionality that will be delivered. The temptation them becomes to add more and more detail and more and more stories in an attempt to define a water-tight specification that rules out any expensive mistakes.

The problem is user stories just don't seem well suited to this task. Can anyone offer any clarification on the role of user stories? For example, is the same user story appropriate for  client, programmer and the author of a functional spec?

Regressing a little, perhaps I'm also asking what is the best way to define a contract of what will and will not be delivered in a software project?

答:
Even the United States federal government can't write water-tight software specifications.

There's a natural conflict in contract work.  The developer wants to be paid a reasonable amount, while the customer wants to know what the software will cost.

If the customer has no idea what they want, the first project should consist of developing a requirements document.  The contractor and customer should negotiate small, achievable projects that eventually get to the working software project.  That way, both parties feel comfortable with the process.

If the customer has a good idea what they want, and the contractor is reasonably sure he or she can develop what the customer wants, then images of screens and reports give both the customer and the developer a good idea of the scope of the development process.

Title: User stories as a contract definition?


问:
Is there a programming language where 1/6 behaves the same as 1.0/6.0?
While I was programming in C++ some days ago, I made this mistake (that I have history of making it!). In one part of my code, I had 1/6 and I was expecting it be 0.16666666666 which is not the case. As you all know the result is 0 - C, C++, Java, Python, all behave the same.

I post it on my Facebook page and now there is debate on if there is a programming language where 1/6 behaves the same as 1.0/6.0.

答: In Squeak Smalltalk / on integers creates Fraction objects. So while this is not the same as float division, still (1/6)*6 returns 1.


答:
Surprisingly, it seems to work properly in Windows PowerShell (version 3).

```<code>PS C:\> 1.0 / 6.0
0.166666666666667

PS C:\> 1/6
0.166666666666667
</code>```

Also seems to work in Python 3 as sepp2k mentioned. The other two languages I have readily available on REPL, Scala and Ruby, both do integer division and yield 0.

Title: Is there a programming language where 1/6 behaves the same as 1.0/6.0?

Body:
While I was programming in C++ some days ago, I made this mistake (that I have history of making it!). In one part of my code, I had 1/6 and I was expecting it be 0.16666666666 which is not the case. As you all know the result is 0 - C, C++, Java, Python, all behave the same.

I post it on my Facebook page and now there is debate on if there is a programming language where 1/6 behaves the same as 1.0/6.0.

Body:
Surprisingly, it seems to work properly in Windows PowerShell (version 3).

PS C:\> 1.0 / 6.0
0.166666666666667

PS C:\> 1/6
0.166666666666667

Also seems to work in Python 3 as sepp2k mentioned. The other two languages I have readily available on REPL, Scala and Ruby, both do integer division and yield 0.


答:
Yes, I just checked my TI-99/4A's built in TI BASIC. As it treats all numeric expressions as floating point, the division operation is floating point as well.</p>

```<code> TI BASIC READY
>PRINT 1/6
  .1666666667

>
</code>```

Body:
Yes, I just checked my TI-99/4A's built in TI BASIC. As it treats all numeric expressions as floating point, the division operation is floating point as well.

 TI BASIC READY
>PRINT 1/6
  .1666666667

>


问:
Can I legally and ethically take an open-source project with community contributions to closed-source?
Let's say I start and develop some project under open-source license, and accept some community contributions. How shaky is the ground I stand on if I decide to take the project commercial and closed-source (or split license)?

This question doesn't directly address the issue of a project with community contributions, which feels like different territory, at least as far as ethics are concerned. Legally, this might be iffy as well, because I'm not sure whether contributions fall under my copyright, or whether the contributor hold the copyright to the part of the project he added.

Am I safe (ethically and legally) as long as I'm up front with the possibility that I may take the project commercial in the future?

答:
If you want to change the license of your project either you requested all contributor to sign a "Contributor agreement" or you have to request permission of every one of the contributors.

which is quite difficult and the reason why the Linux kernel is still under gpl v2


答:
In general, community contributors would retain their copyright to the code they contributed to the project.  They license the contribution to you when they contribute the code.  If you want to retain the possibility of changing the license terms in the future, you would generally need contributors to assign their copyright to you (either personally or a corporate entity you create to own the copyrights for this project) or the changed terms would need to be compatible with the new license terms.  Of course, if you require this sort of copyright assignment paperwork before you can accept a contribution from the community, it is much less likely that the community will decide to contribute and you'll have to do a fair amount of work getting the legal forms in order before accepting each contribution.  Plus, there is a strong chance that your project will get forked if and when you decide to change the license terms.  It strikes me as unlikely that a new open source project is going to get a lot of contributions from the community under those circumstances.

It would generally be easier if you licensed the product under the split license terms initially or if the initial license terms were compatible with a future closed-source product.  Code that is under the BSD license, for example, can be incorporated into a commercial product at any time so if the project and contributions are under the BSD license, you could easily release a commercial version of the same product.  Your intention (or option) to produce a commercial product, though, will likely decrease interest in making contributions to your project-- most open source developers are uninterested in making unpaid contributions to a commercial product.

Of course, as with any legal issues, you'd want to talk with a lawyer rather than relying on a forum post before taking any sort of definitive action.  You'll almost certainly want that lawyer to draft the copyright assignment document you'll need people to sign and you'll need to discuss your plans for the future with the lawyer to ensure that everything is set up correctly.

Title: Can I legally and ethically take an open-source project with community contributions to closed-source?

Body:
Let's say I start and develop some project under open-source license, and accept some community contributions. How shaky is the ground I stand on if I decide to take the project commercial and closed-source (or split license)?

This question doesn't directly address the issue of a project with community contributions, which feels like different territory, at least as far as ethics are concerned. Legally, this might be iffy as well, because I'm not sure whether contributions fall under my copyright, or whether the contributor hold the copyright to the part of the project he added.

Am I safe (ethically and legally) as long as I'm up front with the possibility that I may take the project commercial in the future?


答:
If the project is licensed under one of the more permissive licenses (BSD, MIT, Boost or Apache are the ones that I know allow this) then legally you are allowed to distribute object code and have no requirement to provide any modifications you have made to the source code back to the community. You can also license the derivative work under a different license. Please note that you still need to include the license text as per the license requirements.

Whether this is ethical or not is something that is quite controversial. I tend to think that if a developer licensed their code under one of these more permissive licenses then they want the software to be used in both open source and commercial projects. If they didn't want commercial use of their code then they should have licensed it under the GPLv3.


答:
We can't really tell you what to do.

The fact is, we don't know what tools you would rather use, or what will work better for you. I'm going to be really general here, so bear with me:

Learn HTML, CSS, and Javascript. Before you do any kind of server-side programming, this is a must. You can't build a webpage without HTML, CSS makes it look pretty, and JS makes it dynamic. Also, it wouldn't hurt to add on some jQuery.

Install a web server, or find a free web host online. You don't need to pay for one. You're still learning. Personally, I have a WAMP server running on my desktop since I don't put anything into production, and I advise you to do the same.

Learn a server-side scripting language. Now to get down to business. You have a lot of options here. Python is said to be the easiest to learn. PHP is the most well used server-side language. Ruby is an up-coming phenom. ASP works flawlessly with it's .NET counterparts.

Get coding! I cannot stress this enough. The only way to learn is by doing. You can't just read a book. If you want, do a few projects (e.g. a forum, a phonebook, etc.) to make it fun!

This was a very general walk-through of what you need to do. There is still the matter of learning SQL before a server-side language, and how to use a database, and all that good stuff. But that's fairly easy to figure out with Stack Overflow and Google! Until then, good luck!

A few extras to learn about after the above:

TCP/IP

User Experience

HTTP

SEO

Oh, and read this!

Title: How to become a web developer from scratch without a degree?

Body:
Possible Duplicate:

  Best approach to learning web programming

I am extremely interested in web development though I know very little about code. I did not read computer sciences in my college/university. Now I find myself very determined to learn the server side development and want to have a career in the field, where should I start from? I have got almost an year of free time and can work very hard, guide me please, thank you.


答:
Any contribution I make to your project remains my copyright unless I assign it to someone else. Being the copyright holder means I get to decide what licence my work is available under.

So licensing is a related, but separate, issue.  If I contribute to your project, I should be agreeing to release my work under the project license (or perhaps a compatible one).

Many open source licenses would not allow you to close the derivative source later, but some will.  If I understand correctly, none would allow you to close the current (open) code base, so that is also something you would need to consider.

So you'll either need to start with a license that lets you close future development, or have an agreement to that effect with all contributors.   Best to take the latter up with a lawyer before there are significant contributions, and to be very up front about what you are trying to do.


问:
Why is SQL's BETWEEN inclusive rather than half-open?
Semi-open (or Half-Open, Half-Closed, Half-Bounded) intervals ([a,b), where xbelongs to the interval iff a <= x < b) are pretty common on programming, as they have many convenient properties.

Can anyone offer a rationale that explains why SQL's BETWEEN uses a closed interval ([a,b])? This is esp. inconvenient for dates. Why would you have BETWEEN behave like this?

答: I think inclusive BETWEEN is more intuitive (and apparently, so did the SQL designers) than a semi-open interval. For example, if I say "Pick a number between 1 and 10", most people will include the numbers 1 and 10. The open-ended interval is actually particularly confusing for non-developers because it's asymmetric. SQL is occasionally used by non-programmers to make simple queries, and semi-open semantics would have been much more confusing for them.


答: Both inclusive (a <= x <= b) and exclusive (a < x < b) are about equally common, so when making the standards they simply had to pick one.  "Between" in common English is typically inclusive, and a SQL statement is meant to read similar to an English sentence, so inclusive was a sensible choice.

Title: Why is SQL's BETWEEN inclusive rather than half-open?

Body:
Semi-open (or Half-Open, Half-Closed, Half-Bounded) intervals ([a,b), where xbelongs to the interval iff a <= x < b) are pretty common on programming, as they have many convenient properties.

Can anyone offer a rationale that explains why SQL's BETWEEN uses a closed interval ([a,b])? This is esp. inconvenient for dates. Why would you have BETWEEN behave like this?


答: The operator isn't called ∩[a,b), it's called BETWEEN, so it's considerably more appropriate for its semantics to be those of the English phrase "is between" than those of the mathematical predicate "is in semi-open interval".


答:
Out of prominent languages, JavaScript. 1.0/6.0 = 1/6 =
0.16666666666666666.

I don't see this as surprising. As a rule of a thumb, if a language distinguishes between integer and floating point numeric types, dividing two integers will yield a truncated integer instead of float. If it doesn't, most likely it will default to floating point operations. This should be the expected behaviour on the programmer's part.

Just keep in mind that there are additional things that could also be at play here, like the already mentioned separate integer division operator or implicit type casting.


问:
Explanation of satellite data from a programmer's perspective
I have started reading Part 2 of Introduction to Algorithms and in the section The structure of the data the author/authors says in the context of sorting a sequence of numbers:

In practice, the numbers to be sorted are rarely isolated values. Each
  is usually part of a collection of data called a record. Each record
  contains a key, which is the value to be sorted, and the remainder of
  the record consists of satellite data, which are usually carried
  around with the key. In practice, when a sorting algorithm permutes
  the keys, it must permute the satellite data as well. If each record
  includes a large amount of satellite data, we often permute an array
  of pointers to the records rather than the records themselves in order
  to minimize data movement.

Can some one explain what the authors mean here ? Why the term satellite data ? What is the intuition behind this concept ? And also how this concept relates to a higher level programming platform like Java ?

答:
You are likely confused with popular meaning of satellite as a spacecraft. Meaning in your quote is not about space technology.

Better look up other term definitions in Wiktionary:

An attendant on an important person; a member of someone's retinue, often in a somewhat derogatory sense; a henchman. [from 16th c.] ... A moon or other smaller body orbiting a larger one. [from 17th c.]... A country, state, office, building etc. which is under the jurisdiction, influence, or domination of another body. [from 19th c.]...

Satellite data in the record from your quote refers to above meaning, where record key is considered "dominant" while the rest of the data just follows it.

Rest of the data in the record is considered less important in the context of sorting, which takes into account only the key. In sorting, it's record key that dominates, the rest just follows it.

ContentLicense: CC BY-SA 4.0


答:
It sounds like the authors are referring to complex data structures. In object-oriented languages, like Java, the data structure would be an object that contains a number of fields. In a language like C, the structure would probably be a struct. When you sort, you might only care about sorting by a particular field. The other fields are satellite data - they are part of the structure, but aren't relevant to the sorting algorithms.

When you sort, you can't break the structure. If you have a collection of people with the attributes of a name, a current address, a social security number, and an age and you want to sort them by age, you can't change the association between the four fields. You just need to sort them within the structure based on the value of a field. In this example, age is the key and the satellite data is the name, address, and social security number.

Title: Explanation of satellite data from a programmer's perspective

Body:
I have started reading Part 2 of Introduction to Algorithms and in the section The structure of the data the author/authors says in the context of sorting a sequence of numbers:

In practice, the numbers to be sorted are rarely isolated values. Each
  is usually part of a collection of data called a record. Each record
  contains a key, which is the value to be sorted, and the remainder of
  the record consists of satellite data, which are usually carried
  around with the key. In practice, when a sorting algorithm permutes
  the keys, it must permute the satellite data as well. If each record
  includes a large amount of satellite data, we often permute an array
  of pointers to the records rather than the records themselves in order
  to minimize data movement.

Can some one explain what the authors mean here ? Why the term satellite data ? What is the intuition behind this concept ? And also how this concept relates to a higher level programming platform like Java ?


问:
Best way to approach a partner business to understand the need for B2B web-services
We currently work with a company that has a fairly simplistic web system for processing warranty information. The only way to get data out of it is through excel exporting. Compilation of this data and correlation with our systems has to be manual and makes us be reactive in our response.

The ideal situation would be setting up a web service on their side and automatically mash it up with our data so that we can have good and timely information without human overhead or the weekly bottleneck.

However, when we mentioned this same argument to them, their IT department creeped out from us wanting to access their systems "directly", since they have other information for other vendors which are our competition. In other words, they seem to think it is something weird and insecure.

My question is: how would you make them understand the need to modernize their systems?, have you had any experience convincing the company you want the web-service from?, and, would you go convince them yourselves as a company with the need, or hire a consultant to assess this and speak with them instead?

Edit: We supply custom made electronic devices for our clients which then sell it to end users. End users deal with our clients and, depending on the case, then the client deals with us if they require software/hardware fixes for the next revision.

答:
You have to remember that your idea of new and better may not fit with their goals. You will, of course, need to clearly indicate the advantages of switching to your proposed architecture. However, you must also outline the disadvantages.

Just because the client rejects your idea, it doesn't mean that they are acting unreasonably. Go in and ask lots of pointed questions and get very specific answers as to what their concerns are about changing their systems. If you feel an answer is too vague (e.g. "Change is bad"), then dig deeper for a reason.

The ultimate goal is to work together with them to determine the best solution to the issue at hand. You may find that their reasoning is completely valid.


问:
What does an MSDN subscription offer?
I'm curious because I notice that the Ultimate subscription costs $12,000... for one year (after that, it's $3,800 to renew). Looking at the subscription chart, you do get quite a bit of software that is normally expensive by itself.

Is the package meant for 1 person or is it meant for like a business-type bundle of some sort? If it's the latter, I can kind of understand that, but I can't fathom where anybody is going to have 12 grand to plop down on something that only lasts 12 months.

Anyway, yeah, my question is, is this a good deal to anyone at all? Maybe it's just me not having any industry experience and this is actually a steal and millions of companies should be buying it right now, but I just can't personally picture this being worth the money.

答:
MSDN think that MSDN Ultimate is worth the money if you're a professional programmer, but if  your company provides one for you it's the best deal.

MSDN is more worth the the money if you buy the premium  one and buy Visual Studio Ultimate seperatly.MSDN Premium has  most of the features that MSDN Ultimate has. Visual studio ultimate can be less than $2000.

You can see the diffrences on this site: http://msdn.microsoft.com/subscriptions/buy.aspx

Title: What does an MSDN subscription offer?


答:
A lot of organizations are hesitant to have an external source pull data from them. Perhaps a compromise would be to setup an endpoint on your end that will allow them to periodically push data. This way they know exactly what data you are processing and they control the frequency of data updates.

Education on your definition of a "web service" is often the best way to bring them to your side. A lot of IT workers in the enterprise world seem to a "web service" means a process that will SSH/FTP into a server and download data. They don't realize that they can setup a REST/SOAP/XMLRPC endpoint (with strong[ish] authentication) and only export data they have chosen to share.

I'd say build a simple proof-of-concept, present your implementation to them, and give them example code with instructions on setup. Let them play around with the idea, determine it's secure, and see where they go from there.

Lastly give them the opportunity to ask questions, primarily what about all of this concerns them about this idea. Ideally have this be in person or over video conference so you can see each other face to face and give ample opportunity to brainstorm and think out loud.

Title: Best way to approach a partner business to understand the need for B2B web-services

Body:
We currently work with a company that has a fairly simplistic web system for processing warranty information. The only way to get data out of it is through excel exporting. Compilation of this data and correlation with our systems has to be manual and makes us be reactive in our response.

The ideal situation would be setting up a web service on their side and automatically mash it up with our data so that we can have good and timely information without human overhead or the weekly bottleneck.

However, when we mentioned this same argument to them, their IT department creeped out from us wanting to access their systems "directly", since they have other information for other vendors which are our competition. In other words, they seem to think it is something weird and insecure.

My question is: how would you make them understand the need to modernize their systems?, have you had any experience convincing the company you want the web-service from?, and, would you go convince them yourselves as a company with the need, or hire a consultant to assess this and speak with them instead?

Edit: We supply custom made electronic devices for our clients which then sell it to end users. End users deal with our clients and, depending on the case, then the client deals with us if they require software/hardware fixes for the next revision.


问:
WPF, MVVM, EF, POCO guidance required on simple architecture
(sorry for my poor english)
I am developing a application using WPF, EF Code First using MVVM (Caliburn.Micro).
It should be used mostly to CRUD work. I created a BaseViewModel<T> class from wich all other ViewModels inherit and exposed a T Selected property to bind to the View. I know it is not recomended to expose a Model to the View but it just make things simple to get the app running.

Problem is I do not want to pollute my Models (EF POCO classes) with INotifyPropertyChanged, IDataErrorInfo, IEditableObject, etc... So, there is something that I can do here or do I have to really duplicate all Model properties to the ViewModel and give up trying to bind the model directly? I would like to use the attribute validation too, since all models have them already.

I used this approach on the past with Silverlight/RIA but in this case RIA Services generated the classes for me, with all the plumbing code.

I can get the validation errros using Validator class but I also need to indicate the component that has the error no the UI and I think I need to implement IDataErrorInfo on my model for this to happen, right?

For INotifyPropertyChanged I can use something like NotifyPropertyWeaver but my problem is IEditableObject and something to be able to use the attribute validation.
It would be nice something like MagicBusinessBaseClassThatImplementAllThoseInterfaces<Model> to encapsulate the model so I can just bind it and move on.

I know I can make this work implementing manually the interfaces on each VM - but just think on all the "duplicated" code make me cringe :(

How WPF developers are doing those kind of things today? There some secret ninja technique that I am not aware of?

答:
Personally I see nothing wrong with binding directly to the Model instead of exposing properties through the ViewModel, however if you plan on binding to your EF POCO classes, you need to have them implement INotifyPropertyChanged so the UI knows when they update.

EF should have a setting that will make it generate the classes with INotifyPropertyChanged already implemented, however you will still have to do something custom to get IDataErrorInfo to work the way you want (I recommend using IDataErrorInfo instead of the Validator class when working with WPF because the XAML is already setup to use that interface for errors). Usually I'll create partial classes for each data model that needs validation that implements IDataErrorInfo, although I know other methods do exist that may work better for you.

Another alternative I've used in the past is to create another layer entirely for the Models, and not use EF models at all other than in the database layer. I think last time I did this, I modified EF's T4 template to autogenerate my Models at the same time the EF POCO objects were generated, with the exact same data structure, and I used AutoMapper to map EF objects to my Model objects whenever a database call was made.

And of course, there's also the 3rd alternative you  mentioned of simply exposing the properties from the ViewModel, and not binding to the Model at all. This is the "MVVM-Purist" way of doing it, but its often not as practical since it requires more time to implement.


问:
Is it bad to use Unicode characters in variable names?
I recently tried to implement a ranking algorithm, AllegSkill, to Python 3.

Here's what the maths looks like:

No, really.

This is then what I wrote:

```<code>t = (µw-µl)/c  # those are used in
e = ε/c        # multiple places.
σw_new = (σw**2 * (1 - (σw**2)/(c**2)*Wwin(t, e)) + γ**2)**.5
</code>```

I actually thought it is unfortunate of Python 3 to not accept √ or ² as variable names.

```<code>>>> √ = lambda x: x**.5
  File "<stdin>", line 1
    √ = lambda x: x**.5
      ^
SyntaxError: invalid character in identifier
</code>```

Am I out of my mind? Should I have resorted for a ASCII only version? Why? Wouldn't an ASCII only version of the above be harder to validate for equivalence with the formulas?

Mind you, I understand some Unicode glyphs look very much like each other and some like     ▄ (or is that ▗▖ ) or ╦  just can't make any sense in written code. However, this is hardly the case for Maths or arrow glyphs.

Per request, the ASCII only version would be something along the lines of:

```<code>winner_sigma_new = ( winner_sigma ** 2 *
                    ( 1 -
                     ( winner_sigma ** 2 -
                       general_uncertainty ** 2
                     ) * Wwin(t,e)
                    ) + dynamics ** 2
                   )**.5
</code>```

...per each step of the algorithm.

答: Yes, you are out of your mind. I would personally reference the paper and formula number in a comment, and write everything in straight ASCII.  Then, anyone interested would be able to correlate the code and the formula.</p>


答:
Majority of OS projects seem to have a commercial arm attached to them, like an Enterprise version. Basically, they offer SLAs, support, etc. I think if the project is open source, fundamentally you can't just close it. You may be able to make future versions closed source and rename them, or make addons closed source, but the actual projects as far as I understand must remain Open Source. I think the enterprise is a better way to go though, you still get open source benefits, and can generate revenue.<br>
Out of curiosity why do you want to close source your project? </p>

Body:
Majority of OS projects seem to have a commercial arm attached to them, like an Enterprise version. Basically, they offer SLAs, support, etc. I think if the project is open source, fundamentally you can't just close it. You may be able to make future versions closed source and rename them, or make addons closed source, but the actual projects as far as I understand must remain Open Source. I think the enterprise is a better way to go though, you still get open source benefits, and can generate revenue.

Out of curiosity why do you want to close source your project?


问:
How do I make the most of the chance to meet one on one with a programming guru?
So, I'm not a programmer, though I've been writing code all of my life.  As is my habit, I attempt to contact well know experts in almost any domain I find of interest, and interestingly, I get a lot of meetings, which I value a great deal.

So, here's the deal -- a meeting has been set for me to meet a very well known programmer and I would like advice on how to make the most of it. They've written a number of books, some of which I've read, but nothing strikes me as a point of conversion; meaning they know I'm not a real programmer, though I am very interested in talking to them about their advice for becoming a programmer.

Should I attempt to have a potential coding topic, set of code to review, etc -- or just show up and get general advice?

答:
An expert in any field will bring up topics and give advice that you could never even think of asking about.  I would tell him/her your interests and goals and see where it flows from there.  If you've got a more specific goal than becoming a programmer, obviously bring up  questions on that topic.

Also, he/she will likely not want to discuss basics that you can search for over the internet.  You'll learn the most by asking about this programmer's personal experiences and what was learned from them.


答:
Has everyone forgotten Pascal?

1/6 yields 0.1666666... (to whatever precision is supported).

1 div 6 yields 0

It's arguable whether the C rule is a mistake. Almost all of C's arithmetic operators, where the operands are of the same type, yield a result of the same type. There's something to be said for consistency.

Furthermore, since C is primarily targeted at system-level code, most C programs don't use floating-point at all. At one time, accidentally adding floating-point code to a program that didn't otherwise need it could be a serious problem. That's probably still the case, for small embedded systems -- which, again, are a major target for C.

In most C programs, truncating integer division is probably just what you want anyway.

If 1 / 6 yielded a floating-point result in C, then:

It would be an inconsistency in the language.

The standard would have to make an arbitrary choice of which floating-point type to use for the result (double may seem like the natural choice, but you might prefer the extra precision of long double)

The language would still have to have an operation for integer division; performing floating-point addition and then truncating would likely not be good enough.

C could have provided separate operators for the two kinds of division, but the second point above would still apply: which of the three floating-point types would be used for the result? And since it's easy enough to get floating-point division if you need it (use a floating-point constant for one or both of the operands, or cast one or both of the operands to a floating-point type), it apparently wasn't considered that important.

In the 1974 version of the C manual (that's 4 years before the publication of the first edition of K&R), Ritchie doesn't even mention the possible confusion:

The binary / operator indicates division. The same type considerations as for multiplication apply

which says that if both operands are of type int or char, the result is of type int.

Yes, it's a source of confusion for some C programmers, especially beginners -- but C is not noted for being very novice-friendly.


答:
As evidenced by some of the comments to your question, you make an interesting set of assumptions that unnecessarily degrade your skill.

When you reached out to this person to meet with them, how did you preface the request?  What did you suggest as a topic of conversation?  Start there.

You mentioned the person has written some books, probably has a blog or similar, and perhaps even a podcast.  What have they brought up in those outlets that wasn't clear for you?  Are there any edge cases that you didn't think were covered adequately?  What would be the "next level" based upon those other topics?  Consider asking about how to get there.

Depending upon how much you know about the person, you can always ask about their hobbies and outside interests.  Some folk a single dimensional and only really know / do / live programming.  Others have lots of dimensions and would like to chat about a number of different things.  Do some research on your subject, and come up with questions that interest you.

I think it would be more practical to stay at a philosophical level rather than trying to dig into a particular piece of code.  An exception to that would be Herb Sutter who has some strong opinions on code style.  The key is to make sure the topic is within their domain expertise.

Title: How do I make the most of the chance to meet one on one with a programming guru?

Body:
So, I'm not a programmer, though I've been writing code all of my life.  As is my habit, I attempt to contact well know experts in almost any domain I find of interest, and interestingly, I get a lot of meetings, which I value a great deal.

So, here's the deal -- a meeting has been set for me to meet a very well known programmer and I would like advice on how to make the most of it. They've written a number of books, some of which I've read, but nothing strikes me as a point of conversion; meaning they know I'm not a real programmer, though I am very interested in talking to them about their advice for becoming a programmer.

Should I attempt to have a potential coding topic, set of code to review, etc -- or just show up and get general advice?


答:
Haskell treats 1/6 and 1.0/6.0 as being identically 0.16666666666666666. It also renders 1/6.0 and 1.0/6 as being that same value as well.

This is due to the basic numerical types in Haskell not being quite the same as other languages. True integer division is somewhat...complicated.


答:
Simply follow your guru

I am not sure where are you located, and can you meet all gurus; however simply following their tweet and posts you may get a good idea where their next speaking event will be. You may also get prepared to this event and ask your question in person.

In addition, i would simple advice to post your question in their blog. Most of well known .NET gurus are kind to reply.


答:
VB (VB.Net , VB6, VBA...)

The integer division operator is \


答:
MATLAB.  Numeric literals are doubles by default.</p>

```<code>>> 1/6
ans =
    0.1667
</code>```

Body:
MATLAB.  Numeric literals are doubles by default.

>> 1/6
ans =
    0.1667


答:
Clojure does use fractions by default. It's not the same as 1.0/6.0, but you can convert to it with float or double when you need.

```<code>user=> (/ 1 6)
1/6
user=> (* (/ 1 6) 2)
1/3
user=> (pos? (/ 1 6)) ; Is 1/6 > 0?
true
user=> (float (/ 1 6))
0.16666667
</code>```

Body:
Clojure does use fractions by default. It's not the same as 1.0/6.0, but you can convert to it with float or double when you need.

user=> (/ 1 6)
1/6
user=> (* (/ 1 6) 2)
1/3
user=> (pos? (/ 1 6)) ; Is 1/6 > 0?
true
user=> (float (/ 1 6))
0.16666667


答:
For better understanding of something that is complicated, just make it more simplier.
In this example, just split the word into atoms, like these:

Update - UP_DATE - make it up to date;

Upgrade - UP_GRADE - move it to the upper (or next) grade (or level).

Title: What is the difference between `update` and `upgrade`

Body: What is the difference between update and upgrade in the context of application software?


问:
What are the problems which I will face if all the classes I use are loosely coupled
Loosely coupled classes gives flexibility. If I understand it right, Event flow, Observer Pattern and Design Patterns like MVC focus on loose coupling.  So in this context I am aiming towards making a project where all the classes are loosely coupled.

So, for example I have a class A that uses  B:

then instead of a.b.doThis() ;

I will be going like this :

```<code>b.addEventListener( B.OnEventHappens, doThisInA ) ;
</code>```

So, my question is. If this sort of loosely coupled relationship throughout a project is a good thing to do? Would it make a robust project? Or is it not advisable to use it on the "Extreme" side?

答:
There is a balance that needs to be achieved between looseness of coupling and complexity.  As the person responsible for the overall architecture, you need to strike that balance.

When we call a ToString() method on an object, we can do so safely because we know all of our classes derive from a base class that has a ToString() method, and that method can be overridden in derived classes to achieve better output.  Do we add event listeners to ToString()?  No, we don't.  Why not?  Because it would add additional complexity for no additional benefit.

Do we add event listeners to actions which may or may not have a corresponding target to receive the action?  Of course.  Why?  Because it generalizes our class model, and allows optional message passing where it is appropriate.

If you have two classes that will always work together, but whose methods will never talk to any other class (at least within the realm of their respective Interfaces), you would not decouple them with events.  Why?  Because decoupling doesn't make any sense in that context.  Decoupling can actually make things more difficult, because there are situations where one class must have knowledge of the other class's state in order to function properly (in other words, they must coordinate their efforts).  Decoupling makes classes know less about each other, not more.


答:
What the hell is σ, what is W, what is ε, c and what is γ?

You are to name your variables in a way that explains what their purpose is.

I'd personally beat up anyone who'd leave the Unicode or the ASCII-version for me to maintain, although the ASCII-version is better.

What is evil is calling variables σ or s or sigma or value or var1, because this doesn't convey any information.

Assuming you write your code in English (as I believe you should wherever you are from), ASCII should suffice to give your variables meaningful names, so there is no actual need for Unicode.


答:
I've worked on this exact problem with several B2B clients and it what it always comes down to is having a conversation with the team on their end where you clearly discuss the pros and cons of your proposal and work to mitigate any concerns they raise.

Before you do this you need to understand where your client is coming from. It's extremely difficult to get businesses to make significant (or even minor) shifts in their systems because what they have, no matter how crappy, is working for them and they know how to work around all the rough patches and bugs. It's quite amazing how people will adapt to and become quite proficient with crappy software. It's easy to say upgrading to a new system will transport them to a mystical land of efficiency and unicorns and rainbows but the fact is that updating to a new system poses significant risk in the terms of new bugs and potential downtime. All of these things equate to lost money for a business.

So the chief argument you need to make is that your proposed set up is going to make the system work more efficiently with fewer errors. This is something most IT teams will get behind as they do want to do less work and make their systems more efficient. You have to present them with a clear, well thought out solution and then work with them to address their concerns.

Here are two general solutions that I've used in the past:

Push Web Service

A push web service is a web service that you set up on your end and the client pushes data to (not sure if this is the official name of this but it's what I've always called it). I've found that most clients favor this option as it puts them firmly in the driver's seat in terms of what data is going out of their system.

Pull Web Service

This is the opposite of a push service and what you mentioned in your question. In this scenario the client sets up a web service that you then call to get data out of their system. Clients typically don't like this for variations on the reasons you stated in your question. In fact I've only set up such a system once and then the server making the call first had to connect to the client's VPN (spoiler: it was a complete pain in the ass).

There are other details you need to consider as well. For example, setting up your push service such that it won't get overloaded by a client pushing too much data too frequently.

In the end it always comes down to having a good, close working relationship with the client's IT team. If you establish this relationship you'll be good.


问:
Does continuous integration involve automatic merging between branches?
When setting up a continous integration environment, does it always entail having the build server pull code and merge between branches?

Or is it something you NEVER want to do because you are depending on an automatic merge would usually ends up having issues (and requires manual intervention).

答:
I've never seen a CI system doing any merging. In theory you could set it up to do that but as you mentioned the build will break if you run into any merge issues.

CI environments usually have a specific fixed branch as the "build" branch and the CI server will monitor that branch for new check-ins to fire off a new build cycle.


答:
Never do that. Automatic merge is just one reason. Even more importantly, you should be able to commit to your branch until you've finished, without fear of breaking the trunk.

However, if you're using a tool like Jenkins, you might want to add a separate automated build  for your branch, so that you continue to get fast feedback on commits.

Title: Does continuous integration involve automatic merging between branches?

Body:
When setting up a continous integration environment, does it always entail having the build server pull code and merge between branches?

Or is it something you NEVER want to do because you are depending on an automatic merge would usually ends up having issues (and requires manual intervention).


答:
I haven't heard about any CI system that would automatically merge branches. Why? Because it is not always that easy, and even if you're using one of the most sophisticated DVCSes available out-there it is still possible that a human is required to review the code that has been changed. It is especially tricky when people have actually changed bits in the same file (i.e. same method in the class, same function).

I think automatic merging would do more harm than good. And in the end you (as a developer) don't want to waste your time on investigating issues that are not real issues, and happened just due to the fact that a piece of code was not as smart as you are, and couldn't figure out what the code after merging should look like.


答:
Legally, if you use a license open enough that anyone involved can take it commercial I would imagine (not being a lawyer) that you would also be able to do so.

Ethically you would have a stronger obligation.  You would have to be very open and clear about your intentions both initially and over time as your plans change.


答:
```<code>Automated merge between branches? - That is simply not a good idea.
</code>```

CI is a great process and needs to be setup for comparatively big projects. However, I would never trust to  automated merging. Because, it is quit common to get wrongly merged files resulting in compilation error or even worth by unintended change in coding logic.

Body:
Automated merge between branches? - That is simply not a good idea.

CI is a great process and needs to be setup for comparatively big projects. However, I would never trust to  automated merging. Because, it is quit common to get wrongly merged files resulting in compilation error or even worth by unintended change in coding logic.


答:
Merging always needs to be done manually. If you design the software and manage the development with a degree of sanity, then conflicts will arise only on very, very rare occasions, but when they do occur, they need a human to ensure that the merged result makes sense.

To get the benefit of continuous integration, developers need to merge changes and check their work into a central repo/branch on a frequent basis (every hour or so).


答:
CircleCI, my hosted CI service can be set up to do this. Circle automatically builds all branches by default. For our own code, green builds on master are automatically merged into the production branch. Of course, only do this if you have a good test suite.

Now, that case is easy, because nobody pushes to production directly.

I think there's a lot of interesting work that can go on here. Eventually, I'd like to get all bugfix branches to auto-merge into master on green. I've been in situations where I'm working on a bug, run all the tests, then discover I need to merge with master (rather than fast-foward), and forget to run all the tests again, and end up breaking the build.

A feature I'm interested in writing is comments in the commit message that say "merge with branch X, if it's green". That way, it's never possible to have master be broken.

The other responses here don't make a lot of sense to me. Your CI system doesn't have to be dumb. It should be able to gracefully handle merge conflicts, by not merging, and informing the user. And on any "shared" branch, like master or production, merges should always be fast forwards!


问:
How to inspire an intern with programming?
The situation is this - we took an intern for a summer with a mind that if he will catch up during summer, we will keep him as a part time junior developer.

We took him after his first year in university, so his knowledge was way too low to be involved into real projects(actually he programmed only in university), so my task was to push as much stuff as I can to have him ready for joining real projects in September. As long as we are remote developing team, we gave him possibility to have its internship remotely, with flexible hours.

So two months passed and I'm not impressed with his progress. I gave several tasks to implement, access to learning resources, recommended start paths and so on, agreed that he will report every couple days, we had pair sessions from time to time, reviewed his code together and etc.

Anyway, it looks like he spent less time writing code than I expected and before I would say that he didn't performed well enough to join our team, I was thinking may be that is my fault, may be I was pushing too much stuff, that is important in real life projects (like unit testing, structuring code, database stuff, etc.) and not enough fun stuff, that would hook up him on programming and that is the reason he spent less time than I hoped.

So I have ~20 days left and I can use them to inspire him with programming, question is with what and how?

答:
If you want to inspire him with programming you may have to go out of business context.  Interns are lucky to land internships and typically take what they can get, so don't be offended if your core work doesn't blow his skirt up.  Interns still have some fairy dust in their blood, most young programmers become programmers because of the power to create and the  exhilaration of creating something awesome.

Find out what his hobbies are and what his dream programming job would be.  Have him make something that he thinks is awesome, be it a 2D video game or a database to track pokemon cards.

If he does something in his interest area,  he'll be excited.  You might help reign in the scope so that what he does is realistic for the time period.  You can also highlight topics along the way that are relevant in business scope where you can provide education i.e.

You chose to structure your db like so, what was your thought
  process behind this?  What would happen if xyz?


问:
Is it a good practice to capture build artifacts in Artifactory that Jenkins produces?
We use Jenkins to run continuous integration builds. The output of these builds might be EAR files, WAR files, or just a collection of files that are TAR'd up.

To this point we have used Jenkins to manage the produced artifacts.

We have Artifactory deployed in-house. Would it be a bad idea to leverage Artifactory to capture the produced artifacts?

Or is Artifactory meant to hold JARs with versions that can be pulled into projects with Maven when building and not meant to capture artifacts that a continuous integration tool uses?

答: ArtifactoryPro has features for doing what you're asking, so why the heck not?  JFrog's documentation even has an example: see http://wiki.jfrog.org/confluence/display/RTF/Build+Integration</p>


问:
Using a openid in a "closed system"
I would like to publish a website for certain family members only. Simply put, like a mishmash of family photos and videos. I want it to remain private, however.

I was considering using openid for the login process because I really wanted to avoid:

Storing Usernames and Passwords
(Too much maintainance)

Making a obfuscated url that can be picked up by toolbar
(Not private enough)

Making a password to access the page
(I've had users unable to manage this)

So I was hoping to use openid to have say my brother log in using his google account.

But from what I've seen openid used for, it wouldn't prevent others from logging in to the website. I was thinking maybe I could limit it manually however this paragraph from Google App Platform best practices has me double thinking:

From a protocol perspective, both logins to the two IDPs are legitimate and the attributes returned by the 2nd IDP appear identical — the same email address, name, and so on. The only thing that differs between the two requests is the user's claimed identity. In fact, relying parties are required to verify that IDPs only return identities that they're authoritative to prevent a rogue IDP from asserting identities from other providers. But nothing prevents a rogue IDP from asserting attributes like names and email address that may not be truthful.

Is openid the "right" tool for what I wish to do? (Have a private web interface that requires logins but no user management beyond identifying family members)

答:
You can use OpenID for this as long as you request the user's email address and confirm it's that of a family member.  So you're backend or settings code should have a list of family email addresses.  Anyone else authenticating over OpenID could immediately be booted by your web application.

Think of the OpenID as an identifier for the user.  The choice to trust and finally authenticate is up to you.

Title: Using a openid in a "closed system"


问:
Being a team manager and a developer in a Scrum team
I am managing a team of 6 people that recently moved to Scrum.

We have a Scrum Master (one of the developers in the team) and a Product Owner.

Since I have quite a lot of free time (because a lot of management work that I used to do is now done by the Scrum Master and Product Owner), and since I want to remain technically relevant, I am doing some technical development work.

I act as a part of the development team, commit to some of the stories in each sprint, and participate in all the meetings as a part of the team.

Do you think it is a good idea? Can it contradict the "self-organization" of the team?

答:
Have a read of Roy Osherove's developing thoughts on team leadership in an Agile world at 5whys.com

He talks a lot about three key stages a team goes through as it evolves from Waterfall to Scrum.

Survival phase (where most teams I see are in) -- in which team has no time to learn -- requires a more command and control type of leadership to create that learning time from nothing.

Learning phase  -- where a team has time to learn and is using it -- requires coach like leader, with bursts of control when things will take too long to learn the hard way (choosing no source control, for example)

Self Organization Phase -- Where teams can solve their own problems -- requires more of a facilitator type of leader, that does not tell people what to do, but simply provides constraints and end goals. The team will get there on its own.

When I came across Roy's ideas, at OpenVolcano '10, I was at a complete loss as to why my team had stopped improving. Then I realised that the team had crossed from Survival to Learning and I hadn't changed my style of management at all. I did so and it helped a lot.

So I suggest figuring out which of those three phases you're in and managing accordingly.

Also, make a decision now and be a leader or a developer. Don't fall into the trap of thinking you have spare time until you're well into the Self-Organisation phase. And, if you get there, realise that you're a good team leader (it's difficult) and move on to another team rather than reintegrating yourself.