答:
Using two underscores is definitely bad - that is reserved for compiler-specific implementation details. This does not apply to using one underscore.

Some people have a hate on for underscores. Whether you call something m_index or highest_price or _a - they detest it. I worked with someone 25 years ago who told me about a specific IBM printer (a very popular one) that fit more lines on the page by omitting the bottom pixel on every other line. This was fine for memos,  or for output of big swathes of numbers and such, but had the effect for code of making half of your underscores invisible. (Yes, really!) People from that generation generally have the irrational underscore hate, either from interaction with that printer or from working with someone who beat into them that underscores are not to be used.

Most people find using mixed case (an option we didn't have in, say, Fortran) a more readable approach: mIndex, HighestPrice, a stand up pretty well to the earlier underscored examples. I will give you two rules:

never start anything (function, variable, macro, typedef) with two underscores

pick a consistent convention ( eg _limit for function parameters, m_limit for member variables, never use underscores, camel case, capitalize every word, Hungarian, something) and stick to it. Don't bop around sometimes with underscores at the beginning, sometimes the end, sometimes not using them, and five different casing conventions. Be consistent.

The printer in question is long gone. If you like to use one underscore at time, feel free to. But understand, underscore haters still exist.

Title: Might starting variables/members with an underscore puzzle the compiler?

Body:
I've been taught since high school that defining variables like this:

```<code>int _a;
</code>```

or

```<code>int __a;
</code>```

should be consider bad practice because this would eventually puzzle compilers that use variables starting with an underscore to name temporary variables.

As far as I know this is the reason why some people like to move the underscore at the end of the name, like:

```<code>int a_;
</code>```

However, I see a lot of code all around that makes use of underscore-starting variables. And that code builds fairly well with both Visual Studio 2010 and g++ 4.x.

So I wonder: is this a non-issue nowadays? Are modern compilers smarter about naming conventions?


问:
Why did Alan Kay say, "The Internet was so well done, but the web was by amateurs"?
OK, so I paraphrased. The full quote:

The Internet was done so well that most people think of it as a natural resource like the Pacific Ocean, rather than something that was man-made. When was the last time a technology with a scale like that was so error-free? The Web, in comparison, is a joke. The Web was done by amateurs. -- Alan Kay.

I am trying to understand the history of the Internet and the web, and this statement is hard to understand. I have read elsewhere that the Internet is now used for very different things than it was designed for, and so perhaps that factors in.

What makes the Internet so well done, and what makes the web so amateurish?

(Of course, Alan Kay is fallible, and no one here is Alan Kay, so we can't know precisely why he said that, but what are some possible explanations?)

*See also the original interview*.

答: I dunno, some part of the non-web internet has some horrible warts. Email was before the web, and is part of the internet, and the standard is very open, and requires a lot of hacks on top to tackle (but not solve) the spam problem.</p>

ContentLicense: CC BY-SA 3.0


问:
How web-servers identify a client
I have seen on some sites which say ,for-example, multiple votes/views from same computer will be neglected/penalized etc. For-example liking a facebook page, or youtube video from same computer(different accounts) will not increase its worth(according to my knowledge).

How do these sites identify bogus votes? I just need a direction.

答: At a simplistic level, probably cookies on the machine, if they're more sophisticated then they may use IP filtering.</p>

Title: How web-servers identify a client


问:
Search on multiple values
I have a database having around 15 tables.Currently I am working on a report generation page, which is having 16 criteria.The values are distributed among multiple tables.User can select any number of search criteria. The problem is, if the user is entering 2-3 values, it is better to filter first by certain value and then apply the next level of filtration on remaining values and this order of filtration depends on the user input always. That means, I have to check all the possible ways of input permutation and give execution path for each, which will be horrible.Is there any way by which I can reduce the execution paths. I am not able to come up with an efficient algorithm.

Suppose I have 3 parameters: name, skill, programExp

If name is given, then I should filter based on name first.
If skill is given, then I should filter using skill, programExp and then name.

答:
I'm going to go on the assumption that the query results are the results of a JOIN filtered using a WHERE clause.

I have to check all the possible ways of input permutation and give
  execution path for each, which will be horrible.

That will be horrible.  It sounds like you're trying to do something any decent database already does for you.

Good databases have a query optimizer whose job it is to examine incoming queries and come up with an execution plan for carrying it out.  Plans are constructed to consume the fewest resources (CPU, memory, access to storage) while answering queries quickly and correctly.  The major factors that go into these decisions are the tables used, JOIN conditions, WHERE clauses, available indexes and table statistics.  For example, if the optimizer sees that one of your WHERE clauses can cut the result set of a JOIN from a billion rows to, say, a thousand, that condition will be applied earlier rather than later so fewer intermediate results have to be handled.

What this means for you is that you don't have to worry about what order you apply the conditions.  Stack them up in a WHERE clause and the optimizer will take care of the rest.  Once you've made it work and work right, you can worry about making it work fast if you've determined that your queries are a bottleneck.  The cure will almost universally not be trying to outsmart the optimizer or handling the data yourself, it will be tuning your database so the optimizer has what it needs to do a better job.  Databases with optimizers often have an EXPLAIN or SHOW PLAN feature that will let you see what the optimizer comes up with for a given query, and the parts that cause performance problems will  stick out like a sore thumb.

Bottom line:  build a query based on the conditions in force and let the database do its job.

Title: Search on multiple values


问:
NoSQL and BIG DATA
I am doing an internship on Big Data technologies so I am new to this area. My question is about the use of NoSQL in the Big Data architecture. Do we need always to use a distributed storage (like HDFS in the case of Hadoop) then to put on top a NoSQL databases (like Hbase )?

I find it difficult to understand the typical BIG Data architecture specially for unstructured data .

If you can help me to see better I will be so thankful.

答: Distributed storage is an implementation detail more than a necessary thing to understand to handle BIG data. I would focus on grasping unstructured data first, which is more of a feature and more important to grok.</p>

Title: NoSQL and BIG DATA


问:
Should lookup tables enumerating strings have an integer primary key?
When I learned relational databases, the prof said that one would "almost always" want an artificial int as the primary key in a table, but did not specify what the exceptions are. At some time I stopped using them for junction tables, and never had a problem.

Now I am making a database with a lot of lookup tables, and wonder whether this is a case where leaving artificial keys out wouldn't make for a cleaner design and simple programming.

A toy example: assume that this is a mockup of the UI I want to achieve.

The design option with artificial IDs would be (Type is a foreign key):

```<code>LiteraryWork
Title                           Type
Winnie The Pooh                 1
The Nightingale and the Rose    2
Snowwhite                       2

LiteraryWorkType
ID TypeName
1  Novel
2  Fairy Tale
</code>```

And the option without them uses the Type name itself as the key (again, the column Type is properly declared as a foreign key):

```<code>LiteraryWork
Title                           Type
Winnie The Pooh                 Novel
The Nightingale and the Rose    Fairy Tale
Snowwhite                       Fairy Tale

LiteraryWorkType
TypeName
Novel
Fairy Tale
</code>```

I tend towards using the second option, because I would need one less join when showing data on the screen. (I don't want to get rid of the lookup table entirely because I want to be able to restrict the values users may enter, for example by giving them a drop-down list bound to the lookup table). The only disadvantage I can think of is that, when a stakeholder says "but I want my UI to say 'story', not 'fairy tale'", I would have to update all data rows in the LiteraryWork table. I can live with this, as I don't expect it to happen often in my case.

Does the first design have any other advantages I am missing? Which of the two options is considered best practice, and why?

Edit2 As I understand it, the existing answers are afraid that I am trying to break normalization, as in

```<code>LiteraryWork
Title                           Type        LiteraryWorkTypeIsFiction
Winnie The Pooh                 Novel       Yes
The Nightingale and the Rose    Fairy Tale  Yes
Snowwhite                       Fairy Tale  Yes
</code>```

To make it clear: the above is not what I am trying to do. Instead, if there really was more information pertaining to LiteraryWorkType, and I was using string IDs, I would record it this way:

```<code>LiteraryWork
Title                           Type
Winnie The Pooh                 Novel
The Nightingale and the Rose    Fairy Tale
Snowwhite                       Fairy Tale

LiteraryWorkType
TypeName         IsFiction
Novel            Yes
Fairy Tale       Yes
Conference paper No
</code>```

The only difference to the "typical" database design would be that the ID is a nvarchar, not an integer. Which certainly has its drawbacks in storage needed, as pointed out, but I don't see which normalization rule it is supposed to hurt.

But this example aside, I am not trying to use string IDs when there actually is more information to be recorded about a LiteraryWorkType (so that LiteraryWorkType should be considered an entity in its own right). I am speaking about cases as simple as the toy example I gave at the beginning: the whole second table exists only because SQL has no "enum" type, and each data record in it consists of nothing but a single word, unique between records.

答:
Does the first design have any other advantages I am missing?

You mean besides storing N fewer bytes per instance? Strings are big. Unicode strings are bigger.

Worse yet, by denormalizing the structure, you now have to change the name in N places rather than 1 if you have a typo. Or in another case, when you want to expose those names in other languages.

In general, the tradeoffs for this denormalization are well researched.


问:
Are there standard style guides for PHP?
I've been working in a very small team for PHP development and we've been using an ad-hoc, "Invented Here" style guide. Now that our team and codebase is growing, we would like to use a more broadly-used style guide that would be, if not an official standard, a de facto standards used in many PHP communities. Does such a thing exist as it exists in the C/C++/Java/Javascript/etc. circles ?</p>

答:
The PHP Framework Interop Group has released a series of coding standard recommendations:

PSR-0: Autoloading Standard

PSR-1: Basic Coding Standard

PSR-2: Coding Style Guide (this is what you are looking for)

PSR-3: Logger Interface

FIG's recommendations are far from an official standard, and I wouldn't even consider them a de facto standard, but they are the more coherent set of recommendations for PHP we have.

Other than FIG's recommendations, you should take a look at Zend Framework's standards, which include coding style recommendations, and PEAR's standards. Personally I tend to favour FIG's recommendations, they are a bit more coherent than every other set of PHP standards I've seen and are more widely adopted.

You should also take a look at PHP CodeSniffer. It's a tool that detects violations of a defined (and configurable) set of coding standards and can be easily automated via Phing. If you decide to follow FIG's recommendations, you could also use PHP-CS-Fixer to rewrite your code to be PSR-1 and PSR-2 compliant (with a pre-commit hook, for example).

Lastly, keep in mind that the main reason for adopting a coding style standard is consistency, you'll never find a set of standards that will make everyone in your team happy. It doesn't really matter which set of standards you'll pick, what matters is that you pick one and stick with it.


答:
Yes, there are couple of standards used in the PHP world. Two of them deserve special recomendation.

The PEAR standard, which should be used by all PEAR packages:
http://pear.php.net/manual/nl/standards.php

and the PSR standard, which is supported by some big PHP groups like Symfony, PEAR(again), Drupal, Joomla etc.
https://github.com/php-fig/fig-standards

Title: Are there standard style guides for PHP?

Body: I've been working in a very small team for PHP development and we've been using an ad-hoc, "Invented Here" style guide. Now that our team and codebase is growing, we would like to use a more broadly-used style guide that would be, if not an official standard, a de facto standards used in many PHP communities. Does such a thing exist as it exists in the C/C++/Java/Javascript/etc. circles ?</p>


答:
Repeating a variable length string over many rows (both data and indexes) is far less efficient than storing a tinyint value.

The string "Fairy Tale" takes 12 bytes at least on most systems including 2 for length.

You have denormalised and added data modification anomaly risk

You then have case sensitivity and collation to take into account for comparisons

Edit:

Your main problem is database size and bloating because rows are longer then necessary.
This means less rows per page and more memory use for queries. See these for why

https://dba.stackexchange.com/q/4968/630

https://stackoverflow.com/a/5654947/27535

I've seen huge databases that don't use lookup tables (designed by Hibernate ORM on MySQL) and have long strings repeated. By my estimate, the database could have been 60% smaller at least.

Normalisation isn't an issue if you are using lookup table on the natural key. Which you have clarified

Title: Should lookup tables enumerating strings have an integer primary key?

Body:
When I learned relational databases, the prof said that one would "almost always" want an artificial int as the primary key in a table, but did not specify what the exceptions are. At some time I stopped using them for junction tables, and never had a problem.

Now I am making a database with a lot of lookup tables, and wonder whether this is a case where leaving artificial keys out wouldn't make for a cleaner design and simple programming.

A toy example: assume that this is a mockup of the UI I want to achieve.

The design option with artificial IDs would be (Type is a foreign key):

```<code>LiteraryWork
Title                           Type
Winnie The Pooh                 1
The Nightingale and the Rose    2
Snowwhite                       2

LiteraryWorkType
ID TypeName
1  Novel
2  Fairy Tale
</code>```

And the option without them uses the Type name itself as the key (again, the column Type is properly declared as a foreign key):

```<code>LiteraryWork
Title                           Type
Winnie The Pooh                 Novel
The Nightingale and the Rose    Fairy Tale
Snowwhite                       Fairy Tale

LiteraryWorkType
TypeName
Novel
Fairy Tale
</code>```

I tend towards using the second option, because I would need one less join when showing data on the screen. (I don't want to get rid of the lookup table entirely because I want to be able to restrict the values users may enter, for example by giving them a drop-down list bound to the lookup table). The only disadvantage I can think of is that, when a stakeholder says "but I want my UI to say 'story', not 'fairy tale'", I would have to update all data rows in the LiteraryWork table. I can live with this, as I don't expect it to happen often in my case.

Does the first design have any other advantages I am missing? Which of the two options is considered best practice, and why?

Edit2 As I understand it, the existing answers are afraid that I am trying to break normalization, as in

```<code>LiteraryWork
Title                           Type        LiteraryWorkTypeIsFiction
Winnie The Pooh                 Novel       Yes
The Nightingale and the Rose    Fairy Tale  Yes
Snowwhite                       Fairy Tale  Yes
</code>```

To make it clear: the above is not what I am trying to do. Instead, if there really was more information pertaining to LiteraryWorkType, and I was using string IDs, I would record it this way:

```<code>LiteraryWork
Title                           Type
Winnie The Pooh                 Novel
The Nightingale and the Rose    Fairy Tale
Snowwhite                       Fairy Tale

LiteraryWorkType
TypeName         IsFiction
Novel            Yes
Fairy Tale       Yes
Conference paper No
</code>```

The only difference to the "typical" database design would be that the ID is a nvarchar, not an integer. Which certainly has its drawbacks in storage needed, as pointed out, but I don't see which normalization rule it is supposed to hurt.

But this example aside, I am not trying to use string IDs when there actually is more information to be recorded about a LiteraryWorkType (so that LiteraryWorkType should be considered an entity in its own right). I am speaking about cases as simple as the toy example I gave at the beginning: the whole second table exists only because SQL has no "enum" type, and each data record in it consists of nothing but a single word, unique between records.


问:
What is a static method compared to instance/class/private/public methods?
I'm learning programming in Objective-C and I can't understand what a static method is.  I know what class/instance/private/public methods are.  Can someone explain what it is using an example and comparing it to the others I mentioned?  And in what situation would someone use it?

From what I read on Wikipedia, it sounds like a class method that can't access anything in self.  This sounds to me like its a stand-alone function - that shouldn't be associated with any class in the first place, since it can't access self.

答:
Yes, a static class method belongs to a class but not to a specific object of this class. So it can't access any data in an object.

Static methods are used to provide functionality on the class level. These should of course still be related to this class. There are many reasons why you could use this. For example you may have a class that needs many parameters for object creation and want to have a few "default setups", then you would write a static method that returns an object of the class. Or you want methods that work on lists of objects like for example calling their print methods.


答:
I'm learning programming in Objective-C and I can't understand what a static method is.

Objective-C doesn't have "static methods". It also doesn't have private methods. It does have class methods (marked with a +) and instance methods (marked with a -). Class methods are similar to static methods in C++ in that you can call them without having an instance of the class that defines them, so I expect you're asking about class methods and why they're useful.

In Objective-C, classes themselves are a kind of object, and you can send messages to them just as you send messages to an instance of a class (although the messages that you can send are different). Class methods are used whenever you want the class to do something but don't have an instance of the class. They're often used for getting or creating instances of the class. A perfect example is the +alloc method. +alloc creates an instance of a class by allocating memory for that instance; it's then up to you to initialize the instance with an appropriate initializer:

```<code>Foo *f = [[Foo alloc] initWithBar:bar];
</code>```

Here we're sending the message alloc to the object that is the Foo class itself in order to create an new instance of Foo. Then we're sending the message initWithBar: to the new instance in order to initialize it with the object bar.

Similarly, class methods are often used as "convenience constructors" to create an object in one step rather than the two above:

```<code>NSString *s = [NSString stringWithFormat:@"%f", someFloat];
</code>```

Here we just send a message to the class NSString (remember, classes are themselves objects) and get back a properly initialized string.

Without class methods, there would be no way to create instances of classes.

Sometimes a class manages access to a shared instance of itself. In those cases, the class will often provides a method to retrieve that shared object:

```<code>NSFileManager *fileManager = [NSFileManager defaultManager];
</code>```

Most of the time you don't need to create your own NSFileManager instance -- you can just use the shared object. Having the NSFileManager class manage that object makes sense -- it's easy to figure out how to get the shared instance, and the way the shared file manager is handled may change as the implementation of NSFileManager changes.

From what I read on Wikipedia, it sounds like a class method that
  can't access anything in self.

self is valid in a class method, but it refers to the class object and not to any instance of the class. So you're right that you can't access any instance variables from within a class method, but that doesn't mean that the message should be a "stand-alone function" entirely unrelated to the class.

Title: What is a static method compared to instance/class/private/public methods?

Body:
I'm learning programming in Objective-C and I can't understand what a static method is.  I know what class/instance/private/public methods are.  Can someone explain what it is using an example and comparing it to the others I mentioned?  And in what situation would someone use it?

From what I read on Wikipedia, it sounds like a class method that can't access anything in self.  This sounds to me like its a stand-alone function - that shouldn't be associated with any class in the first place, since it can't access self.

Body:
I'm learning programming in Objective-C and I can't understand what a static method is.

Objective-C doesn't have "static methods". It also doesn't have private methods. It does have class methods (marked with a +) and instance methods (marked with a -). Class methods are similar to static methods in C++ in that you can call them without having an instance of the class that defines them, so I expect you're asking about class methods and why they're useful.

In Objective-C, classes themselves are a kind of object, and you can send messages to them just as you send messages to an instance of a class (although the messages that you can send are different). Class methods are used whenever you want the class to do something but don't have an instance of the class. They're often used for getting or creating instances of the class. A perfect example is the +alloc method. +alloc creates an instance of a class by allocating memory for that instance; it's then up to you to initialize the instance with an appropriate initializer:

Foo *f = [[Foo alloc] initWithBar:bar];

Here we're sending the message alloc to the object that is the Foo class itself in order to create an new instance of Foo. Then we're sending the message initWithBar: to the new instance in order to initialize it with the object bar.

Similarly, class methods are often used as "convenience constructors" to create an object in one step rather than the two above:

NSString *s = [NSString stringWithFormat:@"%f", someFloat];

Here we just send a message to the class NSString (remember, classes are themselves objects) and get back a properly initialized string.

Without class methods, there would be no way to create instances of classes.

Sometimes a class manages access to a shared instance of itself. In those cases, the class will often provides a method to retrieve that shared object:

NSFileManager *fileManager = [NSFileManager defaultManager];

Most of the time you don't need to create your own NSFileManager instance -- you can just use the shared object. Having the NSFileManager class manage that object makes sense -- it's easy to figure out how to get the shared instance, and the way the shared file manager is handled may change as the implementation of NSFileManager changes.

From what I read on Wikipedia, it sounds like a class method that
  can't access anything in self.

self is valid in a class method, but it refers to the class object and not to any instance of the class. So you're right that you can't access any instance variables from within a class method, but that doesn't mean that the message should be a "stand-alone function" entirely unrelated to the class.


问:
Keep a programming language backwards compatible vs. fixing its flaws
First, some context (stuff that most of you know anyway):

Every popular programming language has a clear evolution, most of the time marked by its version: you have Java 5, 6, 7 etc., PHP 5.1, 5.2, 5.3 etc. Releasing a new version makes new APIs available, fixes bugs, adds new features, new frameworks etc. So all in all: it's good.

But what about the language's (or platform's) problems? If and when there's something wrong in a language, developers either avoid it (if they can) or they learn to live with it.

Now, the developers of those languages get a lot of feedback from the programmers that use them. So it kind of makes sense that, as time (and version numbers) goes by, the problems in those languages will slowly but surely go away. Well, not really. Why? Backwards compatibility, that's why. But why is this so? Read below for a more concrete situation.

The best way I can explain my question is to use PHP as an example:

PHP is loved, and hated by thousands of people. All languages have flaws, but apparently PHP is special. Check out this blog post. It has a very long list of so called flaws in PHP. Now, I'm not a PHP developer (not yet), but I read through all of it and I'm sure that a big chunk of that list are indeed real issues. (Not all of it, since it's potentially subjective).

Now, if I was one of the guys who actively develops PHP, I would surely want to fix those problems, one by one. However, if I do that, then code that relies on a particular behavior of the language will break if it runs on the new version. Summing it up in 2 words: backwards compatibility.

What I don't understand is: why should I keep PHP backwards compatible? If I release PHP version 8 with all those problems fixed, can't I just put a big warning on it saying: "Don't run old code on this version !"?

There is a thing called deprecation. We had it for years and it works. In the context of PHP: look at how these days people actively discourage the use of the mysql_* functions (and instead recommend mysqli_* and PDO). Deprecation works. We can use it. We should use it. If it works for functions, why shouldn't it work for entire languages?

Let's say I (the developer of PHP) do this:

Launch a new version of PHP (let's say 8) with all of those flaws fixed

New projects will start using that version, since it's much better, clearer, more secure etc.

However, in order not to abandon older versions of PHP, I keep releasing updates to it, fixing security issues, bugs etc. This makes sense for reasons that I'm not listing here. It's common practice: look for example at how Oracle kept updating version 5.1.x of MySQL, even though it mostly focused on version 5.5.x.

After about 3 or 4 years, I stop updating old versions of PHP and leave them to die. This is fine, since in those 3 or 4 years, most projects will have switched to PHP 8 anyway.

My question is: Do all these steps make sense? Would it be so hard to do? If it can be done, then why isn't it done?

Yes, the downside is that you break backwards compatibility. But isn't that a price worth paying ? As an upside, in 3 or 4 years you'll have a language that has 90 % of its problems fixed.... a language much more pleasant to work with. Its name will ensure its popularity.

EDIT: OK, so I didn't expressed myself correctly when I said that in 3 or 4 years people will move to the hypothetical PHP 8. What I meant was: in 3 or 4 years, people will use PHP 8 if they start a new project.

答:
I don't know if that's a problem for PHP code, but in many languages old, legacy code is never updated after years or, sometimes, even decades, because it works, is critical for the business running it and is too big (say millions of SLOC), so it would not make sense to rewrite it. That's a reason why java made backward-compatability an almost religious issue, despite know old problems, especially in libraries (even if they are easier to update). I guess a lot of code from the Linux kernel was not updated for decades too, despite the adoption of standards like C99 and C11.

Even in languages that are less "entreprisey", breaking old, functional code can be a problem. That's what happened with Python 2 -> 3. A whole bunch of libraries and system scripts were stable and not maintained anymore, not because they were abandoned but because they were stable and doing their work. Adapting them takes a few years. So, as a developer, you cannot necessarily jump to python 3 if your favorite library hasn't made the move yet, so your own code will not work under python 3 either, thus resulting in community fragmentation.


答:
It sounds fine, but rarely works out in practice; people are extremely reluctant to change running code, and even for new, green-field projects they are very reluctant to switch way from a language/version that they already know.

Changing existing, running code that "works fine" is not something that ranks high on any project's priority list. Rather than applying effort to things that the managers thought had been paid for already, just to be able to upgrade to a newer release of a language or platform, they will decree that the developers should just stay on the old release "for now". You can try to entice your users with great features only available in the new release, but it's a gamble where you risk decreasing your user base for no clear gain for the language; cool, modern features cannot easily be weighed against the price of fragmented installation base in popular opinion, and you run the risk of getting a reputation for being an "upgrade treadmill" that requires constant effort to keep running when compared to more relaxed languages/platforms.

(Obviously, most of this doesn't apply to projects written by hobbyists just for their own pleasure. However (here be flamebait...) PHP is disproportionally rarely chosen by hackers because it's such a pleasure to write with in the first place.)

Title: Keep a programming language backwards compatible vs. fixing its flaws

Body:
First, some context (stuff that most of you know anyway):

Every popular programming language has a clear evolution, most of the time marked by its version: you have Java 5, 6, 7 etc., PHP 5.1, 5.2, 5.3 etc. Releasing a new version makes new APIs available, fixes bugs, adds new features, new frameworks etc. So all in all: it's good.

But what about the language's (or platform's) problems? If and when there's something wrong in a language, developers either avoid it (if they can) or they learn to live with it.

Now, the developers of those languages get a lot of feedback from the programmers that use them. So it kind of makes sense that, as time (and version numbers) goes by, the problems in those languages will slowly but surely go away. Well, not really. Why? Backwards compatibility, that's why. But why is this so? Read below for a more concrete situation.

The best way I can explain my question is to use PHP as an example:

PHP is loved, and hated by thousands of people. All languages have flaws, but apparently PHP is special. Check out this blog post. It has a very long list of so called flaws in PHP. Now, I'm not a PHP developer (not yet), but I read through all of it and I'm sure that a big chunk of that list are indeed real issues. (Not all of it, since it's potentially subjective).

Now, if I was one of the guys who actively develops PHP, I would surely want to fix those problems, one by one. However, if I do that, then code that relies on a particular behavior of the language will break if it runs on the new version. Summing it up in 2 words: backwards compatibility.

What I don't understand is: why should I keep PHP backwards compatible? If I release PHP version 8 with all those problems fixed, can't I just put a big warning on it saying: "Don't run old code on this version !"?

There is a thing called deprecation. We had it for years and it works. In the context of PHP: look at how these days people actively discourage the use of the mysql_* functions (and instead recommend mysqli_* and PDO). Deprecation works. We can use it. We should use it. If it works for functions, why shouldn't it work for entire languages?

Let's say I (the developer of PHP) do this:

Launch a new version of PHP (let's say 8) with all of those flaws fixed

New projects will start using that version, since it's much better, clearer, more secure etc.

However, in order not to abandon older versions of PHP, I keep releasing updates to it, fixing security issues, bugs etc. This makes sense for reasons that I'm not listing here. It's common practice: look for example at how Oracle kept updating version 5.1.x of MySQL, even though it mostly focused on version 5.5.x.

After about 3 or 4 years, I stop updating old versions of PHP and leave them to die. This is fine, since in those 3 or 4 years, most projects will have switched to PHP 8 anyway.

My question is: Do all these steps make sense? Would it be so hard to do? If it can be done, then why isn't it done?

Yes, the downside is that you break backwards compatibility. But isn't that a price worth paying ? As an upside, in 3 or 4 years you'll have a language that has 90 % of its problems fixed.... a language much more pleasant to work with. Its name will ensure its popularity.

EDIT: OK, so I didn't expressed myself correctly when I said that in 3 or 4 years people will move to the hypothetical PHP 8. What I meant was: in 3 or 4 years, people will use PHP 8 if they start a new project.


答:
You're making a lot of assumptions about human behavior.  If you change it too much, people will evaluate your competitors, since they're going to have to spend significant effort switching anyway.  For open source languages, people will just fork the old version.

Look at python for an example.  3.x has been available for four years, and still isn't widely adopted.  People try to use it for brand new projects, but I think you're underestimating just how much code work is maintenance.

Of course, most people didn't consider python 2.x to be "flawed."  They didn't have complaints like php users.  Php is in a much more precarious position, because a lot of people only stick with it because of its large existing code base.  If you lost backwards compatibility, a lot of people would take the opportunity they've been waiting for to move to python.


答:
Disclaimer: I manage a ColdFusion user group.

ColdFusion suffers the same problems: loved by many, despised by many. In addition, tons and tons of FUD based on pre-Java versions. ColdFusion 10 came out last year, is a huge seller and last week I signed up to test the pre-release of version 11. Also, there are two major open source alternatives, one is backed by JBoss.

There are TONS of new functions in CF10 that I would love to implement, but migrating from CF 7 or 8 can be difficult depending on the size of your code base, the number of upcoming projects and the resources you have to regression test everything once you're on the latest version. I've run into a number of minor syntactical differences between 8 and 9, as well as edge cases where the code doesn't compile the same way. Once found, I documented them into our Coding Standards so they aren't used in future projects or by new developers.

That said, if ColdFusion 11 (or any programming language) were to completely deprecate certain functions and syntax, the level of effort to find and replace functionality could be enormous. The testing effort could be gargantuan. Will companies pay their developers, QA and project managers to find, replace and test all of those deprecated things? Doubtful.

If the latest version of a language is backwards compatible, but introduces a boost in performance with no code changes (CF9 is about 30% faster than CF8 and CF10 is much faster than CF9), who cares about changing function calls if they still work?

As a company, we have to worry about pleasing our clients and delivering their needs in order to bill services, build the business and recruit more clients.

FWIW, I would love to get us onto the latest version of jQuery at some point, but since certain functions were deprecated a few versions after what we use, and given the volume of JavaScript we have in the system, I don't know how we're going to pull that off.


答:
What happens when your users want to give multiple classifications to a story? What happens when you want to provide translations of the book type...or if you want to allow users to have their own private library with their own classifications? Once you hit one of those scenarios, future you will thank past you (or today you) for giving the table a unique key.

Table keys should have no significance within the system, because business rules change. Something that is "always" unique at first glance will have edge cases as you dive deeper.


答:
You're underestimating the impact of backwards compatibility; your estimate that all active projects would migrate in 3 or 4 years is far too optimistic.

Suppose I'm a PHP developer.  PHP has flaws, but I know how to work around those flaws - that's part of the reason I get paid as a PHP developer.  Now suppose that PHP 8 comes out and fixes those flaws, but it's not backwards compatible.  As a result:

I have to spend time updating my code for PHP 8.  That's time that I could spend responding to customer requests, implementing new features, keeping up with the competition.

Even after I've done this, there's a good chance that I've missed some corner case or unforeseen compatibility issue, introducing bugs in my code.

Given this, there's a strong incentive to never migrate to PHP 8, even if it is "better, clearer, more secure etc."  It's estimated that there are still billions of lines of COBOL (!) - even though there are obviously much better technologies available, the cost of an update, combined with the risk of bugs, just doesn't make it worth it.

Second, even if I decide to migrate my own code, any nontrivial app depends on third-party libraries, and there's no guarantee that the third-party libraries will migrate.  For example, Python 3 was released in December 2008, but Django (probably the leading Python web framework) didn't have stable, production-ready Python 3 support for almost five years (see here and here).


问:
Any performance advantage in copying the session to a variable?
I have a fair number of items in a session, and I am wondering if there are any advantages to copying the session variable to a normal php variable (in order to close the session file as quickly as possible) and then do any calls from there. Something like:

```<code>session_start();
$copiedSession = $_SESSION;
session_write_close();
if (isset($copiedSessionData['foo'])){
    ...
}
...
</code>```

I am looking for ways to test performance on this.

Does it make sense to do so?

Is there a break-even point where it helps / doesn't help?

答:
My PHP experience is very rusty, but in the example you provided, aren't you just creating a reference variable pointing to the session?  In other words,

```<code>$copiedSession = $_SESSION;
</code>```

doesn't give you a "copy" of the session, but just a second variable from which you can reach it.

You want a deep copy.

```<code>foreach ($_SESSION as $key => $value)
    $copiedSession[$key] = $value
</code>```

I think that is what you want.

As for better performance, I suspect not.  It depends on whether $_SESSION is a pure associative array or if it is a special file-backed map that reads/writes through in real-time.

Judging by the PHP manual's SessionHandler interface, whose read/write methods take a session id and session array, I suspect that $_SESSION is a plain old array which comes from SessionHandler::read and gets passed back to SessionHandler::write.

However, to be absolutely sure, the best way is simply to test it.

You could do reading and writing in a loop say 10,000 times against the $_SESSION variable directly and measure min, max and mean execution time.  Then do the same thing against a copy (using the code I gave you above, not the reference pointer code) and compare the numbers.

Body:
My PHP experience is very rusty, but in the example you provided, aren't you just creating a reference variable pointing to the session?  In other words,

$copiedSession = $_SESSION;

doesn't give you a "copy" of the session, but just a second variable from which you can reach it.

You want a deep copy.

foreach ($_SESSION as $key => $value)
    $copiedSession[$key] = $value

I think that is what you want.

As for better performance, I suspect not.  It depends on whether $_SESSION is a pure associative array or if it is a special file-backed map that reads/writes through in real-time.

Judging by the PHP manual's SessionHandler interface, whose read/write methods take a session id and session array, I suspect that $_SESSION is a plain old array which comes from SessionHandler::read and gets passed back to SessionHandler::write.

However, to be absolutely sure, the best way is simply to test it.

You could do reading and writing in a loop say 10,000 times against the $_SESSION variable directly and measure min, max and mean execution time.  Then do the same thing against a copy (using the code I gave you above, not the reference pointer code) and compare the numbers.


答:
For any language other than PHP I'd say, yeah, that absolutely makes sense! That's exactly what Python is doing with the switch to Python 3.

However, the problem with PHP is that there are too many flaws with the language design itself, thus what you're calling "PHP 8" would be a completely different language. And if you'd have to switch to different language, why would you stick with new PHP, rather than any of currently existing and stable alternatives?

Also PHP community is extremely slow to adapt anything new. Just look how long it took to get rid of register_globals. It's been known to be a security risk since year 2000. It's been only finally removed 12 years later. Another example, when PHP5 was introduced, it was huge improvement over PHP4, yet community did not adapt it. I took 4 years and massive actions such as GoPHP5 to jumpstart the adoption. And that even didn't have significant amount of backwards incompatible changes.


问:
Exception Handling in Java web application
I know exception handling is a topic often discussed in the world of Java. I've read a few threads on here and SO as well.

https://stackoverflow.com/questions/2169339/exception-handling-in-a-java-web-application

I find myself identifying with principles such as Do not suppress or ignore exceptions, Do not catch top-level exceptions, and avoid anti-patterns like Log and Throw.

http://today.java.net/article/2006/04/04/exception-handling-antipatterns#throwingException
http://www.onjava.com/pub/a/onjava/2003/11/19/exceptions.html?page=2

Question #1, is there a different standard of practice when it comes to web applications? For example, is it a legitimate use case to catch Exception for logging purposes and then throw it up the stack?

```<code>function void xyz() throws Exception {
    try {
    } catch (Exception e) {
        LOG.error("ERROR: " + e);
        throw e;
    }
}

function void otherFuncA() throws Exception {
    xyz();
}

function void otherFuncB() {
    try {
        xyz();
    } catch (Exception e) {
        LOG.error("ERROR: " + e);
        throw e;
    }
}
</code>```

I am finding it very hard to accept as a practice because it is generating so much unnecessary code (see otherFuncA and otherFuncB), affecting the function calls all through the different layers (DAO, Service, Controller, etc.)

Question #2, do I lose information about an error (let's say what caused a NullPointerException) if I let unexpected, unchecked exceptions float up to the Controller layer and then, and ONLY then, handle it there (catch Exception and throw stack trace)? As opposed to logging immediately, and re-throwing (seen above).

Of course, I will still check for specific exception types where applicable.

I seem to find the stack trace is often a better indicator of what went wrong vs. which specific field was causing an error...  I am really interested in input from more experienced developers and what best practices/reasoning guide your exception handling.

答:
1) No.

2) Not if you put relevant information into the Exception's message - I find that a much preferable alternative.


问:
Beta-testing app good practice
I have just released an iOS app for beta-testing with TestFlight.

I'm wondering what is good practice during beta-testing?

Should I halt development of the app during beta-testing?

Should I continue developing but make a snapshot image of what the
code looked like when it was released for beta-testing?

Issues that could rise that I can think of is that if I make any
changes to the code and then a bug is detected in the code that I
have changed this would not be ideal.

There are probably other issues to deal with but these are the ones that I could think of at the moment.

I'm the only developer of the app at the moment.

答:
When you ask if you should make a "snapshot", it sounds to me like you're not using source control - or if you are, you're not taking full advantage of it.  I would VERY strongly recommend getting hold of a client for Git or Mercurial (Git has better integration with iOS dev tools, if I remember correctly) and setting up a repository on Github or Bitbucket. You can set it to private, so you wouldn't be giving the world access to your source code, and it keeps your code safe from any mishaps, from accidental deletion to loss or damage to the computer you're working on. It also lets you roll back to previous versions in case of problems, compare to earlier versions to find changes that might have caused some behaviour you're trying to track down, and - crucially for your question - it preserves revision history and allows branching.

A source control branch basically lets you split off a version, work on it, and then decide whether to merge it back into the original version. So, you could create a branch from where you are now, and that branch would preserve the state of your code as it was when you gave it to the testers. Any features you add from now on would be kept separate in one branch, and if the testers find bugs, you can fix them in the other branch. Each time you fix a bug, you check to see if the "features" branch needs the fix as well - if it does, you can just merge the fix into both branches. When the test is over, you can pretty much forget about the "testing" branch because you know that any fixes you need to have in the main version were merged in already.

There are various patterns and techniques to determine when and why to branch, all aimed at solving exactly the problem you're describing. A popular one is the "Git-Flow" pattern, although (in my opinion) that has the flaw that it looks rather more complex than it needs to be (I've used it a fair bit, and it's not as complex as it looks, but it's not as simple as it could be, either).

My advice would be to:

get Git installed

get a Bitbucket or Github account

shove your current version of the code into a repository using the above

make a branch called "version-1"

from "version-1", make a branch called "version-2"

keep new features in "version-2"

fix bugs that the testers find in "version-1" and rebase "version-2" each time you do

when the testers stop finding bugs, forget about "version-1", make a new branch from "version-2" called "version-3", give "version-2" to the testers and repeat

You can keep doing that until you run out of new features to add, and then you just get the current version tested until they stop finding bugs, and then when you've fixed the bugs, release the app.

Edit:

The difference between "merge" and "rebase":

Merge does pretty much what it says - it tries to combine the two versions. If one version has changed an area and the other hasn't, that's easy - it takes the changes. If both versions have made changes to the same area, it'll ask you to pick one or the other. There are a variety of diffmerge tools designed to help you work out what's been changed in each version, compare the two side by side, spot where the conflicts are and work out which you need to take.

Rebase is a little different. When you rebase a branch, it "unwinds" the changes you've made to that branch - basically doing them backwards and remembering them. When the branch is back to how it was when it was branched, it gets the current version of the parent branch. Then, it attempts to replay your changes back on top of the new version. Basically, it's as if you'd made the branch now, not a few days ago or whenever. This can be a really powerful tool, and it's a great way of including changes to parent branches in your code. Imagine you have a version being tested in one branch, and you're working on new features in a second branch. Using the method I described above, the "test" branch would be the parent of the "new features" branch. When your testers find a bug, you jump into the "test" branch and fix it. Now, if you'd waited until after the bugfix before starting to develop new features, then you could have built those features with this fix already in place. Rebase basically tries to act like a time machine so that you can do just that. It undoes what you've done, gets the current version, and then makes your changes to it. Obviously, in some cases there will be changes in your parent branch that affect the changes in the branch you're rebasing, so it won't always work, but in my experience it's generally pretty good. When it doesn't work, you can always just use a regular merge, but when it does work, it's really useful - and like I said, in my experience it tends to work quite well. Sometimes you'll have to go back and tweak after rebasing, but often it Just Works.

Git-Flow (ish)

This isn't quite Git-Flow, but it takes the principles. One of the main criticisms of Git-Flow is that it can get complex and leave you with loads of branches; this tries to address that a little.

Master branch. You only put  working, tested code in here, and you never actually push to it directly - you just merge it in. Each new commit to this branch is a new release to the public.

Development branch. This is branched from master. This represents the state of the version you're working on. You only put stuff in here when you're pretty sure it's working, although sometimes bugs will turn up.

Feature branches. When you want to add a feature, you make a branch off development, build the feature in there, and merge back in. These have names starting with "feature/" to help you organise. Name them something that explains what they're for, like "feature/SearchFunction" or whatever. When the branch is merged in, you can close it. You can leave the branch open if you want, maybe to improve the feature or as somewhere to collect fixes for the feature if it turns out you need any, but remember to rebase the branch before you start work on that. Either way, the next time you merge development into master you should close any feature branches that had already been merged in. If you have a feature that you want to save for a future release, or that isn't finished yet, then you wouldn't merge this into development until it's ready, so it can stay open from one release to the next.

Bugfix branches. If you find a bug in development and there isn't an open feature branch to fix it in, create a branch whose name starts with "bugfix/" and fix the bug in there. When you've checked that the fix works, merge the branch back into development and close it. If the bug is in a feature you've merged in but whose branch is still open, you can rebase that branch, fix the bug in there, and then merge it in again.

Hotfix branches. If you find a bug in master, then that means it's in the version your users have. This can't wait for the next version. Make a branch from master whose name starts with "hotfix/" and fix the bug in here. Don't merge it back in until you're sure it works. When you merge it back in, you'll need to merge it into development as well, or else you'll go back to the old buggy code when you next merge development into master. You then release the contents of master as a patch release.

Release branches. At some point, you have to say "ok, no more new features - we need to get this version bug-free and released". When this happens, you make a branch from development. This branch is given a version number; whichever comes after the last version you released. You can then give this branch to your beta testers. Only bugfixes are allowed in this branch. When it's done and you're ready to release, you merge it into master, and into development to make sure the fixes don't get overwritten. Then you can release the contents of master to your users.

This can lead to a lot of branches, but generally speaking, only a few of them exist at any given point. Master is always there, and you can almost always ignore it. Just remember: when code goes into master, build that code and release it as your next version. Development is also always there, but again, you can kind of ignore it; nobody will be working directly in this branch. If you have any in-house testers (not beta testers), they'll be testing what's in here; it's kind of the "alpha-test" code.

You said you're the only developer; that means that I wouldn't expect you to have more than four branches open for most of the time. Master and develop make two, then the feature you're working on makes three, and then if you get interrupted by a bug you decide you should fix then you'll have a bugfix branch. If you get a report of a bug in master and decide to fix that before finishing any of the rest then it'll go up to five. If you get partway into implementing a feature and get stuck or decide to put in on hold for a bit, then that branch will hang around and add to your total. So, worst-case is six branches open at once, but only three of those are being actively worked on, so it's not too difficult to organise.

Title: Beta-testing app good practice


答:
There's a tradeoff here; some bugs REALLY need fixing, but some things can't be changed without breaking someone's code somewhere. I seem to remember someone stating as a "rule" that every bugfix will break someone's project, no matter how obscure or obviously-broken the bug is, someone will be using it for something. Such is the nature of programmers.

This is (to my mind) the difference between major releases, minor releases, and revisions. As a general principle:

Major releases are assumed to contain breaking changes.

Minor releases may change behaviour slightly.

Revisions should be pretty much cross-compatible.

For example, if I'm writing something in v2.3 of a language, I wouldn't expect to notice any difference if I upgrade to v2.3.2. If I upgrade to v2.4, then a few things might change - small syntax tweaks, some functions behave a little differently so I have to tweak logic, etc. If I upgrade to v3.0, I would not be surprised if it broke entirely - functions deprecated or missing, operations not supported or changed so much that I can't just tweak it back into line, I actually have to rewrite some functions to account for the new changes.

Edit:

Steve Vance's paper Advanced SCM Branching Strategies has this to say:

Typically, there are two to three levels of release, named by numbers connected with periods (e.g. 1.2.3). [...] In this structure the first number is associated with a major version, indicating that it has significant feature and functional enhancements from the previous; there may also be significant incompatibilities that require migration. The second number represents a minor version, which contains lesser feature and function enhancements, a significant number of bug fixes, and no incompatibilities. The third number refers to a patch level, signifying almost exclusively a collection of bug fixes; no feature or function enhancements and no incompatibilities are allowed between patch levels.

The only alteration I'd make to this is the aforementioned principle that programmers often find ways to "use" bugs, so a minor version with "a significant number of bug fixes, and no incompatibilities" might be difficult, because it's likely that those bugs will either break something that used them, or will cause a workaround to become unnecessary and start causing problems.


答:
It makes sense to do this when your storage engine is the file system and you have multiple scripts accessing the same session data. (ex: ajax calls). The file containing the session data will be locked until the first script ends execution and this can lead to performance issues.
You can find a detailed explanation here</p>

Title: Any performance advantage in copying the session to a variable?

Body:
I have a fair number of items in a session, and I am wondering if there are any advantages to copying the session variable to a normal php variable (in order to close the session file as quickly as possible) and then do any calls from there. Something like:

```<code>session_start();
$copiedSession = $_SESSION;
session_write_close();
if (isset($copiedSessionData['foo'])){
    ...
}
...
</code>```

I am looking for ways to test performance on this.

Does it make sense to do so?

Is there a break-even point where it helps / doesn't help?


问:
To integrate git versions as build numbers or not?
A colleague and I have been taking turns debating/discussing the issues/merits of integrating a version derived from the current git repository into our code whenever it builds.

We think the merits include:

No need to worry about human error in updating a version number

Traceability between what we find in a device and the source code it was derived from

The issues that have arisen (for us) include:

IDE derived build systems (e.g. MPLABX) can make it hard to figure out where to put these kinds of hooks in (and it can end up pretty cheesy in the end)

More work to actually integrate this into the build scripts/makefiles

Coupling to a particular build approach (e.g. what if one person builds with XCode and the other MPLABX) may create downstream surprises

So we're curious where others have landed on this debate. It's really easy for the discussion to become anecdotal. There are lots of people out there who are insistent on end-to-end automation, hang the amount of up front work and coupling it creates. And there are a lot of others on the other side of the debate, who just do the easiest thing that works and live with the risks.

Is there a reasoned answer to which side is best to land on?

答:
We used to be a SVN shop so this math was easy -- build number was the SVN rev and that was that. We tried to keep this going when we started moving to DCVSes and found that it failed for a few reasons.

First, who knows if rev 69bc333bc8d8 is before, after or concurrent with rev 25b0f0d1052c? There is very little context compared to the SVN system when you at least knew 101 was after 100. Second, the nature of DCVS source control makes things non linear in many ways when subsequent builds might not be advancing the same ball.

We finally settled on using a build server to distribute build numbers to things since it had the right visibility and ability to handle it.


问:
Do your stories include tasks across disciplines? How do you do capacity planning?
My organization does web projects and employs a handful of disciplines like backend dev, frontend, BA, UX, graphic design, QA. We've been pushing to have tasks for every discipline in our sprints with explicit dependencies (Can't build a page without comps, can't do comps without wires, etc). I've heard some other organizations say that scrum is only for dev tasks. Are we barking up the wrong tree? And, if not, are there any good tools for doing capacity planning when only certain resources can do certain tasks?</p>

答:
Maybe.

I've run agile with everything before. Some things (graphic design, UX, BA) are better split into different teams, and to some degree different user stories. Then the hard dependency can be resolved before you take the dependent story off the backlog.

For things like documentation or QA, these are things that need to be really done with development. They're not so much hard dependencies as related tasks that should all be completed before something can be "done".


答:
One can argue Microsoft performed a similar change with ASP.NET (as successor to classic ASP) or with VB.NET (although they made so many concessions with the latter that most of the benefits of "rebooting" the language were lost).

Anyway, if anyone remembers the nightmare of Migrating VB6 code to VB.NET even with the assistance of a migration tool, they'll agree right off that language migration tools don't work very well for major language updates.

It might be possible to move the platform forward but, you should still provide support for "deprecated" APIs through at least a few revisions.


答:
Caleb's answer is very thorough, but the bit in bold about not being able to create instances without class methods is not entirely true.   Objective-C being a hybrid language and all, you can definitely create instances without class methods.

One easy way is to call  [NSAllocateObject( NSClassFromString(@"NSObject" ),0,NULL) init];

Substitute other classes to taste.   You can of course obtain the class using other means, and if you want you can just calloc() a piece of memory and add the class pointer.


答:
I use the following scheme for a visual studio build system of a C# DLL to automatically generate version numbers (We have historically had issues with deployments not being performed correctly so needed a clean way of guaranteeing the deployment of the correct version happened).

Major - Hard coded 1, typically determined by business side

Minor - Hard coded 0, typically determined by business side

Revision - Number of days since Jan 1, 2010 (or any other arbitrary start date)

Build - Half the number of seconds since Midnight (Since it is a 16 bit unsigned number)

Note that this assumes you have 2 fungible 16-bit unsigned numbers to play with. Creating an equivalent system that uses smaller numbers could be done as well.

Also note that non-numeric fields can be helpful if you can attach them as meta-data. For instance adding the git version number as a the Informational Version number.

Title: To integrate git versions as build numbers or not?

Body:
A colleague and I have been taking turns debating/discussing the issues/merits of integrating a version derived from the current git repository into our code whenever it builds.

We think the merits include:

No need to worry about human error in updating a version number

Traceability between what we find in a device and the source code it was derived from

The issues that have arisen (for us) include:

IDE derived build systems (e.g. MPLABX) can make it hard to figure out where to put these kinds of hooks in (and it can end up pretty cheesy in the end)

More work to actually integrate this into the build scripts/makefiles

Coupling to a particular build approach (e.g. what if one person builds with XCode and the other MPLABX) may create downstream surprises

So we're curious where others have landed on this debate. It's really easy for the discussion to become anecdotal. There are lots of people out there who are insistent on end-to-end automation, hang the amount of up front work and coupling it creates. And there are a lot of others on the other side of the debate, who just do the easiest thing that works and live with the risks.

Is there a reasoned answer to which side is best to land on?


答:
Ahh yes, I've asked Alan this question a number of times, for example when he was in Potsdam and on the fonc mailing list.  Here is a more recent quote from the list which to me summed it up quite well:

After literally decades of trying to add more and more features and
  not yet  matching up to the software than ran on the machines the
  original browser was  done on, they are slowly coming around to the
  idea that they should be safely  executing programs written by others.
  It has only been in the last few years --  with Native Client in
  Chrome -- that really fast programs can be safely  downloaded as
  executables without having to have permission of a SysAdmin.

My understanding of his various answers is that he thinks web-browsers should not display (HTML) documents, possibly enriched, but simply run programs.   I personally think he is wrong in this, though I can see where he is coming from.  We already had this sort of thing with ActiveX, Java Applets, Flash and now "rich" JavaScript apps, and the experience generally wasn't good, and my personal opinion is that even now most JavaScript heavy sites are a step back from good HTML sites, not a stop forward.

Theoretically, of course, it all makes sense:  trying to add interactivity piecemeal to what is basically is document description language is backwards and akin to adding more and more epicycles to the Ptolemaic system, whereas the "right" answer is figuring out that (rich) text is a special case of a program and therefore we should just send programs.

However, given the practical success of the WWW, I think it's wise to modify our theories rather than slam the WWW for having the gall not to conform to our theories.

Title: Why did Alan Kay say, "The Internet was so well done, but the web was by amateurs"?

Body:
OK, so I paraphrased. The full quote:

The Internet was done so well that most people think of it as a natural resource like the Pacific Ocean, rather than something that was man-made. When was the last time a technology with a scale like that was so error-free? The Web, in comparison, is a joke. The Web was done by amateurs. -- Alan Kay.

I am trying to understand the history of the Internet and the web, and this statement is hard to understand. I have read elsewhere that the Internet is now used for very different things than it was designed for, and so perhaps that factors in.

What makes the Internet so well done, and what makes the web so amateurish?

(Of course, Alan Kay is fallible, and no one here is Alan Kay, so we can't know precisely why he said that, but what are some possible explanations?)

*See also the original interview*.


答:
We use git describe with version tags. The flow is basically:

create tag for the version we're working on (e.g. v1.1.2)

every build run git describe

when we ship, use the tag name

git describe provides the tag name, number of commits since the tag, and the hash of the tag. A sample tag looks like:

```<code>v1.1.2-6-a3b27gae
</code>```

This has the benefit that developers get hashes, so if something breaks between builds, the developer can easily diff the changes. It's also stupid simple to manage; just have your team lead create and push the tag on a new bugfix branch and your build system takes care of the rest.

We strip the hash (and build number) because it makes it easier for users to understand our version numbers. We find that this gives us the best of both worlds, while still providing enough relevant info when engineering a release.

Currently, we have a slightly more complicated version of this, but the idea remains.

Body:
We use git describe with version tags. The flow is basically:

create tag for the version we're working on (e.g. v1.1.2)

every build run git describe

when we ship, use the tag name

git describe provides the tag name, number of commits since the tag, and the hash of the tag. A sample tag looks like:

v1.1.2-6-a3b27gae

This has the benefit that developers get hashes, so if something breaks between builds, the developer can easily diff the changes. It's also stupid simple to manage; just have your team lead create and push the tag on a new bugfix branch and your build system takes care of the rest.

We strip the hash (and build number) because it makes it easier for users to understand our version numbers. We find that this gives us the best of both worlds, while still providing enough relevant info when engineering a release.

Currently, we have a slightly more complicated version of this, but the idea remains.


答:
It really depends on what's the target of the language - what types of applications are intended to be built with the by the language.

For example, ignoring Android, Java is mostly used in large enterprise systems and middle-ware; these types of applications tend to become very large both in size and in time. This has some implications; imagine a system with 500K+ LoC on which worker 50+ engineers in the development phase. Typically this type of system enters in maintenance after this with say 10 developers; now if the language changes and the changes are not backwards compatible the project cannot be easily migrated to a new version because the programmers that wrote some parts are gone and nobody wants to touch it. This is the smaller problem, the bigger problem consists in the fact that is kind of expensive to adapt a 500 LoC application to new language constraints. For example if generics weren't implemented with type erasure and List list = new List(); wouldn't compile millions of lines of code would need to be rewritten - which is at a great cost.

On the other hand PHP tends to be used on the web for simpler applications; usually it is developed by a single programmer or a small team. The idea is that the developers kind of know the whole project pretty well can can integrate language changes more easily. Also it's purpose is to build a site very fast, and the faster the better so if a new language feature can do this better then it is implemented even at some backwards compatibility costs.


问:
Migrating web app from php to Java
Hi I had today my first interview for  a position of android developer.In my portfolio I had a php e-commerce application that has a catalog , ajax powered shopping cart , and administrator functionality.

Because my Android knowledge is prety limited , I only started learning about 3 weeks ago , I was asked to migrate my current PHP web appplication to Java Web until April 19th when the second stage of the interview will take place , so they can asses how fast I can learn a new technology.

I have no experience with Java working on the web so I do no know where to start.

After a bit of research I found that for developing website with Java usually you use JSP, Spring or Struts.

I would like a recommendation on witch one should I learn to quickly get started on migrating the web application to Java and some resources that do not get into to mutch details just enought to get started.

答:
I had to migrate a large PHP application to Java a few years ago. I chose to migrate to plain Java + JSP rather than using a framework, and it worked out quite well for me; I find that serlvets + JSP + JSTL is extremely powerful and flexible, and doesn't bog you down too much.

I would highly recommend plain Servlets+JSP for your case if for no other reason than it will show you the core foundation of Java web development, without spending too much time learning a framework that you don't know they're actually using. If you know they're using Spring or Struts or anything else, by all means, learn that specifically; otherwise, learn the foundation and work your way outward from there.

Title: Migrating web app from php to Java


问:
What is a Developer in Test?
I was recently talking with a recruiter who wants to put me at a company for a position of Developer in Test. He essentially made it sound like a position where you get to fiddle with new programming techniques and test bugs and improvements in software but where you don't need to worry about standard deadlines. You get to be very creative in your work.

But that description was still kinda vague to me. I have been a Web Developer for a number of years now, mostly working in PHP. So I wanted to know if others in the community know more about what these positions typically entail.

I know that this might not be a subject appropriate for this forum, but it was the best fit I could find among Stack Exchange and I would really appreciate it if this wasn't closed since there is really no where else here to ask about it.

I have tried Googling it, but there isn't a lot of information out there. So what exactly is a Developer in Test?

答:
"Developer in test" usually means that you are in the QA department or in a QA role, but the focus is on writing automated tests rather than on creating and running manual test cases. Thing of it as writing software to test software. It can be a particularly challenging career choice because it takes both programming skill and a good understanding of software testing. </p>

<p>However, different titles mean different things to different companies, so the definitive answer must come from the recruiter. </p>

Title: What is a Developer in Test?

Body:
"Developer in test" usually means that you are in the QA department or in a QA role, but the focus is on writing automated tests rather than on creating and running manual test cases. Thing of it as writing software to test software. It can be a particularly challenging career choice because it takes both programming skill and a good understanding of software testing.

However, different titles mean different things to different companies, so the definitive answer must come from the recruiter.


问:
Should QA be part of the development department?
I work for a small company that has had a product development department for quite a while. What we haven't had, however, is a QA/testing group.

We are looking to add a testing group, but are struggling to determine where best to put them in the organizational structure of the company. Specifically, we are going to hire a "lead tester" position. Should they be put in as part of the product development department, or should they be a new department? Should they be somewhere else?

Our company is roughly structured as follows:

CEO

CTO

Director Product Development

Director Customer Care

Developers

VP Operations

Network engineers

Sales/sales engineers

President

Controller

答: In almost all cases, QA should be separate from Development.  While the goal between both departments is the same (releasing quality products/solutions), QA needs to feel they have the authorization to correct and make suggestions about products with development, and be on equal footing.  If the head of QA reports directly to the head of development, this can lead to QA taking a step back and being at the mercy of development (and consequently sloppier code/products get pushed to production).  </p>


答: The problem lies within the backwards compatibility issue.  Most PHP scripts I execute are running on an older RedHat server.  If I were to use the newer version of the language for future scripts, then I would have to update PHP on this server --  and run the risk of having my older scripts broken/ having to take hours to rewrite all the old code with the new standard.  Plus, all my developers are used to PHP reacting a certain way (whether that way is 'broken' or not).  If it no longer reacts that way, it could be a major hurdle for productivity, as developers may have to basically re-teach themselves PHP.  </p>


答:
I am a Software Development Engineer in Test, and have been at 2 separate companies. Currently I work for Microsoft.

Broadly speaking, Bryan Oakley is correct: you write software that tests software.

Beyond that, it depends on your level of experience, the scope of your responsibilities, and the type of software that the employer would be producing. An SDET position can include writing anything from the basics of feature level verification tests, to writing and maintaining test infrastructure to run those tests. It's also not uncommon to have SDETS that specialize in focused testing for certain types of requirements (testing security, performance/scale, usability, etc. are examples that immediately spring to mind).

The description that you received from the recruiter sounds like a poor selling technique.

You're not fiddling; you have n days to get automated test coverage over x features deployed in y different supported environments in z languages.

Oh, btw: those tests have to run fast enough for the devs to have a quick dev/test cycle because...

No standard deadlines? You're in charge of the quality of the product and the release date was set by marketing 6 months ago. The dev team is 6 weeks late delivering a stable build to your test team, and the company isn't pushing that release date (again). Is the product or service stable enough to release to a couple million (billion?) people, on the same day?

...and if (when ) customers call in with problems... "Why (the hell) didn't you catch it first?"

I hope that gives you a bit of an example of what being an SDET is like.

Title: What is a Developer in Test?

Body:
I was recently talking with a recruiter who wants to put me at a company for a position of Developer in Test. He essentially made it sound like a position where you get to fiddle with new programming techniques and test bugs and improvements in software but where you don't need to worry about standard deadlines. You get to be very creative in your work.

But that description was still kinda vague to me. I have been a Web Developer for a number of years now, mostly working in PHP. So I wanted to know if others in the community know more about what these positions typically entail.

I know that this might not be a subject appropriate for this forum, but it was the best fit I could find among Stack Exchange and I would really appreciate it if this wasn't closed since there is really no where else here to ask about it.

I have tried Googling it, but there isn't a lot of information out there. So what exactly is a Developer in Test?


问:
How do I create a web service with high amounts of traffic that works effectively with lots of different users?
I have created web services before that are used by a small number of users but have a new project that would have lots of users.

For each user that uses the services, this is what they would do:
1) Call a method on the web service that calculates a "price" based on parameters passed by the user.

2) The actual method and algorithm for calculating and returning a "price" is not very complicated and runtime would be very quick, although a look up in a database table would be necessary for each call.

3) The problem is that this method could be called over and over again for each item that needs a price, and if lots of users are using the web service (I don't know an exact number, lets say 1,000 users, 10,000 users, whatever), I don't know what different things I need to think about in terms of how to manage high traffic, many different users trying to use the method at the same time over and over again, pulling data from a table over and over again.

So pretty much I would like some advice from someone who has experience with web services with high amounts of traffic and many different users, with the method pulling from a data base table over and over again, to explain to me steps/thing I need to think about when designing the service to avoid traffic congestion, at what point a certain number of users would start slowing the service down,or just things to think/worry about, etc.

Appreciate any help, thanks!

答:
For item 2, you could definately use a cache to avoid going to the DB for every call, especially if the lookup data is not that volatile.  The lifetime of the cache will depends on how long you keep the data.  The cache could be refreshed as needed by your requirements.  As a side note, most DBs cache results of common queries anyway.

Every service has limits.  I would performance test the service to see how many calls it can handle.  Definately build it stateless, then it is just a matter of how many calls a sec it needs to service.  Say your requirements are 1,000 calls per second and your performance is 400 calls for 1 server.  Then you need 3 servers to meet your requirements.  Should be no problemto implement that sort of infrastructure.

You will not know for sure your service throughput  until it is performance tested.  Once you have baseline numbers, you can tweak the code or the environment to improve performance as needed.


问:
Converting a user management system to use ajax
I am currently building a website, which until quite recently was purely PHP. However I am now making trying to have the site use more AJAX, to lessen the page reloads. In PHP I had a lovely object orientated user class with methods for updating data, logging out, and so on. When a user logs on this would be stored as a session variable, and then any page that wishes to do anything the user could just grab it from the session and call it's methods. Clearly this use of php objects and the session doesn't really work with ajax. However I don't want to have to scrap storing the user in an object (which neatens things up somewhat), so don't just want to go down the route of defining a ton of js functions that grab the current username, and use the to do mysql queries through ajax.  Am I being stupid here, and what route would people recommend I take.</p>

答:
AJAX requests send the cookie by default. Assuming that you are mapping your user object to the PHP session, the request over AJAX should automatically have access to the session and the user object.

If you're using another method to handle sessions (e.g. a session id added to the query string) a) be wary of session spoofing, and b) append it to the AJAX request manually. And VOILA.


问:
What is a good technique to prevent unauthenticated users from accessing controller methods?
I have an event(s) controller:

```<code>class Event extends CI_Controller{

   public function index(){
   }

   public function foo(){
   }

   //Shouldn't be able to use this method unless logged in
   public function bar(){
   }

}
</code>```

And I'm trying to organise my code so it's fairly tidy and straightforward. Just now I have a  controller named MY_Controller so that only authenticated users can access the methods(edit_event(),add_event()) of any controllers extending it.

However, some of the methods in my controller need to be accessed by unauthenticated users (such as get_event()).

What is a good way of handling this? Should I make two completely separate controllers or extend from the basic event controller and add authenticated methods?

Previously I've had a manager controller that handled all methods which required authentication such as add_user,delete_user,add_doc,delete_doc. But it became blotted very quickly and wasn't easy to update or modify the controller (plus it was messy and didn't seem to follow good programming etiquette).

答:
How about

```<code>public function bar() {
   if (notLoggedIn)
       // display error page
   else
       // perform authorized action
}
</code>```

OK, so it's not very sexy, certainly not as fancy as decorating the methods with some thing, but it does have the virtue of giving you full access to the database for authentication purposes, which is more than can be said for, say, the [Authorized] attribute in C#

Body:
How about

public function bar() {
   if (notLoggedIn)
       // display error page
   else
       // perform authorized action
}

OK, so it's not very sexy, certainly not as fancy as decorating the methods with some thing, but it does have the virtue of giving you full access to the database for authentication purposes, which is more than can be said for, say, the [Authorized] attribute in C#


问:
What is the difference between a server and a mainframe?
To me, it seems as though "mainframe" is a somewhat dated term; is it simply an older synonym of "server," or does it server a purpose more similar to a cluster/supercomputer?</p>

答:
A mainframe is designed for processing large amounts of information by the use of batch transaction processing. It particularly works well at running scalable software and dealing with massively parallel operations. Everything about mainframes is screamingly fast. Mainframes are typically built by IBM and usually run z/OS.

A server (when referred to in the hardware sense) is a PC with higher reliability / quality parts and runs usually a *NIX variant, or Windows Server.

Mainframes can run software services, such as JEE application servers, web servers, etc. They are designed to accommodate the concurrent use of hundreds or thousands of users in addition to their batch processing load.


问:
Why is using named routes for generating outbound URLs a violation of Separation of Concerns?
https://stackoverflow.com/questions/98734/what-is-separation-of-concerns

In computer science, separation of concerns (SoC) is the process of
  breaking a computer program into distinct features that overlap in
  functionality as little as possible. A concern is any piece of
  interest or focus in a program. Typically, concerns are synonymous
  with features or behaviors. Progress towards SoC is traditionally
  achieved through modularity and encapsulation, with the help of
  information hiding.

From Pro Asp.Net MVC 4 book ( page 375 ):

The problem with relying on route names to generate outgoing URLs (
  @Html.RouteLink("Click me", "MyOtherRoute","Index", "Customer") is
  that doing so breaks through the separation of concerns that is so
  central to the MVC design pattern. When generating a link or a URL in
  a view or action method, we want to focus on the action and controller
  that the user will be directed to, not the format of the URL that will
  be used. By bringing knowledge of the different routes into the views
  or controllers, we are creating dependencies that we would prefer to
  avoid.

a) I understand that we create a dependency ( between action method/view and a routing configuration module ) by having Html.RouteLink ( called within action method or view ) specifying the name of the route we want to use.

But is introducing such a dependency already considered a violation of SoC? Namely, even though we created a dependency between the two modules, we haven't actually introduced any additional functionality/concern into either of the modules ( the definition of SoC implies that violation of SoC occurs when new functionality/concern is introduced into a module )

b) Anyhow, I don't understand how will simply generating an URL ( within action method/view ) by specifying a named route bring focus to the format of the URL?

Thank you

答:
I think what the Pro ASP.NET MVC book means is that, by referring to a route by name you have now created a dependency on a particular route definition, rather than relying strictly on the action and controller that will be called.

The route is what determines the shape of the URL.  If you create a link by using a route name, you are literally saying "I want the URL to be this shape," rather than saying "I want the URL to invoke this functionality" and letting the route engine decide which route is most appropriate.

Whether or not this makes sense in your particular application ultimately depends on your needs.  Using a named route creates a level of indirection which allows you to change both the shape of the URL, and the controller/method that gets called, by merely changing the entry in the route table.

As to the coupling aspect, using a named route does tightly-couple the links to that specific route because no other route would be eligible, and because it requires the view to have knowledge of that specific route.  Whether that is a problem or not, again, depends on your needs.  If that coupling is a desirable feature, it doesn't really matter whether it is "tight" or not according to someone else's opinion.


答: In a medium to large project I separate the controllers. This keeps the implementation of each controller a bit cleaner. And since security should be a core concern, this ensures you never forget to explicitly check the user is logged in. Plus you can easily swap your security implementation later if it needs to change. </p>

Title: What is a good technique to prevent unauthenticated users from accessing controller methods?

Body:
I have an event(s) controller:

```<code>class Event extends CI_Controller{

   public function index(){
   }

   public function foo(){
   }

   //Shouldn't be able to use this method unless logged in
   public function bar(){
   }

}
</code>```

And I'm trying to organise my code so it's fairly tidy and straightforward. Just now I have a  controller named MY_Controller so that only authenticated users can access the methods(edit_event(),add_event()) of any controllers extending it.

However, some of the methods in my controller need to be accessed by unauthenticated users (such as get_event()).

What is a good way of handling this? Should I make two completely separate controllers or extend from the basic event controller and add authenticated methods?

Previously I've had a manager controller that handled all methods which required authentication such as add_user,delete_user,add_doc,delete_doc. But it became blotted very quickly and wasn't easy to update or modify the controller (plus it was messy and didn't seem to follow good programming etiquette).


问:
The problems with Avoiding Smurf Naming classes with namespaces
I pulled the term smurf naming from here (number 21). To save anyone not familiar the trouble, Smurf naming is the act of prefixing a bunch of related classes, variables, etc with a common prefix so you end up with "a SmurfAccountView passes a SmurfAccountDTO to the SmurfAccountController", etc.

The solution I've generally heard to this is to make a smurf namespace and drop the smurf prefixes. This has generally served me well, but I'm running into two problems.

I'm working with a library with a Configuration class. It could have been called WartmongerConfiguration but it's in the Wartmonger namespace, so it's just called Configuration. I likewise have a Configuration class which could be called SmurfConfiguration, but it is in the Smurf namespace so that would be redundant. There are places in my code where Smurf.Configuration appears alongside Wartmonger.Configuration and typing out fully qualified names is clunky and makes the code less readable. It would be nicer to deal with a SmurfConfiguration and (if it was my code and not a library) WartmongerConfiguration.

I have a class called Service in my Smurf namespace which could have been called SmurfService. Service is a facade on top of a complex Smurf library which runs Smurf jobs. SmurfService seems like a better name because Service without the Smurf prefix is so incredibly generic. I can accept that SmurfService was already a generic, useless name and taking away smurf merely made this more apparent. But it could have been named Runner, Launcher, etc and it would still "feel better" to me as SmurfLauncher because I don't know what a Launcher does, but I know what a SmurfLauncher does. You could argue that what a Smurf.Launcher does should be just as apparent as a Smurf.SmurfLauncher, but I could see `Smurf.Launcher being some kind of class related to setup rather than a class that launches smurfs.

If there is an open and shut way to deal with either of these that would be great. If not, what are some common practices to mitigate their annoyance?

答:
You raise some good points.

With regards to having duplicate classes, you can alias classes in C#. Use for example using ColorScheme = The.Fully.Qualified.Namespace.Outlook2007ColorScheme; See this post on StackOverflow. You've not indicated your programming language but I have inferred it from what you've written. So where you're dealing with two different projects, you can alias them as SmurfConfiguration and WartmongerConfiguration which would free ambiguity when consuming both classes.

As a service is exposed to external application(s) I see no problem in branding the service with your application name, so in this case SmurfService would be valid as it would actually disambiguate groups of services in the consuming application.

I feel that namespaces should be used to avoid this style of naming. It makes it more difficult to grok the code and see at face value what a class is without reading MyCompanyMyProductMyAreaClassName. Using the aliasing technique allows you to reduce ambiguity where needed. The only time I think you should introduce complexity into your naming is, as I've pointed out in #2, when people will be consuming a service. This is where it makes perfect sense to have this style of naming because if the consumer has a variety of services it is consuming the ambiguity could be confusing.


问:
Requiring Explicit Null Reference Handling
One of the problems I have with null references is that they may not be exceptional. In my current position, there are few requirements and you are lucky if conventions are followed. This means being unable to handle a request is a frequent occurrence and throwing an exception is too slow (think millions of requests). I am in charge of writing an api for handling these requests and I am trying to decide how to handle failures.

Our code is written in C# and I am a huge fan of LINQ. I know that LINQ handles this problem by providing two methods "Function()" and "FunctionOrDefault()". By returning the default value (usually null), we make it very easy for the developer to shoot himself in the foot. On the other hand, throwing an exception is unacceptable for us. There is also the "TryParse" pattern, but that doesn't lend its self well to lambda expressions.

I recently discovered the Option type in F# and how it requires explicit handling of both the Some and None cases or your assembly will not compile. This seems like a much better solution to the null value problem than leaving it up to the developer to remember to implement error handling.

I could implement an option type that will not both compile and return the desired value unless both Some and None cases are handled. The contract for my implementation would look like this:

```<code>Option<SomeClass> option = new SomeClass { Value = 5 }.ToOption(); // Extension method
int value = option.Some(x => x.Value).None(x => x.Default(25)); // Other helper methods provided as well for None cases.
</code>```

So my question is, if I have the ability to require explicit null reference handling, are there any downsides to this approach? Would it be better to stick with conventions rather than try to solve this problem upfront to prevent future hidden bugs?

答:
You don't need it.  Here's my reasoning:

You may be underestimating the consumers of your API.  Every textbook I ever read on programming languages contained a section on how to check for null values.  Many languages include null coalescing or null checking features + syntactic sugar.

You need to prove to me (another programmer) why you need this convention.

If you can't prove that it provides a significant workflow or debugging benefit, then you need to use a simpler approach.  Especially if the simpler approach is already taught by the community at large.

```<code>var value = proxy.FirstOrDefault();
if (value != null) { ...
</code>```

Consider is the meaningfulness of the idioms you create.  Is the code above more or less meaningful than your ToOption() method?  If they are about the same, don't do it.  Only do work that provides a significant benefit.  This is the basic idea behind YAGNI.

Consider a similar debate in the nodejs community about the usefulness of enforcing the Promise/A pattern for libraries.  While not equivalent, you can see that there is some discontinuity on the issue.

Lastly, I would err on the side of allowing your consumers to choose the level of complexity they want.  If your ToOption approach is clearly superior, consumers will implement it anyway.

Body:
You don't need it.  Here's my reasoning:

You may be underestimating the consumers of your API.  Every textbook I ever read on programming languages contained a section on how to check for null values.  Many languages include null coalescing or null checking features + syntactic sugar.

You need to prove to me (another programmer) why you need this convention.

If you can't prove that it provides a significant workflow or debugging benefit, then you need to use a simpler approach.  Especially if the simpler approach is already taught by the community at large.

var value = proxy.FirstOrDefault();
if (value != null) { ...

Consider is the meaningfulness of the idioms you create.  Is the code above more or less meaningful than your ToOption() method?  If they are about the same, don't do it.  Only do work that provides a significant benefit.  This is the basic idea behind YAGNI.

Consider a similar debate in the nodejs community about the usefulness of enforcing the Promise/A pattern for libraries.  While not equivalent, you can see that there is some discontinuity on the issue.

Lastly, I would err on the side of allowing your consumers to choose the level of complexity they want.  If your ToOption approach is clearly superior, consumers will implement it anyway.