答:
IMHO a technology potentially compatible with every device on the market (if well implemented) is the way to go.

Portability has always been one of the most important properties of successful languages such as C.

HTML5 together with JavaScript and server-side languages offers you all you need to develop rich applications (not only web, as the latest Microsoft announcements on Windows 8 seems to indicate).

Technologies such as Flash and Silverlight will always have a market, but I see the big wave moving towards HTML/JS.

As for the ease with which more complex things are possible with Silverlight, it's just a matter of time, with the new HTML5 and the many JS frameworks growing and getting better year after year.

I would have no doubts in investing my time in such a growing technology.

Title: Is it better to develop apps using a platform specific technology or web technologies?

Body:
I happened to read an interesting article the other day that talked about building mobile applications using Javascript and HTML5. One interesting point they brought out was how this approach worked across multiple platforms, different hardware (ex. screen size) and software (ex. iPhone, WP7, Mac, Windows).

I also noticed something interesting posted on Microsoft's Build Website for their upcoming conference. They seem to put a lot of emphasis on HTML5 and JavaScript. It does seem ideal to develop a single application (of course it would still require minor modifications) and have it work on tablets, PCs, mobile devices, TVs or pretty much any internet-capable device.

Is this a shifting trend?

Obviously it's no fun learning a technology just to find out a year later that it's getting shut down. In my opinion it seems rather difficult as it stands to do certain functionality like animations or data-binding (my favorite!) with HTML5 and JavaScript when compared to Silverlight. In this case the tools alone make it a better choice (Expression Blend and Visual Studio 2010). I am concerned though because it has been getting easier to do things on the web that just a few years ago didn't seem possible.

Is there still a place for technologies like Flash and Silverlight when it comes to developing applications or should we be aiming to gear our apps toward web-specific technologies such as HTML5, CSS3, and JavaScript?


问:
is it realistic to make use of HTML5 local storage to store CSS, and JavaScript
The idea is to make use of HTML5 local storage to store frequently accessed CSS and JavaScript.

For example (pseudo-code):

```
var load_from_cdn = true;
if (detect local storage)
{
  if (cache of css, js found)
  {
     load the local storage cache
     load_from_cdn = false;
  }
}
if (load_from_cdn)
{
   document.write('<script>...');
}
```

Is this possible or realistic?

I do aware browser cache, there will be still some header access checking,

I assuming no HTTP access is better (in my thinking)

PS : It seems that local storage only support key-value pair, can someone prove it ?

(best with some examples)

答: Doesn't the browser already do this for you, and probably better?</p>

ContentLicense: CC BY-SA 3.0


答:
What's the point?

There is already a well established technique called client-side caching. What does HTML5 local storage brings in this case what caching is missing?

You may have some sort of strange application which must load chunks of JavaScript code dynamically so you can't effectively use the cache, but it's an extremely rare case.

Also, be aware of another thing. Browsers have specific policies for cache, and most browsers are quite good at managing cache well (removing only the older content, etc.). By implementing your home-made cache, you prevent the browsers from managing it correctly. Not only it can be criticized on its own, but it will also hurt you soon or later. Example: when the users of a web application are reporting bugs, often you answer by asking them to clear their cache. I'm not sure what you'll ask in your case, since clearing the cache will never resolve issues with your web app.

In response to your first edit (your second edit being off-topic):

I do aware browser cache, there will be still some header access checking

You seem to lack some understanding of browser caching. That's why it is essential to understand how it works first, before starting to implement your own home-made caching mechanism. Reinvent your own wheel only when you understand enough the existent wheels and have a good reason to not use them. See point 1 of my answer to the question "Reinventing the wheel and NOT regretting it".

When providing some data through HTTP, you can specify a few headers related to the cache:

Last-Modified specifies when the content was changed,

Expires specifies when the browser must ask to the server if the content changed.

Those two headers allow the browser to:

Avoid downloading the content again and again. If Last-Modified is set to the last month, and the content was already downloaded today a few hours before, there is no need to download it again.

Avoid querying for the date where the file was last modified. If Expires of a cache entity is May 5th, 2014, you don't have to issue any GET request neither in 2011, nor in 2012 or 2013, since you know that the cache is up-to-date.

The second one is essential for CDNs. When Google serves JQuery to a visitor of Stack Overflow or cdn.sstatic.net serves images or stylesheets used by Stack Overflow, they do not want browsers to query for a new version every time. Instead, they are serving those files once, set the expiration date to something long enough, and that's all.

Here's for example a screenshot of what's happening when I come to Stack Overflow home page:

There are 15 files to serve. But where are all those 304 Not Modified responses? You only have three requests of content that changed. For everything else, the browser uses the cached version without making any request to any server.

To conclude, you really need to think twice before implementing your own cache mechanism, and especially find a good scenario where this can be useful. As I said at the beginning of my answer, I can find only one: where you are serving chunks of JavaScript to use them through, OMG, eval(). But in this case, I'm pretty sure that there are better approaches which are either:

More effective using the standard cache techniques, or

Easier to maintain.

Title: is it realistic to make use of HTML5 local storage to store CSS, and JavaScript

Body:
The idea is to make use of HTML5 local storage to store frequently accessed CSS and JavaScript.

For example (pseudo-code):

```
var load_from_cdn = true;
if (detect local storage)
{
  if (cache of css, js found)
  {
     load the local storage cache
     load_from_cdn = false;
  }
}
if (load_from_cdn)
{
   document.write('<script>...');
}
```

Is this possible or realistic?

I do aware browser cache, there will be still some header access checking,

I assuming no HTTP access is better (in my thinking)

PS : It seems that local storage only support key-value pair, can someone prove it ?

(best with some examples)


问:
What is the correct definition of Moore's law
I see different sources that say the number of transistors will double every 24 months or every 18 months.

Does anyone have a credible source?

答:
The original source ftp://download.intel.com/museum/Moores_Law/Articles-Press_Releases/Gordon_Moore_1965_Article.pdf .

Note that Moore's law said nothing about performance, it was simply that the optimal number of components on a single IC would increase exponentially with time (from a cost/function point of view).

Quote from the 1965 paper:  "This allows at least 500 components per linear inch or a quarter million per square inch"

The current core i7 is approximately 0.4 sq inches and has 750M transistors so 2billion per square inch!


答:
Check here: sound right to me:

http://www.computerhistory.org/semiconductor/timeline/1965-Moore.html

It started at 12 months, then changed to 24 months...

Title: What is the correct definition of Moore's law

Body:
I see different sources that say the number of transistors will double every 24 months or every 18 months.

Does anyone have a credible source?


答:
The wikipedia article explains it;

Moore slightly altered the formulation of the law over time, in
  retrospect bolstering the perceived accuracy of his law.[17] Most
  notably, in 1975, Moore altered his projection to a doubling every two
  years.[18] Despite popular misconception, he is adamant that he did
  not predict a doubling "every 18 months". However, David House, an
  Intel colleague, had factored in the increasing performance of
  transistors to conclude that integrated circuits would double in
  performance every 18 months.[note 1]


答: As usual, Ars Technica has an excellent article on the meaning and history of Moore's Law. It cite's Gordon Moore's 1965 paper containing the original prediction(s). Whether the period is 12, 18, or 24 months really doesn't matter all that much in most cases -- the most important element is that component density has continued to grow geometrically for much longer than anyone thought it would. I'd recommend starting with the Ars article and then reading Moore's paper if you're still interested in knowing more.</p>


问:
How to manage time for studying while working?
I've been programming 8 years for a company. We build business intelligence software systems. Since I thought working is learning, I've always studied in terms of what I was doing at the company while working for 60 hours per week. These days, however, I am looking for a new company for employment, I can see that thought was a dumb idea because I frequently fail in job interviews mainly due to lack of knowledge on the other areas. Of course, I am still willing to improve myself and am really trying. But while working that much of time per week, I can't find good amount of study time to catch up.

I don't think I am the only one to concern about this so I would like to ask how you guys find time to study for your career? How many hours do you assign to studying other areas? Am I missing some time management skills?

答:
Well walking in your shoes I'd say I've got enough data to figure how much time to assign to studying other areas. Look...

I frequently fail in job interviews mainly due to lack of knowledge on the other areas

...Been there done that. Interviews failures (and passes for that matter) are invaluable source of knowledge for what to learn.

After each interview (no matter failed or passed), I make notes marking what areas I was lacking - that makes a solid base for the further study. Then, I just list, prioritize and estimate items extracted from these notes and that makes a guidance on further learning.

If an item makes a key skill I missed at dream job interview, I try do my best to find time to study it.

If it's a frequently asked stuff requiring I dunno day or two to grok, I study it too.

The rest fails into if time allows bucket. If time allows, I study it thoroughly, otherwise try to get a basic understanding or drop it if it doesn't feel important enough

For the sake of completeness: items in my list include not only technical areas but also whatever other skills I may be missing. These can be items like eg, hard time handling post-interview stress or difficulties with paper-and-pen coding - basically anything that I felt was not quite OK at interview.

PS. maintaining and tracking such a list of high-demand technologies might lead you farther than you expect. Thing is, persistence in fiddling with that list kind of breaks the mental block of programming 8 years for a company.

Eg if you decide that you really badly miss something, one day you may decide to change a job to some not-too-appealing position that however gives you an opportunity of full-time experience in desired area. That happened to me twice. Have to admit, each time it felt like jumping into ice water. Nevertheless in the long term perspective it turned out really worth it.


答:
Client-side local caching should be way more optimized than using HTML5 local storage.  Just make sure your javascript and CSS are in external cachable files and your page should load much quicker via browser cache than trying to extract them from local storage and execute them yourself.

Besides, the browser can start loading external resources as the page starts to load, before you can actually start running javascript in that page to then get your resources from HTML5 local storage.

Plus, you need code in the page anyway in order to load from HTML5 local storage, so just put all your JS in one external, cachable JS file.


问:
Is it better to develop apps using a platform specific technology or web technologies?
I happened to read an interesting article the other day that talked about building mobile applications using Javascript and HTML5. One interesting point they brought out was how this approach worked across multiple platforms, different hardware (ex. screen size) and software (ex. iPhone, WP7, Mac, Windows).

I also noticed something interesting posted on Microsoft's Build Website for their upcoming conference. They seem to put a lot of emphasis on HTML5 and JavaScript. It does seem ideal to develop a single application (of course it would still require minor modifications) and have it work on tablets, PCs, mobile devices, TVs or pretty much any internet-capable device.

Is this a shifting trend?

Obviously it's no fun learning a technology just to find out a year later that it's getting shut down. In my opinion it seems rather difficult as it stands to do certain functionality like animations or data-binding (my favorite!) with HTML5 and JavaScript when compared to Silverlight. In this case the tools alone make it a better choice (Expression Blend and Visual Studio 2010). I am concerned though because it has been getting easier to do things on the web that just a few years ago didn't seem possible.

Is there still a place for technologies like Flash and Silverlight when it comes to developing applications or should we be aiming to gear our apps toward web-specific technologies such as HTML5, CSS3, and JavaScript?

答: It's impossible to know which is "better" in the absence of requirements and some sense of available resources. HTML5 is great, but if your business model relies on in-app purchase, or if you have a team that's fluent in Flash, you'll probably choose a different direction. "Best" is what best solves your particular problem. It doesn't mean much in the abstract.</p>


答:
You'll get much better performance by using a content delivery network (CDN) like Google's code library.  Planned thoughtfully, the majority of your JS and CSS should be in every visitor's cache before they hit your site for the first time.  Minify the remainder.

You can always benchmark browser caching vs your hand-rolled HTML5 solution.  But my bet is that the native caching is going to beat the pants off it.


问:
Are SMART goals useful for programmers?
Several organisations I know use SMART goals for their programmers. SMART is an acronym for Specific, Measurable, Achievable, Relevant and Time-Bound. They are fairly common in large corporations.

My own prior experience with SMART goals has not been all that positive. Have other programmers found them an effective way to measure performance? What are some examples of good SMART goals for programmers (if they exist).

答:
We go through this exercise every year.  The problem is that developers here tend to have very little autonomy over what they do (tasks determined by product manager).  We are fortunate that, at least on paper, we have time dedicated to pursuing our goals.  Realistically, we get far less than that, however.

Within that framework, I've found that setting self-developmental goals works really well.  For example, two of my goals from last year were:

To read Design Patterns and write toy projects to learn and
demonstrate each pattern by next year. This has ended up taking 2 years, but the
improvement to my coding has been noticeable.

To study .NET 3.5
language features and do a presentation to my co-workers each
quarter.  This ended up being 1 presentation on LINQ which my
co-workers appreciated in various degrees between apathetic and
mildly interested.  However, I learned lots, and having demonstrated
my C# knowledge I've been moved to work on a pretty cool new
project.

So, yeah, I've benefited and had fun while doing it.

Honestly, in our company, I think the lack of good developer SMART goals has more to do with knee-jerk aversion to corporate-speak.

Title: Are SMART goals useful for programmers?


问:
Applying SOLID principles
I am quite new to the S.O.L.I.D. design principles. I understand their cause and benefits, but yet i fail to apply them to a smaller project which I want to refactor as a practical exercise to use the SOLID principles. I know there is no need to change an application that works perfectly, but I want to refactor it anyway so I gain design experience for future projects.

The application has the following task (actually a lot more than that but let's keep it simple):
It has to read an XML file which contains Database Table/Column/View etc definitions and create an SQL file which can be used in order to create an ORACLE database schema.

(Note: Please refrain from discussing why I need it or why I don't use XSLT and so on, there are reasons, but they are off-topic.)

As a start, I chose to look only at Tables and Constraints. If you ignore columns, you could state it the following way:

A constraint is part of a table (or more precisely, part of a CREATE TABLE statement), and a constraint may also reference another table.

First, I will explain what the application looks like right now (not applying SOLID):

At the moment, the application has a "Table" class which contains a list of pointers to Constraints owned by the table, and a list of pointers to Constraints referencing this table. Whenever a connection gets established, the backwards connection will be established as well.
The table has a createStatement() method which in turn calls the createStatement() function of each Constraint. Said method will itself use the connections to the owner table and referenced table in order to retrieve their names.

Obviously, this doesn't apply to SOLID at all.
For example, there are circular dependencies, which bloated the code in terms of "add"/"remove" methods required and some large object destructors.

So there are a couple of questions:

Should I resolve the circular dependencies using Dependency Injection? If so, I suppose the Constraint should receive the owner (and optionally the referenced) table in its constructor. But how could I run over the list of constraints for a single table then?

If the Table class both stores the state of itself (e.g. table name, table comment etc) and the links to Constraints, are these one or two "responsibilities", thinking of the Single Responsibility Principle?

In case 2. is right, should I just create a new class in the logical business layer which manages the links? If so, 1. would obviously no longer be relevant.

Should the "createStatement" methods be part of the Table/Constraint classes or should I move them out as well? If so, where to? One Manager class per each data storage class (i.e. Table, Constraint, ...)? Or rather create a manager class per link (similar to 3.)?

Whenever I try to answer one of these questions I find myself running in circles somewhere.

The problem obviously gets a lot more complex if you include columns, indices and so on, but if you guys help me out with the simple Table/Constraint thing, I can maybe work out the rest on my own.

答:
The cure for circular dependencies is to vow that you will never, ever create them.  I find that coding test-first is a strong deterrent.

Anyway, circular dependencies can always be broken by introducing an abstract base class.  This is typical for graph representations.  Here the tables are nodes and the foreign key constraints are edges.  So create an abstract Table class and an abstract Constraint class and maybe an abstract Column class.  Then all the implementations can depend on the abstract classes.  This may not be the best possible representation, but it is an improvement over mutually coupled classes.

But, as you suspect, the best solution to this problem may not require any tracking of object relationships.  If you only want to translate XML to SQL, then you don't need an in-memory representation of the constraint graph.  The constraint graph would be nice if you wanted to run graph algorithms, but you didn't mention that so I'll assume it's not a requirement.  You just need a list of tables and a list of constraints and a visitor for each SQL dialect you want to support.  Generate the tables, then generate the constraints external to the tables.  Until the requirements changed, I wouldn't have any problem with coupling the SQL generator to the XML DOM.  Save tomorrow for tomorrow.

Title: Applying SOLID principles


答:
My personal opinion revolves around gaining maximum advantage from both the plugin side as well as raw HTML/CSS/JS manipulation.

I'm starting to see a trend that biases your thought pattern towards one technology. Rather than approach it that way, I tend to get to the ideas behind these changes.

Example:

1) Both HTML5 and silverlight/flash permit Canvas. How different are the ways in which you can control pixels, and programmatic logic to make games in either?

2) It is common knowledge that through plugins you can manipulate the browser's DOM directly. How easy is it to make the plugin invisible for non-common usages? Can you use the plugin for say getting huge amounts of data?

The tooling folks at Microsoft and Adobe will assist you in every way possible to use their products. How easy is it to get greedy with plugins and out of the box web standards plus scripting languages to deliver a solution?

I find my thoughts making more progress if I think along these dotted lines. YMMV


问:
What is a good way to reset the Primary Key?
We've hit an application issue with an Oracle table Primary Key exceeding the limits used by a Java Integer (2 ^ 32) and one of the suggestions is to reset this to 1000 and let it start again.
OR change the code to use Java Long (2 ^ 64) instead.

This has a ripple effect since this key is used as ID by a lot of other systems as well. And there can be future duplication (in the far future)

Are there any suggestions on good and bad outcomes in this approach?

答: You'll have to talk to your other systems to go over the alternatives. I would expect moving to a 64 bit integer would be more likely to break them.</p>


问:
Are there revision repositories which implement commenting on revisions other than a fixed single commit message?
Sangdol asked: Why can’t I edit and SVN commit message? There are good reasons to maintain individual records ‘as is’ for historical purposes. However, there is an arguably objective hazard in not limiting the spread and use of misleading, and dangerous data.

Aside: Certainly, sometimes, one should just suck up they’ve made an error.

That aside, er aside, it appears clearly beneficial to have some mechanism for recording and sharing the best possible information. It also seems clearly beneficial to have some mechanism for correcting ‘bad data’ and informing others of ‘hazardous data’.

In the Sangdol thread l0b0, comments:

You're right. There is a fundamentally flawed design assumption in all
  VCSes I've ever seen: A commit has one commit message, which is
  immutable. As Alex says, we should "allow multiple versions of the
  commit message".

To keep the question less subjective, your answers should be an objectively better practice than the ‘Moses Principle’ of, “Get it right first time, we’re carving this puppy in stone”, and address the ability to handle one or more problems along the lines of (I’m willing to update and alter this list if there are better suggestions):

Suppose I discover that a commit message I entered a month ago is misleading, confusing, and downright wrong. Shouldn't I be able to added a correcting notation that will be seen by everyone who sees the incorrect message? (I agree the original message should be easily available unmodified and the change itself should be tracked and timestamped. But I disagree that this constitutes "changing history".) – David Schwartz comment from the Sangdol question.

答: There is git-notes which allows you to add notes to a commit, but doesn't allow you to change the original commit message itself. I'm not sure if this is quite what you're looking for.</p>


问:
Do some languages make it easier to build graphically-intensive GUIs?
I made an algorithm that has a good potential use for a commercial application. I'm thinking of making a GUI, and since it's computationally expensive, I'm thinking of putting it "on the cloud" to offer the numerical part as a service. What I'm thinking is making a GUI, and then the users submit the work to the server. This GUI could be made open software (in fact, very probably will be). The GUI has a lot of graphics. Imagine something like making picks on surfaces plots, taking a look at those picks with different tools, and using numerical mathematics on those picks.

Are there languages that make this work easier? What, specifically, about them aide in creating GUIs like this?

答:
If the application is Graphically intensive you will probably want to use something like OpenGL ( cross platform ) or DirectX ( Windows ) to drive the graphics and take advantage of modern graphics cards.

This takes the performance aspect of the client language out of the equation.

Every language has bindings to OpenGL, some are easier than others to work with. Some languages have higher level wrappers around OpenGL to make it very easy to work with ( pygame ).

For the actual GUI with widgets and things, Qt is a good place to start if you want to ensure cross platform support. All popular languages have bindings for this as well, making it easy to use a high level language and get the low-level performance that Qt provides.

If you are doing batch processing a simple REST interface based on HTTP would be sufficient. This would open up a world of rapid development languages for the front end. Python, Ruby, Lua etc, all have OpenGL support and all are very easy to get something working quickly.

If you are doing something that is real-time or near real-time network traffic, you will have to go with UDP. The Torque Network Library is a good place to start, it is the lowest latency network code I can think of, and it is C++ so you can wrap some bindings around it using SWIG and still write code in something more high level like Python.

NOTE: There is no reason you can't do what you want in 100% Java, the mythical performance gap to C++ is just that, especially in the areas you mention. With the Java bindings to OpenGL and the JIT it can create very compelling 100% Java solutions.


答:
Instead of reinventing the wheel just use the HTML5 offline functionality:
http://www.whatwg.org/specs/web-apps/current-work/multipage/offline.html</p>


答:
QT is somewhat awkward to deploy if you don't buy the expensive commercial developer license. I may be wrong, but last time I looked you couldn't statically link qt with the LGPL licensed product, you had to buy the commercial version to do that. Free users needed to compile the QT dlls, and their source and the dlls must all be compiled with identical versions or one finds oneself in dll hell.   </p>

<p>QT is an awesome C++ library, it's much easier to use than the std or boost libraries (although it co-exists with those just fine).  </p>

Title: Do some languages make it easier to build graphically-intensive GUIs?

Body:
I made an algorithm that has a good potential use for a commercial application. I'm thinking of making a GUI, and since it's computationally expensive, I'm thinking of putting it "on the cloud" to offer the numerical part as a service. What I'm thinking is making a GUI, and then the users submit the work to the server. This GUI could be made open software (in fact, very probably will be). The GUI has a lot of graphics. Imagine something like making picks on surfaces plots, taking a look at those picks with different tools, and using numerical mathematics on those picks.

Are there languages that make this work easier? What, specifically, about them aide in creating GUIs like this?

Body:
QT is somewhat awkward to deploy if you don't buy the expensive commercial developer license. I may be wrong, but last time I looked you couldn't statically link qt with the LGPL licensed product, you had to buy the commercial version to do that. Free users needed to compile the QT dlls, and their source and the dlls must all be compiled with identical versions or one finds oneself in dll hell.

QT is an awesome C++ library, it's much easier to use than the std or boost libraries (although it co-exists with those just fine).


问:
How to pick a web application software engineer?
How should I pick a web application software engineer?

The (permanent) position is to rewrite the client of an existing desktop client server application.  The pages will not be generated dynamically on a server, but the server will expose a full API in whatever way is needed, for example JSON RPC calls, and can make static files available.  It will replace a client that people have to download and install, so requiring a decent browser with reasonable settings (e.g. JavaScript enabled) is fine.  Almost all use cases are for a desktop P.C.  It will not be accessible to search engines (it is an enterprise application).

We can go so far as to write the whole thing in a single page, but don't have to.  It would pretty much all be written by the web application software engineer in question.  The exact open source libraries to use is also up to the engineer, within reason.

I'm specifically looking for advice on what qualifications to look for/verify in an interview, since picking a web application software engineer in general is just too broad a topic.

Edit - The position would be purely in-browser JavaScript programming (and be responsible for HTML and CSS) - other developers would develop the server but this position could request facades over the API.  There is no Ruby, ASP, JSP, etc. because the web server layer is very thin and just translates calls to the business layer API and returns them as JSON (or whatever, but JSON seems easiest).

答:
As a web developer who mainly works on enterprise apps dealing with legacy systems, I can offer a few suggestions as to what makes me successful, and hopefully that will help.

I'm not sure whether you're looking for a temporary/consultancy situation to provide you with one app, or an FTE to develop and maintain this long-term, but these should apply in either case, I think.

I primarily use Ruby. This makes rapid prototyping very fast and easy, and Rails makes it simple to bootstrap a new project. Now, I don't know what your environment is like, whether you have institutional mandates re languages, platforms, tooling, but if you can hire a developer who is proficient in a modern, flexible language/framework that makes writing DSL's to deal with foreign API's relatively quick and easy, that's a plus. Basically, any of the languages with the Lisp-nature will be superior in this regard. Also, hiring someone proficient in a language with good ecosystem of open-source libraries to deal with common abstractions is a must.

If you can find someone used to dealing with legacy systems and abstracting their idiosyncrasies, that's rare and you should explore it. Most devs are used to building projects from the ground up (or getting brought in to maintain existing projects) and building something new to interface with something old takes a certain... not skill set, per se, but approach.

When you say "the server will expose an API in whatever way is needed," that's rather vague, but I'm guessing you mean there are existing developers who can implement the API on the server? I would make it clear that the position will involve working with those developers to specify the API. If you can give an example of the type of interaction required, and ask the candidate their initial thoughts about how to implement it, that might be telling. I think the fact that your initial thought was JSON RPC shows you are leaning in the right direction, so watch out for anyone who has visions of complex XML and XSLT interactions.

If you can expect decent browser JavaScript support, look for someone experienced with JS frameworks like Backbone.js, JavaScriptMVC, etc. You could in that case do the entire app (basically) in-browser and maybe serve it with Node.js or something... so look toward good JS devs. If they say they prefer to write their JS in CoffeeScript, they're probably even better JS devs.

Just some thoughts from my experience in the trenches, but if my department were hiring a new developer, this is what I would tell them to look for.

I wish my department had the budget for another developer...


答:
Sometimes you need to burn the midnight oil and really hit it hard.  A previous poster talked about a "balanced lifestyle", but sometimes you need to put aside that balance and just be "that guy" with work and personal development.

My suggestion?  Have person spurts of studying.  Say to yourself, every night for the next 3 weeks I am going to study three hours every night before bed.  Sure it'll be a rough 3 weeks, but you'll be surprised at how much you can accomplish.  Then take a week off from the crazy schedule and just relax after work.  This can go in cycles and you will see yourself successful.

Another thing, when it is time to study or personally code at home, don't let yourself get distracted by T.V. or the internet or any other non-productive activities.

Title: How to manage time for studying while working?

Body:
I've been programming 8 years for a company. We build business intelligence software systems. Since I thought working is learning, I've always studied in terms of what I was doing at the company while working for 60 hours per week. These days, however, I am looking for a new company for employment, I can see that thought was a dumb idea because I frequently fail in job interviews mainly due to lack of knowledge on the other areas. Of course, I am still willing to improve myself and am really trying. But while working that much of time per week, I can't find good amount of study time to catch up.

I don't think I am the only one to concern about this so I would like to ask how you guys find time to study for your career? How many hours do you assign to studying other areas? Am I missing some time management skills?


问:
"It was working yesterday, I swear!" What can you do?
When you arrive in the morning, you find that your software does not work anymore, even though it did when you left yesterday evening.

What do you do? What do you check first? What do you do to stop being angry and start working on your problem? Do you blame your colleagues and go directly to them? What can be done to avoid being in such a situation?

答:
it was working yesterday as it was being used correctly.

you find that other people use things in a way that there not suppose to which is a good way of breaking stuff.

its always good to update code early on in the day as this leaves you with a good testing environment.

Backup!


问:
Inject dependency as method parameter instead of constructor parameter
I'm using an ORM which doesn't allow me to inject dependencies in the constructor. Let's say I'm  using DDD for the business logic, and the MVC pattern for the UI.

Now one of my domain objects needs to access an external service. I'm very opposed to the service locator anti-pattern (wouldn't touch it with a ten foot pole), but as I see it, that leaves me with the following:

```<code>class Controller
{
    private readonly IExternalService _externalService;

    public Controller(IExternalService externalService)
    {
        _externalService = externalService;
    }

    public ViewResult Action(Guid Id)
    {
        // Omitted repository access for brevity.
        domainObject.DoSomethingWichNeedsAnExternalService(_externalService);
    }
}
</code>```

Somehow I get the feeling this isn't very clean, what if the "domainObject" is buried deep into the model/graph, should the "_externalService" be passed all the way down?

Are there any best-practice alternatives?

答:
It seems like it will get out of hand.  For instance, I had to use an IRealTimeClockService to inject into my units under test so that I could have repeatable test results for things that depend on the system time.  That seems like a lot of weight for a service that just calls DateTime.Now.  But I must admit that it really hasn't made the code less readable, even though you have to pass it to base class constructors too.

In some ways it's better because it's obvious what your dependencies are.

If you do have a lot of dependencies injected into an object, that might mean you're violating the single responsibility principle, and that class could be broken up into something that does two unrelated things.

On the other hand, if you have a complex system, you will have complex objects with lots of dependencies.  I think it's better to be explicit about it.

Something to consider: if your class A takes 5 dependencies and passes 4 of them on to a helper object without touching them, perhaps you should just replace those 4 with a dependency on the helper object (or an interface, obviously).


问:
How do you organise your git repositories?
I'm struggling to phrase this question correctly, hence the poor title.

Basically I have a simple Chrome extension that I am developing for work. It is in use at the moment and as I am using it regularly I am constantly thinking of improvements or extra features it could have.

My file structure is like this (I'm on a mac)

~/Sites/Chrome_extensions/{my employers name}/CharCounter/

CharCounter/ contains all the files needed for the Chrome extension.

Whenever I am happy with a new version of my extension I pack it in Chrome and the resulting .crx file is called CharCounter_{version number}.crx

So for example, the most recent is called CharCounter_1.3.3.crx. However, the development folder currently always has the same name. If I want to roll back and continue developing a previous version I can't.

I have decided to start using git however I'm unsure how to tackle my version control.

Should I set up my git repository in

~/Sites/Chrome_extensions/{my employers name}

then when I decide I am making a big enough change to the extension to warrant a new version number I duplicate the CharCounter folder and add _{new version number} to it? Thereby having several CharCounter folders each with a different version number appending to them.

or should I set it up in

~Sites/Chrome_extensions/{my employers name}/CharCounter/

and never duplicate the CharCounter folder but just make a new commit every time I make a new version?

How do you tackle version control? Does using git do away with having to keep multiple versions (current and legacy) of your code in folders called folder_version_X.Y.Z or is that still a good idea?

答:
The later.

Create a new repository for every project. When you build a version you want to create a tag for it.


答: I find setting breakpoints to pause and check my data very helpful, to pinpoint exactly where and how it's going bad.</p>

Title: "It was working yesterday, I swear!" What can you do?

Body:
When you arrive in the morning, you find that your software does not work anymore, even though it did when you left yesterday evening.

What do you do? What do you check first? What do you do to stop being angry and start working on your problem? Do you blame your colleagues and go directly to them? What can be done to avoid being in such a situation?


答: What I've done is to create a factory class that creates all the other instances and wires them together.  Then you don't have to pass dependent objects through constructors:  Give the factory the replacement instances, and have it build everything else.</p>

Title: Inject dependency as method parameter instead of constructor parameter

Body:
I'm using an ORM which doesn't allow me to inject dependencies in the constructor. Let's say I'm  using DDD for the business logic, and the MVC pattern for the UI.

Now one of my domain objects needs to access an external service. I'm very opposed to the service locator anti-pattern (wouldn't touch it with a ten foot pole), but as I see it, that leaves me with the following:

```<code>class Controller
{
    private readonly IExternalService _externalService;

    public Controller(IExternalService externalService)
    {
        _externalService = externalService;
    }

    public ViewResult Action(Guid Id)
    {
        // Omitted repository access for brevity.
        domainObject.DoSomethingWichNeedsAnExternalService(_externalService);
    }
}
</code>```

Somehow I get the feeling this isn't very clean, what if the "domainObject" is buried deep into the model/graph, should the "_externalService" be passed all the way down?

Are there any best-practice alternatives?


答:
The best solution would indeed be tags, perhaps something that might get what you want is to (partially) implement a workflow as illustrated here.

To make it easier to work with such a workflow a git extension has also been made which can be found here

This would allow you to:

Switch back to a previous version if that needs some bug fixing

Work on multiple new features at the same time (If this ever occurs)

Make sure you always have a fully working branch

Title: How do you organise your git repositories?

Body:
I'm struggling to phrase this question correctly, hence the poor title.

Basically I have a simple Chrome extension that I am developing for work. It is in use at the moment and as I am using it regularly I am constantly thinking of improvements or extra features it could have.

My file structure is like this (I'm on a mac)

~/Sites/Chrome_extensions/{my employers name}/CharCounter/

CharCounter/ contains all the files needed for the Chrome extension.

Whenever I am happy with a new version of my extension I pack it in Chrome and the resulting .crx file is called CharCounter_{version number}.crx

So for example, the most recent is called CharCounter_1.3.3.crx. However, the development folder currently always has the same name. If I want to roll back and continue developing a previous version I can't.

I have decided to start using git however I'm unsure how to tackle my version control.

Should I set up my git repository in

~/Sites/Chrome_extensions/{my employers name}

then when I decide I am making a big enough change to the extension to warrant a new version number I duplicate the CharCounter folder and add _{new version number} to it? Thereby having several CharCounter folders each with a different version number appending to them.

or should I set it up in

~Sites/Chrome_extensions/{my employers name}/CharCounter/

and never duplicate the CharCounter folder but just make a new commit every time I make a new version?

How do you tackle version control? Does using git do away with having to keep multiple versions (current and legacy) of your code in folders called folder_version_X.Y.Z or is that still a good idea?


答:
Wouldn't be wrapping the ORM api an option, so you can pass whatever you want to your wrapper's constructor?

Generally, when dealing with external apis, it might not be bad idea to do so. Plus, you are less tied to the ORM, which may be a nice in the future.


问:
What do I need to know for CSDA-like certification exams?
I am interested in taking the IEEE CSDA exam. What are some of the better, individual strategies for learning software engineering practices in preparation for the exam?</p>

答:
I took this exam and passed it in December 2010. This was in the second quarter of my final year in the Software Engineering program at the Rochester Institute of Technology, after I had completed all of the required courses (with the exception of the ongoing senior project).

My approach was to purchase access to the CSDA Assessment Course, which comes with sample exams that are scored. This course was broken into four modules. There were review presentations with an outline of the material and sample exams that were in-depth on the material for each module. There were also PDFs that were between 100 and 200 pages that explained the material in-depth.

Prior to taking the exam (even before deciding to take the exam), I had purchased a copy of SWEBOK 2004 (also available online for free), which I also used to review a high level overview of each topic. I was incredibly fortunate that my university's software engineering curriculum required a number of the books recommended for reading for the exam, and I had kept them. I purchased a few from areas where I needed extra learning and self teaching. If you want book recommendations, there are a number of questions here about book suggestions.


答:
I assume that you have meant 2 ^ 31 = 2,147,483,647

I agree with the suggestions made so far...

1-Never circulate PKs

2-If you change the datatype, you need to coordinate this very well. This is not a trivial change.

There is something you may be willing to try. For an integer value the following is true:

-2,147,483,647-1 <= integer value <= +2,147,483,647

So far you have only used the positive part.

Why not use the negative part? you still have about 2,147,483,647 items to use without changing the data type of the column?

Title: What is a good way to reset the Primary Key?

Body:
We've hit an application issue with an Oracle table Primary Key exceeding the limits used by a Java Integer (2 ^ 32) and one of the suggestions is to reset this to 1000 and let it start again.
OR change the code to use Java Long (2 ^ 64) instead.

This has a ripple effect since this key is used as ID by a lot of other systems as well. And there can be future duplication (in the far future)

Are there any suggestions on good and bad outcomes in this approach?


答:
Note: This is simply my opinion, so don't throw the kitchen sink at me ;)

I think you're munging the names of two distinctly different positions (which can be a little confusing).

Software Engineer: An engineer. One who is strong at solving abstract problems that aren't necessarily tied to any specific platform. Strong knowledge of design patterns, algorithms (both known algorithms as well as algorithm design and analysis), some strength in linear algebra and maybe some calculus. When hiring a software engineer in the past, I haven't been as worried about their specific domain knowledge as their ability to solve complex problems.

Web Application Developer: Someone who knows the ins and outs of building web applications. Understands server vs client-side architectures and how to effectively communicate between the two. Is familiar with W3C standards, both completed and WIP states. Understands how databases work and how to optimize when necessary (query optimization, database caching, indexing, etc). Also understand different mechanisms of caching and other ways to optimize their applications. Also understands semantic conventions.

There are probably a few things there that I'm missing that I might fill in as I think about 'em.

From the description of what you're looking for, it sounds to me like you're not looking for a software engineer at all; you're looking for a web application developer.

So, first thing I would do is narrow down who you're looking for and what expertise you're expecting from a candidate. Might help you quite a bit.

Title: How to pick a web application software engineer?

Body:
How should I pick a web application software engineer?

The (permanent) position is to rewrite the client of an existing desktop client server application.  The pages will not be generated dynamically on a server, but the server will expose a full API in whatever way is needed, for example JSON RPC calls, and can make static files available.  It will replace a client that people have to download and install, so requiring a decent browser with reasonable settings (e.g. JavaScript enabled) is fine.  Almost all use cases are for a desktop P.C.  It will not be accessible to search engines (it is an enterprise application).

We can go so far as to write the whole thing in a single page, but don't have to.  It would pretty much all be written by the web application software engineer in question.  The exact open source libraries to use is also up to the engineer, within reason.

I'm specifically looking for advice on what qualifications to look for/verify in an interview, since picking a web application software engineer in general is just too broad a topic.

Edit - The position would be purely in-browser JavaScript programming (and be responsible for HTML and CSS) - other developers would develop the server but this position could request facades over the API.  There is no Ruby, ASP, JSP, etc. because the web server layer is very thin and just translates calls to the business layer API and returns them as JSON (or whatever, but JSON seems easiest).


问:
How do you respond to: "Ever since the update..." questions from clients?
Ever since the update, people keep calling and saying "Ever since the update X, Y and Z are slow, bad and crashing"

This has happened ever since the dawn of updates.

What do people expect? Gamma comes after beta, and gamma testing always turns our users into The Incredible Hulks...

Perhaps you've never heard this from a client, perhaps you're in college or a FLOSS Dev who can spread the blame around more than 5 or 6 guys, perhaps you unit test your code, perhaps you're not in that interesting situation where customers actually call you requesting the exact time of day you'll be releasing today's patch (I'd love to do that to Microsoft) or perhaps you're a sorry son-of-a-biscuit like me who just shipped a new update and went home and is dreading going back to work tomorrow.

Anyway, ya'll are smarter than me anyway. How do you field criticism framed in "You must be a bad programmer because you're making your software worse"?

答:
Details, Details, Details.   I ask what they were doing and when, be specific.  It could be something or it could just be that the Justin Beaber video just released on youtube.  Log files are your friend in both cases.

I also ask for dates when they noticed it.  Sometimes especially in enterprise shops users don't know when a release comes out, they just know that something takes a long time to complete and they are just now complaining about it.

Job Shadow.  Can't emphasize this enough.  If you are lucky enough to have users nearby, just watch them work from time time.  I often find they ignore glaring issues and never report them.  They will often only complain when they know something is new or they initially notice an issue.

ContentLicense: CC BY-SA 2.5


问:
How do you tackle really bizarre errors that keep you puzzled for more than 10 hours?
You know them, those errors that make NO sense. Where it seems like a gremlin just jumped deep inside your chips and messed up something. Do you take a walk, write stuff, call an uncle?</p>

答: Quit.  No, not your job! Just get up and go home.  You're done for the day or the weekend. 19 times out of 20 when you come back to the problem next, the solution will present itself within an hour.</p>


答:
One word, timebox, set a limited amount of time to work on something, and if it isn't solved, move on to something else and come back to it the next day with a fresh perspective.

That and another set of eyes, is always worth more than any time you can waste staring at something.

I would never spend more than 45 mins to an hour trying to solve something in one sitting, it violates the law of diminishing returns.

Title: How do you tackle really bizarre errors that keep you puzzled for more than 10 hours?

Body: You know them, those errors that make NO sense. Where it seems like a gremlin just jumped deep inside your chips and messed up something. Do you take a walk, write stuff, call an uncle?</p>


答:
Before ten hours go by, I would get some help.

Describe the problem to someone else, anyone else, even your rubber duck.

Ask someone else to take a look at the code, or step through it with them.

Isolate it.  Delete a bunch of stuff, then bring it back bit by bit until the problem reappears.

Get some sleep!


答: You could see if getting up, pacing around, and thinking about the problem helps you find a solution.  Whether or not you're actually standing or pacing, try getting away from the computer while you're thinking.</p>


问:
What is the best "bucket-fill" algorithm?
I'm pretty new to image processing, and I am currently working on a paint-like application that will feature a bucket-fill.  However, I have no idea what the best algorithm for a bucket-fill is.

I implemented an example I found from this site, however, it ran into infinite loop problems when a user tried to bucket-fill an area that had already been bucket-filled with the same color.

I'm currently working around that problem by filling left, right, up and then down; however, I made it so that once a pixel has been filled in to the left, it cannot fill to the right, which means shapes such as:

will not be filled properly if the bucket tool is used at the red dot.

Therefore, I am hoping someone knows of an algorithm or a link to one that will resolve all these issues.

Additional Information: This will be implemented using Javascript as the paint tool. It will be used online utilizing the Canvas element.

答: It sounds like you're actually looking for whats called a Flood Fill algorithm.  That may be why you havent found tons of examples for it.  There's several Flood Fill methods listed on the Wikipedia page for the algorithm.  I highly recommend one of the non-recursive, 'queued' methods.</p>


答: Pretty sure IBM/Rational ClearCase allows this. I recall making edits to the commit (aka Checkin) messages after the checkin was done. It also recorded that there was an edit made. I'm not sure that it kept the original text, though.</p>

Title: Are there revision repositories which implement commenting on revisions other than a fixed single commit message?

Body:
Sangdol asked: Why can’t I edit and SVN commit message? There are good reasons to maintain individual records ‘as is’ for historical purposes. However, there is an arguably objective hazard in not limiting the spread and use of misleading, and dangerous data.

Aside: Certainly, sometimes, one should just suck up they’ve made an error.

That aside, er aside, it appears clearly beneficial to have some mechanism for recording and sharing the best possible information. It also seems clearly beneficial to have some mechanism for correcting ‘bad data’ and informing others of ‘hazardous data’.

In the Sangdol thread l0b0, comments:

You're right. There is a fundamentally flawed design assumption in all
  VCSes I've ever seen: A commit has one commit message, which is
  immutable. As Alex says, we should "allow multiple versions of the
  commit message".

To keep the question less subjective, your answers should be an objectively better practice than the ‘Moses Principle’ of, “Get it right first time, we’re carving this puppy in stone”, and address the ability to handle one or more problems along the lines of (I’m willing to update and alter this list if there are better suggestions):

Suppose I discover that a commit message I entered a month ago is misleading, confusing, and downright wrong. Shouldn't I be able to added a correcting notation that will be seen by everyone who sees the incorrect message? (I agree the original message should be easily available unmodified and the change itself should be tracked and timestamped. But I disagree that this constitutes "changing history".) – David Schwartz comment from the Sangdol question.


问:
"Anything can go wrong will go wrong" - Murphy's Law. so is it necessary to test all the conditional, exception cases?
If "Anything can go wrong will go wrong" is true, we need to test all the conditionals and exceptional cases in my code.

But sometimes it's hard to find all of them since many of them are corner cases, which are hard to test. How can I go about finding corner cases better or avoiding the issue?

答:
If everyone knew how to account for everything, there would basically be one version of software, no maintenance would be needed, testers wouldn't be required, etc. You can't follow a set of guidelines that will give you a magic black-and-white answer because the list of items to test is based on a multi-variable component (code).

The best thing you can do is learn. You'll make mistakes and forget to do things; make a conscious effort not to make the same mistake twice. If you can do this, you're probably better than the average software engineer.


问:
Watermarking an image with the text given as input
I want to create a simple web app where I can drag an image in, and watermark the corner with the given text. Where should I start for something like this?

I have knowledge in Java and Ruby.

答:
Start with learning how to load the image, draw some text on it and save it again in a stand-alone program.  The Oracle tutorial on 2D graphics would be a good starting point:

http://download.oracle.com/javase/tutorial/2d/images/index.html

When you have that running , see https://stackoverflow.com/questions/4890659/java-images-receiving-webserver for the "upload image in webserver" part.   This can be a bit tricky.

Have fun.


答:
Consider code coverage analysis. In my experience it was pretty efficient way to discover un-tested use cases.

When tests already have high code coverage, using this approach to discover holes may be fun, too - because remaining cases turn out rather non-obvious (or, even more interesting, might correspond to bugs in specification).

Just don't assume that coverage analysis will guarantee to cover all the relevant cases. Eg it won't protect you from missing feature or concurrency issues.

Thing to keep in mind is that it may be tricky to drill into every possible case. Imagine an application designed to output "Hello World" if and only if it's Thursday and it rains - to test it, you would have to wait until Thursday when it rains? or mock the necessary conditions. That may be too much effort to justify the risks you'd avoid by having it covered in tests.

Another thing to consider is how much time testing takes. If it takes a year to fully test your application then you better drop that idea (unless you're on mission critical product)

Title: "Anything can go wrong will go wrong" - Murphy's Law. so is it necessary to test all the conditional, exception cases?

Body:
If "Anything can go wrong will go wrong" is true, we need to test all the conditionals and exceptional cases in my code.

But sometimes it's hard to find all of them since many of them are corner cases, which are hard to test. How can I go about finding corner cases better or avoiding the issue?


答:
Github lets you (and your other users) tie comments to specific lines of a committed file (after it has been pushed to the remote), look for this icon on the left when you mouseover a source code: .

It also support comments tied to a commit, but that's from native Git afaik.


答:
I find this very true. I sometimes tend to be lazy and dont test certain lines of code, but almost never fails to come back and hit me.

If you are writing OO code. Here are the inputs based on my learning.

Use Occam's Razor. That is find the simplest way to implement it.

Divide anything that can be divided into multiple classes or mixins until you see that each class or mixin is doing exactly one thing. That is respect SRP.

For every mixin/class write atleast one test case initially covering every function.

If you are using a few third party library see if there are chances that those functions can return unexpected results from the documentation.

Now look at each if/for/while/case and similar constructs to see if that is covered in your test case. If not write more test cases.

Check if any line can fail due to stuffs like NullPointerException or object not defined type of errors. Typically lines after some sort of object creation or stuff that depend on using library to set your object.

Use Black box testing, where you test every function weather its available public or not. Most testing frameworks believe that testing public interfaces will do(white box testing) and some languages wont give you access to private interfaces. In these situations try to test the private functions through public functions.

Use some kind of automated tools that can test for code coverage.

Even after this there will be some scenario's that one cannot easily test, especially the environment related stuff. You can either get the code peer reviewed by an experienced programmer or run your test cases in all possible environments.

One can never be fully confident that every case is covered. If you have spent a lot of time with the code while its developed you will gain confidence on it. Once you have enough confidence, release it bravely. Things will come back, since you would have read your code a 100 times, you can fix stuff really quickly and will be able to imagine other places this will happen. For every bug that comes back, cover it with test cases.


答:
Yes! Every block of code should be tested. But how do you test it? By Unit Testing in first place,

well, to let you code to be testable, it is another theory, it is a kind of programming technique. You can't let your code become smell.

Test your code part by part by function.

Your function must be specific, one purpose, simple, not complex.

e.g. don't make Global variable in your function, otherwise (not testable)

Your function must be understandable.

Your function is loosely coupling, less dependency, so that you can test it easily.
etc.etc....

Once your code style is improved, your test cases , corner cases would be easily to be tested.

Here is a good article of how to make your code become less smell. Hope it helps.


答:
The most important thing is that things will happen that you have not anticipated, and hence not coded for.

It is very important that your program handles this correctly.  You must choose if "something unexpected happened" is bad enough that the program should shut down gracefully immediately for manual inspection or what else might be the correct procedure.

I have personally found that the "fail fast" approach is the best way to get good program behaviour after a few iterations.


问:
What is a Ph.D. good for in the software industry?
I'm a self-taught programmer and have just started a computer science degree to supplement my knowledge and fill in the gaps.

However, I'm already debating the direction of my education. I want a 4 year bachelor's degree for sure, but after that, I'm not sure: Is it worth it to get an M.Sc? What about a Ph.D.? What opportunities do these degrees open up?

Currently my goal is to be a software developer, but there are a number of fascinating fields in the software industry and I'm certainly interested in investigating many of them. It is in this respect that I think a higher degree may be worth it -- even if it wouldn't necessarily help a career of software development.

So will it be worth it? Will grad school open doors?

答:
Well, I went the PhD route (slowly and painfully). I didn't have a "purpose", like how it might help me get different kinds of jobs. I did it because I wanted to know things.

I had been a programmer, and I thought programming was pretty much a cut-and-dried subject, except that I had read Isaac Asimov's book "I, Robot", and I wanted to be able to build robots, and I didn't know how. I wanted to know how to make a computer think, understand natural language, see, walk, etc. The point is there were things I didn't know how to do and wanted to find out.

So what's the result? I learned something about how to make computer programs think, see, etc., but I also learned that these are much deeper and broader subjects, worthy of a lifetime of inquiry. Along the way I learned a lot of theory and math, and learned that there is a great deal more to learn.

I also learned a lot that helps me develop software, which I've written a book and some articles about, and posted on stackoverflow. While I think it makes me more effective, I think it also makes me a bit of a stranger in programming teams.

So did it help? I guess so. I wouldn't want to be the person I was before it.


答: If you do this with Ruby on Rails in combination with ImageMagick and the RMagick gem it shouldn't be more than a few lines of code to get the whole thing running.</p>

Title: Watermarking an image with the text given as input

Body:
I want to create a simple web app where I can drag an image in, and watermark the corner with the given text. Where should I start for something like this?

I have knowledge in Java and Ruby.


问:
Can I brand my open-source application?
Is it possible for the author to register a logo or the name of his/her application when it is open-source because it uses a gpl library (for example)? The application uses the library but it has its own features, that is it's not a modification of the library.
So everyone can see the source code, downloading an "anonymous" non-branded version from Sourceforge, but none can use the logo or the name and so the author can sell it from his/her web-site (for example) to non-expert users, only after payment.
Is he/she obliged to give directly the source code, or it is enough that there is the non-branded version available on Sourceforge or other official repository?</p>

答:
This question, apart from the fact it's hardly related to programming, suffers from a major issue. Which country are you considering? In most of Europe in general, and in France in particular, your intellectual property is protected, and a logo, as it is an artwork, will be protected without any other step unless you expressly make it public domain.

However, other countries and regions may differ, and you would need a lawyer with expertise in global intellectual property to answer decisively.

Title: Can I brand my open-source application?

OwnerDisplayName: Kheldar


问:
How can I study C# from Stack Overflow
How can I study C# from Stack Overflow?

I have only the basics of the C# language with some simple exercises; now I want to go to the highest level C# through Stack Overflow, reading any questions tagged "c#". The questions are not ordered from easiest to hardest.

Do you have any idea on how to learn C# from Stack Overflow?

答: I thinks SE are appropriate for asking question for a situation, For studying something you need to master the basic through structured course or guideline, i thinks other type of media such as book or video is more appropriate. For Video i would recommend Pluralsight for book i would Recommend Head First c#.</p>

Title: How can I study C# from Stack Overflow


答:
NO, you can't.

But you can surely get help, when you get stuck at some point. Stack Overflow is a Q&A answers website, which provides answers to code-related questions from users all around the world in various languages, including C#.

Questions asked on Stack Overflow are particular to a project, user and his requirement. Since they are very specific about a particular project, learning from them will be nightmare and hell lot confusing.

I suggest you start some project, like an accounting application or a website. Keep going through, and when you get stuck, post the question on SO; the humble community will definitely get you through.

Or you can read a book, which shows sample applications. You can find various books on Problem-Design-Solution format.

Title: How can I study C# from Stack Overflow

Body:
How can I study C# from Stack Overflow?

I have only the basics of the C# language with some simple exercises; now I want to go to the highest level C# through Stack Overflow, reading any questions tagged "c#". The questions are not ordered from easiest to hardest.

Do you have any idea on how to learn C# from Stack Overflow?


答:
Reading other people's questions can be a good way to learn, but Q&A forums like the various Stack Exchange sites aren't designed to teach you a subject in-depth. As you observe, questions aren't ordered in a way that will help you learn quickly.

Your best bet is use Stack Overflow as a resource, but use a book or other website that's designed for instruction as your primary source. When you come across something in the book that you don't understand, look for related questions on Stack Overflow. With over 2 million questions and counting, it's very likely that someone has asked about the very thing that you're wondering about.

If you really want to learn C# in a way that's strongly connected to Stack Overflow, try reading C# in Depth, written by SO's #1 member, Jon Skeet.

Title: How can I study C# from Stack Overflow


问:
Web development in a small team - best practices
Currently developing a web app in a team of two maybe three in the near future. Tech stack is at the moment : flask, mongodb, and extjs for the fontend. I currently have the project under version control using mercurial and bitbucket.

Question

What is exactly the best way to work as a team on a we app peoject? I ussually work on the back end while my colegue works on the frontent. Sometimes i also help out on the front end. How should we do this? Each has a repo on their system but whee is the web server started? Curentlly i have it on my computer but that means that my partner needs to commit and push for each modification and i need to pull the changes and merge for each change. And for frontend stuff there needs to be a lot of changes.
We tried having a server started on each of our machines but its a pain with multiple mongodb servers.

Anyway any tips, clues and advices are greatly appreciated and welcomed.

答:
I've worked in multiple projects in a similar environment to what you describe. In my experience something like this works pretty well:

Each developer should have their own development setup - servers, databases, etc.

You need to be able to test your work quickly and without disturbing other people's work

You also should have a "testing" or "staging" server.

This is where you should try to keep an environment as close to your production system as possible.

You should test your code here before moving code into production

The source control repository can be kept on a server as well. (This could be your staging server too, you don't necessarily need a separate one)

Although mercurial keeps copies of the repos on the dev machines, it's easier to keep everyone updated if everyone pushes their changes to a central repository.

You can also do deployments to staging/testing and later production more easily if all the code is in a central location.

To address some of your problems...

At least with SQL databases it's relatively simple to keep the database shared. You can just take dumps of the data and copy it over to the other people.

You don't necessarily need to have the same exact data on all developer's computers. It should be enough they can perform testing etc. with the data they do have.

The testing/staging server should preferably have the same data as your production server - this is to ensure your code gets tested in a realistic environment before it's moved to production.

OwnerDisplayName: InnocentPixel


问:
HTML5 card game
I created a card game in Silverlight a year ago, in order to learn a bit about Silverlight. I am now wanting to make a HTML5 version of the game in an effort to learn a little bit more about that. I am thinking I'd like to take advantage of stuff like Knockout.js and WebSockets and the canvas element.

Now what I'm confused about is how to lay out the cards on the screen. With Silverlight I was able to make a "Hand" control, which was made up of two sub controls: the cards the player has in their hand and the ones they have on the table. They were made up of Card controls.

I don't believe there is the concept on a User Control in JavaScript; so I am possibly thinking about this in entirely the wrong way.

I have a client side JSON object called game, which contains an array of players; each player has a hand which is made up of an array of in-hand cards and on-table cards. Ideally I would like to bind these to something using Knockout.js, but I don't know what I could bind to.

How could I lay out some cards on the table, and perhaps make reuse of something for each player? Would I simply position images (of cards) on a canvas? Is there a way to make some kind of hand object that each player could have and that I could bind to?

答:
You don't need knockout with the canvas. Just do your design like you normally would.

Personally I create objects with Draw methods, these are Drawable.

Live Example.

Then you have other container object that have references to Drawable objects.

Example of a Drawable Card.

(Uses pd)

```<code>var Card = {
    draw: function _draw() {
        ctx.strokeRect(this.x, this.y, 30, 50);
        ctx.strokeText(this._value, this.x+10, this.y+25);
    },
    setPosition: function _position(x, y) {
        this.x = x;
        this.y = y;
    }
};
</code>```

And a Container Hand that has references to drawable cards.

```<code>var Hand = {
    draw: function _draw() {
        this.cards.forEach(function (c, i) {
            c.draw();
        });
    },
    generateCards: function _generateCards(n) {
        for (var i = 0; i < n; i++) {
            this.cards.push(Object.create(Card, pd({ _value: i })));
        }
    },
    setPosition: function _setPosition(x, y) {
        this.x = x;
        this.y = y;
        this.cards.forEach(function _each(c, i) {
            c.setPosition(x + i*40, y);
        });
    }
};
</code>```

And some bootstrap code to draw something.

```<code>var h = Object.create(Hand, pd({ cards: [] }));

h.generateCards(3);

h.setPosition(10, 10);

h.draw();
</code>```

Title: HTML5 card game

Body:
You don't need knockout with the canvas. Just do your design like you normally would.

Personally I create objects with Draw methods, these are Drawable.

Live Example.

Then you have other container object that have references to Drawable objects.

Example of a Drawable Card.

(Uses pd)

var Card = {
    draw: function _draw() {
        ctx.strokeRect(this.x, this.y, 30, 50);
        ctx.strokeText(this._value, this.x+10, this.y+25);
    },
    setPosition: function _position(x, y) {
        this.x = x;
        this.y = y;
    }
};

And a Container Hand that has references to drawable cards.

var Hand = {
    draw: function _draw() {
        this.cards.forEach(function (c, i) {
            c.draw();
        });
    },
    generateCards: function _generateCards(n) {
        for (var i = 0; i < n; i++) {
            this.cards.push(Object.create(Card, pd({ _value: i })));
        }
    },
    setPosition: function _setPosition(x, y) {
        this.x = x;
        this.y = y;
        this.cards.forEach(function _each(c, i) {
            c.setPosition(x + i*40, y);
        });
    }
};

And some bootstrap code to draw something.

var h = Object.create(Hand, pd({ cards: [] }));

h.generateCards(3);

h.setPosition(10, 10);

h.draw();


问:
Are there minimum quality standards for .NET applications?
Does Microsoft require third party .NET applications to meet any minimum standards for things like application security or code quality?</p>

答:
Microsoft does not impose any minimum quality or security requirements on the applications built on the .NET on the desktop and on the web.

We all want applications to be secure and of high quality, but there is no certification process for desktop and web .NET applications. It is up to individual developers and their employers (if any) to ensure quality.

The .NET platform also extends to the mobile market and there Microsoft has application certification requirements that a Windows Phone application must meet in order to be listed in the Windows Phone Marketplace. According to that page, the core requirement categories are:

Reliability;

Efficient use of resources;

Lack of interference with other phone applications;

Absence of malicious software.

For games developed on the XNA platform, there are different standards for indie games and professional ones. Indie games go through a community-driven peer review before they can be published on XBox Live. I can't find a link to a description of the process major game releases go through, but from my combined developing and gaming experience I imagine it is also pretty rigorous.


答:
You may be confusing the idea of Microsoft's ownership of the .NET platform with control of that platform. Although Microsoft can direct and modify the platform itself as they see fit, they do not exercise control or claim rights over any software written to target the platform. If they did, it would be platform suicide--few third-party software vendors would willingly write code  that Microsoft could then "veto."

The same is true of the Java platform: Oracle controls its future direction, its development, and its core features, but third-party developers create software to run on the platform independently of Oracle.

Title: Are there minimum quality standards for .NET applications?

Body: Does Microsoft require third party .NET applications to meet any minimum standards for things like application security or code quality?</p>


答:
It provides a huge pay increase if you work for the government.

See GS Levels.

Anecdotally I've heard it can make a 30k/year difference.

Title: What is a Ph.D. good for in the software industry?

Body:
I'm a self-taught programmer and have just started a computer science degree to supplement my knowledge and fill in the gaps.

However, I'm already debating the direction of my education. I want a 4 year bachelor's degree for sure, but after that, I'm not sure: Is it worth it to get an M.Sc? What about a Ph.D.? What opportunities do these degrees open up?

Currently my goal is to be a software developer, but there are a number of fascinating fields in the software industry and I'm certainly interested in investigating many of them. It is in this respect that I think a higher degree may be worth it -- even if it wouldn't necessarily help a career of software development.

So will it be worth it? Will grad school open doors?


问:
Is there a reason for initial overconfidence of scientists and engineers working on artificial intelligence in the 1960s?
I just started an AI & Data Mining class, and the book. AI Application Programming, starts off with an overview of the history of AI. The first chapter deals with the history of AI from the 1940s to present. One particular statement stuck out at me:

[In the 60s] AI engineers overpromised and underdelivered...

What was the reason for the overconfidence? Was it because of mathematical prediction models showing that a breakthrough was around the corner, or due to the ever-increasing hardware capability to take advantage of?

答:
My personal opinion is that it was due to hubris. There were some mighty big egos walking the halls of MIT, Stanford, etc. back in the 60s and 70s and they just knew they had cracked this problem. Right.

Although I wasn't part of that universe in those days, in the mid-to-late 80s I was working with similarity searching. Our work was initially based on research done by Gerard Salton at Cornell in the 60s, which used weighted attribute vectors to represent documents and queries. It actually was a useable approach, but when neural nets went down in flames (at least until they discovered back propagation), Salton's work was included with it because of similarities (pun intended) to neural nets. He was trying to do something different, but there were several years where he was lumped in with the rest.

Every time someone comes up with a solution for the Current Brick Wall™ they get very excited and declare AI to be a solved problem. Only it's not. Because behind that brick wall is another one. This cycle has repeated over, and over, and over again, and not just in AI. I firmly believe that all prospective computer scientists and engineers should be required to take a semester-long class in the History of Computing, with special emphasis on the number of Next Big Things™ that went up like rockets ... and then made a very large crater in the valley floor.

Addendum: I spent the Labor Day weekend with an old friend and we talked a little about this. Context — figuring out what that means, how to represent it, and then how to use it — emerged as possibly the single biggest hurdle to be cleared. And the longer you look at it, the bigger a hurdle it becomes. Humans are capable of amazing, near-instantaneous partial-pattern matching of "what is happening" against a vast store of "what has happened before," and then combining that knowledge of the past with the present situation to create a context in which understanding can lead to action. For example, we can use it as a powerful filter of "things we can/can't ignore" as we whiz down the Waldo Grade at 60 MPH with traffic 4 lanes abreast and separated by only 3 or 4 feet (or less!).

On the spectrum of stuff > data > information > knowledge > understanding > judgement we are still straining to get to the information/knowledge steps, and even that is limited to highly constrained domains of discourse.


答:
I think the reason was arrogance. Had I been an Engineer in the 60s working on AI, I would have been pretty arrogant myself.

I think in order to accomplish great things, you have to reach for great things. So overpromising is not necessarily a bad thing as long as you don't exceed the limit. Scientist today are promising things I don't believe will be possible, but if they don't reach for that, we'll miss out on what will be accomplished as a result.

Title: Is there a reason for initial overconfidence of scientists and engineers working on artificial intelligence in the 1960s?

Body:
I just started an AI & Data Mining class, and the book. AI Application Programming, starts off with an overview of the history of AI. The first chapter deals with the history of AI from the 1940s to present. One particular statement stuck out at me:

[In the 60s] AI engineers overpromised and underdelivered...

What was the reason for the overconfidence? Was it because of mathematical prediction models showing that a breakthrough was around the corner, or due to the ever-increasing hardware capability to take advantage of?


答:
Maybe

You cannot account for all exceptional cases unless you have a ton of time and money.  The more interconnects in a software system the more complex it is and the more it take to cover even the standard test cases. We aren't even necessarily talking about code you wrote.  Remember anytime your software isn't operating purely out of memory (that doesn't grow) you will have many more exception cases.  Accessing network, disk, display, any other devices can all cause an exception.  Growing memory can cause an exception.  In some cases even detecting that the software was improperly stopped may be an exception case.  The question is do you really need to cover every exception case.

Yes

If your working on software where lives hang in the balance, literally.  Then yeah, you probably do need to at least consider every exception cases.  Surgery software, Space Shuttle software, weapon system software, etc.  In each  of these cases there is often explicit analysis of what the all the exceptions are and if they need to be covered.  These kinds of projects often end up spending alot more time and money to cover these cases.  That is the cost of covering "all" exception cases.

No

Are you working on a social networking software.  A Facebook app, an iPhone app, some motorcycle enthusiast site, etc.  This kind of software doesn't usually warrant the kind of consideration I talked about above.  Usually there is a cost to getting to the market late, and covering even some of the exceptional cases may be prohibitively expensive. This can often be a decision that will have business implications, especially in a startup.  Do you cover all those cases and drive your company out of business, or lose a large portion of revenue?

It Depends

So the answer is "it depends".  It depends on the needs of the company, the cost of those exceptions, the cost of the extra time and effort required to guard against those exceptions, and the time involved.

Ideally

Ideally you strike a balance.  Using practices like automated tests to get at least as much coverage on your code as possible without too much cost in time or money.  You can use practices like unit testing, functional testing, fuzz testing, etc; so that the software isn't too buggy, that it's easy to maintain and extend, and so you can look at it and take some pride in what you wrote.


答:
I have a three step plan:

Get a coffee or other tasty beverage.

Work on something else for the rest of the day.

"Phone a friend" and doodle on the whiteboard.

Each stage is an escalation if the previous step failed. There's almost always something else productive I can work on at stage 2.


问:
Is return-type-(only)-polymorphism in Haskell a good thing?
One thing that I've never quite come to terms with in Haskell is how you can have polymorphic constants and functions whose return type cannot be determined by their input type, like

```<code>class Foo a where
    foo::Int -> a
</code>```

Some of the reasons that I do not like this:

Referential transparency:

"In Haskell, given the same input, a function will always return the same output", but is that really true? read "3" return 3 when used in an Int context, but throws an error when used in a, say, (Int,Int) context. Yes, you can argue that read is also taking a type parameter, but the implicitness of the type parameter makes it lose some of its beauty in my opinion.

Monomorphism restriction:

One of the most annoying things about Haskell. Correct me if I'm wrong, but the whole reason for the MR is that computation that looks shared might not be because the type parameter is implicit.

Type defaulting:

Again one of the most annoying things about Haskell. Happens e.g. if you pass the result of functions polymorphic in their output to functions polymorphic in their input. Again, correct me if I'm wrong, but this would not be necessary without functions whose return type cannot be determined by their input type (and polymorphic constants).

So my question is (running the risk of being stamped as a "discussion quesion"): Would it be possible to create a Haskell-like language where the type checker disallows these kinds of definitions? If so, what would be the benefits/disadvantages of that restriction?

I can see some immediate problems:

If, say, 2 only had the type Integer, 2/3 wouldn't type check anymore with the current definition of /. But in this case, I think type classes with functional dependencies could come to the rescue (yes, I know that this is an extension). Furthermore, I think it is a lot more intuitive to have functions that can take different input types, than to have functions that are restricted in their input types, but we just pass polymorphic values to them.

The typing of values like [] and Nothing seems to me like a tougher nut to crack. I haven't thought of a good way to handle them.

答:
I actually think that return type polymorphism is one of the best features of type classes.  After having used it for a while, it is sometimes hard for me to go back to OOP style modeling where I don't have it.

Consider the encoding of algebra.  In Haskell we have a type class Monoid (ignoring mconcat)

```<code>class Monoid a where
   mempty :: a
   mappend :: a -> a -> a
</code>```

How could we encode this as an interface in an OO language?  The short answer is we can't.  That's because the type of mempty is (Monoid a) => a aka, return type polymorphism.  Having the ability to model algebra is incredibly useful IMO.*

You start your post with the complaint about "Referential Transparency."  This raises an important point: Haskell is a value oriented language.  So expressions like read 3 don't have to be understood as things that compute values, they can also be understood as values.   What this means is that the real issue is not return type polymorphism: it is values with polymorphic type ([] and Nothing).  If the language should have these, then it really has to have polymorphic return types for consistency.

Should we be able to say [] is of type forall a. [a]?  I think so.  These features are very useful, and they make the language much simpler.

If Haskell had subtype polymorphism [] could be a subtype for all [a].  The problem is, that I don't know of a way of encoding that without having the type of the empty list be polymorphic.  Consider how it would be done in Scala (it is shorter than doing it in the canonical statically typed OOP language, Java)

```<code>abstract class List[A]
case class Nil[A] extends List[A]
case class Cons[A](h: A. t: List[A]) extends List[A]
</code>```

Even here, Nil() is an object of type Nil[A] **

Another advantage of return type polymorphism is that it makes the Curry-Howard embedding much simpler.

Consider the following logical theorems:

```<code> t1 = forall P. forall Q. P -> P or Q
 t2 = forall P. forall Q. P -> Q or P
</code>```

We can trivially capture these as theorems in Haskell:

```<code>data Either a b = Left a | Right b
t1 :: a -> Either a b
t1 = Left
t2 :: a -> Either b a
t2 = Right
</code>```

To sum up: I like return type polymorphism, and only think it breaks referential transparency if you have a limited notion of values (although this is less compelling in the ad hoc type class case).  On the other hand, I do find your points about MR and type defaulting compelling.

*. In the comments ysdx points out this isn't strictly true: we could re-implement type classes by modeling the algebra as another type.  Like the java:

```<code>abstract class Monoid<M>{
   abstract M empty();
   abstract M append(M m1, M m2);
}
</code>```

You then have to pass objects of this type around with you.  Scala has a notion of implicit parameters which avoids some, but in my experience not all, of the overhead of explicitly managing these things.  Putting your utility methods (factory methods, binary methods, etc) on a separate F-bounded type turns out to be an incredibly nice way of managing things in an OO language that has support for generics.  That said, I'm not sure I would have groked this pattern if I didn't have experience modeling things with typeclasses, and I'm not sure other people will.

It also has limitations, out of the box there is no way to get an object that implements the typeclass for an arbitrary type.  You have to either pass the values explicitly, use something like Scala's implicits, or use some form of dependency injection technology.  Life gets ugly.  On the other hand, it is nice that you can have multiple implementations for the same type.  Something can be a Monoid in multiple ways.  Also, carrying around these structures separately has IMO a more mathematically modern, constructive, feel to it.  So, although I still generally prefer the Haskell way of doing this, I probably overstated my case.

Typeclasses with return type polymorphism makes this kind of thing easy to handle.  That doesn't meen it is the best way to do it.

**.  Jörg W Mittag points out this isn't really the canonical way of doing this in Scala.  Instead, we would follow the standard library with something more like:

```<code>abstract class List[+A] ...
case class Cons[A](head: A, tail: List[A]) extends List[A] ...
case object Nil extends List[Nothing] ...
</code>```

This takes advantage of Scala's support for bottom types, as well as covariant type paramaters.  So, Nil is of type Nil not Nil[A].  At this point we are pretty far from Haskell, but it is interesting to note how Haskell represents the bottom type

```<code>undefined :: forall a. a
</code>```

That is, it isn't the subtype of all types, it is polymorphically(sp) a member of all types.

Yet more return type polymorphism.

OwnerDisplayName: dainichi

Body:
I actually think that return type polymorphism is one of the best features of type classes.  After having used it for a while, it is sometimes hard for me to go back to OOP style modeling where I don't have it.

Consider the encoding of algebra.  In Haskell we have a type class Monoid (ignoring mconcat)

class Monoid a where
   mempty :: a
   mappend :: a -> a -> a

How could we encode this as an interface in an OO language?  The short answer is we can't.  That's because the type of mempty is (Monoid a) => a aka, return type polymorphism.  Having the ability to model algebra is incredibly useful IMO.*

You start your post with the complaint about "Referential Transparency."  This raises an important point: Haskell is a value oriented language.  So expressions like read 3 don't have to be understood as things that compute values, they can also be understood as values.   What this means is that the real issue is not return type polymorphism: it is values with polymorphic type ([] and Nothing).  If the language should have these, then it really has to have polymorphic return types for consistency.

Should we be able to say [] is of type forall a. [a]?  I think so.  These features are very useful, and they make the language much simpler.

If Haskell had subtype polymorphism [] could be a subtype for all [a].  The problem is, that I don't know of a way of encoding that without having the type of the empty list be polymorphic.  Consider how it would be done in Scala (it is shorter than doing it in the canonical statically typed OOP language, Java)

abstract class List[A]
case class Nil[A] extends List[A]
case class Cons[A](h: A. t: List[A]) extends List[A]

Even here, Nil() is an object of type Nil[A] **

Another advantage of return type polymorphism is that it makes the Curry-Howard embedding much simpler.

Consider the following logical theorems:

 t1 = forall P. forall Q. P -> P or Q
 t2 = forall P. forall Q. P -> Q or P

We can trivially capture these as theorems in Haskell:

data Either a b = Left a | Right b
t1 :: a -> Either a b
t1 = Left
t2 :: a -> Either b a
t2 = Right

To sum up: I like return type polymorphism, and only think it breaks referential transparency if you have a limited notion of values (although this is less compelling in the ad hoc type class case).  On the other hand, I do find your points about MR and type defaulting compelling.

*. In the comments ysdx points out this isn't strictly true: we could re-implement type classes by modeling the algebra as another type.  Like the java:

abstract class Monoid<M>{
   abstract M empty();
   abstract M append(M m1, M m2);
}

You then have to pass objects of this type around with you.  Scala has a notion of implicit parameters which avoids some, but in my experience not all, of the overhead of explicitly managing these things.  Putting your utility methods (factory methods, binary methods, etc) on a separate F-bounded type turns out to be an incredibly nice way of managing things in an OO language that has support for generics.  That said, I'm not sure I would have groked this pattern if I didn't have experience modeling things with typeclasses, and I'm not sure other people will.

It also has limitations, out of the box there is no way to get an object that implements the typeclass for an arbitrary type.  You have to either pass the values explicitly, use something like Scala's implicits, or use some form of dependency injection technology.  Life gets ugly.  On the other hand, it is nice that you can have multiple implementations for the same type.  Something can be a Monoid in multiple ways.  Also, carrying around these structures separately has IMO a more mathematically modern, constructive, feel to it.  So, although I still generally prefer the Haskell way of doing this, I probably overstated my case.

Typeclasses with return type polymorphism makes this kind of thing easy to handle.  That doesn't meen it is the best way to do it.

**.  Jörg W Mittag points out this isn't really the canonical way of doing this in Scala.  Instead, we would follow the standard library with something more like:

abstract class List[+A] ...
case class Cons[A](head: A, tail: List[A]) extends List[A] ...
case object Nil extends List[Nothing] ...

This takes advantage of Scala's support for bottom types, as well as covariant type paramaters.  So, Nil is of type Nil not Nil[A].  At this point we are pretty far from Haskell, but it is interesting to note how Haskell represents the bottom type

undefined :: forall a. a

That is, it isn't the subtype of all types, it is polymorphically(sp) a member of all types.

Yet more return type polymorphism.

OwnerDisplayName: Philip JF


问:
How do you encourage your organization to move from Java to Scala?
Has anybody's organization started the migration from Java to Scala? If yes, how do you do that? What can I do to encourage my colleagues to do the same?</p>

答:
Over the past two years we've progressed a fair way along this journey at guardian.co.uk - our Open Platform is built on Scala, our core CMS (originally in Java) is gradually incorporating more Scala (we're soon moving from Maven to SBT for our build) and it's been a wonderful experience - really invigorating our devs, some of whom were becoming a bit jaded with Java :)

I'd encourage you to read these two articles about our transition, and maybe use them as supporting evidence with your pointy-haired:

http://skillsmatter.com/podcast/home/how-we-moved-from-java-to-scala

http://www.infoq.com/articles/guardian_scala

Some quick tips:

Start by writing your tests in Scala - that way you can get familiar with the language, increase your confidence in it, and not have to conquer any fears you might have about adding the runtime to your production servers straight away.

Don't ask for permission to try new technologies. Better to ask for forgiveness if you have to :-)