答:
Let's assume first of all that you've hired junior programmers that are actually competent. This is not necessarily a safe assumption, especially since senior programmers interviewing "someone less experienced than me" is likely to overlook basic incompetence.

But, assuming they're competent, the first step is to send them to a class. A one-week class will cost you $2,000-$3,000 (US). However, it will give them hands-on experience, with an instructor who (hopefully) understands the material, and a lesson plan designed to bring them up to speed. Sending someone off with a book and the directive to "learn this" isn't going to be anywhere near as valuable, and is likely to cost more (the cost of the class is about equal to one wasted programmer-week).

After they have the baseline knowledge, work with them. Sit at an adjacent desk, and give up at least half of your time to making sure that they understand your business, and your way of doing things. Yes, it will decrease your productivity, at least initially, but in the long term in makes your team as a whole more productive. And if you think, again, about costs, if a junior person wastes a month doing the wrong thing, that's probably about equal to a half month of your salary.

Title: How to train junior programmers for today's (complicated) web environment?

Body:
Currently our company develops applications consisting, most of the time, in Ruby on Rails web servers and a bunch of different REST clients, from kiosk systems in Java to embedded devices in C/C++ (besides the interfaces for standard web browsers). We need to expand our team and, having failed at finding good senior programmers, we decided to put some effort into training junior programmers who would grow together with the company.

We've already given them some Ruby and Rails books and asked them to build some toy programs, but I'm now realizing how steep the learning curve for the current state of web programming is.

When I started programming 15 years ago I used only Delphi and Source Safe and was able to produce usable software right from the beginning. They were both simple tools and it was easy to delve into the inner workings of the environment. Slowly I started using third-party frameworks, have switched to CVS, SVN and finally Git, learned the pieces which make today's web, like HTTP, JavaScript, CSS, REST etc. Today, even after years of experience, I don't know as much about how Ruby on Rails works inside as I did in the past about Delphi, and for me that was important so I could connect the basic learning blocks to the tools I was using.

It seems to me that the programmers I'm hiring will take a long time to integrate with the team and produce something usable, because there's so many things to learn to use a single framework (Rails): Ruby, HTML, CSS, JavaScript, REST, test-cases, database access (with SQL magically built inside the framework!), MVC, three different package managers (apt for Ubuntu, gem and bundler for Ruby), ssh, git, Apache and Phusion Passenger for deploying, etc.

I'm feeling lost since it's the first time I need to deal directly with junior programmers. What is the best way to train junior programmers in today's best practices for web development when there are so many choices?


问:
Enterprise knowledge sharing?
I recently read this article on knowledge sharing and immediately recognized the same problem within my own organization. My main goal now is to 'kill peer-to-peer collaboration' as the default method of communication for non-private, system related discussions. Otherwise you end up with all of the historical knowledge living in the heads of individuals, or lost in a massive email system.

My question for the group is as follows:

What methods / software have you used to encourage more 'public' discussions among your developers?

Some initial ideas I had.. any feedback would be great:

Internal news group

'better' wiki software (using Sharepoint now)

Message board

(I would love to have an internal instance of StackExchange, but don't think that is an option!)

Note: As stated above, we already have a wiki, but I dislike the wiki idea because things are usually only added to the wiki after the fact, if at all.

Thanks!

答: My company has some internal discussion boards. They are used very seldom. For the most part, the knowledge we have is either too general (general technology questions/topics that are just as well discussed in the internet) or too specific (applies only to our application and not to other application teams in the same company). It is good in that it does give a place for people to say how do I accomplish xyz here but its not much of a community feel.</p>

ContentLicense: CC BY-SA 2.5

Title: Enterprise knowledge sharing?


问:
Best practices for execution of untrusted code
I have a project where I need to allow users to run arbitrary, untrusted python code (a bit like this) against my server. I'm fairly new to python and I'd like to avoid making any mistakes that introduce security holes or other vulnerabilities into the system. Are there any best-practices available, recommended reading, or other pointers you can give me make my service usable but not abusable?

Here's what I've considered so far:

Remove __builtins__ from the exec context to prohibit use of potentially dangerous packages like os. Users will only be able to use packages I provide to them.

Use threads to enforce a reasonable timeout.

I'd like to limit the total amount of memory that can be allocated within the exec context, but I'm not sure if it's even possible.

There are some alternatives to a straight exec, but I'm not sure which of these would be helpful here:

Using an ast.NodeVisitor to catch any attempt to access unsafe objects. But what objects should I prohibit?

Searching for any double-underscores in the input. (less graceful than the above option).

Using PyPy or something similar to sandbox the code.

NOTE: I'm aware that there is at least one JavaScript-based interpreter. That will not work in my scenario.

答:
There is no way you can do this safely.

If you wanted to do something like this safely, you'd have to start
by having your own implementation of python which runs in a completely
controlled environment, preferably runs in the users' browser instead
of on your system.  You might start with Jython (python for java) and
package it as a java applet.  Since it would be running in the java
sandbox, on the user's machine, your system would be reasonably safe.

ContentLicense: CC BY-SA 3.0


问:
How to train junior programmers for today's (complicated) web environment?
Currently our company develops applications consisting, most of the time, in Ruby on Rails web servers and a bunch of different REST clients, from kiosk systems in Java to embedded devices in C/C++ (besides the interfaces for standard web browsers). We need to expand our team and, having failed at finding good senior programmers, we decided to put some effort into training junior programmers who would grow together with the company.

We've already given them some Ruby and Rails books and asked them to build some toy programs, but I'm now realizing how steep the learning curve for the current state of web programming is.

When I started programming 15 years ago I used only Delphi and Source Safe and was able to produce usable software right from the beginning. They were both simple tools and it was easy to delve into the inner workings of the environment. Slowly I started using third-party frameworks, have switched to CVS, SVN and finally Git, learned the pieces which make today's web, like HTTP, JavaScript, CSS, REST etc. Today, even after years of experience, I don't know as much about how Ruby on Rails works inside as I did in the past about Delphi, and for me that was important so I could connect the basic learning blocks to the tools I was using.

It seems to me that the programmers I'm hiring will take a long time to integrate with the team and produce something usable, because there's so many things to learn to use a single framework (Rails): Ruby, HTML, CSS, JavaScript, REST, test-cases, database access (with SQL magically built inside the framework!), MVC, three different package managers (apt for Ubuntu, gem and bundler for Ruby), ssh, git, Apache and Phusion Passenger for deploying, etc.

I'm feeling lost since it's the first time I need to deal directly with junior programmers. What is the best way to train junior programmers in today's best practices for web development when there are so many choices?

答:
Many people won't like this idea, but I am advocating this wherever I can: regardless of the programming language and environment, if they don't have any experience and if there are maintenance tasks which come up from real world bug reports of customers of yours, try to make sure they get assigned to that kind of task at least for 30-40% (+) of their time. "Here's the bug report, have a look at it, solve it. If you don't know what it's all about, communicate with experienced colleagues, google it, whatever". Real work on real problems, no toys, at least: not only toys. Make sure, too, that someone with lots of experience has a look at what they were doing before it gets released and shipped to the customer, of course. Make sure the new colleague gets honest feedback on what he did from colleagues and customers. Choose these tasks carefully in order to not overburden them, but keep in mind that some day you want them to do their work independently.

Doing bug fixing is learning on the job which lets them work on code which get's actually executed and has some relevance (otherwise there would be no bug reports) and will show them in many examples how to not do it.

The focus is automatically put on pain points. They'll start learning those details which are actually causing trouble. It also puts real responsibility onto their shoulders right from the beginning, which (while maintenance as such is not really attractive) can be rather motivating if they get it done to the satisfaction of the customer/end user. Going through what they did will be taken more seriously by your seniors cause they know the impact if things go wrong, and that way it will also simplify integration into the team, cause it will make them talk to each other automatically, as well.

The point is not to set them productive from the first moment (as it might look like). The point is to make sure that they know they are supposed to do something valuable right from the first moment, and to put a focus on what matters most without the need to actually create a list.

I do have some years of experience working every now and then with people coming directly from college into their new developer job, and the worst results I got to see was usually when someone without at least some experience in maintenance was asked to do new application development. Just make sure they always have someone they can ask for support if they feel lost.


答:
Python sandboxing is hard. Python is inherently introspectable, at multiple levels.

This also means that you can find the factory methods for specific types from those types themselves, and construct new low-level objects, which will be run directly by the interpreter without limitation.

Here are some examples of finding creative ways to break out of Python sandboxes:

Ned Batchelder starts with a demonstration how dangerous eval() really is; eval() is often used to execute Python expressions; as a primitive and naive sandbox for one-liners.

He then continued to try and apply the same principles to Python 3, eventually succeeding to break out with some helpful pointers.

Pierre Bourdon uses similar techniques to hack a python system at a hack-a-thon

The basic idea is always to find a way to create base Python types; functions and  classes and break out of the shell by getting the Python interpreter to execute arbitrary (unchecked!) bytecode.

The same and more applies to the exec statement (exec() function in Python 3).

So, you want to:

Strictly control the byte compilation of the Python code, or at least post-process the bytecode to remove any access to names starting with underscores.

This requires intimate knowledge of how the Python interpreter works and how Python bytecode is structured. Code objects are nested; a module's bytecode only covers the top level of statements, each function and class consists of their own bytecode sequence plus metadata, containing other bytecode objects for nested functions and classes, for example.

You need to whitelist modules that can be used. Carefully.

A python module contains references to other modules. If you import os, there is a local name os in your module namespace that refers to the os module. This can lead a determined attacker to modules that can help them break out of the sandbox. The pickle module, for example, lets you load arbitrary code objects for example, so if any path through whitelisted modules leads to the pickle module, you have a problem still.

You need to strictly limit the time quotas. Even the most neutered code can still attempt to run forever, tying up your resources.

Take a look at RestrictedPython, which attempts to give you the strict bytecode control. RestrictedPython transforms Python code into something that lets you control what names, modules and objects are permissible in Python 2.3 through to 2.7.

If RestrictedPython is secure enough for your purposes does depend on the policies you implement. Not allowing access to names starting with an underscore and strictly whitelisting the modules would be a start.

In my opinion, the only truly robust option is to use a separate Virtual Machine, one with no network access to the outside world which you destroy after each run. Each new script is given a fresh VM instead. That way even if the code manages to break out of your Python sandbox (which is not unlikely) all the attacker gets access to is short-lived and without value.

Title: Best practices for execution of untrusted code

Body:
I have a project where I need to allow users to run arbitrary, untrusted python code (a bit like this) against my server. I'm fairly new to python and I'd like to avoid making any mistakes that introduce security holes or other vulnerabilities into the system. Are there any best-practices available, recommended reading, or other pointers you can give me make my service usable but not abusable?

Here's what I've considered so far:

Remove __builtins__ from the exec context to prohibit use of potentially dangerous packages like os. Users will only be able to use packages I provide to them.

Use threads to enforce a reasonable timeout.

I'd like to limit the total amount of memory that can be allocated within the exec context, but I'm not sure if it's even possible.

There are some alternatives to a straight exec, but I'm not sure which of these would be helpful here:

Using an ast.NodeVisitor to catch any attempt to access unsafe objects. But what objects should I prohibit?

Searching for any double-underscores in the input. (less graceful than the above option).

Using PyPy or something similar to sandbox the code.

NOTE: I'm aware that there is at least one JavaScript-based interpreter. That will not work in my scenario.


答: I really like the wiki idea as well, but you're right -it's hard to get people to contribute. And without contributions, no one will actually use it because it doesn't have enough information. There is a "tipping point" however in which if you could get people to post (perhaps thru a required business process) at some point the wiki would just take off as it would be this great repository of information.</p>

Title: Enterprise knowledge sharing?

Body:
I recently read this article on knowledge sharing and immediately recognized the same problem within my own organization. My main goal now is to 'kill peer-to-peer collaboration' as the default method of communication for non-private, system related discussions. Otherwise you end up with all of the historical knowledge living in the heads of individuals, or lost in a massive email system.

My question for the group is as follows:

What methods / software have you used to encourage more 'public' discussions among your developers?

Some initial ideas I had.. any feedback would be great:

Internal news group

'better' wiki software (using Sharepoint now)

Message board

(I would love to have an internal instance of StackExchange, but don't think that is an option!)

Note: As stated above, we already have a wiki, but I dislike the wiki idea because things are usually only added to the wiki after the fact, if at all.

Thanks!


问:
Data warehouse architecture for mutating schema
I am setting up an ETL process and small data warehouse for querying the data in a few different dimensions. One issue is that the schema for the objects can mutate over time - mainly that some fields will be added and some removed. What are some methodologies or approaches for handling this?

(Note the source data is managed as EAV, which is hard to query and it's slow - hence the DW approach in the first place).

What seems like a naive approach (which can often be the best) is to simply add columns over time to the destination shapes in the warehouse, and backfill existing objects with some query-valid placeholder data.

This is a little outside my domain expertise though, so looking for input.

答:
Data warehouses typically can be "refilled" completely from some kind of OLTP database. It is not unusual to do this once per night, asynchronously. So whenever you have a new requirement where you have to make a schema change, one possible strategy is just to define that as a new "version" of your data warehouse, adapt your ETL process to the new version, delete all previous data and refill the DW completely from scratch from your OLTP source again. That makes schema changes very painless, since you can assume a completely empty database during the change. This way, you won't need any "schema change" scripts, just delete the whole schema and run a complete set of CREATE TABLE scripts for the newest version of your DW.

What you have to test is if that simple strategy is fast enough for your case and suffers your needs. If your data warehouse is small (whatever that means in your eyes), as you said, you may have no problems to provide different versions of your data warehouse in parallel, so your users can use version "(n-1)" while the ETL process for version n is still running.


问:
In C++ why and how are virtual functions slower?
Can anyone explain in detail, how exactly the virtual table works and what pointers are associated when virtual functions are called.

If they are actually slower, can you show the time that the virtual function takes to execute is more than normal class methods? It is easy to lose track of how/what is happening without seeing some code.

答:
because a virtual call is equivalent to

```<code>res_t (*foo)(arg_t);
foo = (obj->vtable[foo_offset]);
foo(obj,args)
</code>```

where with a non-virtual function the compiler can constant-fold the first line, this is a dereference an addition and a dynamic call transformed into just a static call

this also lets it inline the function (with all due optimization consequences)

Body:
because a virtual call is equivalent to

res_t (*foo)(arg_t);
foo = (obj->vtable[foo_offset]);
foo(obj,args)

where with a non-virtual function the compiler can constant-fold the first line, this is a dereference an addition and a dynamic call transformed into just a static call

this also lets it inline the function (with all due optimization consequences)


答:
Virtual methods are commonly implemented via so-called virtual method tables (vtable for short), in which function pointers are stored. This adds indirection to the actual call (gotta fetch the address of the function to call from the vtable, then call it -- as opposed to just calling it right ahead). Of course, this takes some time and some more code.

However, it is not necessarily the primary cause of slowness. The real problem is that the compiler (generally/usually) cannot know which function will be called. So it can't inline it or perform any other such optimizations. This alone might add a dozen pointless instructions (preparing registers, calling, then restoring state afterwards), and might inhibit other, seemingly unrelated optimizations. Moreover, if you branch like crazy by calling many different implementations, you suffer the same hits you'd suffer from branching like crazy via other means: The cache and branch predictor won't help you, the branches will take longer than a perfectly predictable branch.

Big but: These performance hits are usually too tiny to matter. They're worth considering if you want to create a high-performance code and consider adding a virtual function that would be called at alarming frequency.
However, also keep in mind that replacing virtual function calls with other means of branching -- if .. else, switch, function pointers, etc. -- won't solve the fundamental issue, and may very well reduce performance. Eliminating unnecessary indirection, whether due to virtual functions or other control flow statements, improves performance.

Edit: The difference in the call instructions is described in other answers. Basically, the code for a static ("normal") call is:

Copy some registers on the stack, to allow the called function to use those registers.

Copy the arguments into predefined locations, so that the called function can find them regardless from where it is called.

Push the return address.

Branch/jump to the function's code, which is a compile-time address and hence hardcoded in the binary by the compiler/linker.

Get the return value from a predefined location and restore registers we want to use.

A virtual call does exactly the same thing, except that the function address is not known at compile time. Instead, a couple of instructions ...

Get the vtable pointer, which points to an array of function pointers (function addresses), one for each virtual function, from the object.

Get the right function address from the vtable into a register (the index where the correct function address is stored is decided at compile-time).

Jump to the address in that register, rather than jumping to a hardcoded address.

As for branches: A branch is anything which jumps to another instruction instead of just letting the next instruction execute. This includes if, switch, parts of various loops, function calls, etc. and sometimes the compiler implements things that don't seem to branch in a way that actually needs a branch under the hood. See Why is processing a sorted array faster than an unsorted array? for why this may be slow, what CPUs do to counter this slowdown, and how this isn't a cure-all.

Title: In C++ why and how are virtual functions slower?

Body:
Can anyone explain in detail, how exactly the virtual table works and what pointers are associated when virtual functions are called.

If they are actually slower, can you show the time that the virtual function takes to execute is more than normal class methods? It is easy to lose track of how/what is happening without seeing some code.

ContentLicense: CC BY-SA 4.0


答:
Here's some actual disassembled code from a virtual function call and a non-virtual call, respectively:

```<code>mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
callq  *%rax

callq  0x4007aa
</code>```

You can see that the virtual call requires three additional instructions to look up the correct address, whereas the address of the non-virtual call can be compiled in.

However, note that most of the time that extra lookup time can be considered negligible.  In situations where the lookup time would be significant, like in a loop, the value can usually be cached by doing the first three instructions before the loop.

The other situation where the lookup time becomes significant is if you have a collection of objects and you're looping through calling a virtual function on each of them.  However, in that case, you're going to need some means of selecting which function to call anyway, and a virtual table lookup is as good a means as any.  In fact, since the vtable lookup code is so widely used it is heavily optimized, so trying to work around it manually has a good chance of resulting in worse performance.

Body:
Here's some actual disassembled code from a virtual function call and a non-virtual call, respectively:

mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
callq  *%rax

callq  0x4007aa

You can see that the virtual call requires three additional instructions to look up the correct address, whereas the address of the non-virtual call can be compiled in.

However, note that most of the time that extra lookup time can be considered negligible.  In situations where the lookup time would be significant, like in a loop, the value can usually be cached by doing the first three instructions before the loop.

The other situation where the lookup time becomes significant is if you have a collection of objects and you're looping through calling a virtual function on each of them.  However, in that case, you're going to need some means of selecting which function to call anyway, and a virtual table lookup is as good a means as any.  In fact, since the vtable lookup code is so widely used it is heavily optimized, so trying to work around it manually has a good chance of resulting in worse performance.


答:
Slower than what?

Virtual functions solve a problem that cannot be solved by direct function calls. In general, you can only compare two programs which compute the same thing. "This ray tracer is faster than that compiler" doesn't make sense, and this principle generalizes even to small things like individual functions or programming language constructs.

If you don't use a virtual function to dynamically switch to a piece of code based on a datum, such as an object's type, then you will have to use something else, like a switch statement to accomplish the same thing. That something else has its own overheads, plus implications on the organization of the program which influence its maintainability and global performance.

Note that in C++, calls to virtual functions are not always dynamic.  When calls are made on an object whose exact type is known (because the object isn't a pointer or reference, or because its type can otherwise be statically inferred) then the calls are just regular member function calls. That not only means that there isn't dispatch overhead, but also that these calls can be inlined in the same way as ordinary calls.

In other words, your C++ compiler can work out when virtual functions do not require virtual dispatch, so there is usually no reason to worry about their performance relative to non-virtual functions.

New: Also, we must not forget shared libraries. If you're using a class which is in a shared library, the call to an ordinary member function will not simply be a nice one instruction sequence like callq  0x4007aa.  It has to go through a few hoops, like indirecting through a "program link table" or some such structure. Therefore, shared library indirection could somewhat (if not completely) level the cost difference between (truly indirect) virtual call and a direct call. So reasoning about virtual function tradeoffs must take into account how the program is built: whether the target object's class is monolithically linked into the program which is making the call.


答:
From the warehouse side I would have a staging table from each (logical and temporal) source, so for all data coming from source 1, there would be a table for source 1-version 1, source 1-version 2 and so on.

You then have a second schema (or database) which is 'reportable' and that is filled from the staging table(s). You can add, and not need to remove columns to it as additional data comes online.*

*You might decide to remove columns from it as a maintenance measure if they're no longer reported on, but again you preserve the data in the staging table for future use

Title: Data warehouse architecture for mutating schema

Body:
I am setting up an ETL process and small data warehouse for querying the data in a few different dimensions. One issue is that the schema for the objects can mutate over time - mainly that some fields will be added and some removed. What are some methodologies or approaches for handling this?

(Note the source data is managed as EAV, which is hard to query and it's slow - hence the DW approach in the first place).

What seems like a naive approach (which can often be the best) is to simply add columns over time to the destination shapes in the warehouse, and backfill existing objects with some query-valid placeholder data.

This is a little outside my domain expertise though, so looking for input.


答:
The knowledge that is important to the enterprise should make it into the project itself, in the form of well-written code, high-level comments about the architecture, and exceptional documentation about the project's goals and how they are accomplished with technology.

I couldn't disagree more with the linked author's conclusions.  Encouraging the capture of knowledge by discouraging team collaboration?  Sorry, but that's not how it works.  It is the collaboration itself that produces the knowledge wealth, not sequestering engineers in cubicles.

Title: Enterprise knowledge sharing?


问:
Windows Phone 8 development on Windows 7 - is it or will be possible?
I was trying to install Windows Phone 8 SDK on my Windows 7 machine and it hit me with the 'supported only on Windows 8' message. I actually wanted to develop Phone 7.5 apps on Visual Studio 2012, impossible thing with the 7.1 SDK, so I thought 8 SDK will do the job.

As if it was not enough that the 8 SDK was controversial upon release, now that it's generally available, to me it seems like a horrible decision to make it available only for Windows 8, because in my humble opinion, no serious and sane developer will install Windows 8 ever, or at least in the near future, just because of the Metro UI.

So, anyone knows any workarounds for developing Windows Phone 8 on Windows 7, or at least develop for 7.5 but using Visual Studio 2012?

答: The biggest reason being that windows 8 apps and WP8 apps use the new WinRT runtime don't support .NET, you can't run winRT on Windows 7 so your apps won't compile. You could create metro style apps with WPF, but they won't run on Windows 8 (at least not in metro/modern mode).</p>


问:
Why many programming languages have only 2 data-structures: arrays and hashes?
Many programming languages have only those 2 structures, and even some languages that have more structures still only provide special syntax for those 2; usually, [] and {}. Why is this? Is there anything special about those datatypes that is necessary for the completeness of the language?

答:
Is there anything special about those datatypes that is necessary for the completeness of the language?

Nope.

Many languages don't have hashes as a fundamental data structure in the language.  And indeed, there are examples of languages that don't have arrays or lists either.  (BCPL for instance).

And many languages have other fundamental data structures; e.g. structs, unions, classes and so on.

The real answer is that there is a complicated trade-off between expressiveness, simplicity and implementability that the language designer has to make.  Depending on the nature and purpose of the language, different choices are more appropriate.  One of the choices is whether a particular "useful" data structure requires linguistic support, or whether it is better provided as a (standard) library.


答:
You've got two basic choices.  You have either direct memory access (malloc with C and the resulting pointer arithmetic) or you have to provide some basic data structures to the programmer.

The first, and simplest data structure is a list of some sort (be it implemented with an array or a linked list or some other list structure behind the scenes).

With a list, one could ask the programmer to write his or her own map / associative array / hashtable / dictonary structure.  Most people who have taken an undergraduate data structures class have done this.  The problem is, most people have done it poorly.

To both make good use of the computer (by not having another poorly implemented hash function) and the programmer's time (to not have to write another poorly implemented hash function again and again - think back to C, basic, and fortran days), many language designers have incorporated this structure into the base language - either as a base structure (perl's %hash) or as part of the standard library (java.util.map).

These really end up as the only two basic structures necessary (and really, only the ability to have a list/array/block of indexable memory is critical).  With them, one can build sets, trees, skip lists, and all the rest of the complex data structures that one can dream of.

Title: Why many programming languages have only 2 data-structures: arrays and hashes?

Body: Many programming languages have only those 2 structures, and even some languages that have more structures still only provide special syntax for those 2; usually, [] and {}. Why is this? Is there anything special about those datatypes that is necessary for the completeness of the language?


问:
High-Availability Vs. Cloud Scaling
I work for a company that develops a web server that runs in a customer datacenter.  The customer wants the server to have hot failover and I'm currently investigating HA approaches such as Pacemaker and LVM (might as well have the backup doing something so I'm using load balancing as well).

It occurs to me that some of these features are also provided by cloud computing (e.g. private cloud) technologies.  Specifically auto-scaling which is provided by EC2 and cloud foundry addresses load balancing and failover support to some degree.

As a new application would I be better off spending my time trying to setup the application as a private cloud or by utilizing the tried and true HA architectures?

答:
That depends on whether or not scaling is in the foreseeable future.

The jump from hot failover to cloud is not trivial; the big difference is that you have more then one machine doing the same thing, which introduces a host of new problems to deal with.

OTOH, if scaling is definitely going to happen, then you should probably jump straight to it.

Title: High-Availability Vs. Cloud Scaling


问:
How to interview someone you know well?
How would you interview someone you know well or someone you may even be friends with? What if you already know their strengths and weaknesses. I would prefer to avoid this situation by delegating this task to somebody else, but what if this is not an option. I feel like there is just too much personal feelings involved and it is almost impossible to be unbiased. If you have been in an similar situations, how did you handle them? </p>

答:
If I know this person well, then I'll already know whether they would be a fit for my workplace.

Sounds like you have a problem being honest with your friend.  If you don't think they are qualified then tell them.  Be sure to tell them exactly why.  This is the only way to be a true friend.  Give them pointers on how to be the type of person you need.  It might be as simple as "we need X years of working with Y tech and it can't be learned on the job."

If it's more of a "I think you're lazy" type of thing then that's a whole other conversation, but one that you should still have if you are a true friend.

If you do think they are qualified then there shouldn't be an issue, just hire them.

Title: How to interview someone you know well?


问:
WinRT for 'desktop' apps
So I'm reading up about the differences between the old and the new APIs, and I can't find whether the new WinRT API will provide for desktop apps, so far it seems its only available to write Metro apps - ie the full screen, 'phone style' apps.

Does this mean that I can write a WinRT-based app and it will be invoked from a desktop but display like other Metro apps (eg IE) and I won't be able to write an old-style desktop app that runs in the old-style desktop?

What does this mean for server side apps? I imagine WinRT would be the API of choice for servers, now that Windows Server comes with an optional GUI, so I imagine that if I can write a windows-less app using WinRT for the server, I should be able to write the same for the client too? (and if that's the case, surely I could connect a non-Metro UI to it)

答:
You can very well run apps designed for WinRT on desktops, only limitation here you need to keep in mind is that it will not run on previous operating systems like Windows 7, Windows Vista and Windows XP and so on.

And since now more and more monitors are becoming touch screen so end-user should not have any problem in running your app on dektop, but if you are targeting users who are going to use keyboard and mouse than it might be frustrating to replicate the gestures and innovation of top and bottom app bar, so it is a good idea to keep the semantic zoom and gesture related action to minimal.

Title: WinRT for 'desktop' apps


问:
Does the windows 8 store only support windows RT?
I'm in a project for creating a game engine and eventually a game, and we need ideas on how to get our game out into the internet.

I had an idea with putting it onto the windows 8 store at a low cost(or free) in order to get the word out, but does the windows 8 store only support apps programmed in windows RT?

Our game will be built in C++ / OpenGL / GLEW / Actionscript / GLM / etc.. , so we won't be using any windows RT functionality at all.

答:
As long as you can following the guidelines for publishing an app on window store, it should not matter. But do check before hand the dll's and component you are using, will be allowed on windows store or not other at the last minute when trying to publish the app it will be a big disappointment.

I know for you it does not allow Win32 based dll's. and Some of the pretty common c++ static libraries are also not allowed


问:
How to create a Web app that "interacts" with email?
I have a web host that supports cPanel and email addresses. I'm interested in creating a web app that checks for email messages, reads their contents and then does something with them, like interact with a database.

For example, Bob with email bob@gmail.com links his email address to his account on my web app. He sends an email to storethis@webapp.com with subject "Shopping List" and message "Apples, bananas, kiwis, milk", along with an attachment. The web app receives this email, and then parses the email's contents and stores this data into a database.

How can I implement this?

答:
Java has JavaMail, which is a complete API for email servers and services.  You could run a small java application which listens for the messages, processes them and acts accordingly (writing to a database, etc).  It doesn't have to be a Web application per se, just some Java Beans which use the JavaMail API to register with the email service.

http://www.oracle.com/technetwork/java/javamail/index.html


问:
Program Structure for Table Cells Representing Objects
So I have a program with "cue" objects and each have their own table cell. The thing is that the table cells have loading bars on them that represent the progress of the cues. This presents the following question: How should I structure the program?

Should the objects representing the Cues store pointers to the table cells, allowing them to update the table cells themselves, or would some other program structure work better.

Sorry if this question is too general, but I couldn't really find anything at all about this when I searched around on google and the website. I fairly new to iOS development and my programs structure is already getting chaotic. The suggestion I gave was just my initial instinct, but it's probable wrong...

答: Well, I don't know anything about iOs, but what you probably need is an event mechanics. Let your cue objects generate events whenever the progress changes (they should know nothing about the event receiver).  Make your table or table cells event sinks for updating the loading bars (they should know nothing about who is sending those events to them). And have a third place in your program where you wire events and event sinks together.</p>


问:
What's a good format for documenting hundreds of data feeds?
Several governments are starting to publish open data: datasets generated by the goverment, made freely available for citizens to use for value-added app development, analysis, and feedback. For instance, the City of Vancouver (Canada) Open Data Catalogue publishes 130 datasets. The subject matter ranges from tabular files of city councillor contact information to geographical datasets of zoning districts. Formats range from Comma-Separated Value (CSV) to SHP to KML and beyond.

It would be nice for each of these open data portals to have a dataset of datasets: their catalogue of datasets in structured data file form. The catalogue dataset should have metadata describing each dataset (name of dataset, URL of download page, the formats the dataset is available in, maybe a description of the dataset format and attributes or URL to same.

What is a good data model and a good format for such a catalogue dataset?  If this is a solved problem, I'd like to suggest that Vancouver reuse that solution, instead of inventing one.

Update: in response to the question, why is it desirable to to have a catalogue as a structured dataset, I can think of three classes of use case.

Analysis across all the datasets of a data provider. It is convenient to get a list of all datasets, with links to descriptions etc., which I can import into a spreadsheet and annotate. Someone else may want to count total number of records published, or breadth of government activity covered by the data. In my case, I'm working on a Vancouver Open Data language census.

Analysis of corresponding datasets across multiple data providers. For instance, one might want to aggregate a list of all zoning boundary datasets published by Canadian cities. That is easier if one can sift through dataset lists by machine instead of by hand.

Analysis of dataset catalogue change over time. It might be interesting to analyse the growth in Open Data from one year to the next.  Structured catalogues make this easier to automate.

答:
Suggest looking at http://spec.datacatalogs.org.

I also note that Data Catalog / Portal software like http://ckan.org/ (which powers e.g. data.gov.uk) provides an API for getting all the datasets in a standard form.


问:
What is the meaning of "inversion" in Dependency Inversion design principle?
I'm reading about design patterns. I know what this principle does.

High-level and low-level classes depend on abstractions. But why we say this is inversion?

答:
From Wikipedia:

In traditional programming, the flow of the business logic is
  determined by objects that are statically assigned to one another.
  With inversion of control, the flow depends on the object graph that
  is instantiated by the assembler and is made possible by object
  interactions being defined through abstractions. The binding process
  is achieved through dependency injection, although some argue that the
  use of a service locator also provides inversion of control.

Or in other words: in traditional, non-inverted control higher-level components depend on lower-level ones.

This has been demonstrated as a limitation, because high-level components lose the chance of working with more than an environment or low-level excessively specific components.

With inversion of control, the above paradigm is inverted. The high-level components are just abstract classes or interfaces and these are usually (and should be) declared in a package or assembly having no dependency on the code implementing them, and it's the implementation the code that's dependent on higher-level code (because the low-level code must implement a high-level interface or abstract class).

This is the inversion!

OwnerDisplayName: Khajavi

OwnerDisplayName: Matías Fidemraizer


答:
Quote of Bob Martin in his original article on the topic:

One might question why I use the word “inversion”. Frankly, it is because more traditional
software development methods, such as Structured Analysis and Design, tend to create
software structures in which high level modules depend upon low level modules, and in
which abstractions depend upon details. Indeed one of the goals of these methods is to
define the subprogram hierarchy that describes how the high level modules make calls to
the low level modules. Figure 1 is a good example of such a hierarchy. Thus, the depen-
dency structure of a well designed object oriented program is “inverted” with respect to
the dependency structure that normally results from traditional procedural methods.

So as I understand, having the inversion priciple in place makes the high level policy described in terms of abstraction rather than concrete utility components. And from the point of view of the high level module the abstract policy remains stable. Any changes of the low level implementations do not force the high level module to change.

The term 'inversion' distinguishes the approach from the traditional model.

Title: What is the meaning of "inversion" in Dependency Inversion design principle?

Body:
I'm reading about design patterns. I know what this principle does.

High-level and low-level classes depend on abstractions. But why we say this is inversion?

OwnerDisplayName: nansen


问:
Designing a self-describing JSON document system
I'm trying to devise a document system for a specific domain involving simple objects (People, Companies, Invoices, etc.) that would also be able to completely describe itself. This self-description ability would ideally be recursive. The document system will be based on JSON, but I believe the principle in question applies to any structured notation.

To illustrate what I mean, let's say I have the following JSON document that describes a person (company, invoice, etc. are basically all the same, only with different properties):

```<code>{
  "Name": "John Doe",
  "Email": "john.doe@example.org",
  "BirthDate": "1976-07-04"
}
</code>```

Then, I have a second JSON document that describes the structure of the first one. Let's call this a "Level 1 Meta-document":

```<code>{
  "Type": "Person",
  "Properties": {
    "Name": { "Type": "String", "Required": true },
    "Email": { "Type": "String" },
    "BirthDate": { "Type": "Date" }
  }
}
</code>```

This would be simple enough, if not for the requirement, that system should also be able to fully describe this meta-document.

To put it in more general terms: I'm looking for a way to define a self-sufficient "Level N Meta-document", that would be able to describe a structure of the "Level N-1 Meta-documents".

NOTE: I'd be willing to go with a solution for N = 2, but instinct tells me that a true solution for N = 2 would also work for any N. Now that I think of it, this may be more of a math puzzle than programming one. :)

Is this even possible? If yes, can you give me some examples? If not, what are my other options?

EDIT: I've included a naive example of how a "Level 2 Meta-Document" would look, based on the above:

```<code>{
  "Type": "MetaLevel2",
  "Properties": {
    "Properties": { "Type": "Hash", "Required": true }
  }
}
</code>```

The problem with this is that it doesn't describe the object that describes the property details (i.e. the one with the "Type" and "Required" attributes).

If I were to include description of those, I'd have to add another attribute to the very same object I'm trying to describe:

```<code>{
  "Type": "MetaLevel2",
  "Properties": {
    "Properties": {
      "Type": "Hash",
      "Required": true,
      "ValueProperties": { "Type": "String", "Required": "Boolean" }
    }
  }
}
</code>```

Unfortunately, this throws me into recursive problem, because I now lack the description for "ValueProperties". In fact, for every new attribute I invent on level N, I have a problem describing it on level N+1 without introducing yet another attribute that needs description.

What I'm looking for is a solution that wouldn't suffer from this problem.

To be clear: I'm aware of XSD, but I'm not sure how to apply its principles to my case. Unless I'm missing something, XSD would suffer from the same recursive problem. This gives me reason to believe I have a problem with the approach itself.

答:
Yes, this is possible. This is already used for XML and is called XML Schema Definition (XSD).

You may simply take what XSD does and do the same thing with JSON.


问:
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?

答:
By returning the default value (usually null), we make it very easy for the developer to shoot himself in the foot.

I disagree, and I guess you are on the road to over-engineering. If you have a function returning null and the user of that function handles that properly, everything is fine. If the user does not (which means he tries to use the returned object), he will get an exception, so no error will be masked.

Only problem here is that the user might not get a clear error message. But that would be also the case when you use any other kind of error signaling mechanics and the user of your functions forgets "translating" technical error messages to clear-text messages which show the root cause of a problem.

Better invest the time to teach your team mates to write tests for revealing missing error handling.


问:
Stroustrup and the C++ complexity admission
I heard from a friend that Bjarne Stroustroup admitted that he doesn't know entirely the C++ programming language due to its vast complexity

Is it true and there's some referrable sources or is it just an exaggeration?

This affirmation should be present on his website, he told it in an interview/conference some time ago

答:
Stroustrup writes "The C++ Programming Language", which is described (by the publisher) as "his definitive reference" and "The C++ Programming Language, Fourth Edition, delivers meticulous, richly explained, and integrated coverage of the entire language" (emphasis mine).

It's possible that the publishers are lying, but it's also possible that Stroustrup does understand the whole language, or can research it well enough for his purposes in a given situation. I'm inclined to believe the latter.


答:
It seems I've now come up with a better approach. The recursion problem can be avoided by flattening the nested objects, like this:

```<code>{
  "Type": "MetaLevel2",
  "Properties": {
    "Properties": { "Type": "Hash", "Required": true },
    "Properties.Type": { "Type": "String", "Required": true },
    "Properties.Required": { "Type": "Boolean" }
  }
}
</code>```

Granted, it feels like a slight abuse of the property system, but not unreasonably so. I can build the required awareness about the dotted property name notation directly into the software that will handle these documents.

I'll leave the question open for a while longer. Unless someone comes up with a cleaner solution during that time, I'll go with this.

EDIT: Yep, this works quite well, as it turns out.

Whenever I decide I need another nested attribute, I can simply describe it by using the flattened notation, thus staying compatible with existing structure.

The only special thing that software needs to understand to consume these documents is the meaning of "Type": "Hash" attribute, which signals that several attributes should be interpreted as a single JSON object when reading and vice-versa when writing.

Still, my thanks to everyone that took the time to read all this and respond!

Title: Designing a self-describing JSON document system

Body:
I'm trying to devise a document system for a specific domain involving simple objects (People, Companies, Invoices, etc.) that would also be able to completely describe itself. This self-description ability would ideally be recursive. The document system will be based on JSON, but I believe the principle in question applies to any structured notation.

To illustrate what I mean, let's say I have the following JSON document that describes a person (company, invoice, etc. are basically all the same, only with different properties):

```<code>{
  "Name": "John Doe",
  "Email": "john.doe@example.org",
  "BirthDate": "1976-07-04"
}
</code>```

Then, I have a second JSON document that describes the structure of the first one. Let's call this a "Level 1 Meta-document":

```<code>{
  "Type": "Person",
  "Properties": {
    "Name": { "Type": "String", "Required": true },
    "Email": { "Type": "String" },
    "BirthDate": { "Type": "Date" }
  }
}
</code>```

This would be simple enough, if not for the requirement, that system should also be able to fully describe this meta-document.

To put it in more general terms: I'm looking for a way to define a self-sufficient "Level N Meta-document", that would be able to describe a structure of the "Level N-1 Meta-documents".

NOTE: I'd be willing to go with a solution for N = 2, but instinct tells me that a true solution for N = 2 would also work for any N. Now that I think of it, this may be more of a math puzzle than programming one. :)

Is this even possible? If yes, can you give me some examples? If not, what are my other options?

EDIT: I've included a naive example of how a "Level 2 Meta-Document" would look, based on the above:

```<code>{
  "Type": "MetaLevel2",
  "Properties": {
    "Properties": { "Type": "Hash", "Required": true }
  }
}
</code>```

The problem with this is that it doesn't describe the object that describes the property details (i.e. the one with the "Type" and "Required" attributes).

If I were to include description of those, I'd have to add another attribute to the very same object I'm trying to describe:

```<code>{
  "Type": "MetaLevel2",
  "Properties": {
    "Properties": {
      "Type": "Hash",
      "Required": true,
      "ValueProperties": { "Type": "String", "Required": "Boolean" }
    }
  }
}
</code>```

Unfortunately, this throws me into recursive problem, because I now lack the description for "ValueProperties". In fact, for every new attribute I invent on level N, I have a problem describing it on level N+1 without introducing yet another attribute that needs description.

What I'm looking for is a solution that wouldn't suffer from this problem.

To be clear: I'm aware of XSD, but I'm not sure how to apply its principles to my case. Unless I'm missing something, XSD would suffer from the same recursive problem. This gives me reason to believe I have a problem with the approach itself.

Body:
It seems I've now come up with a better approach. The recursion problem can be avoided by flattening the nested objects, like this:

{
  "Type": "MetaLevel2",
  "Properties": {
    "Properties": { "Type": "Hash", "Required": true },
    "Properties.Type": { "Type": "String", "Required": true },
    "Properties.Required": { "Type": "Boolean" }
  }
}

Granted, it feels like a slight abuse of the property system, but not unreasonably so. I can build the required awareness about the dotted property name notation directly into the software that will handle these documents.

I'll leave the question open for a while longer. Unless someone comes up with a cleaner solution during that time, I'll go with this.

EDIT: Yep, this works quite well, as it turns out.

Whenever I decide I need another nested attribute, I can simply describe it by using the flattened notation, thus staying compatible with existing structure.

The only special thing that software needs to understand to consume these documents is the meaning of "Type": "Hash" attribute, which signals that several attributes should be interpreted as a single JSON object when reading and vice-versa when writing.

Still, my thanks to everyone that took the time to read all this and respond!


答: There's IETF draft for JSON Schema. That sounds like what you want to use. Also check it out at Wikipedia.</p>


答:
Since 1998 C++ is an ISO international standard, which basically means it's not just one person redacting it. It's a committee with a lot of people arguing about features to add or things to change (after a proposition have been made ready for review). It also means the details of the language might not be understood fully by all committee members, mainly because C++ standard document is mainly targeted at compiler implementer.

I don't see why it is surprising that the original author can't know all the details.

Title: Stroustrup and the C++ complexity admission

Body:
I heard from a friend that Bjarne Stroustroup admitted that he doesn't know entirely the C++ programming language due to its vast complexity

Is it true and there's some referrable sources or is it just an exaggeration?

This affirmation should be present on his website, he told it in an interview/conference some time ago


问:
Recruiter asking for help understanding JEE5 or JEE6 and J2EE. (NOT A JOB POSTING NOT LOOKING FOR CANDIDATES)
I am a recruiter. I want to learn as much as I can about JEE5/JEE6 so when I try and find these types of candidates I can at least talk intelligently with them.

What I need to understand is what goes without saying?
So for example, if you were a J2EE or had experience with JEE5 or JEE6, could I assume you had spring and hibernate? Could I assume you had Jboss and Jboss admin?

I guess it would be helpful if I posted a job description and let you guys tell me what is wrong with it?

Candidate must have the following skills:

Extensive experience with Java/J2EE Development

Experience with various Development Tools (Eclipse, SVN, etc.)

Database design and SQL expertise

Web Services

JavaServer Faces (JSF)

Model-View-Controller (MVC)

Comfortable working in a Unix/Linux environment

Maven

JBoss Deployment and Administration

Swing/AWT

Scrum/Agile

TeamForge

So if I was a certified J2EE would i have all these skills? Are these skills even grouped right? If you were writing this job description for a J2EE what would you change? I am trying to learn. I am not posting this to find candidates for a job. I am posting this to try and get a handle on what a hiring manager is asking for and be able to tell him, there is no way a J2EE has all these skills or, no problem, all J2EE's have these skills. Am I making sense?

答:
A regular JEE developer would know either most of those skills or the equivalent, except for one outlier: Swing/AWT. Those are both desktop application GUI programming, so a typical web developer would most likely not be very familiar with them (in the sense that they wouldn't use it often).

There are a few things on that list with equivalents that you may need to know about when talking to the candidate:

JavaServer Faces - JavaServer Pages is the biggest contender, otherwise there are other templating languages that can be used - Velocity and FreeMarker are popular options.

SVN - Git, Mercurial, and CVS are other common version control systems.

JBoss - Application server. Some other possibilities are Tomcat, Glassfish, and WebLogic.

Overall, nothing about that skill listing is too odd. It isn't asking for a skill in a completely unrelated skillset (such as another language or platform entirely).

The issue comes with assuming anything. Hibernate is a very common skill, but it can be used in multiple flavors. It is also very complex, so while a developer may know how to use it, they might not know how to set it up or the fine-tuning that could be necessary.

One last thing - JEE5/6 and Spring tend not to be used at the same time. For a long time Spring was how the JEE stack should have been - and then JEE5/6 brought in some of the features. Nowadays they are competing platforms. Nothing stops you from using Spring in a JEE project, but it would be adding redundant capabilities and complexity for no reason.


问:
Why is Java boolean primitive type name not 'bool'?
Java has

int and Integer

boolean and Boolean

This seems a bit inconsistent, why not either

bool vs Boolean to use an established shorter name for primitive type?

or

integer vs Integer to keep type names consistent?

I think C++ had decided to use bool quite a bit earlier than Java decided to use boolean, and maybe also some (non-standard at the time?) C extensions too, so there would have been historical precedence for bool. I've noticed I often instinctively try to use bool at first (good thing modern editors immediately spot this without extra compilation round), so it'd be nice to know the rationale behind current state of affairs.

If someone remembers (a part of) the story, or can even find and link to relevant historical discussion in the net, that would be great.

答:
Without getting in contact with people who were actually involved in these design decisions, I think we're unlikely to find a definitive answer. However, based on the timelines of the development of both Java and C++, I would conjecture that Java's boolean was chosen before, or contemporaneously with, the introduction bool to C++, and certainly before bool was in wide use. It is possible that boolean was chosen due to its longer history of use (as in Boolean Algebra), or to match other languages (such as Pascal) which already had a boolean type.

Historical context

According to Evolving a language in and for the real world: C++ 1991-2006, the bool type was introduced to C++ in 1993.

Java included boolean in its first release in 1995 (Java Language Specification 1.0). The earliest language specification I can find is the Oak 0.2 specification (Oak was later renamed to Java). That Oak specification is marked "Copyright 1994", but the project itself was started in 1991, and apparently had a working demo by the summer of 1992.


答:
I don't know if Stroustrup ever said anything like that. I've never heard that.

I did once attend a lecture by Brian Kernighan in 1992 or thereabouts where Kernighan pointed out humorously that he routinely wrote programs that used every feature of C and had never even come close to writing a program that used all the features of C++, but his point was not that C++ was unknowable; rather, that the language had added a lot of special-purpose features.

More generally: it is very difficult to keep all of a large, complex language in your head at once. If a language has n non-orthogonal features then there are O(n2) interactions between those features.


问:
What's the worst question you were ever asked at interview?
It doesn't have to be programming or software development related, but just asked during an interview for an IT related job.

I know some "left field" questions are meant to see how the candidate copes with unexpected and novel situations, but here I'm looking for a question that appeared to be completely unrelated to the job they were interviewing you for, or something that made you think "what useful information could they possibly get from my answer to that question?".

答:
I was once asked, "Has anything unfortunate happened to you recently?"

I responded that my father had recently died. The interviewer just nodded slowly and said "Hmmm...."


答:
I will run through the chances that a given software developer applying for a typical Java developer possesses the following skills:

Extensive experience with Java/J2EE Development
  Experience with various Development Tools (Eclipse, SVN, etc.)

Goes without saying

Database design and SQL expertise

Common

Web Services
  JavaServer Faces (JSF)
  Model-View-Controller (MVC)
  Comfortable working in a Unix/Linux environment
  Maven

Common for web application developers

JBoss Deployment and Administration
  Swing/AWT

Uncommon for web application developers

Scrum/Agile

Familiarity should be common but I don't think anybody should be discounted for not having worked in an Agile/Scrum environment before.

TeamForge

This should be a nice to have as this a very specific skill set that probably doesn't have a very high learning curve.

Title: Recruiter asking for help understanding JEE5 or JEE6 and J2EE. (NOT A JOB POSTING NOT LOOKING FOR CANDIDATES)

Body:
I am a recruiter. I want to learn as much as I can about JEE5/JEE6 so when I try and find these types of candidates I can at least talk intelligently with them.

What I need to understand is what goes without saying?
So for example, if you were a J2EE or had experience with JEE5 or JEE6, could I assume you had spring and hibernate? Could I assume you had Jboss and Jboss admin?

I guess it would be helpful if I posted a job description and let you guys tell me what is wrong with it?

Candidate must have the following skills:

Extensive experience with Java/J2EE Development

Experience with various Development Tools (Eclipse, SVN, etc.)

Database design and SQL expertise

Web Services

JavaServer Faces (JSF)

Model-View-Controller (MVC)

Comfortable working in a Unix/Linux environment

Maven

JBoss Deployment and Administration

Swing/AWT

Scrum/Agile

TeamForge

So if I was a certified J2EE would i have all these skills? Are these skills even grouped right? If you were writing this job description for a J2EE what would you change? I am trying to learn. I am not posting this to find candidates for a job. I am posting this to try and get a handle on what a hiring manager is asking for and be able to tell him, there is no way a J2EE has all these skills or, no problem, all J2EE's have these skills. Am I making sense?


问:
Why should form inheritance be avoided?
I remember learning VB4 and dragging a button onto a form, double-clicking on that button, and typing code into that event handler I had just been magically blessed with. Coming from QBASIC I was thrilled with the "V" in "VB", the visual designer was literally the best thing since sliced bread.

Of course you could do all that programmatically but the magic of the "V" was so appealing you just couldn't help but drag that button. We were encouraged to take that route.

But then a few years ago I started learning about C# and the .net framework and was fascinated by the way everything I thought I knew had just gone out the window. There's a lot of magic going on in VB6 that's completely unveiled in .net: take constructors and the InitializeComponents method for example. In the latter you'd find all the control instances you've dragged from the toolbox, all the events you've registered and the properties you've set in the designer.

And that's fine... I guess. It's just, I feel like I don't "own" what's going on, this code that I can only modify via the designer annoys the heck out of me. Every time you copy a button that says "Ok" from one form to another (sometimes along with its brother "Cancel"), you are actually duplicating code, and that's a sin isn't it? DRY, don't repeat yourself, says the Pope.

Religions and schools of thought aside, in all objectivity, shouldn't we derive forms from base forms instead, and have the "Ok" button (and all of its friends) live on the base form? Something like a FormBase from which derives a DialogFormBase; all classes created in no time... by typing code. The buttons are created depending on how the class is instanciated (i.e. a constructor enum argument determines which buttons are to be created), controls are laid out inside an arrangement of split panels and flow layout panels, injected into the form as Content that fits into the main content panel. Isn't this what ASP.net does with master pages and content placeholders? I'd derive a form when I need a new "master page", but this new "master page" still derives from a base form class so the visuals are consistent across the entire application.

To me that's much more code reuse than anything else I've ever done with the designer in WinForms, and it wasn't even hard, and code isn't cluttered with a 200-lines method that I have no control over, I can put comments where I like, they won't get overwritten by a designer. I guess it's just a matter of patterns and architecture, which is what brought me to this link: Best design for Windows forms that will share common functionality, where I realized I was spot on, except the answer there, suggests exactly what I'm doing, but it's advising against form inheritance because of designer considerations. That's the part I don't get. I would rather advise against using the designer because of code structure considerations, especially in regards with form and control inheritance, which I see no reason to avoid other than well it breaks the designer.

We can't all be just lazy, so what part am I missing?

答:
I'm gonna oppose you with different paradigm : Favor composition over inheritance.

Even when you start writing GUI code by hand and use inheritance to share behavior and visuals between forms, you will hit same problem as normal OOP design. Lets say you have DialogForm, that has OK/Cancel buttons and GridForm, that has grid. You derive all dialogs from DialogForm and all forms with Grid from GridForm. And then you find out you want form with both. How would you solve it? If you are using form inheritance, then there is no way solve it. On the other side, if you are using UserControls, then you can simply put GridControl on your form and be done with it. And you can still use designer with UserControls, so you don't have to waste time writing tedious GUI code.

Title: Why should form inheritance be avoided?


问:
Negative test cases confusion
In the Software testing book from Koirala, Sheihk, they say:

A positive test is when you put in a valid input and expect some
  action to be completed in accordance with the specification.

  A
  negative test is when you put in an invalid input and receive errors.

Part of my question:

Let's say there is a requirement: If the customer name=="James Bond", do something.

Is name<>"James Bond" negative or still positive test, verifying the requirement?

Or a login function:

Is correct login positive test case and incorrect negative?

Or Login failed is just confirmation of requirement that a password must be correct ->confirming invalid pass will not work.

For example, if the program is supposed to give an error when the person types in "101" on a field that should be between 1 and 100, then that is positive then if an error shows up. If, however, the application does not give an error when user types 101, then you have a negative test.

答:
I do not think it is a negative test, because the requirement dictates
  to show error when number ==101. Also typing 101 I am validating the
  requirement.

If you're testing the requirement that the program produces an error for input of 101, then entering 101 and expecting an error is a positive test.

If you're testing that the program accepts values between 1 and 100, then entering 101 and expecting an error is a negative test.

In other words, the difference between positive and negative test depends on exactly what you're testing. A positive test determines that the behavior works correctly (or doesn't), and a negative test determines that erroneous input fails.

Title: Negative test cases confusion


答:
There is always a lot of semantic confusion when you double your negatives or negate your positives. That's more a limitation of English than of testing theory of methodology. In essence, many scenarios can be described both in what should happen and what shouldn't happen. One is a "positive" effect (what should happen) and one is a "negative" effect - the error. But in actuality these are two different features you are testing.

In your 1-100 example, for instance, the two features are "only accept input between 1 and 100", and "show an error message when input isn't between 1 and 100". These aren't the positive and negative aspects of the same test, but two different tests. The positive element of the first test is to give an input between 1 and 100 and see that the function works. The negative aspect is to give an input of 101 and see that it doesn't work. That's all.

For the second feature, the positive test would be to give an input of 101, or Int32.MinValue, or 0, or other edge cases, and see the error shown. The negative test would be to give an input of 40, and ensure no error is displayed.

Title: Negative test cases confusion

Body:
In the Software testing book from Koirala, Sheihk, they say:

A positive test is when you put in a valid input and expect some
  action to be completed in accordance with the specification.

  A
  negative test is when you put in an invalid input and receive errors.

Part of my question:

Let's say there is a requirement: If the customer name=="James Bond", do something.

Is name<>"James Bond" negative or still positive test, verifying the requirement?

Or a login function:

Is correct login positive test case and incorrect negative?

Or Login failed is just confirmation of requirement that a password must be correct ->confirming invalid pass will not work.

For example, if the program is supposed to give an error when the person types in "101" on a field that should be between 1 and 100, then that is positive then if an error shows up. If, however, the application does not give an error when user types 101, then you have a negative test.


答:
It's likely an exaggeration, in the same spirit as the fake interview with Stroustrup where he basically "admits" that C++ was designed entirely as a conspiracy to promote programmer job security.

Even if it is true, what does it really mean?  What does it mean to "know entirely" a programming language?  Does that mean you know every keyword?  Does that mean you know every function in the standard library?  I've been programming in Python for years now, and I certainly haven't memorized every function in the enormous standard library.

Regardless, claims about the complexity of C++ are often exaggerated or at least, misleading.  I regularly program in C++ and Python.  When programming in Python I very often have to peruse the docs to find the exact function parameters or whatnot for some function in Python's enormous standard library.  In contrast, I barely ever look at any C++ docs, because I pretty much have STL syntax burned into muscle memory, since the C++ standard library is pretty small and generic compared to other languages.

Yes, C++ has many obscure corners like member function pointers, virtual inheritance, pointer-to-data-members, etc.  But every language has obscure corners.  (Did you know Java has a Void reference type?  Have you fully memorized how to work with memoryview objects in Python?)  In practice, these features are so rarely used that you'll probably need to open up a reference no matter what if you decide to use them or encounter them in someone's code.  But that hardly kills overall productivity, because again, these features are rarely used.


问:
Why does Cem Kaner consider a test not revealing a bug a waste of time?
What about confirming the functionality in positive tests, proving it is working - should I say it is a waste of time? What kind of concept is behind this quote?

Unsuccessful tests, i.e. tests that do not find errors are a waste of
  time.

Web Engineering: The Discipline of Systematic Development of Web Applications quoting Cem Kaner.

答:
I wrote most of Testing Computer Software over 25 years ago. I've since pointed to several parts of the book that I consider outdated, or simply wrong. See http://www.kaner.com/pdfs/TheOngoingRevolution.pdf

You can see more (current views, but without explicit pointers back to TCS) at my site for the Black Box Software Testing Course (videos and slides available for free), www.testingeducation.org/BBST

The testing culture back then was largely confirmatory.

In modern testing, the approach to unit testing is largely confirmatory--we write large collections of automated tests that simply verify that the software continues to perform as intended. The tests serve as change detectors--if something in other parts of the code and this part now has problems, or if data values that used to be impossible in the real world are now reaching the application, then the change detectors fire, alerting the programmer to a maintenance problem.

I think the confirmatory mindset is appropriate for unit testing, but imagine a world in which all of system testing was confirmatory (for folks who make a distinction, please interpret "system integration testing" and "acceptance testing" as included in my comments on system testing.) The point of testing was to confirm that the program met its specifications and the dominant approach was to build a zillion (or at least a few hundred) system-level regression tests that mapped parts of the spec to behaviors of the program. (I think spec-to-behavior confirmation is useful, but I think it is a small portion of a larger objective.)

There are still test groups that operate this way, but it is no longer the dominant view. Back then, it was. I wrote emphatically and drew sharp contrasts to make a point to people who were consistently being trained in this mindset. Today, some of the sharp contrasts (including the one quoted here) are outdated. They get misinterpreted as attacks on the wrong views.

As I see it, software testing is an empirical process for learning quality-related information about a software product or service.

A test should be designed to reveal useful information.

Back then, by the way, no one talked about testing as a method for revealing "information". Back then, testing was either for (some version of ...) finding bugs or for (some version of ... ) verifying (checking) the program against specifications. I don't think that the assertion that tests are for revealing useful information came into the testing vocabulary until this century.

Imagine rating tests in terms of their information value. A test that is very likely to teach us something we don't know about the software would have a very high information value. A test that is very likely to confirm something that we already expect and that has already been demonstrated many times before, would have a low information value. One way to prioritize tests is to run higher information value tests before lower information value tests.

If I was to oversimplify this prioritization so that it would attract the attention of a programmer, project manager, or process manager who is clueless about software testing, I would say "A TEST THAT IS NOT DESIGNED TO REVEAL A BUG IS A WASTE OF TIME." It's not a perfect translation, but for readers who cannot or will not understand any subtlety or qualification, that's as close as it's going to get.

Back then, and I see it again here, some of the people who don't understand testing would respond that a test designed to find corner cases is a waste of time compared to a test of a major use of a major function. They don't understand two things. First, by the time testers find time to check boundary values, the major uses of the major functions have already been exercised several times. (Yes, there are exceptions, and most test groups will pay careful attention to those exceptions.) Second, the reason to test with extreme values is that the program is more likely to fail with extreme values. If it doesn't fail at the extreme, you test something else. This is an efficient rule. On the other hand, if it DOES fail at an extreme value, the tester might stop and report a bug or the tester might troubleshoot further, to see whether the program fails in the same way at more normal values. Who does that troubleshooting (the tester or the programmer) is a matter of corporate culture. Some companies budget the tester's time for this, some budget the programmers, and some expect programmers to fix corner case bugs whether they are generalizable or not so that troubleshooting is not relevant. The common misunderstanding -- that testers are wasting time (rather than maximizing efficiency) by testing extreme values is another reason that "A test that is not designed to reveal a bug is a waste of time" is an appropriate message for testers. It's a counterpoint to the encouragement from some programmers to (in effect) never run tests that might challenge the program. The message is oversimplified, but the entire discussion is oversimplified.

By the way, "information value" can't be the only prioritization system. It's not my rule when I design unit test suites. It's not my rule when I design build verification tests (aka sanity checks). In both of those cases, I'm more interested in types of coverage than in the power of the individual tests. There are other cases (e.g. high-volume automated tests that are cheap to set up, run and monitor) where power of individual tests is simply irrelevant to my design. I'm sure you can think of additional examples.

But as a general rule, if I could state only one rule (e.g. speaking to an executive whose head explodes if he tries to process more than one sentence), it would be that a low information-value test is usually a waste of time.


问:
Why does PHP have interfaces?
I noticed that as of PHP5, interfaces have been added to the language. However, since PHP is so loosely typed, it seems that most of the benefits of using interfaces is lost. Why is this included in the language?</p>

答:
Lots of people will probably hate me for answering this way but the solution to your typing problems can be easily fixed with PHP. Yes PHP is loosely typed so types are assumed by default, which can cause some problems, especially in comparison operations which is most peoples problem with it. That being said, PHP can be just as strict as any strongly typed language if you cast what you are using into the type you need it to be, and then use bitwise comparison operators. Here is the easiest example I can think of of what I am saying:

$myVar = (int) 0;
$myOtherVar = '0';

comparing ($myVar == $myVar) would equal (bool) true

but comparing ($myVar === $myVar) would equal (bool) false just like any "typed" comparison

I really just wish developers would stop arguing about these things, if you have a problem with the way PHP works either go program in java and live and let live, or use it in the way that it will do what you want it to... What good does bitching about it do for you anyway? Give you an excuse to screw around all day? Make you look better than someone else? Well it's great that you feel so highly about yourself that you're willing to make someone else look bad but in reality it's your preference and forcing your beliefs on anyone really just makes them code in a way they are not comfortable with causing three things:

1) They will code your way but "messy" by your standards (think, have you ever seen a java programmer create their first PHP program or vice versa? It will be the same way changing their methodology or maybe even worse.)

2) You will find something else to whine about

3) It will probably take longer for them to produce. And maybe it will make you look better in the short term, but the team as a whole will look worse for it (remember you may code slower than someone else and that's not necessarily bad as long as the team meets deliverables in a reasonable timeframe, but forcing your habits on someone who has typically performed a little faster may end up making your whole team slow down thus, look worse in a very demanding workflow)

I personally prefer writing procedural PHP code although I can, and have, written full programs using OOP in a few different languages. That being said, I have seen good OOP code and bad OOP code, and good procedural code and bad procedural code for that matter... It really has nothing to do with the practice, but with the habits that you use and even then, a lot of things are my interpreted feelings... that does not mean I am going to talk bad about those developers or say brag with "my way is best" B.S., it's just right for me, and the company I work for is pretty happy with my work and I'm proud of that. There are reasons a standard should be established but what you include in the standard you choose is VERY important... Thanks for letting me get that off my chest. Have a great day.

Title: Why does PHP have interfaces?


答:
is it just an exaggeration? ...this affirmation should be present on his website

It's just an exaggeration and you are right, affirmation of that is present on his website, right in the FAQ page. Stroustrup's position on C++ complexity is clearly stated in FAQ -> Why is C++ so BIG?

Full quote of this section is presented below for your convenience, I put bold font on the part of text that directly addresses your question (Stroustrup does not think C++ is vastly complex):

C++ isn't as big as some people imagine. It's not a tiny language designed to be a minimal language for teaching, but neither are the languages people most often compare it to, such as C, Java, C#. They too are huge compared to say, Pascal as Dr. Wirth originally defined it - for good reasons, I think. The programming world is far more complex today than it was 30 years ago, and modern programming languages reflect that.

The C++ standard is 740 pages, but that includes 400 pages of library description. The language features are described (in excruciating detail) in 340 pages. Similarly, TC++PL is 1000+ pages, but only 350 of those are devoted to the explanation of language facilities and their use; the rest discuss libraries, programming techniques, etc.

C++ directly supports (i.e., in the language) what some other languages support through libraries, so the language part will be relatively larger. On the other hand, if you want to write a "typical modern application", you need to consider operating system interfaces, GUI, databases, web interfaces, etc. the sum of language features, libraries, and programming conventions and standards that you must become familiar with dwarf the programming language. Here, C++'s size can be an advantage as far as it better supports good libraries.

Finally, the days where a novice programmer can know all of a language are gone, at least for the languages in widespread industrial use. Few people know "all of C" or "all of Java" either and none of those are novices. It follows that nobody should have to apologize for the fact that novices do not know all of C++. What you must do - in any language - is to pick a subset, get working writing code, and gradually learn more of the language, its libraries, and its tools. For my suggestion on how beginners can approach C++, see Programming: Principles and Practice using C++.

The misquote your friend refers to likely originates from that very section quoted above, as a satire on the statement "the days where a novice programmer can know all of a language are gone, at least for the languages in widespread industrial use".

Note that if you just drop the word novice from that quote, you can pretend that "can't know all of the language" applies to Stroustrup himself.

Note though that the way it is really stated (with novice word in it), it suggests that Stroustrup believes to know all of a language and even more, he believes that with sufficient experience (sufficient to stop being novice), anyone can know.


答:
Much of this is tied to the technology stack of choice.

WinForms and WPF may both be .NET UI frameworks but vary greatly in how you achieve the end goal. Certain paradigms move between technologies just fine but others don't and you shouldn't try and force a paradigm simply because you feel it's meant to exist in every framework. There is a reason that MVVM is geared at WPF/SL and MVC is a seperate concept in ASP.NET from WebForms and so on. Certain technologies work better with certain paradigms.

Keep in mind that generated code should generally be removed from your DRY concerns. While applicable in some instances, more often than not it should be ignored. DRY concepts should certainly remain a focus outside your Presentation layer but at the Presentation layer generated code is more often than not a byproduct of the framework you are working in. This is not to say you can't apply DRY principles in your approach but remain cautious. Could you create a base Form and inherit from it indefinitely? Yes. Could you drag and drop components on a new Form each and every time as needed? Yes. Keep focused on the end goal, avoiding potential defects, making it easy to refactor downstream, and scalability while working within the confines of the technology stack of choice.

Title: Why should form inheritance be avoided?

Body:
I remember learning VB4 and dragging a button onto a form, double-clicking on that button, and typing code into that event handler I had just been magically blessed with. Coming from QBASIC I was thrilled with the "V" in "VB", the visual designer was literally the best thing since sliced bread.

Of course you could do all that programmatically but the magic of the "V" was so appealing you just couldn't help but drag that button. We were encouraged to take that route.

But then a few years ago I started learning about C# and the .net framework and was fascinated by the way everything I thought I knew had just gone out the window. There's a lot of magic going on in VB6 that's completely unveiled in .net: take constructors and the InitializeComponents method for example. In the latter you'd find all the control instances you've dragged from the toolbox, all the events you've registered and the properties you've set in the designer.

And that's fine... I guess. It's just, I feel like I don't "own" what's going on, this code that I can only modify via the designer annoys the heck out of me. Every time you copy a button that says "Ok" from one form to another (sometimes along with its brother "Cancel"), you are actually duplicating code, and that's a sin isn't it? DRY, don't repeat yourself, says the Pope.

Religions and schools of thought aside, in all objectivity, shouldn't we derive forms from base forms instead, and have the "Ok" button (and all of its friends) live on the base form? Something like a FormBase from which derives a DialogFormBase; all classes created in no time... by typing code. The buttons are created depending on how the class is instanciated (i.e. a constructor enum argument determines which buttons are to be created), controls are laid out inside an arrangement of split panels and flow layout panels, injected into the form as Content that fits into the main content panel. Isn't this what ASP.net does with master pages and content placeholders? I'd derive a form when I need a new "master page", but this new "master page" still derives from a base form class so the visuals are consistent across the entire application.

To me that's much more code reuse than anything else I've ever done with the designer in WinForms, and it wasn't even hard, and code isn't cluttered with a 200-lines method that I have no control over, I can put comments where I like, they won't get overwritten by a designer. I guess it's just a matter of patterns and architecture, which is what brought me to this link: Best design for Windows forms that will share common functionality, where I realized I was spot on, except the answer there, suggests exactly what I'm doing, but it's advising against form inheritance because of designer considerations. That's the part I don't get. I would rather advise against using the designer because of code structure considerations, especially in regards with form and control inheritance, which I see no reason to avoid other than well it breaks the designer.

We can't all be just lazy, so what part am I missing?


答:
A. HIGH LEVEL MODULES SHOULD NOT DEPEND UPON LOW
LEVEL MODULES. BOTH SHOULD DEPEND UPON ABSTRACTIONS.

B. ABSTRACTIONS SHOULD NOT DEPEND UPON DETAILS. DETAILS
SHOULD DEPEND UPON ABSTRACTIONS.

I'll put a direct example of the inversion of control.

Imagine you have a RemoteControl class:

```<code>class RemoteControl {
    private TV television;

    public RemoteControl() {
        this.television = new TV();
    }

    function turnOn() {
       this.television.turnOn();
    }
}
</code>```

As you can see RemoteControl is tightly coupled with the Television class, a low-level component or a concrete utility component. That means Television depends on the button class to be turned on.

Inversion of control dictates that RemoteControl must not depend on concrete utility components or low-level components such as the Television class. We must find a way to abstract the RemoteControl and Television concrete implementations into a "high-level" ideas in order for the design to be decoupled.

If we do that, we could make the television a concept that can be turned on with multiple interchangeable low-level utility components (switch, remote control, gestures, etc), and the same for the remote control. It can be a component that can turn on different interchangeable low-level utility components (radio, AC, lights, etc)

The solution would be something like this:

```<code>interface OnOffAbleComponent {
    public function turnOn();
    public function turnOff();
}

class Television implements OnOffAbleComponent {
    function turnOn() {
         ...
    }
    function turnOff() {
         ...
    }
}

interface Switch {
    public function turnOn();
    public function turnOff();
}

class RemoteControl implements Switch {
    function turnOn() {
         this.onOffAbleComponent.turnOn();
    }
    function turnOff() {
         this.onOffAbleComponent.turnOff();
    }
}
</code>```

Now Television doesn't know if it's a "button", "remote control", or a "human gesture" the thing that is turning the television on. Television only knows about some "abstract idea" that allows it to be turned on. Our old component "RemoteControl" now implements an interface SomethingThatTurnsOnTVInterface, which is a high-level component or "the high-level abstract idea".

So we went from concrete ideas to abstract ideas:

lowLevel-----------------------lowLevel

RemoteControl ---- depends  on ----> Television

To:

highlevel -------------------------highLevel

Switch -----depends on --------> OnOffAbleComponent

Television is not coupled to RemoteControl anymore.

We have successfully inverted the control from low-level to high-level.

Body:
A. HIGH LEVEL MODULES SHOULD NOT DEPEND UPON LOW
LEVEL MODULES. BOTH SHOULD DEPEND UPON ABSTRACTIONS.

B. ABSTRACTIONS SHOULD NOT DEPEND UPON DETAILS. DETAILS
SHOULD DEPEND UPON ABSTRACTIONS.

I'll put a direct example of the inversion of control.

Imagine you have a RemoteControl class:

class RemoteControl {
    private TV television;

    public RemoteControl() {
        this.television = new TV();
    }

    function turnOn() {
       this.television.turnOn();
    }
}

As you can see RemoteControl is tightly coupled with the Television class, a low-level component or a concrete utility component. That means Television depends on the button class to be turned on.

Inversion of control dictates that RemoteControl must not depend on concrete utility components or low-level components such as the Television class. We must find a way to abstract the RemoteControl and Television concrete implementations into a "high-level" ideas in order for the design to be decoupled.

If we do that, we could make the television a concept that can be turned on with multiple interchangeable low-level utility components (switch, remote control, gestures, etc), and the same for the remote control. It can be a component that can turn on different interchangeable low-level utility components (radio, AC, lights, etc)

The solution would be something like this:

interface OnOffAbleComponent {
    public function turnOn();
    public function turnOff();
}

class Television implements OnOffAbleComponent {
    function turnOn() {
         ...
    }
    function turnOff() {
         ...
    }
}

interface Switch {
    public function turnOn();
    public function turnOff();
}

class RemoteControl implements Switch {
    function turnOn() {
         this.onOffAbleComponent.turnOn();
    }
    function turnOff() {
         this.onOffAbleComponent.turnOff();
    }
}

Now Television doesn't know if it's a "button", "remote control", or a "human gesture" the thing that is turning the television on. Television only knows about some "abstract idea" that allows it to be turned on. Our old component "RemoteControl" now implements an interface SomethingThatTurnsOnTVInterface, which is a high-level component or "the high-level abstract idea".

So we went from concrete ideas to abstract ideas:

lowLevel-----------------------lowLevel

RemoteControl ---- depends  on ----> Television

To:

highlevel -------------------------highLevel

Switch -----depends on --------> OnOffAbleComponent

Television is not coupled to RemoteControl anymore.

We have successfully inverted the control from low-level to high-level.