问:
Matching algorithms in context of data quality problems
I work for an organization that has lots of databases containing person information.  The data quality is poor.  One case was a surname I found like this (this is the worst-case scenario):

Mark "Dunno his surname, but it sounded like Lion 'RAR', Ha ha"

There is a date of birth of: 01/09/1499

This is a worst-case scenario.  Most data quality issues are due to pressing a wrong key on the keyboard e.g. Snith instead of Smith (n is next me m on the keyboard).

I am looking for algorithms which can help me with some kind of "fuzzy matching" under these circumstances. Our requirements involve several millions of records per day. I have looked for "data matching" and discovered the following algorithms:

```<code>SQL SOUNDEX
SQL METAPHONE
Levenshtein Distance
</code>```

Also is there such thing as a possible match for dates of birth? A possible match for a surname were the Levenstein distance is 80%.

Therefore I have two questions:

What algorithms are available except the three specified above?

What approaches are used to match possible addresses

答:
For date of birth and people in general, one will need to validate if that person exists and if thier address is valid.

You can do both of these using 3rd party services that will:

Validate if the person is a real person

Validate and standardize address information

You can do this yourself using algorithms that you have mentioned, but why re-invent the wheel and most likely your implementation will be flawed.

Most of these services are configurable and allow you to send information like name, DOB, phone number and will attempt to look up to see if that person exists.

The same holds true for address information.  It will attempt standardize the address, locate it (see if it really exists) and then return the standardized address back to you.

In both of these scenarios, no hits can be returned, which means that the person is not found or the addresss is not found.  In those cases you probably have a fake individual or address like the one in your sample data.

Also, sometimes it might return multiple matches or less than 100% matches.  For example, if the only piece of valid information is a phone number, it might return back multiple people at that phone number.

For less than absolute matches you might set a confidence factor which you want to match on, like 90%.  Anything below that number goes into a report which will require manual intervention.  People who don't match should be eliminated from your datastore as it is junk data.


问:
Do compilers attach the Garbage Collector to the final executable?
Since the Garbage Collector is part of the language implementation (not OS, etc.), does the compiler has to attach the GC to the final executable? Or is it like a dependency that has to be already available on the target machine?

If it's attaching the GC, then should I think of it as a Wrapper around my application that once in a while stops the execution, does some clean-ups, recovers the state of the application and let it continue the execution?

Also I think some languages like Java have their own GC included in their VM. In that case I'm only talking about languages that directly compile to the machine code and don't need any VM to execute.

答:
does the compiler has to attach the GC to the final executable? Or is it like a dependency that has to be already available on the target machine?

This depends on the language implementation and the target platform.

It's possible that the GC gets linked into the executable, it's also possible that the GC is part of the runtime library, and it's possible that the GC is a part of the target platform.

If it's attaching the GC, then should I think of it as a Wrapper around my application that once in a while stops the execution, does some clean-ups, recovers the state of the application and let it continue the execution?

Wrapping is only needed when the application doesn't know that it is being garbage-collected. The Boehm-Demers-Weiser collector is a GC for C and C++ programs that don't even know that they are being GCed. You can just replace all calls to malloc/realloc with calls to GC_malloc/GC_realloc and remove all calls to free (for example by redefining them using a macro) and everything will still work.

However, programs written in a language with automatic storage management already know they are being collected, there is no need to wrap them.

Also, again, it depends on the GC implementation whether or not it has to "stop-the-world". Some GCs need to stop the application for the whole collection. Some only need to stop it for one phase of the collection. Some are incremental, i.e. they don't need to do all work at once, they can do a little bit of work, then let the application run a bit, do a little bit of work, let the application run …

Some collectors are concurrent, they can collect while the application is running without any need to stop it at all.

Also I think some languages like Java have their own GC included in their VM. In that case I'm only talking about languages that directly compile to the machine code and don't need any VM to execute.

There is no such thing as a "language that compiles directly to machine code". That depends on the language implementation. Languages don't compile, compilers do. Every language can be interpreted, every language can be compiled to machine code or any other language.

The Java Language Specification says that memory is managed automatically. How the implementation does that, is completely up to the implementor. Oracle javac compiles to JVM bytecode, which also manages memory automatically, so the javac doesn't need to worry about GC. GCJ, for example, compiles Java to native code and links it with a GC based on the Boehm-Demers-Weiser GC.

ContentLicense: CC BY-SA 3.0


问:
Who is responsible to challenge a product owner?
I am relatively new to Scrum and I am not clear on the boundaries of a product owner.

The product owner that I am currently working with seems to behave more like a manager than someone who gives requirements to developers. When talking to me or other members of the team without the team lead present, he behaves differently e.g. does not allow us to question any requests or the value of what is being asked. When we question about what is the need or urgency of something while he can not really support his case, it is evident that he is upset mainly because I think he considers that developers are “lower” rank than he is.

While I could take it up with my team lead, I would prefer to understand if that is how product owners normally behave since I don't have experience in Agile.

Is the team lead the only one responsible to “challenge” a product owner in Scrum?

答:
First let me say that Product owner is the one who decide which story has higher priority, as a developer we give our prospective in release and sprint planning meetings but he/she is still the one who has final say in prioritizing the user stories. The reason is simple, he/she knows the business better. As an agile developer we gotta give our feedback and work on task we create for ourselves.

Having said that, here seems like your whole team is new to Agile. It's important to understand that Agile is very different from our traditional working setup. First of all, all the team members including product owner and scrum masters should know what their role is and should understand the Agile manifesto and Agile principles. Half of the problem resolves when team know what Agile is all about. In your particular situation I think following principles need to be reminded to product owner.

1) Build projects around motivated individuals. Give them the environment and support they need, and trust them to get the job done.

2) At regular intervals, the team reflects on how to become more effective, then tunes and adjusts its behavior accordingly.

As mentioned in first of two principles, "Give them the environment and support they need" is very important. Right now you are not getting environment where you could work with full dedication and to resolve that you need more interaction with your team including your product owner, and that's where 2nd principle come into action.

Having conflicts is not a bad thing. Agile helps to resolve these issues by having retrospectives regularly. Hope with time your team will start understanding each other better.


问:
Who writes the technical 'user stories' in scrum
I know that a product owner should write a user story in scrum.

A user story is describing a feature for the end user.

But who describes what needs to be technically developed and how it needs to be implemented

and where is that information stored concerning scrum?

That would really interest me!

I see a big lack of knowledge in our company when developer start to implement the story but they do not know HOW to implement it!

For example they have to deal with a legacy COM API and have no idea how to handle it or they are not that technically skilled with WPF/WEB or whatever.

How does scrum help that people to start with the user story?

答:
This is not an Agile problem. Problem is that team does not have enough technical knowledge to complete a user story (agile) or a requirement (traditional).
Can Agile help in this situation?
No, if the team was not selected carefully and no one in the team has enough technical experience to perform their tasks.
Yes, If some of the team members has good technical knowledge who can help other team members to perform their tasks. For that team needs to be self-organizing, and should know it's strength and weaknesses.

please remember the following Agile priciple.

"The best architectures, requirements, and designs emerge from self-organizing teams"

This happen because in Agile environment team trust is high and they delegate work among themselves.


问:
How to express what do do when error occurs in a user story?
How do you express what to do when error occurs in a user story? Should the response to what happen on errors be in a task of the original user story, or should I create another user story that is concerned with what happens on errors?

E.g.

This says nothing about what to do on errors such as credit card is invalid, not enough money, …

As a buyer I want to pay for the order with a credit card to get immediately access to the services.

I could add another user story like this:

As a buyer I want to get information about errors during payment immediately so that I can fix the errors and try again.

Which of these is common/correct? Should the error handling be part of the original user story?

答: All the requirements to make a user story acceptable including errors should be mentioned in "Acceptance Criteria" of the user story. It's responsibility of developer to work with the and discuss all the scenarios pertaining a user story with product owner. Usually by having detailed discussions acceptance criteria of the user story evolves. </p>


问:
Is a developer-driven product a good thing?
I work in a company where the CEO manages the product team, who mockup features and drop in the lap of developers to then implement said features. There is some iteration of course, developer's opinions are respected. But I wonder how effective this process is.

Jason Calacanis just wrote :

The Zuckerberg Doctrine: Developers
  design products with significantly
  improved speed and functionality
  compared to product managers and
  designers, outweighing potential
  mistakes and drawbacks.

...

Then it really hit me:
  Developer-driven startups always
  produce product faster.

This stands to reason: our
  nontechnical people are having
  discussions and debates while
  Zuckerberg is coding his next feature.
  This is why no one has been able to
  keep up with Facebook!

While MySpacers debated how to iterate
  on their product, Facebook simply
  tried stuff.

Does this actually work better in practice ?

答:
Developer-driven software might be in most cases better than manager-driven software. Manager see the most value in features (mostly buzzwordish features) that look good on an ad or can be used in a speech. Developers see different values: performance, lesser bugs, lean design, maintainability. That leads nearly almost to better software.

But the best would be user-driven software. Users really know what they need, what helps them to do their real work. That would be the ideal.

ContentLicense: CC BY-SA 2.5


问:
What would be the best sort to use on a something with sorted "chunks"?
Imagine a sorted deck of N cards that has been cut K times by moving X cards from the top to the bottom (X is a different / random amount each time, X is always < N) - what would be the best way to sort this, knowing that there are "chunks" of sorted cards?

I am thinking something along the lines of going 1 by 1 until reaching one that is out of order, and then splitting what I reached out as a "chunk", and then continuing until I have (K+1?) chunks, and then sorting the chunks via a standard sort, however I am not sure if this is the best solution, nor exactly how to describe its complexity in terms of big-o

(for the big-o, I think it would be N (chunking) + (k+1)log(k+1) for the sorting -> k+1(log(k+1)), but I am not sure)

答:
Timsort, which combines Merge and Insertion sort to do exactly what you describe. It makes use of already sorted parts of the collection to speed sorting.

Effectively it's a merge sort up till it finds enough "chunks" to use insertion sort. This gives it a worst case and average case time complexity of O(nlogn), same as the base merge sort. It gains the O(n) best case of insertion sort.

It is the default sort for Python as well as an increasing number of other platforms.


问:
Porting an algorithm implementation licensed under GNU GPL v3
I'm working on a JavaScript port of a red-black tree implementation in Java from the book Algorithms 4th Edition, by Sedgewick and Wayne. I believe that my JavaScript port qualifies as a derivative work. It's not nearly a line-for-line copy, but the core logic for RBT manipulation is quite similar.

On the book site, it states that the libraries stdlib.jar and algs4.jar are licensed under GPLv3. The red-black tree implementation in Java is part of the algs4.jar library. Ideally I'd like to release the port under a more permissive license, but that doesn't appear to be possible, for understandable reasons.

However I'm unclear about how users of my port will be bound by the license. Does any software making use of my JavaScript red-black tree port, regardless of the overall size of the project, need to make the entire project's source available under the same terms, or just the source for the JavaScript port itself?

In other words, would the authors of some larger project be bound to release their entire project under GPLv3 just because it uses a port of an algorithm implementation released under those terms in some part of the project?

答:
Your code needs to be released under the GPLv3 as you believe it is a derivative work of the algs4.jar implementation.

Other projects utilizing your code will likely need to be released as GPLv3.  Most larger applications just incorporate code from smaller projects, and treat the smaller code base as part of the larger.  That will trigger the "viral" aspect of GPLv3.

If you provide a way to access your code in one of the accepted "escape mechanisms" then the larger project will not be affected by the viral aspect of GPLv3.  This section of the GPL FAQ explains some of the ways that GPL code can be used in proprietary code without triggering the viral aspect of the GPLv3.

However, in many cases you can distribute the GPL-covered software alongside your proprietary system. To do this validly, you must make sure that the free and non-free programs communicate at arms length, that they are not combined in a way that would make them effectively a single program.

You may also be able to license your project as LGPL, which can make it easier for other projects to link to your project without being impacted by the GPL/LGPL license.


答:
In order to attach your own license to code, you must own the copyright.  Generally speaking, that means that it must be code that you have written.

As an example, there are libraries out there already that provide some capability I want in my program.  I have two choices: I can either live with the license that the library provides, or I can write my own library that performs a similar function.

The safest way to write my own clone library is to do it as a clean room implementation: that is, I write my library with no knowledge of the original library's internals.  That way, I can be accused of neither stealing the code nor the algorithms that the code implements, because all of my work is original work.

Things get a little dicier if you're examining the code of the original library in detail.  In order for a transformative work (that is, work that incorporates elements of an already copyrighted work) to qualify for copyright protection of your own, your work must be novel in some way; that is, it must contain original work.  It seems to me that a library directly transcribed into another language is not novel enough to meet this criteria.

Further Reading

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

Title: Porting an algorithm implementation licensed under GNU GPL v3

Body:
I'm working on a JavaScript port of a red-black tree implementation in Java from the book Algorithms 4th Edition, by Sedgewick and Wayne. I believe that my JavaScript port qualifies as a derivative work. It's not nearly a line-for-line copy, but the core logic for RBT manipulation is quite similar.

On the book site, it states that the libraries stdlib.jar and algs4.jar are licensed under GPLv3. The red-black tree implementation in Java is part of the algs4.jar library. Ideally I'd like to release the port under a more permissive license, but that doesn't appear to be possible, for understandable reasons.

However I'm unclear about how users of my port will be bound by the license. Does any software making use of my JavaScript red-black tree port, regardless of the overall size of the project, need to make the entire project's source available under the same terms, or just the source for the JavaScript port itself?

In other words, would the authors of some larger project be bound to release their entire project under GPLv3 just because it uses a port of an algorithm implementation released under those terms in some part of the project?


答:
it is evident that he is upset mainly because I think he considers that developers are “lower” rank than he is

I believe this is the main problem. You should have your Scrum Master talk to him about his position. Everyone on the team, including Product Owner, is of same rank and no one has higher authority than anyone else.

I believe Agile is primarily about fact that everyone working on a software is a rational human and that problems can be solved by rational discussion backed up by facts. As developers we have to admit that we don't have as good idea about what business needs. On the other side, I would expect product owner to have real reason why some feature is high priority. If this reason doesn't exist, I would question his decision and require actual facts about it.

Title: Who is responsible to challenge a product owner?

Body:
I am relatively new to Scrum and I am not clear on the boundaries of a product owner.

The product owner that I am currently working with seems to behave more like a manager than someone who gives requirements to developers. When talking to me or other members of the team without the team lead present, he behaves differently e.g. does not allow us to question any requests or the value of what is being asked. When we question about what is the need or urgency of something while he can not really support his case, it is evident that he is upset mainly because I think he considers that developers are “lower” rank than he is.

While I could take it up with my team lead, I would prefer to understand if that is how product owners normally behave since I don't have experience in Agile.

Is the team lead the only one responsible to “challenge” a product owner in Scrum?


问:
Code First vs. Database First
When I design and create the software I work on, I typically design and create the back-end SQL tables first and then move on to the actual programming. The project I'm currently working on has me down right puzzled though. This is probably due to a lack of good, solid requirements, but there's unfortunately little I can do about that this time. It's a "just go make it happen" kind of situation.. but I digress.

I'm thinking of flipping my workflow on it's head and creating the UI and data model classes first in hopes that working that out will make it clear to me what my database schema will eventually look like. Is this a good idea? I'm nervous that I'll end up with a UI and still no idea of how to structure the db.

If anyone is curious, I'm using SQL Server as a backend and MS Access as a front end application. (Access isn't my choice either... so please don't hate on it too bad.)

答:
Since the requirements are not clear one can start with a very rudimentary data model with the key elements you will know you need, maybe just basic tables and PKs to start.  The rest of the data, serialize to binary or XML and store the BLOB in the database to start with.  That should allow one to develop the UI and business layer (middle tier) without a fully relational model but you will still have persistence to save and retrieve and simple key lookups as needed.

As an example, maybe you have a Person, so you have a PK of Person Id.  The rest of the attributes are not known so just start with a Person table with a PK Person Id and another column that will store the Blob, all the person data.

Once the requirements solidify take your Blobs and extract all the tables and columns needed and make the model relational.  Then it's just a matter of changing the persistance from a BLOB to relational in the data access layer.  But everything else, business rules UI etc will still work.  Note, this adds some time to the project but gives allows for complete flexibilty to add and drop things as needed without changing the relational model until things become firmer

Searching may be delayed as you can't query a BLOB so as the model stabilizes, start storing your the data that needs to be searched in relational columns.

Basically you start with a tabular model and move to a relational one as the project progresses.

Or, firm up the requirements prior to any work started so that a relational model can be developed initially.

Title: Code First vs. Database First


问:
C# OOP Class Usage
I am just being picky and really wanted some of my code to look, feel, and be used a specific way but am not sure if its possible.

I have a class I created that can be used like this

```<code>Query("ServerName", "TSQL").Run()
</code>```

sample:

```<code> class Query
    {
        public string serverName { get; set; }
        public string tSQL { get; set; }
        public Query(string ServerName, string TSQL)
        {
            serverName = ServerName;
            tSQL = TSQL;
        }

        public void Run()
        {
            //DO STUFF
        }
    }
</code>```

is it possible to create a class and sub classes so that I use it like this

```<code>Query.Server("ServerName").TSQL("TSQL").Run()
</code>```

答:
Yes, what you're referring to is method chaining. You would add these methods to your class, and the return for each method would be the class itself.

```<code>class Query
{
    public string serverName { get; set; }
    public string tSQL { get; set; }
    public Query(string ServerName, string TSQL)
    {
        serverName = ServerName;
        tSQL = TSQL;
    }

    public void Run()
    {
        //DO STUFF
    }

    public Query Server(string svrName)
    {
        serverName = svrName;
        return this;
    }

    public Query TSql(string tsql)
    {
        tSQL = tsql;
        return this;
    }
}
</code>```

As long as each method in the chain returns the updated object in question rather than void or some other class it will function just fine. Given the simplistic nature of this usage, I wouldn't actually recommend chaining as a useful feature here, but it certainly can be applied.

Title: C# OOP Class Usage

Body:
Yes, what you're referring to is method chaining. You would add these methods to your class, and the return for each method would be the class itself.

class Query
{
    public string serverName { get; set; }
    public string tSQL { get; set; }
    public Query(string ServerName, string TSQL)
    {
        serverName = ServerName;
        tSQL = TSQL;
    }

    public void Run()
    {
        //DO STUFF
    }

    public Query Server(string svrName)
    {
        serverName = svrName;
        return this;
    }

    public Query TSql(string tsql)
    {
        tSQL = tsql;
        return this;
    }
}

As long as each method in the chain returns the updated object in question rather than void or some other class it will function just fine. Given the simplistic nature of this usage, I wouldn't actually recommend chaining as a useful feature here, but it certainly can be applied.


问:
When to refactor
I've read through most of Fowler's Refactoring book and have refactored many applications in my past big and small.

One of the harder things I find to teach is "when" to refactor.  I tend to do this based on a gut feel which has served me remarkably well in the past.  However, when getting into discussions with people about whether a piece of code should be left alone or refactored right now it is hard to stand by the "gut check".

I feel like there should be more rigorous approaches to this, but am not sure what they are.

I understand "code-smells", red-green-refactor and other thoughts, but often I feel that the best time to refactor is not the first time you write the code, but the second or third time you are using the code and realize that it is actually a problem and is in actual use.

答:
In my 20 years of programming, here is the only rule of thumb that I've actually seen work, which people can stick to, and managers allow time for. (Refactoring is like dieting: sure, "calories in / calories out" is the formula to losing weight, but that doesn't translate into a diet that people will comply with.) And so:

Refactor continuously, as you work. Use Test Driven Development so that you have several red-green-refactor cycles through the day. Refactor just the parts of the code that you've touched.

Once you're more sure of yourself, you can vary from this regimen.

Title: When to refactor


问:
Is it allowed to embed an LGPL command-line tool?
I want to sell a closed-application that depends upon a certain command line tool. Am I allowed to distribute my software including this command line tool?

For example, as a separate binary accompanied by the proper NOTICE file and if needed the source code.

Do I need to explain how I call this binary, so the user could swap it?

答:
The text of the LGPL is complex, as it attempts to define the term 'link', since the LGPL is intended to cover libraries. So it's a completely open legal question as to whether incorporating an LGPL executable (which is not a library) as part of a larger work is:

the creation of a derivative work exempted from GPL provisions by the LGPL.

the creation of a derivative work not exempted from GPL provision by the LGPL.

the creation of a 'mere aggregation', and so not subject to the terms of the license at all.

It would depend on how a court decided to construe the exemption in the LGPL and how that same court would view what you've constructed. It may depend on exactly, technically, how you combine that executable with the rest of your stuff.

In case (1) or (3), you only have to make the source of the command itself available. In (2), you'd have to make all your source available.

In short, if there's a lot of money on the line here, you'll need legal advice.


问:
What are some good examples of using pass by name?
When I write programs I using pass by value or pass by reference always seem to be logical methods. When learning about different programming languages I came across pass by name.

Pass by name is a parameter passing method that waits to evaluate the parameter value until it is used. See Stack Overflow pass by name question for more information on the method.

What I would like to know is: what are some good examples and/or reasons to use pass by name and should it be re-introduced into some more modern languages.

答:
Scala is an example of modern language that supports call-by-name evaluation (as well as call-by-value, which is the default). As you said, the parameter is lazily evaluated.

This feature can be used for creating your own control structure. The code given by Axidos in his answer is a simple, but good example.

There are other examples in the book Programming in Scala. I'll try to post these examples here tonight.


问:
Confusion about associations in UML class diagram
```<code>---------------------    ----------------------
|       FLIGHT      |    |       STEWARD      |
---------------------    ----------------------
| Arrival time      |    |  Steward ID        |
| Departure time    |    |  Name              |
| Flight ID         |    ----------------------
---------------------    | Call()             |
| Board()           |    | HelpPassenger()    |
| Depart()          |    ----------------------
---------------------
</code>```

Today was my first UML lesson in class diagrams. My teacher asked me to model this class diagram. I have many confusions about what association I am supposed to use. I have some experience in ERDs and OOP.

I am doubting what I should name my association. Should it be "a flight has * stewards"? Or should it be "a steward works on many flights"?

Should I specify the multiplicity (1..* etc) at both sides?

My teacher hasn't covered compositions and aggregations yet, but I'm afraid if I only use regular associations I might be doing something wrong. Can you make a class diagram with just associations? Would you consider a more complex class diagram wrong if it doesn't use compositions/aggregations?

I read that there's no consensus on what aggregations precisely
means. So why would we use something if there's no formal definition?

答:
In my eyes there is no such thing as a Many to Many relationship. There is a crucial concept that is lost in the shuffle when you rely on a many to many relationship.

Let's look at a diagram I made for your scenario

In here I've modeled your domain using color-based modeling. A Plane (Person/Place/Thing) has 0 or more Flights (Moment-Interval). Each Flight has multiple Staff Assignments which can be a Steward or Pilot (Roles), there is a staff assignment for each Pilot or Steward in a flight. So it's 1 to many from Flight to Assignment and Many to one from Assignment to Steward or Pilot.

Note that I modeled the relationship between the Assignment to the Steward/Pilot as aggregations. The Steward and Pilot exist outside of the realm of the Assignment. All the others I represented as compositions. IE a Flight exists only in the context of a plane (there's no flight without a plane), in the same regard there is no assignment without a flight. That is the difference between composition and aggregation.

You could alternatively choose to model the FlightAssignment as a PlaneStaffAssignment (i.e. this is the crew working on the plane at this point in time). You'd then have to traverse the relationship to see who was assigned to the plane for which flight. It's all up to what's more important to you.


问:
Modern OOP vs Alan Kays OOP
I've recently come to discover there's actually a strong amount of criticism towards what people refer to as "modern OOP" - often comparing it to either functional programming or Alan Kays' OOP.

Here's the question which got me thinking: https://stackoverflow.com/questions/2409494/some-solid-oop-criticism

Wikipedia has a section about OOP criticism: http://en.wikipedia.org/wiki/Object-oriented_programming#Criticism

Coming from a computer engineering university degree, I did my fare share of programming and development classes. I've done Java and C++ in school as well as NodeJS, Python, Perl and PHP on my own time. In all of these languages (except for maybe Python), I either implemented some OOP or used libraries which did.

So what's the big deal against modern OOP (or OOP in general)? Why do so many people seemingly dislike and dismiss it?

答:
First off, "modern OOP" is not a deviation from Alan Kay's OOP.  Kay may have coined the term itself, but Smalltalk-style "OOP" is a significant deviation from actual class-and-object programming as it existed before Smalltalk.  The original OOP system was called Simula, and it was an extended dialect of of ALGOL whose OOP concepts would feel right at home in modern languages such as Delphi, Java or C#.  The Smalltalk style is the aberration, and it's been a failure everywhere it's been tried.  (With the minor exception of Objective-C, whose popularity is due in its entirety to Apple shoving it down iOS developers' throats; outside of the Apple ecosystem its market share is essentially nil.)

As for the question, the biggest reason why many people criticize it is simple, old-fashioned "sour grapes."  Looking at the linked Wikipedia article, the critics it names are hardly objective: one is one of the principal guys behind ML, the other is the principal guy behind Erlang, both of which are languages that have failed in the "marketplace of ideas" while OOP has taken over the world.

Luca Cardelli has claimed that OOP code is "intrinsically less efficient" than procedural code, that OOP can take longer to compile, and that OOP languages have "extremely poor modularity properties with respect to class extension and modification", and tend to be extremely complex.

Intrinsically less efficient?  Maybe, but it's also far more powerful.  The main intrinsic inefficiency comes from polymorphism: virtual dispatch requires more CPU cycles and is cache inefficient, but it can achieve some incredibly useful abstractions in return for this engineering tradeoff.  And I doubt that anyone trying to achieve the same thing in a procedural language without language-level support could do it in any way that turns out to be noticeably more efficient, so that's kind of a silly complaint.

that OOP can take longer to compile?  Ha! Try telling that to a Delphi developer.  It can literally compile code faster than the hard drive can serve it up.

that OOP languages have "extremely poor modularity properties"?  Try telling that to any Delphi, Java or .NET developer who uses the rich ecosystem of modular code that's been built up over the years on a daily basis.  This is simply not true.

tend to be extremely complex?  Well sure; they're solving complex problems.  You can't make essential complexity disappear; you can add abstraction and sweep it under the rug, but that will come back to bite you at some point, guaranteed.

Bottom line: if OOP didn't work well, it wouldn't work well.  And then no one would be using it because it just doesn't work.  But a simple glance at the reality of the programming world puts the lie to that concept.

Title: Modern OOP vs Alan Kays OOP


问:
Isn't there a chicken-and-egg issue since GCC is written in C++ itself?
Since 4.8 release, the C++ compiler GCC (the G++ part of it) is written not in C anymore, but in C++ itself. I have a hypothetical question on this.

I wonder how to compile the C++ code of GCC on a new platform that has no C++ compiler yet. Of course, you could use prebuilt binaries compiled on other machines. Or you could use an older version of GCC that was written in C and compile the current version with it.

However, without prebuilt binaries and just the newest version, you were stuck, right? If not, are there other implications on this situation raised by the switch from C to C++ of the GCC project?

答: This is actually a well-known concept called bootstrapping.  Basically, there exists, somewhere, a minimal C codebase to build a version of GCC that's capable of building the current GCC codebase.  Self-hosting languages have been doing things like that for decades.</p>


问:
Missing `$` like operators in Haskell
Below I've produced what I believe to be a summary of the standard $ like operators for various classes in Haskell. There's some gaps however. Following the applicative pattern, you would think those operators would be $$ and <$$> however I didn't see operators like that on Hoogle or Hayoo. Could someone fill in the gaps with the most commonly used operators for such gaps?

```<code>              | Function first           | Op   | Function second          | Op   |
----------------------------------------------------------------------------------
| Plain       | (a -> b)   -> a   -> b   | $    | a   -> (a -> b)   -> b   |      |
| Functor     | (a -> b)   -> f a -> f b | <$>  | f a -> (a -> b)   -> f b |      |
| Applicative | f (a -> b) -> f a -> f b | <*>  | f a -> f (a -> b) -> f b | <**> |
| Monad       | (a -> m b) -> m a -> m b | =<<  | m a -> (a -> m b) -> m b | >>=  |
-----------------------------------------------------------------------------------
</code>```

答:
There isn't one sadly. People usually use the left column with . instead of separate operators. I sometimes see people use

```<code>|> :: a -> (a -> b) -> b
</code>```

as a pipe line-esque operator F# and OCaml like. Generally, however, people use . instead so

```<code> a |> f |> g
</code>```

is written as

```<code> g . f $ a
</code>```

This also applies to <$>

```<code> a |$> f |$> g
</code>```

could be written as

```<code> g . f <$> a
</code>```

This is actually faster (by a factor of 2x) since <$> can be quite expensive for large collections.

Title: Missing `$` like operators in Haskell

Body:
There isn't one sadly. People usually use the left column with . instead of separate operators. I sometimes see people use

|> :: a -> (a -> b) -> b

as a pipe line-esque operator F# and OCaml like. Generally, however, people use . instead so

 a |> f |> g

is written as

 g . f $ a

This also applies to <$>

 a |$> f |$> g

could be written as

 g . f <$> a

This is actually faster (by a factor of 2x) since <$> can be quite expensive for large collections.


问:
Using Prolog to implement authorization rules
I'm working on a user management "pseudoframework" in PHP, and I'm trying to implement fine-grained rule-based authorization.  I'm using a combination of SQL and condition-checking functions written in PHP right now, but I'm not completely satisfied.  It works, but it is not very elegant and suffers from some limitations.

Prolog is Turing-complete, so it occurs to me that any arbitrary authorization rules could be implemented this way.  For example:

```<code>in_group("Alice","admin").
in_group("Alice","user").
in_group("Bob","user").
in_group("Carlos","admin").
in_group("Carlos","user").
allowed("delete_user",X,Y):-    in_group(X,"admin"),
                                not(in_group(Y,"admin")).
</code>```

This basically says "Only allow user X to delete user Y if X is an admin and Y isn't."

My questions are basically:

Will issues in scalability still arise in modern Prolog implementations?

How would these issues be complicated by the way that people typically use web applications?

What are the risks of compromising security due to the "unintended consequences" of some Prolog constructs?

How difficult will this make it for people without a Prolog background to modify authorization rules?  The above example looks straightforward to me, but what if there are thousands of rules?

If Prolog isn't the best idea for this situation, are there other logic programming languages that might be better suited?

I read this post: Why Aren't Rule Engines Written In Prolog?, but that question seems to be about rules engines in general, not authorization rules specifically.

答:
A much better framework for this kind of thing is Drools. It uses a very efficient algorithm to search for rules that apply to a given set of facts. It is a Java-based system, so you won't necessarily want to use it in your program but you should study it to see what you can learn about how the pros do it.

All of that being said, I believe you are opening your application up to a world of heartache. Having many different, fragmentary statements about security and accessibility creates a nightmare world where it is extremely easy to specify rules that allow large trucks to drive in and steal your stuff, or, almost as bad, wall off areas of a system that are not accessible by the people who need to access it, in a computer-driven catch-22.


问:
How do you unit-test code using graph structures?
I am writing (recursive) code that is navigating a dependency graph looks for cycles or contradictions in the dependencies. However, I am not sure how to approach unit testing this. The problem is that one of our main concerns is will the code handle on all the interesting graph structures that can arise and making sure that all nodes will be handled appropriately.

While usually 100% line or branch coverage is sufficient to be confident that some code works, it feels like even with 100% path coverage you'd still have doubts.

So, how does one go about selecting graph structures for test cases to have confidence that their code could handle all the conceivable permutations you'll find in real world data.

PS- If it matters, all edges in my graph are labelled "must have" xor "cannot have" and there are no trivial cycles, and there is only one edge between any two nodes.

PPS- This additional problem statement was originally posted by the question's author in a comment below:

For all vertices N in forest F, for all vertices M, in F, such that if there are any walks between N and M they all must either use only edges labelled 'conflict' or 'requires'.

答:
You are using phrases like "all the interesting graph structures" and "handled appropriately". Unless you have ways to test your code against all of those structures and determine if the code handles the graph appropriately, you can only use tools such as test coverage analysis.

I suggest you start by finding and testing with a number of interesting graph structures and determine what the appropriate handling would be and see that the code does that. Then, you can start perturbing those graphs into a) broken graphs that violate rules or b) not-so-interesting graphs that have problems; see if your code properly fails to handle them.

ContentLicense: CC BY-SA 4.0


问:
Is there something as a bug-free application?
We are developing an application that goes through many testers before reaching our client.

Finally, when it reaches the client, they find some more bugs and report to us, and this has become a tedious process. There are some bugs which I personally can't fix, because it requires me to modify most of the inner code, and I am not even sure that it might work.

Questions:

Why do bugs get reported even after going through so much testing? Is it our requirements' issue?

Our client doesn't seem happy for anything we provide. Are we doing something incorrect?

Has anyone developed any application that were totally bug free? What is the process? Why can't we deploy the application with minor bugs? Are we supposed to be perfectionist?

Is the current scenario the correct process of development and testing? If not, what is an efficient way where developers, testers and client get the maximum benefit together?

答:
The closest you get to a bug-free application, the more expensive it gets. It's like targeting 100% code coverage: you spend the same amount of time and money getting from 0% to 95%, from 95% to 99% and from 99% to 99.9%.

Do you need this extra 0.1% of code coverage or quality? Probably yes, if you're working on a software product which controls the cooling system of a nuclear reactor. Probably not if you're working on a business application.

Also, making high quality software requires a very different approach. You can't just ask a team of developers who spent their life writing business apps to create a nearly bug-free application. High quality software requires different techniques, such as formal proof, something you certainly don't want to use in a business app, because of the extremely high cost it represents.

As I explained in one of my articles:

Business apps shouldn't target the quality required for life-critical software, because if those business apps fail from time to time, it just doesn't matter. I've seen bugs and downtime in websites of probably every large corporation, Amazon being the only exception. This downtime and those bugs are annoying and maybe cost the company a few thousands of dollars per month, but fixing it would be much more expensive.

Cost should be the primary focus, and should be studied pragmatically. Let's imagine a bug which is affecting 5 000 customers and is so important that those customers will leave forever. Is this important? Yes? Think more. What if I say that each of those customers is paying $10 per year and that it will cost almost $100 000 to fix the bug? Bug fixing now looks much less interesting.

Now to answer your questions specifically:

why do bugs get reported even after going through so much testing? Is it our requirements issue? Our client doesn't seem happy for anything we provide? are we doing something incorrect?

Lots of things can go wrong. By testing, do you mean actual automated testing? If not, this is a huge problem on itself. Do testers understand the requirements? Do you communicate with the customer on regular basis—at least once per iteration, at best the customer representative is immediately reachable on-site by any member of your team? Are your iterations short enough? Are developers testing their own code?

Similarly to They write the right stuff article linked above, take a bug report and study why this bug appeared in the first place and why was it missed by each tester. This may give you some ideas about the gaps in your team's process.

In important point to consider: is your customer paying for bug fixes? If not, he may be encouraged to consider lots of things to be a bug. Making him pay for the time you spend on bugs will then considerably reduce the number of bug reports.

Has anyone developed any application that were totally bug free? What is the process? Why can't we deploy the application with minor bugs? Are we supposed to be perfectionist?

Me. I've written an app for myself the last weekend and haven't found any bug so far.

Bugs are only bugs when they are reported. So in theory, having a bug-free application is totally possible: if it's not used by anyone, there will be nobody to report bugs.

Now, writing a large-scale application which perfectly matches the specification and is proven to be correct (see formal proof mentioned above) is a different story. If this is a life-critical project, this should be your goal (which doesn't mean your application will be bug-free).

Is the current scenario the correct process of development and testing? If not what is an efficient way where developers,testers and client gets the maximum benefit together?

In order to understand each other, they should communicate. This is not what happens in most companies I've seen. In most companies, project manager is the only one who talks to the customer (sometimes to a representative). Then, he shares (sometimes partially) his understanding of the requirements with developers, interaction designers, architects, DBAs and testers.

This is why it is essential either for the customer (or customer's representative) to be reachable by anyone on the team (Agile approach) or to have formal communication means which authorize a person to communicate only with a few other persons on a team and to do it in a way that the information can be shared to the whole team, ensuring that everyone has the same information.

There are many processes to do development and testing. Without knowing precisely the company and the team, there is no way to determine which one should be applied in your case. Consider hiring a consultant or hiring a project manager who is skillful enough.


答:
Defects have existed from the beginning of software development.  It's hard to tell from your question to what extent and what severity the defects effect the usability or functionality.

Defect-free programs exist, but just about any non-trivial system will have defects.

You will have to decide upon some sort of prioritization and likely will have to do some study of the cause of the defects - where they were introduced.  There is far too much to discuss about such things in a simple Q&A post.

Entire books have been written about causal analysis and fixing process for an organization that has quality problems.

So my recommendation is to: (in no particular order)

Implement a defect tracking system if you have not found one already

Determine a way to classify the severity of defects

Figure out why you are not meeting customer expectations (is it the developers, the QA, the customer, etc)

Learn about some exercises like the 'Five whys' and do similar investigation into some of the causes of your defects.

Title: Is there something as a bug-free application?

Body:
We are developing an application that goes through many testers before reaching our client.

Finally, when it reaches the client, they find some more bugs and report to us, and this has become a tedious process. There are some bugs which I personally can't fix, because it requires me to modify most of the inner code, and I am not even sure that it might work.

Questions:

Why do bugs get reported even after going through so much testing? Is it our requirements' issue?

Our client doesn't seem happy for anything we provide. Are we doing something incorrect?

Has anyone developed any application that were totally bug free? What is the process? Why can't we deploy the application with minor bugs? Are we supposed to be perfectionist?

Is the current scenario the correct process of development and testing? If not, what is an efficient way where developers, testers and client get the maximum benefit together?


问:
Should CountDownLatch be used for waiting for an event?
I have a situation here, where I have a loop that loops x amount of times. The value x is determined by the user. Everytime it loops, I want it to wait for a button click before continuing the loop. ie. something like this (pseudocode):

```<code>loop(x times){
Button b;
  wait until a click
  when clicked{
    b.onclicklistener{
      setText(x);
    }
  }
}
</code>```

I am using this for an android app, so with Thread.wait()/Thread.notify() what I learned was that it interrupts the main UIthread, so I cannot use that.

So what I believe the only two options that I can use to kind of "pause" the loop is CountDownLatch.await() or AsyncTask (I don't know what that does, have not researched about it)

Would CountDownLatch.await()/CountDownLatch.countDown() be the best methods and class to use in this example, or should I look into AsyncTask?

答: I wouldn't use CountDownLatch in your scenario because it's not reusable. Look at Semaphore or Cyclic Barrier for similar functionality.


问:
Why use arg type `class Object` instead of `Comparable[]`?
In the code below, I believe it would look more appropriate to make the method argument be of type Comparable[] instead of Object[].

The first reason it would be more appropriate is that one can be safe from runtime exceptions because every passed object has to implement interface Comparable. Second, every object in Java inherits from class Object so one can typecast any object as (Object) to use the methods of class Object.

```<code>package java.util;
public class Arrays {
.........
public static void sort(Object[] a) {
        Object[] aux = (Object[])a.clone();
        mergeSort(aux, a, 0, a.length, 0);
    }
.........
}
</code>```

Is there a reason why type Object[] is preferred over type Comparable[] as an argument type?

答:
Basically, Java types don't always propagate nicely. If at any point, you cast to Object, you loose information about your types (this might not be always true in a block your compiler can analyze). And you can't always avoid Object, due to generics.

Details

If we look at OpenJDK's implementation, the comment says:

Objects must implement Comparable

Objects must be mutually comparable: you can't compare String and Integer instances.

Both checks can be done at runtime (throwing exceptions if needed).
What you suggest enables to do the first check during compilation.

However, we must consider the method with respect to its usage, and unfortunately, you can't always know the type of some objects.

I originally wrote an example with List<String> and toArray, which returns an Object[]. The conversion to Object[] does not allow calling sort and I saw no easy way to convert Object[] to String[]. Thanks to SJuan76's comments, here is how to do it:

```<code>    String[] strings = names.toArray(new String[0]);
</code>```

Then strings, thanks to array covariance, is suitable for comparison. However, this approach is not developper-friendly. Furthermore, it cannot be abstracted away by language constructs: generics use type erasing techniques that introduce Object instances.
By the way, let's forget about generics for a moment: after all, early versions of Java, for which sort was implemented, did not provide generics.

As already said, the kind of code written above is certainly not convenient for use. But more importantly, even though it is checked at compile-time, I am pretty sure it is not optimized away: there is still an array copy operation at runtime: you don't want to write an API which imposes this kind of cost to the user (also consider the performance of original virtual machines).

Then, it is better to simply accept more parameters and perform checks dynamically. Since anyway, point (2) above already requires runtime checks and possibly throws exceptions, we might as well accept Object[] and test types at runtime.

Now, you might think that the fact that some functions loose type informations like toArray (without argument) is itself unfortunate but this is more an issue of the language's type system at this point.

Body:
Basically, Java types don't always propagate nicely. If at any point, you cast to Object, you loose information about your types (this might not be always true in a block your compiler can analyze). And you can't always avoid Object, due to generics.

Details

If we look at OpenJDK's implementation, the comment says:

Objects must implement Comparable

Objects must be mutually comparable: you can't compare String and Integer instances.

Both checks can be done at runtime (throwing exceptions if needed).
What you suggest enables to do the first check during compilation.

However, we must consider the method with respect to its usage, and unfortunately, you can't always know the type of some objects.

I originally wrote an example with List<String> and toArray, which returns an Object[]. The conversion to Object[] does not allow calling sort and I saw no easy way to convert Object[] to String[]. Thanks to SJuan76's comments, here is how to do it:

    String[] strings = names.toArray(new String[0]);

Then strings, thanks to array covariance, is suitable for comparison. However, this approach is not developper-friendly. Furthermore, it cannot be abstracted away by language constructs: generics use type erasing techniques that introduce Object instances.
By the way, let's forget about generics for a moment: after all, early versions of Java, for which sort was implemented, did not provide generics.

As already said, the kind of code written above is certainly not convenient for use. But more importantly, even though it is checked at compile-time, I am pretty sure it is not optimized away: there is still an array copy operation at runtime: you don't want to write an API which imposes this kind of cost to the user (also consider the performance of original virtual machines).

Then, it is better to simply accept more parameters and perform checks dynamically. Since anyway, point (2) above already requires runtime checks and possibly throws exceptions, we might as well accept Object[] and test types at runtime.

Now, you might think that the fact that some functions loose type informations like toArray (without argument) is itself unfortunate but this is more an issue of the language's type system at this point.


答:
If you look at the mergeSort code you will see that it casts each member of array a to Comparable.  If any object in the array is not a Comparable, a ClassCastException will be generated unless you have created a Comparator which knows how compare your objects and passed that to the sort method.  Example of the two different techniques (comparable v comparator) here.

The Java developers decided that you should not be forced to add a Comparable interface to objects just because you want to store them in an array and may choose to sort them at some point.  This gives you greater flexibility (and less cruft on your classes) at the minor risk of runtime failures rather than compile-time type checking.  The flexibility is a win, in my opinion.

Title: Why use arg type `class Object` instead of `Comparable[]`?

Body:
In the code below, I believe it would look more appropriate to make the method argument be of type Comparable[] instead of Object[].

The first reason it would be more appropriate is that one can be safe from runtime exceptions because every passed object has to implement interface Comparable. Second, every object in Java inherits from class Object so one can typecast any object as (Object) to use the methods of class Object.

```<code>package java.util;
public class Arrays {
.........
public static void sort(Object[] a) {
        Object[] aux = (Object[])a.clone();
        mergeSort(aux, a, 0, a.length, 0);
    }
.........
}
</code>```

Is there a reason why type Object[] is preferred over type Comparable[] as an argument type?


答:
There is a problem caused by the way java arrays work, which is this: every array has its own type, which is not necessarily the same type as the objects contained in the array, and the type cannot be changed at runtime.

For example:

```<code>Object [] a= new Object[]{
   (Integer)5,
   (Integer)2
};

Arrays.sort ((Comparable [])a);
</code>```

Would cause a class cast exception, despite the fact that all of the elements in a are comparable.

Now, you could argue that we shouldn't create an Object array but rather a more specific type, but there's another problem with that. Consider this code:

```<code>class GenericArrayExample<T extends Comparable>
{
    T[] a;

    GenericArrayExample(int size)
    {
        a = new T[size];
    }
    public void sort ()
    {
        Arrays.sort (a);
    }
 }
</code>```

What's the problem with this, you may ask: a is an array of Ts so should be comparable.  There are two problems, however.

The first is that the constructor won't compile, because in order to create the new array it needs to know the type of T at runtime, but Java can't actually provide this information (google java generics erasure if you want to find out why). The usual solution is to use an array of objects instead. You could use Comparable [] instead, though, except:

Wouldn't it be nice if we could use an instance of this class to store non-Comparable objects too? We'd have to avoid using the sort method, of course, and it should throw some kind of exception if we try to use it..

This can only be achieved, however, if a is an array of objects, which means Arrays.sort must accept object arrays.

Body:
There is a problem caused by the way java arrays work, which is this: every array has its own type, which is not necessarily the same type as the objects contained in the array, and the type cannot be changed at runtime.

For example:

Object [] a= new Object[]{
   (Integer)5,
   (Integer)2
};

Arrays.sort ((Comparable [])a);

Would cause a class cast exception, despite the fact that all of the elements in a are comparable.

Now, you could argue that we shouldn't create an Object array but rather a more specific type, but there's another problem with that. Consider this code:

class GenericArrayExample<T extends Comparable>
{
    T[] a;

    GenericArrayExample(int size)
    {
        a = new T[size];
    }
    public void sort ()
    {
        Arrays.sort (a);
    }
 }

What's the problem with this, you may ask: a is an array of Ts so should be comparable.  There are two problems, however.

The first is that the constructor won't compile, because in order to create the new array it needs to know the type of T at runtime, but Java can't actually provide this information (google java generics erasure if you want to find out why). The usual solution is to use an array of objects instead. You could use Comparable [] instead, though, except:

Wouldn't it be nice if we could use an instance of this class to store non-Comparable objects too? We'd have to avoid using the sort method, of course, and it should throw some kind of exception if we try to use it..

This can only be achieved, however, if a is an array of objects, which means Arrays.sort must accept object arrays.


答:
Creating a compiler that is written in the same language that it compiles is called bootstrapping. The wikipedia article describes a number of ways that a compiler can be bootstrapped.

Given your restriction that you only have a post-4.8 G++ source code and no pre-built binaries for your target platform (no existing C++ compiler), then bootstrapping the G++ compiler can be done by means of cross-compilation.

When bootstrapping a compiler using cross-compilation, you build several versions of your compiler

On your PC, you install a C++ compiler (can be any C++ compiler, doesn't have to be G++)

Using that compiler, you create a G++ cross-compiler that can execute on the PC and generates code for the target platform

Using the G++ cross-compiler you just built, you create a native G++ compiler that can run on the target platform and create code for it.

You are done. You have created a C++ compiler for the new platform.

If you also don't have a PC (or similar) to perform the initial steps on, then you are indeed stuck, but the chance of being in that situation and trying to bootstrap a compiler are negligible.

Title: Isn't there a chicken-and-egg issue since GCC is written in C++ itself?

Body:
Since 4.8 release, the C++ compiler GCC (the G++ part of it) is written not in C anymore, but in C++ itself. I have a hypothetical question on this.

I wonder how to compile the C++ code of GCC on a new platform that has no C++ compiler yet. Of course, you could use prebuilt binaries compiled on other machines. Or you could use an older version of GCC that was written in C and compile the current version with it.

However, without prebuilt binaries and just the newest version, you were stuck, right? If not, are there other implications on this situation raised by the switch from C to C++ of the GCC project?


答:
Not all bugs are created equal so you need to sort out the wheat from the chaff.

Expectations

Many bugs are raised simply due to a shortfall in what the software does and what the end user is expecting. This expectation comes from many areas: using other software, incorrect documentation, over-zealous sales staff, how the software used to work etc etc.

Scope creep

It goes without saying that the more you deliver, the greater the potential for bugs. Many bugs are simply raised on the back of new features. You deliver X & Y but the customer says that on the back of this it should now also do Z.

Understand the problem domain

Many bugs come about for the simple reason that the problem domain was poorly understood. Every client has their own business rules, jargon and ways of doing things. Much of this won't be documented anywhere - it will just be in people's heads. With the best will in the world, you can't hope to capture all this in one pass.

So...what to do about it.

Automated unit tests

Many bugs are introduced as an unexpected side effect of some code change or other. If you have automated unit tests, you can head off many of these issues and produce better code from the outset.

Tests are only as good as the data supplied - so make sure you fully understand the problem domain.

Code coverage

This goes hand in hand with automated unit testing. You should ensure that as much code is tested as is practical.

Learn the lessons

Madness is doing the same thing again and again and again and expecting different results

Do you understand the causes of the last failure? Do you? Really? You may have stopped the problem occurring but what was the true root source? Bad data? User error? Disk corruption? Network outage?

Nothing annoys clients more than encountering the same problems again and again without progress towards some form of resolution.


问:
Is a developer-driven product a good thing?
I work in a company where the CEO manages the product team, who mockup features and drop in the lap of developers to then implement said features. There is some iteration of course, developer's opinions are respected. But I wonder how effective this process is.

Jason Calacanis just wrote :

The Zuckerberg Doctrine: Developers
  design products with significantly
  improved speed and functionality
  compared to product managers and
  designers, outweighing potential
  mistakes and drawbacks.

...

Then it really hit me:
  Developer-driven startups always
  produce product faster.

This stands to reason: our
  nontechnical people are having
  discussions and debates while
  Zuckerberg is coding his next feature.
  This is why no one has been able to
  keep up with Facebook!

While MySpacers debated how to iterate
  on their product, Facebook simply
  tried stuff.

Does this actually work better in practice ?

答:
What if you produce products faster that noone wants to use?

Focusing on a single attribute (functionality, time to market, price, qualitity, etc) can make sense for a certain point in time. E.g. Apple kind of rushed the iPhone and the iPad out of the door. Quality suffered a bit but it was quite important to be first.

I think it hurts you, if you focus on one aspect only in the long run.


问:
VCS - Better way to change location than pushing to branch?
I work from multiple locations quite frequently, and there's times (16:59 on a Friday for example) when I need to leave quickly with potentially unstable code. Right now I tend to commit and push the days work to my branch and work on it from home/elsewhere, but this feels a little dirty. Would others consider this acceptable? How else would you go about it?</p>

答:
This is perfectly acceptible for me. In fact I've probably done this since I started using version control as I found it the most convenient way.. Other options like dropbox etc work but then you still have to wait for the sync and it does lead to conflicts sometimes which are a mess. I've even known people emailing themselves the temporary work, even messier.

I usually don't just push to the branch I'm working on though, but to a branch called work-in-progress for example: if you're in a hurry it's easy to just push all current changes to a branch as-is without having to properly lay out one or more commits with decent messages etc or without having to fix your messy commit afterwards.


答:
There are two main reasons to use branches in a VCS:

To isolate unreleased features from each other and from released code. This is mainly what git flow is all about.

To share unfinished code with other developers without impacting the whole team. This is exactly your use-case, where you can read "other developers" as "myself sitting behind different computers".

So, yes, committing non-compiling, unfinished code to a branch is perfectly fine. The only consideration should be that others (including automated build setups) don't depend on that branch being stable/buildable.

Title: VCS - Better way to change location than pushing to branch?

Body: I work from multiple locations quite frequently, and there's times (16:59 on a Friday for example) when I need to leave quickly with potentially unstable code. Right now I tend to commit and push the days work to my branch and work on it from home/elsewhere, but this feels a little dirty. Would others consider this acceptable? How else would you go about it?</p>


答:
Even though this could work, this might be a little overkill.

Will issues in scalability still arise in modern Prolog implementations?

Beware of strings.
In some implementations, the generated code for querying in_group/2 will result in a lot of branching, as in if "Alice" then ... else if "Bob" ....

Replace double-quotes with single-quotes, and you have atoms, which lead to hash-table based queries. Unless you want to complicate things, have names and roles in ASCII (if you can).

Some implementation also have worker threads, if you want to have multiple queries in parallel.

How would these issues be complicated by the way that people typically use web applications?

This should not matter.

What are the risks of compromising security due to the "unintended consequences" of some Prolog constructs?

Well, you can backtrack, but this is intended, right?

in_group(X,Y) gives you all pairs of values.

in_group(N,admin) gives you all admins.

in_group(N,admin),in_group(N,user) gives the intersection of users and admins.

in_group(N,X),member(X,[admin,user]) gives the union instead.

Unintended consequences are synonym with programming errors here, assuming you understand the language. If you mess with variable names or make a typo, you could have an exception at runtime: you generally don't leave the execution environment (even if you stack-overflow because you wrote an infinitely recursive predicate), but you can't reply to further requests. This is the same as for any dynamic language.

How difficult will this make it for people without a Prolog background to modify authorization rules? The above example looks straightforward to me, but what if there are thousands of rules?

If you don't enclose name in quotes and start them with an uppercase letter, those are variables: you will have the unintended consequences you mentioned.

Maybe you can try to teach and trust people who will modify your file (but compile and test your queries before deploying).

Otherwise, make them use "higher-level" queries that check inputs and produce predicates (i.e. dynamic predicates or compile_term).

Title: Using Prolog to implement authorization rules

Body:
I'm working on a user management "pseudoframework" in PHP, and I'm trying to implement fine-grained rule-based authorization.  I'm using a combination of SQL and condition-checking functions written in PHP right now, but I'm not completely satisfied.  It works, but it is not very elegant and suffers from some limitations.

Prolog is Turing-complete, so it occurs to me that any arbitrary authorization rules could be implemented this way.  For example:

```<code>in_group("Alice","admin").
in_group("Alice","user").
in_group("Bob","user").
in_group("Carlos","admin").
in_group("Carlos","user").
allowed("delete_user",X,Y):-    in_group(X,"admin"),
                                not(in_group(Y,"admin")).
</code>```

This basically says "Only allow user X to delete user Y if X is an admin and Y isn't."

My questions are basically:

Will issues in scalability still arise in modern Prolog implementations?

How would these issues be complicated by the way that people typically use web applications?

What are the risks of compromising security due to the "unintended consequences" of some Prolog constructs?

How difficult will this make it for people without a Prolog background to modify authorization rules?  The above example looks straightforward to me, but what if there are thousands of rules?

If Prolog isn't the best idea for this situation, are there other logic programming languages that might be better suited?

I read this post: Why Aren't Rule Engines Written In Prolog?, but that question seems to be about rules engines in general, not authorization rules specifically.


答:
I am doubting what I should name my association. Should it be "a flight has * stewards"? Or should it be "a steward works on many flights"?

Usually, the more specific you can name your association, the better, because a more specific name conveys more information.

On the other hand, if you are using a directional association (you put an arrowhead on one end), then the name must make sense when going in the direction of the arrow.

For example, if you have Flight --> Steward, then you can't name that association "works on", because it doesn't make sense to say "Flight X works on Steward Y".

If you have a non-directional association (no arrowheads, you can follow it in either direction), but your name only makes sense when it is read in a particular direction, you can optionally indicate that by putting a small arrow/tilted triangle next to the name, like this:

```<code>+--------+                +---------+
| Flight |   < Works On   | Steward |
|        |----------------|         |
+--------+                +---------+
</code>```

This means that the association should be read as "Steward Y works on Flight X".

Should I specify the multiplicity (1..* etc) at both sides?

If the multiplicity can be inferred from the context, you can leave it out.

But as a beginner, it might be better to be explicit about your intended multiplicity.

You write the multiplicity number on both sides of the association, like this:

```<code>+--------+                  +---------+
| Flight |2..4 < Works On  1| Steward |
|        |------------------|         |
+--------+                  +---------+
</code>```

This means that each Flight has exactly 1 Steward and each Steward works on between 2 and 4 Flights (no more, no less).

An unknown upper limit to a range can be indicated with a *, like 2..* for "two or more". As a shorthand, just a * stands for 0..*.

My teacher hasn't covered compositions and aggregations yet, but I'm afraid if I only use regular associations I might be doing something wrong. Can you make a class diagram with just associations? Would you consider a more complex class diagram wrong if it doesn't use compositions/aggregations?

No, I would not consider a class diagram without compositions/aggregations wrong. The biggest risk that you run when using an inappropriate type of association is that you don't convey your intended meaning, or that additional documentation is needed to convey it.

For class exercises, I wouldn't worry about the need for concepts that haven't been discussed yet in class. Either they are not needed to complete the exercise to a high standard, or there will be a follow-on exercise to refine your current diagram with the new concepts when they have been discussed.

I read that there's no consensus on what aggregations precisely means. So why would we use something if there's no formal definition?

Plain association, aggregation and composition each refer to a different strength of the relation between two classes. Everyone agrees that plain association indicates the weakest kind of relation, composition the strongest and that aggregation is somewhere in the middle.

What the disagreement is on is just how strong a relation is when indicated with aggregation (where in the middle of the strength scale it is) and how such a relation should be implemented in the various languages.

The reason that it is still used is because it is often useful to have more than two levels to indicate the strength of a relation between two classes.

Title: Confusion about associations in UML class diagram

Body:
```<code>---------------------    ----------------------
|       FLIGHT      |    |       STEWARD      |
---------------------    ----------------------
| Arrival time      |    |  Steward ID        |
| Departure time    |    |  Name              |
| Flight ID         |    ----------------------
---------------------    | Call()             |
| Board()           |    | HelpPassenger()    |
| Depart()          |    ----------------------
---------------------
</code>```

Today was my first UML lesson in class diagrams. My teacher asked me to model this class diagram. I have many confusions about what association I am supposed to use. I have some experience in ERDs and OOP.

I am doubting what I should name my association. Should it be "a flight has * stewards"? Or should it be "a steward works on many flights"?

Should I specify the multiplicity (1..* etc) at both sides?

My teacher hasn't covered compositions and aggregations yet, but I'm afraid if I only use regular associations I might be doing something wrong. Can you make a class diagram with just associations? Would you consider a more complex class diagram wrong if it doesn't use compositions/aggregations?

I read that there's no consensus on what aggregations precisely
means. So why would we use something if there's no formal definition?

Body:
I am doubting what I should name my association. Should it be "a flight has * stewards"? Or should it be "a steward works on many flights"?

Usually, the more specific you can name your association, the better, because a more specific name conveys more information.

On the other hand, if you are using a directional association (you put an arrowhead on one end), then the name must make sense when going in the direction of the arrow.

For example, if you have Flight --> Steward, then you can't name that association "works on", because it doesn't make sense to say "Flight X works on Steward Y".

If you have a non-directional association (no arrowheads, you can follow it in either direction), but your name only makes sense when it is read in a particular direction, you can optionally indicate that by putting a small arrow/tilted triangle next to the name, like this:

+--------+                +---------+
| Flight |   < Works On   | Steward |
|        |----------------|         |
+--------+                +---------+

This means that the association should be read as "Steward Y works on Flight X".

Should I specify the multiplicity (1..* etc) at both sides?

If the multiplicity can be inferred from the context, you can leave it out.

But as a beginner, it might be better to be explicit about your intended multiplicity.

You write the multiplicity number on both sides of the association, like this:

+--------+                  +---------+
| Flight |2..4 < Works On  1| Steward |
|        |------------------|         |
+--------+                  +---------+

This means that each Flight has exactly 1 Steward and each Steward works on between 2 and 4 Flights (no more, no less).

An unknown upper limit to a range can be indicated with a *, like 2..* for "two or more". As a shorthand, just a * stands for 0..*.

My teacher hasn't covered compositions and aggregations yet, but I'm afraid if I only use regular associations I might be doing something wrong. Can you make a class diagram with just associations? Would you consider a more complex class diagram wrong if it doesn't use compositions/aggregations?

No, I would not consider a class diagram without compositions/aggregations wrong. The biggest risk that you run when using an inappropriate type of association is that you don't convey your intended meaning, or that additional documentation is needed to convey it.

For class exercises, I wouldn't worry about the need for concepts that haven't been discussed yet in class. Either they are not needed to complete the exercise to a high standard, or there will be a follow-on exercise to refine your current diagram with the new concepts when they have been discussed.

I read that there's no consensus on what aggregations precisely means. So why would we use something if there's no formal definition?

Plain association, aggregation and composition each refer to a different strength of the relation between two classes. Everyone agrees that plain association indicates the weakest kind of relation, composition the strongest and that aggregation is somewhere in the middle.

What the disagreement is on is just how strong a relation is when indicated with aggregation (where in the middle of the strength scale it is) and how such a relation should be implemented in the various languages.

The reason that it is still used is because it is often useful to have more than two levels to indicate the strength of a relation between two classes.


答:
Depends on what you call an application.

If you mean, an interactive program where you need to be certain that the real-time behaviour is exactly such and such under any given circumstances, then it's basically impossible to proove there aren't any bugs in it. I suppose it would be possible if you could solve the halting problem, but you can't.

However, if you restrict yourself to a statement of "such and such input will eventually yield such and such final state", then your chances of a "bug-free proof" are better, because you can use invariants. That, and only that, allows a correctness proof to be broken down in subproblems, each of which can relatively easy be prooven to work correctly under all circumstances of the remaining program (though you generally can't be very accurate about how much time & memory it might take).

Such techniques are basically possible in any programming language (though some esoteric ones like Malbolge try to disproove that!), but in all imperative languages it gets messy very quickly, because you have to meticolously keep track of a lot of implicit program state.  In functional languages1, the proofs tend to look much nicer (pure languages, or the purely-functional subset of a language). Still, in particular with dynamic types, you will need to write out a lot of requirements about what inputs are permitted. That's of course one of the main benefits of strong static type systems: the requirements are right there in the code!

Well, ideally, that is. In practise, O'Caml or even Haskell programs tend to contain nontotal functions, i.e. functions that will crash / hang / throw for certain inputs, despite the correct type2. Because even though these languages have very flexible type systems, it's sometimes still not feasible to use it to fully restrict something.

Enter dependently-typed languages! These can "calculate" types precisely as needed, so everything you define can have exactly the type signature that prooves all you need. And indeed, dependently-typed languages are mostly taught as proof environments. Unfortunately, I think none of them is really up to writing production software. For practical applications, I think the closest you can get to completely bug-proof is writing in Haskell with as thoroughly total functions as possible. That gets you pretty close to bug-proof – albeit, again, only with regard to the functional description. Haskell's unique way of handling IO with monads also gives some very useful proofs, but it generally doesn't tell you anything about how long something will take to finish. Quite possibly, something might take exponential time in particular circumstances – from the user's POV, that would likely be as severe a bug as if the program completely hangs.

1Or more generally, descriptive languages. I haven't much experience with logical languages, but I suppose they can be similarly nice in proof regards.

2If it's not the correct type, the compiler will never allow it in those languages; that already eliminates a lot of bugs. (And, thanks to Hindley-Milner type inference, it actually makes the programs more concise as well!)


问:
"Standard" format for using a timestamp as part of a filename
I searched for a standard format for using a date/time as part of a file name and was unable to come up with anything.

My question is two parts:

Is using time stamps to enforce unique in file names a poor practice?

I could get the time from the creation date and serialize the file names (file0001.bak, file0002.bak, etc) but just including the time stamp lets perform file operations such as mv 2011-01* somewhere/. Is there a downside to using this type of naming system?

The format I am using is YYYY-mm-dd_HH-MM-SS.

Is there a better format I should be using?

With this format should i be concerned with file system compatibility, str_to_date_parsing concerns, etc?

Thanks!

edit:

I might have wanted to leave out the enforce uniqueness bit since it's a single user generating backup using a cronjob (there shouldn't be any concurrency problems).

答:
The FBI has a "single" user problem of backing up 100 million criminal arrest fingerprints that they receive from all police everywhere...

...they start with the date: yyyymmdd

I don't know how they continue. I continue with hhmm and for me that does it.

Using GMT / Zulu sounds like an excellent idea for a global solution. Personally I use ET, and the FBI "personally" uses ET as well since that's where they are headquartered.


问:
ASP.NET MVC should I reference the DAL from the UI?
I am developing an ASP.NET MVC  application, and I have three projects:

UI (with the system.web.mvc reference, BL and DAL references)

BL (business facade  and business objects)

DAL (contains my entities/poco classes and connects to the DB using an external  assembly)

I am building my viewmodels in the UI layer, using the data contained in my DAL entities, so my UI has reference to BLL and DAL, but I'm not sure if a DAL reference should exist in the UI project.

I was thinking about creating a class in the BL layer That uses the data contained in the DAL entities, and then creating my viewmodels using the new class, but it seems very repeatitive and redundant.

What do you guys think? What I want to do is to build my viewmodels using data contained in data base

答:
You are right,  DAL reference should NOT exist in the UI project. You should instead create DTO objects for sending/recieving data to your BLL. It can be a separate project called DTOs or can be included in the BLL by creating specific folders like Customer and placing its facade classes along with the DTOs in that folder. BLL will be responsible for mapping the DAL objects to BLL DTOs back and forth (I would use AutoMaper for this purpose).

So you should create TWO DTOs for each DAL object. Like if we have a Customer class in DAL, then I would create TWO DTOs for it as follows:

```<code>    public class CustomerBrief
    {
        public string Name {get; set;}
        public string Address {get; set;}
        public string Email {get; set;}
    }

    //excuse my naming conventions :)
    public class CustomerFull : CustomerBrief
    {
        public string SomeOtherFieldThatYouNeedInDetail_1 {get; set;}
        public string SomeOtherFieldThatYouNeedInDetail_2 {get; set;}
        public string SomeOtherFieldThatYouNeedInDetail_3 {get; set;}
    }
</code>```

So when you need a list of Customers, you can return List<CustomerBrief>. And when you need a customer's full detail, you can return CustomerFull. This way only the data that is actually needed is passed around the web.

Now, you would reference only the BLL in your UI project and now your Customer ViewModel may look like following:

```<code>    public class CustomerVM
    {
        public CustomerFull Customer {get; set;}
        public List<CountryBrief> Countries {get; set;}
    }
</code>```

OwnerDisplayName: Enrique Olvera

Body:
You are right,  DAL reference should NOT exist in the UI project. You should instead create DTO objects for sending/recieving data to your BLL. It can be a separate project called DTOs or can be included in the BLL by creating specific folders like Customer and placing its facade classes along with the DTOs in that folder. BLL will be responsible for mapping the DAL objects to BLL DTOs back and forth (I would use AutoMaper for this purpose).

So you should create TWO DTOs for each DAL object. Like if we have a Customer class in DAL, then I would create TWO DTOs for it as follows:

    public class CustomerBrief
    {
        public string Name {get; set;}
        public string Address {get; set;}
        public string Email {get; set;}
    }

    //excuse my naming conventions :)
    public class CustomerFull : CustomerBrief
    {
        public string SomeOtherFieldThatYouNeedInDetail_1 {get; set;}
        public string SomeOtherFieldThatYouNeedInDetail_2 {get; set;}
        public string SomeOtherFieldThatYouNeedInDetail_3 {get; set;}
    }

So when you need a list of Customers, you can return List<CustomerBrief>. And when you need a customer's full detail, you can return CustomerFull. This way only the data that is actually needed is passed around the web.

Now, you would reference only the BLL in your UI project and now your Customer ViewModel may look like following:

    public class CustomerVM
    {
        public CustomerFull Customer {get; set;}
        public List<CountryBrief> Countries {get; set;}
    }


问:
HTTP Response Header for a unique Request ID for REST service
For our REST service I want to send back a unique request ID with every response; useful for debugging internal projects but also for offering support to any third parties who might use the service in the future.

I have decided that I need to use a response header, since not all REST requests need to result in a response body (often lower-level REST APIs take advantage purely of status code and description), but would still need to send back this request ID.

I want to ensure, if possible, that I use an HTTP Response Header that is unlikely to be stripped out by any proxies along the way.

This could be very important since a large number of clients will likely be mobile devices with what is bound to be 'interesting' network topologies between them and our servers.

However, the same services are likely to be marketed to other businesses with their own corporate firewalls/proxies too.

Because of this I've basically chucked out the idea of using a custom response header in favour of a well-known header.

My current winning well-known header would be the ETag header, but while it's almost right, it's not quite - because an ETag is for a resource, not a request (i.e. two separate requests for the same resource will legitimately return the same ETag).  Moreover, if I do use that, it'll mean I can't do any entity-tagging for anything else.

Anyone have any better ideas?

Update

The Pragma header, it appears, could be used, but I'm having issues writing to it within the Asp.Net WebAPI.  Here's a related question on SO.

答:
Have a look at the guidelines from the Heroku team. Amongst other things such as Etags they suggest a Request-Id in the header. We are looking to implement most of these guidelines where they make sense.

Trace requests with Request-Ids

Include a Request-Id header in each API response, populated with a
  UUID value. If both the server and client log these values, it will be
  helpful for tracing and debugging requests.

https://github.com/interagent/http-api-design/blob/master/README.md


问:
Java card game design decision
I am making an application for a card game, with a standard 52-deck playing card. For now, I am writing a solitaire game with for learning purposes. I've had some experience making platformers and arcade games, but none with card and turn-based games.

I am trying to implement some sort of MVC pattern, separating the game logic from the actual GUI. I intend to have a drag-and-drop interface for cards, but I don't know where to handle the card's position. I have a Card class that contains the rank and the suit, and other card-related methods. Should the Card class handle it's own position? Wouldn't that mean that my model is not decoupled properly? If the View should handle the card's position, wouldn't that create excessive objects and references? Any idea and argument is greatly appreciated.

答:
Add a Table class that holds several Stacks.

Then each Stack is a list of cards where you can take the top one off and put a card on given some constraints.

Moving a card will then be (destination and source are Stacks):

```<code>if(destination.canPut(source.top())){
    destination.put(source.take());
}
</code>```

The view will know where and how to render each Stack and what the cards look like etc.

Then end result is that Card is just a dumb immutable object that is contained in a Stack.

Each stack can have different constraints using polymorphism, for example the pot cannot take any cards, the result can only take cards of the same suit and 1 higher and so on.

Title: Java card game design decision

Body:
Add a Table class that holds several Stacks.

Then each Stack is a list of cards where you can take the top one off and put a card on given some constraints.

Moving a card will then be (destination and source are Stacks):

if(destination.canPut(source.top())){
    destination.put(source.take());
}

The view will know where and how to render each Stack and what the cards look like etc.

Then end result is that Card is just a dumb immutable object that is contained in a Stack.

Each stack can have different constraints using polymorphism, for example the pot cannot take any cards, the result can only take cards of the same suit and 1 higher and so on.


答:
NO, unless it solves a real world problem

Programmers usually love solving problems, sometimes to problems that don't yet exist :)

Programmers usually make terrible GUI's, because its a secondary thought

Most user problems are not the same as programmer problems.

Thus programmer driven product will usually be good for other programmers, but not so good for users.

Also a Note on face-book:

Face-books success has nothing to do with its technical merits, its more of a piggy back idea that just caught on really big and snowballed. Face-book et al only happen every once in a "Google Blue Moon".

However:

If a programmer has a real "user" problem, one that is not a programmer problem. Then its likely that its a very good thing. If the stakeholder is also the developer that in relation to the problem is an ideal situation for a great product solution.

Title: Is a developer-driven product a good thing?

Body:
I work in a company where the CEO manages the product team, who mockup features and drop in the lap of developers to then implement said features. There is some iteration of course, developer's opinions are respected. But I wonder how effective this process is.

Jason Calacanis just wrote :

The Zuckerberg Doctrine: Developers
  design products with significantly
  improved speed and functionality
  compared to product managers and
  designers, outweighing potential
  mistakes and drawbacks.

...

Then it really hit me:
  Developer-driven startups always
  produce product faster.

This stands to reason: our
  nontechnical people are having
  discussions and debates while
  Zuckerberg is coding his next feature.
  This is why no one has been able to
  keep up with Facebook!

While MySpacers debated how to iterate
  on their product, Facebook simply
  tried stuff.

Does this actually work better in practice ?


答:
Should the Card class handle it's own position?

No. As you said, a card is defined purely by its rank and suite. The 10 of Spades remains the 10 of Spades regardless of where it is. In fact I would argue cards have no relevant methods other than getting the rank and suit. (It's convenient to define equals and hashCode as methods, but if you have access to the rank and suit you can compare cards without access to their private fields. It's just simpler not to have to pass Comparators or whatnot when sorting, etc. If you make cards enums, you get this for free.)

As a side note, there's two separate concepts of position here. There's the abstract logical position relevant to the game logic (e.g. the 10 of Spades is on top of the 4th stack from the left) and then there's the presentation position (e.g. the 4th stack from the left is drawn at screen coordinates 58, 160). The abstract position of the stacks belongs in the model; the presentation position in the view.

Wouldn't that mean that my model is not decoupled properly?

Yes, if you introduce the screen position into the Card class, you've introduced coupling from the model to the view. (Coupling in the other direction - from view to model - is normal.) For example, if you wanted to make the game look fancier by having 3D cards moved around a 3D table, you'd have to change the Card class to contain 3D points instead of 2D points. You don't just want to make it so you can change view implementations by swapping one class for another - you also want to isolate the model from being impacted by changes to the view's design.

If the View should handle the card's position, wouldn't that create excessive objects and references?

I don't see how moving the card's position from one layer of the program to another changes the amount of data you have to keep track of. Even if it did, it probably won't change the asymptotic time or space usage of the program. Even if it did, it's too early to worry about optimizing if you don't have clearly-defined performance goals and an implementation you can benchmark. It's doubtful a game with such little data to keep track of will have a performance issue unless you're doing something very, very wrong.

Title: Java card game design decision

Body:
I am making an application for a card game, with a standard 52-deck playing card. For now, I am writing a solitaire game with for learning purposes. I've had some experience making platformers and arcade games, but none with card and turn-based games.

I am trying to implement some sort of MVC pattern, separating the game logic from the actual GUI. I intend to have a drag-and-drop interface for cards, but I don't know where to handle the card's position. I have a Card class that contains the rank and the suit, and other card-related methods. Should the Card class handle it's own position? Wouldn't that mean that my model is not decoupled properly? If the View should handle the card's position, wouldn't that create excessive objects and references? Any idea and argument is greatly appreciated.