问:
How to gain Professional Experience in Java/Java EE Development
I have been seeing opportunities go past me for just 1 reason: not having professional industry experience. I say to many employers that I'm capable of doing the job and show them the work I've done during the academics and also several personal projects which I took extra time and effort to teach myself the new industry standard technologies.

But still, all they want is some 2-3 years experience in an industry. I'm a recent graduate with a Master's Degree in Computer science. I've been applying for quite a few jobs and most of these jobs require 2 years minimum experience.

So, I thought somebody here might give me some realistic ideas about getting some experience which can be considered professional.

Any kind of constructive comments are welcome.

答: As a recent graduate, you may have resources at your school.  Does your school have a job bank or something similar?  Also, my first job after graduation was with one of my instructors, working on a professional research project.  Even if none of them is currently employing, they may have contacts in industry who are looking for entry-level graduates.</p>


答:
Usually companies have separate positions for New grads which dont require industry experience as such but it helps if you have experience through internships during the course of your study. </p>

<p>I suggest you to consider applying for such new grad positions to get the experience or through internships or doing some freelance work. </p>

ContentLicense: CC BY-SA 3.0

Title: How to gain Professional Experience in Java/Java EE Development

Body:
I have been seeing opportunities go past me for just 1 reason: not having professional industry experience. I say to many employers that I'm capable of doing the job and show them the work I've done during the academics and also several personal projects which I took extra time and effort to teach myself the new industry standard technologies.

But still, all they want is some 2-3 years experience in an industry. I'm a recent graduate with a Master's Degree in Computer science. I've been applying for quite a few jobs and most of these jobs require 2 years minimum experience.

So, I thought somebody here might give me some realistic ideas about getting some experience which can be considered professional.

Any kind of constructive comments are welcome.

Body:
Usually companies have separate positions for New grads which dont require industry experience as such but it helps if you have experience through internships during the course of your study.

I suggest you to consider applying for such new grad positions to get the experience or through internships or doing some freelance work.


答:
I'm in the same boat as you are. What I did was to apply to different jobs even though I don't  have any years of experience. Most of them I failed but there are some that considered my "programming attitude" (i.e. my aptitude towards learning new things) rather than my "programming experience". I was lucky I got my current job. Then what I did (and still continuously doing) is to immerse myself into "good programming habits" and to surround myself with "good programming resources". I know there is no shortcut to success in this industry but I got to understand complex stuff faster when I "filtered out the noise". As Douglas Crockford said, "Most programming languages contain good parts and bad parts. I discovered that I could be a better programmer by using only the good parts and avoiding the bad parts... You can write better programs by
relying exclusively on the good parts." (taken from JavaScript The Good Parts). I took his advice by heart and I think you should too.

Another thing is to join open source projects and programming communities (like stackoverflow). They are the best places to share knowledge and to learn at the same time. Good luck.


问:
Is it just me or is this a baffling tech interview question?

Background

I was just asked in a tech interview to write an algorithm to traverse an "object" (notice the quotes) where A is equal to B and B is equal to C and A is equal to C.

That's it.  That is all the information I was given.

I asked the interviewer what the goal was but apparently there wasn't one, just "traverse" the "object".

I don't know about anyone else, but this seems like a silly question to me.  I asked again, "am I searching for a value?".  Nope.  Just "traverse" it.

Why would I ever want to endlessly loop through this "object"??  To melt my processor maybe??

The answer according to the interviewer was that I should have written a recursive function.

OK, so why not simply ask me to write a recursive function?  And who would write a recursive function that never ends?

My question:

Is this a valid question to the rest of you and, if so, can you provide a hint as to what I might be missing?  Perhaps I am thinking too hard about solving real world problems.  I have been successfully coding for a long time but this tech interview process makes me feel like I don't know anything.

答:
It seems to me that this is a (poorly articulated) question regarding a circular linked list.  I would have likely asked if that is what was meant (because the answer would be certainly different than another above which is to say they are all references to the same object).

If this was a linked list question, then you (in this case) have a singly linked list, where the end node points to the other end (although if it was worded as you say - then it may be doubly linked if A points to B and C - but clarification on the interviewer's part would help this).

A -> B -> C -> A

Also (and this happens all the time), the interviewer may have read this question, thought it was a 'good' question, but didn't actually know the answer themselves (or even what it meant).


答:
A lot of employers who advertise for "2-3 years experience" are not necessarily looking for someone who can use a particular technology (You mention Java EE), but for somebody who has acquired the kinds of soft skills which can only really be gained from working on real projects with other engineers, with real pressures, meeting real deadlines.

As cliche as it may sound, you'd probably need a disproportionately higher wealth of technical knowledge in order to offset that.   My guess would be that if you knew nothing about Java EE, but had several projects to your name of some other kind (Maybe even non-programming projects), accompanied by all the mistakes and realisations which you get from working on them, you'd have a better chance at those particular jobs because many employers tend to be more interested in taking on somebody who understands the pressures & priorities, and who will be capable of learning specific technologies along the way.

--

As an example, the first project I ever worked on put me in a position where I had to work with another junior engineer with supervision from the project manager;   We both developed our respective parts with no problems.  Later, we went through an integration stage with the existing system, whereby we had both assumed that everything would "just work" - as it turned out, the integration ended up being extremely painful, tedious, slow, difficult, and resulted in a huge number of defects and regression issues turning up.

We also fell foul of "team process" issues, where particular steps had been overlooked resulting in a breakdown of communication between engineers and other project stakeholders - The QA testers on the project had been out of the loop, and a whole bunch of issues didn't get elevated to the project manager in time for them to be dealt with.   Finally, we landed ourselves in a steep learning curve with all of the company's tools and figuring out how the existing large code-base worked.

The end-result was delay to the project, and weeks of frustrating re-work while we trawled through tens-thousands of lines of code to understand where we'd gone wrong, and iron out the unforseen problems.    These are the sorts of mistakes which shape you as an engineer, and make you much better at project work.  Unfortunately, nobody can really be taught this kind of experience from a book or in a classroom, it can only be learned the hard way; and really the only opportunity to do something like that is to get yourself involved with real projects.

Also, the work involved getting dirty with build scripts, installers, project tracking tools, creating documentation, etc.   The whole project probably involved less than 10% time actually "creating code", with the other 90% doing all of the supporting work to make sure everything is right.  This is not uncommon, but is something else which most graduates tend not to be prepared for when they first start out (Every junior who walks into their first job expecting to spend 7.5 hours a day programming always has a shock when they're asked to sit down and solve their first "difficult" problem buried somewhere among a million lines of code)

There are certainly plenty of employers out there who will take on graduates/juniors, and those employers understand the necessity of learning through mistakes (they'll likely also be more than happy to take on an engineer at a significantly lower wage than the ones who already have had several years of continued "real world" learning).  It's a matter of finding the right job, and getting into the right opportunity to learn all the hard lessons for yourself.


问:
Testing loses its effectiveness if all programmers don't use them
Let's assume you are convinced that the extra time spent unit testing has merit and improves production. Does that still hold up when everyone working on the same code doesn't use them? This question makes me wonder if fixing tests that everyone doesn't use is a waste of time. If you correct a test so the new code will pass, you're assuming the new code is correct. The person updating the test better have a firm understanding of the reasoning behind the code change and decide if the test or the new code needs to be fixed. This much inconsistency in a team when it comes to testing is probably an indication of other problems as well.

There is a certain amount of risk involved that someone else on the team will alter code that is covered by testing. Is this the point where testing becomes counter-productive?

答:
Ideally the whole team should be using tests and other good practices, but that isn't always realistic - If you don't have the power to tell the rest of the team what to use, having to get the entire team to agree can mean that improvements never happen.

Fortunately most of these improvements are worthwhile even if you are the only one using them. Normally tests are run on commit to answer the question "Did my code break anything?", but the same tests can be run on checkout to answer the question "Did anyone else break my code?", which is even more useful in some environments.

This approach lets you introduce testing one developer at a time, which is much easier than getting everyone to agree up front. Eventually everyone will be using the tests and you can start doing things like requiring tests to pass on the build server.


问:
Application that provides unique keys to multiple processes
Any idea on how to build an application that provides unique keys each time it get called by another process.

Calling process isn't my problem here, my problem is how to sync between two(or more) processes and preventing it from providing the same key to both of them.

I'd really appreciate your help in this issue, please only outline the solution and I'll try to implement it.

答: not to be to basic but why not just have an incrementing integer (ack a global) for your key. Have it initialize at start up. Save the calling process and key in a dictionary if you need the reference both ways. You could do this with a class, or store it in a database depending on your need.</p>


答: Just use a GUID as your key. It's universally unique. </p>

Title: Application that provides unique keys to multiple processes

Body:
Any idea on how to build an application that provides unique keys each time it get called by another process.

Calling process isn't my problem here, my problem is how to sync between two(or more) processes and preventing it from providing the same key to both of them.

I'd really appreciate your help in this issue, please only outline the solution and I'll try to implement it.


答:
Everyone has to appreciate the benefit that unit tests bring in order for them to have any value whatsoever. I've compared unit tests to a new puppy before: They're great, but they require love and care, otherwise you find them dead in the corner crawling with ants after a few weeks.

I've seen a few scenarios in my career thus far:

Everyone writes good unit tests, the tests are part of a CI build, and code is written to the tests, not the other way around.

I'm the only person writing unit tests, and the solution to a failing test is either to comment it out or just stick an Assert.IsTrue(true); in there

People write tests to their code. By this, I mean someone writes a bunch of code, runs it with a set of inputs, gets a set of outputs, and blindly sticks the output into a test. This is how you end up with a legitimate bug fix resulting in a slew of tests breaking, which tends to lead to scenario #2 ("We don't have time to fix these 30 tests, just comment them out!")

If you want to write unit tests, good. If no one else wants to, it's time to go find another team to work with that does.

Title: Testing loses its effectiveness if all programmers don't use them

Body:
Let's assume you are convinced that the extra time spent unit testing has merit and improves production. Does that still hold up when everyone working on the same code doesn't use them? This question makes me wonder if fixing tests that everyone doesn't use is a waste of time. If you correct a test so the new code will pass, you're assuming the new code is correct. The person updating the test better have a firm understanding of the reasoning behind the code change and decide if the test or the new code needs to be fixed. This much inconsistency in a team when it comes to testing is probably an indication of other problems as well.

There is a certain amount of risk involved that someone else on the team will alter code that is covered by testing. Is this the point where testing becomes counter-productive?


问:
Is dynamic HTML layout good from an SEO perspective?
Just wondering whether dynamically built HTML layout is fine from SEO perspectives? So let's assume e-commerce engine and its most popular page - products catalog. So 90% of the page is built using AJAX and MVVM library knockoutjs which builds HTML on the fly on the client side. So how search bots would parse such content? Is it fine indexed and would be such effective as server-side built HTML pages from the SEO perspectives?</p>

答: It's rarely impossible or even all that difficult to implement a progressive enhancement approach that delivers static content when JavaScript is turned off. This isn't just an accessibility win. It's also mighty handy as a fallback for mobile browsers whose JS interpreters simply aren't worth attempting to normalize for (*cough*blackberry*/cough*). I'd rather adopt PE where possible and then mess with how spiders handle JS delivered content in the minority of scenarios where it's actually messy to implement PE. This of course, assumes you've got your separation of client-side concerns down in the first place. If you don't, do it right next time. You won't regret it.</p>


答:
Some interviewers specifically try to ask questions to see if the candidate is smart and honest enough to give one of these two answers:

I don't know.

or maybe:

I can't answer that as stated.

They don't want a candidate who will accept pure BS as a spec, and waste their employer's time and pay trying to implement it.

Title: Is it just me or is this a baffling tech interview question?

Body:
Background

I was just asked in a tech interview to write an algorithm to traverse an "object" (notice the quotes) where A is equal to B and B is equal to C and A is equal to C.

That's it.  That is all the information I was given.

I asked the interviewer what the goal was but apparently there wasn't one, just "traverse" the "object".

I don't know about anyone else, but this seems like a silly question to me.  I asked again, "am I searching for a value?".  Nope.  Just "traverse" it.

Why would I ever want to endlessly loop through this "object"??  To melt my processor maybe??

The answer according to the interviewer was that I should have written a recursive function.

OK, so why not simply ask me to write a recursive function?  And who would write a recursive function that never ends?

My question:

Is this a valid question to the rest of you and, if so, can you provide a hint as to what I might be missing?  Perhaps I am thinking too hard about solving real world problems.  I have been successfully coding for a long time but this tech interview process makes me feel like I don't know anything.


问:
Possible applications of algorithm devised for differentiating between structured vs random text
I have written a program that can rapidly (within 5 sec on a 2GB RAM desktop, 2.33 Ghz CPU) differentiate between structured text (e.g English text) and random alphanumeric strings. It can also provide a probability score for the prediction.

Are there any practical applications/uses of such a program? Note that the program is based on entropy models and does not have any dictionary comparisons in its workflow.

答: It could be used as part of a program like the Unix file command to distinguish "English text" from unstructured "data".


答:
You could use it to scan through random text blocks and identify patterns and use these patterns for "predicting" the future. Kinda like an automated Nostradamus. :-)

On a more serious note, perhaps you could use it to select word/phrase-like strings from a bunch of randomly generated strings. These are usually desirable passwords because they are easier to remember and usually wouldn't appear in a dictionary.

Title: Possible applications of algorithm devised for differentiating between structured vs random text

Body:
I have written a program that can rapidly (within 5 sec on a 2GB RAM desktop, 2.33 Ghz CPU) differentiate between structured text (e.g English text) and random alphanumeric strings. It can also provide a probability score for the prediction.

Are there any practical applications/uses of such a program? Note that the program is based on entropy models and does not have any dictionary comparisons in its workflow.


问:
INI files or Registry or personal files?
I want to save the configuration of my project which includes

Screen size

Screen position

Folder paths

Users settings and so on.

The standard places where you can save these are configuration values are:

Registry

INI files

Personal files (like *.cfg)

How do you choose between these places? Also, are there any pros and cons of using any of them?

答: My preference is XML files.  They are hierarchical, you can bend them to your will in almost any way imaginable, they are well understood, platform independent, and there is a wide array of software available to read and write them.</p>


问:
How would I unit test database logic?
I am still having a issue getting over a small issue when it comes to TDD.

I need a method that will get a certain record set of filtered data from the data layer (linq2SQL).  Please note that i am using the linq generated classes from that are generated from the DBML.
Now the problem is that i want to write a test for this.

do i:

a) first insert the records in the test and then execute the method and test the results

b) use data that might be in the database.  Not to keen on this logic cause it could cause things to break.

c) what ever you suggest?

答:
Variation on (a).

Have a test db or subsection of the db that can be used for testing. When you are setting up
your tests, have a routine that initializes the DB as you need it to begin testing (this can be done before each test, as appropriate). This may include deleting data, inserting data, etc. Then run your tests. In the Teardown phase, clean up after yourself. Can be repeated as much as is needed, without risk of disrupting live system (not a good idea to test using data in the database that is needed for anything else).

ContentLicense: CC BY-SA 2.5

Title: How would I unit test database logic?


问:
Is the phrase "never reinvent the wheel" suitable for students?
I find myself constantly running into this expression "don't reinvent the wheel" or "never reinvent the wheel" when I ask some questions on SO.  They tell you to use some frameworks or existing packages.  I know where this attitude is coming from since it's unwise to waste time on something others have already solved.  Or it that so?

As a student,  I find by using some code others wrote to solve my problem I can't learn as much as I'd like to, and I gain less insight.  And sometimes I think that phrase is mainly for working programmers facing deadlines and not for students like me.

Is it that bad to "reinvent the wheel"?  Maybe I'm thinking it wrong? Maybe there is a way I can avoid reinventing the wheel and at the same time learn a lot?

答:
I'm a newly educated student.
In the school we was 'learning' asp.net and C#, those 2 years the education took, we never tried to make our own email system, login system, or CMS.. Everything was just dragging, and dropping control into the design view.

We started 102 students, 23 did complete. 4 people has a work. The reason?: Those 4 people(including me) did know how to program before we actually started on the education.

The rest of the people is lost. Because we never 'reinvented the wheel'. We never got to know how the code actually work. It's fairly simple to build a full login system, with user management - But the students from my education, doesn't know how to do so. Because they don't know how a login system actually works.

I feel sad, that at some point, actually wasted 2 years, learning nothing. - I wish, that teachers around the world, say: Yeah, we know there is frameworks, where the code exists, You can use them in the real life.. But on this education you will learn how to do programming..

Many programming educations are very short, so the educations need to cover a lot of things within that time. I think it would be better that the list of things was cut to half, and spending more time on programming. People can 'invent a new kind of wheel' if they know how to build a normal 'wheel'. People are not stupid if they have a little knowledge, but you can't ask a man that doesn't know anything about cars, to build a car.. But asking a man that knows how to build a bike, would have much easier with actually building the car.


答:
I'd go with INI files, they are the more human friendly option:

```<code>[window]
width       = 600
height      = 350
position.x  = 400
position.y  = 200

[paths]
path1       = "/some/random/path/"
path2       = "/some/other/random/path/"

[user]
name        = "Yannis"
preference  = "INI"
</code>```

XML might be a good option, but it can't beat INIs' simplicity and elegance:

```<code><?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <window>
        <width>600</width>
        <height>350</height>
        <position>
            <x>400</x>
            <y>200</y>
        </position>
    </window>
    <paths>
        <path1>/some/random/path/</path1>
        <path2>/some/other/random/path/</path1>
    </paths>
    <user>
        <name>Robert</name>
        <preference>XML</preference>
    </user>
</configuration>
</code>```

INIs are also very well understood and platform independent. There aren't probably as many tools available for them as for XML files, because, well, who needs a specialized tool to read and edit an INI file?

Title: INI files or Registry or personal files?

Body:
I want to save the configuration of my project which includes

Screen size

Screen position

Folder paths

Users settings and so on.

The standard places where you can save these are configuration values are:

Registry

INI files

Personal files (like *.cfg)

How do you choose between these places? Also, are there any pros and cons of using any of them?

Body:
I'd go with INI files, they are the more human friendly option:

[window]
width       = 600
height      = 350
position.x  = 400
position.y  = 200

[paths]
path1       = "/some/random/path/"
path2       = "/some/other/random/path/"

[user]
name        = "Yannis"
preference  = "INI"

XML might be a good option, but it can't beat INIs' simplicity and elegance:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <window>
        <width>600</width>
        <height>350</height>
        <position>
            <x>400</x>
            <y>200</y>
        </position>
    </window>
    <paths>
        <path1>/some/random/path/</path1>
        <path2>/some/other/random/path/</path1>
    </paths>
    <user>
        <name>Robert</name>
        <preference>XML</preference>
    </user>
</configuration>

INIs are also very well understood and platform independent. There aren't probably as many tools available for them as for XML files, because, well, who needs a specialized tool to read and edit an INI file?


问:
Which things instantly ring alarm bells when looking at code?
I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further discussion.

This sort of thing always worries me as there's that truism that everyone thinks they're an above average driver. Although I think I can recognize bad code I'd love to learn more about what other people consider to be code smells as it's rarely discussed in detail on people's blogs and only in a handful of books. In particular I think it'd be interesting to hear about anything that's a code smell in one language but not another.

I'll start off with an easy one:

Code in source control that has a high proportion of commented out
  code - why is it there? was it meant
  to be deleted? is it a half finished
  piece of work? maybe it shouldn't have
  been commented out and was only done
  when someone was testing something
  out? Personally I find this sort of
  thing really annoying even if it's just the odd line here and there, but when you see large blocks interspersed with the rest of the code it's totally unacceptable. It's
  also usually an indication that the rest of
  the code is likely to be of dubious
  quality as well.

答:
Using lots of text-blocks rather than enums or globally defined variables.

Not good:

if (itemType == "Student") { ... }
```

<p>Better:</p>

<pre class="lang-java prettyprint-override"><code>private enum itemTypeEnum {
  Student,
  Teacher
}
if (itemType == itemTypeEnum.Student.ToString()) { ... }
</code>```

Best:

private itemTypeEnum itemType;
...
if (itemType == itemTypeEnum.Student) { ... }
```

Body:
Using lots of text-blocks rather than enums or globally defined variables.

Not good:

if (itemType == "Student") { ... }

Better:

private enum itemTypeEnum {
  Student,
  Teacher
}
if (itemType == itemTypeEnum.Student.ToString()) { ... }

Best:

private itemTypeEnum itemType;
...
if (itemType == itemTypeEnum.Student) { ... }


问:
The rule of 5 - to use it or not?
The rule of 3 (the rule of 5 in the new c++ standard) states :

If you need to explicitly declare either the destructor, copy constructor or copy assignment operator yourself, you probably need to explicitly declare all three of them.

But, on the other hand, the Martin's "Clean Code" advises to remove all empty constructors and destructors (page 293, G12:Clutter) :

Of what use is a default constructor with no implementation? All it serves to do is clutter up the code with meaningless artifacts.

So, how to handle these two opposite opinions? Should empty constructors/destructors really be implemented?

Next example demonstrates exactly what I mean :

```<code>#include <iostream>
#include <memory>

struct A
{
    A( const int value ) : v( new int( value ) ) {}
    ~A(){}
    A( const A & other ) : v( new int( *other.v ) ) {}
    A& operator=( const A & other )
    {
        v.reset( new int( *other.v ) );
        return *this;
    }

    std::auto_ptr< int > v;
};
int main()
{
    const A a( 55 );
    std::cout<< "a value = " << *a.v << std::endl;
    A b(a);
    std::cout<< "b value = " << *b.v << std::endl;
    const A c(11);
    std::cout<< "c value = " << *c.v << std::endl;
    b = c;
    std::cout<< "b new value = " << *b.v << std::endl;
}
</code>```

Compiles fine using g++ 4.6.1 with :

```<code>g++ -std=c++0x -Wall -Wextra -pedantic example.cpp
</code>```

The destructor for struct A is empty, and not really needed. So, should it be there, or should it be removed?

答:
The rule of 5 is a cautalative extension of the rule of 3 that is a cautelative behavior againt possible object misuse.

If you need to have a destructor, it means that you did some "resource management" other than the default (just construct and destruct values).

Since copy, assign, move and transfer by default copy values, if you are not holding just values, you have to define what to do.

That said, C++ deletes teh copy if you define the move and deletes the move if you define the copy. In the most of the case you have to define if you want to emulate a value (hence copy mut clone the resource, and move has no sense) or a resource manager (and hence move the resource, where copy has no sense: the rule of 3 becomes the rule of the other 3)

The cases when you have to define both copy and move (rule of 5) are quite rare: typically you have "big value" that has to be copyed if given to distinct objects, but can be moved if taken from a temporary object (avoiding a clone then destroy). That's the case for STL containers or arithmetic containers.

A case can be matrixes: they have to support copy because they are values, (a=b; c=b; a*=2; b*=3; must not influence each other) but they can be optimized by supporting also moving ( a = 3*b+4*c has a + that takes two temporaries and generates a temporary: avoiding clone and delete can be useful)

Title: The rule of 5 - to use it or not?


问:
NoSql databases - Decent tutorial/book that covers the concepts
Am looking for a good resource on learning the concepts behind NoSql databases.

Most things I find are related to a specific technology (MongoDb, CouchDB etc) but I'm after all the concepts behind NoSql instead of focusing on a specific area (some are graph DBs, some key-value etc).

Can you share from your experience and point me to a good resource?

答:
I don't know if that's even possible.

NoSQL is a broad term that covers graph databases, document stores, key-value stores. Their lowest common factor is just that you don't have an SQL interface to access the data.


答:
There's an upcoming (as yet unreleased) book that might cover what you are looking for - http://www.amazon.com/NoSQL-Distilled-Martin-Fowler/dp/0321826620

You might also find Ian Varley's master's thesis useful - http://ianvarley.com/UT/MR/Varley_MastersReport_Full_2009-08-07.pdf

Another overview - http://www.aosabook.org/en/nosql.html

For specific implementations, this site covers a lot of ground - http://nosql-databases.org/

Title: NoSql databases - Decent tutorial/book that covers the concepts

Body:
Am looking for a good resource on learning the concepts behind NoSql databases.

Most things I find are related to a specific technology (MongoDb, CouchDB etc) but I'm after all the concepts behind NoSql instead of focusing on a specific area (some are graph DBs, some key-value etc).

Can you share from your experience and point me to a good resource?


问:
Are there currently any modern, standardized, aptitude test for software engineering?

Background

I am a working software engineer who is in the midst of seeking out a new contract for the next year or so.  In my search, I am enduring several absurd technical interviews as indicated by this popular question I asked earlier today.

Even if the questions I was being asked weren't almost always absurd, I would be tired nonetheless of answering them many times over for various contract opportunities.

So this got me thinking that having a standardized exam that working software professionals could take would provide a common scorecard that could be referenced by interviewers in lieu of absurd technical interview questions (i.e. nerd hazing).

Question

Is there a standardized software engineering aptitude test (SEAT??) available for working professionals to take?

If there isn't a such an exam out there, what questions or topics should be covered?

An additional thought

Please keep in mind, if suggesting a question or topic, to focus on questions or topics that would be relevant to contemporary development practices and realistic needs in the workforce as that would be the point of a standard aptitude test.  In other words, no clown traversal questions.

答:
Have a look at Codility.

It's an on-line programming test that supports a number of different languages. The questions are well defined, and not overly complex although they do require some thought, as well as good (defensive) programming techniques - not only do you have to write a correct working solution but they will test for things like edge conditions and integer overflow.

I have no idea how well regarded the self certification is, but two recent job applications have used that site as part of the selection process.


答:
Arguably, that's the role of certifications and degrees.  If you want a standardized test of someone's familiarity with a particular programming language, you could look for people that have a particular language certification.  If you want a standardized test of general computer science knowledge, look for someone that has a computer science degree.

The problem, of course, is that we all know that these sorts of credentials are far from perfect.  It is too easy for people to cram for a certification exam once the exam topics are finalized without actually learning anything or being able to apply the knowledge.  A rather large fraction of solid developers aren't going to bother going through the certification process.  And trying to be certified on everything an employer is looking for (languages, development processes and methodologies, etc.) would be quite onerous.  Computer science degrees are also fallible-- there are people that complete their degree without ever managing to learn how to write useful code and there are people that learn how to write great code while majoring in something else.

Given that the standardized approaches have demonstrated themselves to be insufficient in the real world, it's exceptionally unlikely that a standardized exam would fare any better.  It would almost certainly end up getting gamed just like existing certification exams.  People would cram for the exam or get access to the questions from "brain dumps".  Existing developers wouldn't all run out to take the exam.  And employers wouldn't be willing to rely heavily on the exam results.  So they're still going to want to ask technical questions in an interview.

Beyond that, though, a good technical interview (obviously, there are bad interviewers and bad questions just like there are bad developers) should also be about assessing how a candidate's approach will mesh with the current team.  A good interview ought to assess a candidate's communication skills and their soft skills just as much as it assesses their technical skills.  I'm much more interested in a candidate that asks good questions to clarify the requirements and that explains their thought process well even if they don't immediately come up with the best algorithm over someone that comes up with a great algorithm but can't explain their answer effectively or discuss trade-offs effectively.

Title: Are there currently any modern, standardized, aptitude test for software engineering?

Body:
Background

I am a working software engineer who is in the midst of seeking out a new contract for the next year or so.  In my search, I am enduring several absurd technical interviews as indicated by this popular question I asked earlier today.

Even if the questions I was being asked weren't almost always absurd, I would be tired nonetheless of answering them many times over for various contract opportunities.

So this got me thinking that having a standardized exam that working software professionals could take would provide a common scorecard that could be referenced by interviewers in lieu of absurd technical interview questions (i.e. nerd hazing).

Question

Is there a standardized software engineering aptitude test (SEAT??) available for working professionals to take?

If there isn't a such an exam out there, what questions or topics should be covered?

An additional thought

Please keep in mind, if suggesting a question or topic, to focus on questions or topics that would be relevant to contemporary development practices and realistic needs in the workforce as that would be the point of a standard aptitude test.  In other words, no clown traversal questions.


答:
The NoSQL wikipedia article covers everything you need to know about the different types of NoSQL databases available.

If you want to delve into specifics, you can read about each one of them individually on wikipedia, or look for other types of documentation.


答:
Also are there any pros and cons of using any of them?

Registry:

+ Relatively standard in the Windows environment.

+ Generally good support from installers, etc.

- Platform specific API, if you ever want to port your application.

- Not particularly human readable.

INI Files:

+ Simple format.

+ Portable.

+ Human readable.

- May be difficult to store more complex information (for example, anything nested more than two levels deep).

? May have to write your own parser (although not difficult) or use an external library like SimpleIni (thanks to Jonathan Merlet for the comment).

XML Files (I'm guessing this is the .cfg option):

+ A standard format.

+ Portable.

+ Supports deeply nested structures.

- Not particularly human readable.

Personally, for Windows applications I tend to use C#, and go with a personal file for the user, stored as XML. I do this typically because human readability is not usually a priority in the types of applications I write (and the application should have a configuration editor, in any case), and in the .NET environment, it's very easy to work with XML. I very often end up with a UserConfiguration object which simply gets serialised to and from a configuration file - almost no development involved (parsing, casting stuff around), and you have your configuration ready to use in a strongly typed environment.


问:
What does "enterprise" means in relation to software architecture?
I see the term "enterprise" being thrown around software developers and programmers a lot and used loosely it seems.

en·ter·prise/ˈentərˌprīz/

Noun: A project or undertaking, typically one that is difficult or requires effort.
Initiative and resourcefulness.

Can someone please clarify what this term actually encompasses? "At an enterprise level", "enterprise scale"? There are even "enterprise editions" of things. What exactly does it mean? It obviously doesn't make sense judging by the above definition so more specifically to software what does one mean when using the word enterprise?

EDIT:

To add a spin on this - how does this term then fit into phrases such as Enterprise Framework Model? What does data access and data context have to do with company-wide descriptions?

答: The use is rather vague but normally means software that is expected to work in large organisations - multinational ones, for instance.</p>


答:
Aptitude tests are meant to measure someone's innate facility for a given subject, not how much you already know about a subject. I don't think that's what you're looking for. Instead, you seem to want a standard way to demonstrate what you know so that you don't have to endure the technical questions at an interview (or can at least avoid the silly ones).

Good news: There are a lot of ways that you can demonstrate what you know. Tools at your disposal include:

résumé: A well-written résumé can go a long way toward answer questions about what you've done in the past and, by extension, what you now know. Don't just list where you've worked, say what you've done.

projects: Bring something that you've created with you and offer a quick demo. Show your code and be willing to explain it. This lets you show your technical ability on your own turf. (If it's something that others have also contributed to, be very clear about what you did vs. what other people have done. If you can, it's best to show something that's entirely your own.)

writing: If you've written any papers, a blog, or a book or magazine article, try to introduce that before your interview so that the interviewers have a chance to read it.

degree or certification: These are about as close to a standard exam as you're likely to get.

In short, your goal is to provide as much evidence as possible that you have the knowledge that the interviewer is looking for.

Bad news: No matter what, you're probably always going to face a contrived technical question or two when you interview for a job. Even if you really wow 'em with your experience and can demonstrate that you're exactly the guy they're looking for, they'll still ask a few questions about data structures or whatever. There's no down side for the company -- the person they're looking for should be able to answer those questions in his sleep, and there are apparently a lot of people who can't. Also, some organizations have strict hiring procedures that require them to ask the same questions of every candidate; interviewers aren't free to decide that you know your stuff and they can just skip the technical questions.


答:
You need to widen your definition.

From http://dictionary.reference.com:

en·ter·prise  [en-ter-prahyz]  noun

a project undertaken or to be undertaken, especially one that is important or difficult or that requires boldness or energy: To keep
  the peace is a difficult enterprise.

a plan for such a project.

participation or engagement in such projects: Our country was formed by the enterprise of resolute men and women.

boldness or readiness in undertaking; adventurous spirit; ingenuity.

a company organized for commercial purposes; business firm.

As per the 5th definition that I have quoted above, Enterprise software or an Enterprise Licence is intended to provide a company-wide solution.  As per the OP's dictionary definition, the "Project or Undertaking" in the cases quoted by the OP is a company.

A company-wide solution means that it will be used wherever a company has an office, or a site.  So an Enterprise license will provide a solution for all of a company's sites.  This differs to a Site license, which would only cover one location belonging to a company, instead of all of them. Anther use of the term Enterprise is simply to indicate an entire company, and isn't necessarily limited in definition to something software related. Thus you can have software, HR or Accounting, or even a supply of Jelly Beans for "The Enterprise". When used in either case, the word Enterprise in relation to the size of a company isn't relevant, as it applies equally to a small business, as it does to a megacorp.

Enterprise editions of software are intended to be packed full of the sort of features that you would typically need to suite a multi-site multi-server solution of some sort.  In this case however, you'll find that it is just as likely to mean that you are expected to pay more to get more of the features that you probably wouldn't need in a smaller "enterprise", and therefore the word becomes as much marketing hyperbole as anything.

To answer the edited part of the OP's answer, an Enterprise Framework is a fancy name for an API that supports implementation of products designed for distributed data storage and communications, typically necessary for products designed with a multi-site product in mind. This is typically not intended for small businesses and yet can be used to create products which can scale from a single server/site to multiple servers/sites. The idea is to allow a product to grow to match the changing needs of a company (the Enterprise) as it grows, such as opening offices around the world, but sharing a common mail system for example.

So the issue of the word being used "vaguely" or "loosely" is really a bit of a non-issue, since the term Enterprise is always intended to mean "company-wide, regardless of the number of sites you need to service"... only Enterprise is clearly much less of a mouthful to say, and as per the examples that the OP has listed, the meaning of the word Enterprise remains clear.

Title: What does "enterprise" means in relation to software architecture?

Body:
I see the term "enterprise" being thrown around software developers and programmers a lot and used loosely it seems.

en·ter·prise/ˈentərˌprīz/

Noun: A project or undertaking, typically one that is difficult or requires effort.
Initiative and resourcefulness.

Can someone please clarify what this term actually encompasses? "At an enterprise level", "enterprise scale"? There are even "enterprise editions" of things. What exactly does it mean? It obviously doesn't make sense judging by the above definition so more specifically to software what does one mean when using the word enterprise?

EDIT:

To add a spin on this - how does this term then fit into phrases such as Enterprise Framework Model? What does data access and data context have to do with company-wide descriptions?


答:
In theory "enterprise solution" is any kind of solution that is apt enough for large scale corporate business. In practice however it means solutions developed with "nobody get's fired for hiring IBM" mentality.

On the other hand there are companies like Google, Facebook, Amazon etc. who have built their business on solutions not traditionally considered "enterprise level". For example they initially were using cheap, CotS hardware. Software they are using is Open Source, with great role played by dynamic languages, which also aren't traditionally considered "enterprise ready" (even though they are widely used by enterprises).


答:
The typical application for this (categorizing data based on previous training data - assuming that is indeed what this does) would be for an adaptive spam filter. Other things that I can think of:

categorize texts by language

estimate entropy (the higher the probability for "completely random", the better your entropy)

salvage textual content from damaged files or partitions

estimate the quality of forum posts (higher probability for "structured text" means more likely to be properly written)

find clear-text payload in sniffed network communications

categorize texts by some stylistic property, e.g. formality level (slang / informal / formal / ...) or poetic vs. factual (is this bit of text from a novel or from a news article?)

Whether your algorithm is suitable for these problems depends, but if it does what I think it does, you should be able to apply it to any of them.


问:
Is realtime validation of username good or bad?
I have a simple form for the user to sign up to my site; with email, username and password fields. We are now trying to implement an ajax validation so the user doesn't have to post the form to find out if the username is already taken. I can do this either on keyup event or on text blur event. My question is, which of these is really the best way to do?

Keyup

From the user POV, it would be good if the validation is done as and when they are typing, (on key up event) - of course, I am waiting for half a second to see if the user stops typing before firing off the request, and user can make any adjustments immediately.

But this means I am sending way more requests than if I validated the username on Blur event.

Blur

The number of requests will be much lower when the validation is done on blur event, But this means the user has to actually go away from the textbox, look at the validation result, and if necessary go back to it to make any changes and repeat the whole process until he gets it right.

I had a quick look at google, tumblr, twitter and no one actually does username validations on keyup events, (heck, tubmlr waits for the form to be posted) but I can swear I have seen keyup validations in a lot of places too.

So, coming back to the question, will keyup validations be too many for server, is it an unnecessary overhead? or is it worth taking these hits to give user a better experience?

ps: all my regex validations etc are already done on javascript and only when it passes all these other criteria does it send a request to server to check if a username already exists. (And the server is doing a select count(1) from user where username = '' - nothing substantial, but still enough to occupy some resource)

pps: I'm on asp.net, MS SQL stack., if that matters.

答:
create a 1 second timeout on keyup and cancel the previous one

```<code><input onkeyup="cleartimout(lastTimeout);lastTimeout=setTimeout(validate,1000);">
</code>```

this way fast typers don't trigger a validate on each keyup but when the user stops typing the username is validated and gets feedback on whether it is free

Body:
create a 1 second timeout on keyup and cancel the previous one

<input onkeyup="cleartimout(lastTimeout);lastTimeout=setTimeout(validate,1000);">

this way fast typers don't trigger a validate on each keyup but when the user stops typing the username is validated and gets feedback on whether it is free


答:
From user point of view, I would want to know whether whatever I am doing at given moment is going to fail as soon as possible. Which is why I suggest going for key-up validation. Few reasons for it:

gives user nice real-time interaction and security feel (system is watching whether you do what you're supposed to correctly)

helps user to focus at one task at time (selecting name in this case)

Problem with blur validation (or any other lost focus ones) is that at the point you're doing validation, user is probably interested in something else. I would expect that once I fill the name field, I simply move on with form and don't bother with name anymore until I decide to validate it (or submit). Situation where I'm done with user name and say, started thinking where I've put my birth certificate so I can check what phase was moon in at the time I was born, and then suddenly system tells me I need to go back to check username again is highly unwanted.

Keep in mind this might be enough for some users to leave your website and never come back at this point. And I'm not exaggerating here, many times I've seen people (myself included), who would leave app or website/chose different one purely for the most ridiculous reasons like "this button does not do what I though it would" or "why can't I drag this tab?". Remember that you want to not only attract user, but even more importantly - keep him and make him come back. And frustration with very first interaction he'll have with your service is not going to help achieving that :-)

So - let users decide what they want to focus on at time. Either go with real-time validation as user types, or grand-total validation upon form submit.

On top of that, you need to think how those select count(1) ... queries will impact your server. If it is ready to process thousands of other queries at time, extra 3 to check user name won't differ too much. Not to mention, user account creation is process which doesn't happen often (usually only once per user). Don't optimize prematurely, see whether those queries will be an issue at all.

Title: Is realtime validation of username good or bad?

Body:
I have a simple form for the user to sign up to my site; with email, username and password fields. We are now trying to implement an ajax validation so the user doesn't have to post the form to find out if the username is already taken. I can do this either on keyup event or on text blur event. My question is, which of these is really the best way to do?

Keyup

From the user POV, it would be good if the validation is done as and when they are typing, (on key up event) - of course, I am waiting for half a second to see if the user stops typing before firing off the request, and user can make any adjustments immediately.

But this means I am sending way more requests than if I validated the username on Blur event.

Blur

The number of requests will be much lower when the validation is done on blur event, But this means the user has to actually go away from the textbox, look at the validation result, and if necessary go back to it to make any changes and repeat the whole process until he gets it right.

I had a quick look at google, tumblr, twitter and no one actually does username validations on keyup events, (heck, tubmlr waits for the form to be posted) but I can swear I have seen keyup validations in a lot of places too.

So, coming back to the question, will keyup validations be too many for server, is it an unnecessary overhead? or is it worth taking these hits to give user a better experience?

ps: all my regex validations etc are already done on javascript and only when it passes all these other criteria does it send a request to server to check if a username already exists. (And the server is doing a select count(1) from user where username = '' - nothing substantial, but still enough to occupy some resource)

pps: I'm on asp.net, MS SQL stack., if that matters.


答:
In my experience, the word "enterprise" in a software setting most often refers to software being written for a large corporation.  It also often refers to internal software, rather than client-facing software.

This may seem like an arbitrary line to draw (and of course, what exactly is "large"), but having written software for a variety of different types of companies, I can tell you that the needs of large businesses is very different to the needs of small companies, which is again very different to the needs of individuals.

Issues that are often irrelevant (or rather, not worth investing in) for many small companies include:

High availability / seamless failover

Redundancy / disaster recovery

Privacy of customer data

Compliance to laws and regulations

Realtime monitoring, rich trace info for troubleshooting

A focus on reporting (typically allowing for intelligent management)

I would hazard a guess that this is because the overheads and profits of a large company are on a completely different scale to a large company.  If a small company's payrolls go offline, you can pay by hand, or apologise to everyone personally.  If it happens in a large corporate, there's an uprising.  I've once had a bank throw around numbers of several millions of dollars being lost per hour until a bug was found - it puts the perspective on things.  Reliability is a big thing for most large companies (well, at least on paper).


答:
My personal preference is XML files:

In most cases I don't expect the user to have to edit their configuration settings so the human readability issue is not an argument in this case.

If they do need to edit them you can provide a editing tool - this prevents the user doing something daft with the data. If they want to restore the default settings you can just tell them to delete file x which most users will be comfortable doing.

Note that you still need to be careful that you have permission to store your file as some locations do not have write access by default in Windows 7 etc.

INI Files are a good standard way of storing configuration and are tried and tested but they just feel a bit 'Windows 3.1' to me!

Probably the best option if you want the user to be able to tinker with their data

I would personally steer away from the registry. For one thing you cannot guarantee that the user has the necessary permissions to read/write to wherever you want to store your data.

In more recent OSs where registry virtualisation comes into play this can cause major confusion because you can't 'see' the virtualised settings - this has bitten us more than once where have spent hours trying to figure out why something was not working.


问:
What's the difference between recursion and corecursion?
What's the difference between these?

Recursion

Corecursion

On Wikipedia, there is little information and no clear code explaining these terms.

What are some very simple examples explaining these terms?

How is corecursion the dual of recursion?

Are there any classic corecusive algorithms?

答:
Check this at Vitomir Kovanovic' s blog. I found it to the point:

Lazy evaluation in one very nice feature found in programming
  languages with functional programming capabilities such as lisp,
  haskell, python etc. It mans that evaluation of variable value is
  delayed to the actual usage of that variable.

It means that for example if you wanted to create a list of million
  elements with something like this (defn x (range 1000000)) it is not
  actually created, but it is just specified and when you really use
  that variable for the first time, for instance when you want 10th
  element of that list interpreter creates only first 10 elements of
  that list. So the first run of (take 10 x) actually creates these
  elements and all subsequent calls to the same function are working
  with already existing elements.

This is very useful because you can create infinite lists without out
  of memory errors.The list will be large just how much you requested.
  Of course, if your program is working with large data collections it
  can hit memory limit in the usage of these infinite lists.

On the other hand corecursion is dual to recursion. What this means?
  Well just like the recursive functions, which are expressed in the
  terms of themselves, corecursive variables are expressed in the terms
  of themselves.

This is best expressed on the example.

Let’s say we want list of all prime numbers...

ContentLicense: CC BY-SA 4.0


问:
What is platform independence? Are cross-platform and 'platform independence' same?
What is the platform independence really mean?
What are the criterion to call a language platform independent ?
Are cross-platform and 'platform independence' same?</p>

<p>(This may be a question for self study, but i would like to hear from experts from Stack overflow. There are lots of definitions and views regarding it on interenet and some of them are confusing) </p>

答:
To expand slightly on Shekhar_Pro's answer,

Platform Independent will execute any any platform. Think of Java or Python applications without any platform specific stuff that can be executed on Windows, Mac, and Linux without necessarily recompiling or rewriting.

Cross-Platform products are a different kettle of fish entirely.  Where some aspects of a cross platform product might share common requirements and even source code (for example, some math functions implemented in C), each product version is written and compiled entirely for a specific platform.  Think of Mozilla Firefox, for example, which has different versions running on Mac, Windows, Linux, BeOS, Android, and so on. Each version is similar, and may even have compatible data structures, but each version is also developed independently and are often written using entirely different programming languages and APIs, different version numbering and so on.

OwnerDisplayName: CSharpLearner


问:
Why don’t UI frameworks use generics?
One way of looking at type safety is that it adds automatic tests all over your code that stop some things breaking in some ways. One of the tools that helps this in .NET is generics.

However, both WinForms and WPF are generics-free. There is no ListBox<T> control, for example, which could only show items of the specified type. Such controls invariably operate on object instead.

Why are generics and not popular with UI framework developers?

答: In case of WinForms it's backward compatibility with early .NET versions that didn't support generics (hence all those object senders in event handlers), while WPF implements databinding differently ({Binding Path=Name} etc.; it works by reflection).

Title: Why don’t UI frameworks use generics?


答:
When using keyup are you going to the server after every keystroke? Is there a minimum limit on the length of the username? Are there any other conditions the name needs to satisfy. If so you can check for these on the client side first, before going back to the server and finding if the name is valid. If this is the approach you are taking already then you won't be doing too many calls to the server, therefore using keyup seems to be best and most responsive.

As you say using blur means your user has left the textbox and perhaps their focus is elsewhere.


答: For a UI framework it makes much more sense to take objects and bind reflexively than to strongly-type the interfaces somehow. Lots of cases where you need to throw completely arbitrary objects into arbitrary UI containers in cases where you can't divine the types at runtime.</p>

Title: Why don’t UI frameworks use generics?

Body:
One way of looking at type safety is that it adds automatic tests all over your code that stop some things breaking in some ways. One of the tools that helps this in .NET is generics.

However, both WinForms and WPF are generics-free. There is no ListBox<T> control, for example, which could only show items of the specified type. Such controls invariably operate on object instead.

Why are generics and not popular with UI framework developers?


问:
Biggest mistake you've ever made
Similar to the question I read on Server Fault, what is the biggest mistake you've ever made in an IT related position. Some examples from friends:

I needed to do some work on a production site so I decided to copy over the live database to the beta site. Pretty standard, but when I went to the beta site it was still pulling out-of-date info. OOPS! I had copied the beta database over to the live site! Thank god for backups.

And for me, I created a form for an event that was to be held during a specific time range. Participants would fill out the form for a chance to win, and we would send the event organizers a CSV from the database. I went into the database, and found ONLY 1 ENTRY, MINE. Upon investigating, it appears as though I forgot an auto increment key, and because of the server setup there was no way to recover the lost data.

I am aware this question is similar to ones on Stack Overflow but the ones I found seemed to receive generic answers instead of actual stories :)

What is the biggest coding error/mistake ever…

答:
Seven years ago my boss & company owner, whom I'd not yet met I was so new to the job, was in another state doing a demo of our research web site to a couple of potential clients. Memberships fees ran in the low to mid five figures, so these demos were a big deal to our fledgling company.

In the middle of his demo, as I was doing some database work, I made a change to the live database and updated every survey question in every survey to the same text, something like "This is a test question" because of a flaw in the WHERE. My co-worker and I scrambled for the backup and cringed, hoping he wasn't demoing that section of the site right then but waiting for the email in all caps that gratefully never appeared.

The good side was the boss finally sprung for a development box.

Title: Biggest mistake you've ever made


答:
Well, there are two aspects to this.

Firstly, if you are trying to learn, it can be useful to do some things from scratch, or use lower-level interfaces than necessary. However, it is still necessary to identify what you are learning: if you want to learn about the HTTP protocol, you don't need to do the socket programming yourself. Only reinvent the things you are learning about, and only do so to really explore and understand them.

But - one of the most important skills of a professional programmer is to select, learn about, and use pre-existing software. This is something that you also need to learn. A huge proportion of the questions on SO seem to come from people who are incapable of reading documentation.

Finally, programming rests on a substantial theoretical base. You will need to use both practical exercises, coupled with reading, to learn the theory.

Title: Is the phrase "never reinvent the wheel" suitable for students?

Body:
I find myself constantly running into this expression "don't reinvent the wheel" or "never reinvent the wheel" when I ask some questions on SO.  They tell you to use some frameworks or existing packages.  I know where this attitude is coming from since it's unwise to waste time on something others have already solved.  Or it that so?

As a student,  I find by using some code others wrote to solve my problem I can't learn as much as I'd like to, and I gain less insight.  And sometimes I think that phrase is mainly for working programmers facing deadlines and not for students like me.

Is it that bad to "reinvent the wheel"?  Maybe I'm thinking it wrong? Maybe there is a way I can avoid reinventing the wheel and at the same time learn a lot?


答:
WinForms came with .NET 1.0 before there was support for generics. In the case of WPF, development started on that before the Framework supported generics as well. Although generics support came to .NET before WPF was released, it would have taken substantial effort to go back and add it in.

Also, the XAML to represent generics is not pretty

Title: Why don’t UI frameworks use generics?


问:
How would you explain that software engineering is more specialized than other engineering fields?
I work with someone who insists that any good software engineer can develop in any software technology, and experience in a particular technology doesn't matter to building good software. His analogy was that you don't have to have knowledge of the product being built to know how to build an assembly line that manufactures said product.

In a way it's a compliment to be viewed with an eye such that "if you're good, you're good at everything", but in a way it also trivializes the profession, as in "Codemonkey, go sling code". Without experience in certain software frameworks, you can get in trouble fast, and that's important.

I tried explaining this, but he didn't buy it. Any different views or thoughts on this to help explain that my experience in one thing, doesn't translate to all things?

答:
but in a way it also trivializes the profession, as in "Codemonkey, go sling code".

I would argue quite the opposite.  A good software engineer would have the ability to conceptualize, architect, and design quality software agnostic of technology.  The opposite end of this spectrum is the .NET or Java or PHP only "codemonkey" that is good at being given direction or specifications and utilizing the tool to implement the software.

A software engineer doesn't need to be a master of all tools, but should have a pretty good high level understanding about what the majority of them are, what they bring to the table, and what will likely be most appropriate for the given project.  I would expect a code monkey to only be a master of their proclaimed expertise in a specific tool.

I wouldn't trust a Ford engineer that doesn't know how to do the Mechanic's job.

Still though, software engineering is one of these fields where in many cases we are expected to be the Engineer, the Builder, and the Mechanic all at the same time.


答:
I agree with the premise your colleague suggests although I would add a caveat.

A good software engineer will be able to build good software in any tech..... after they have done a bit of learning in the new tech.

There might be some quirks that are not obvious at first, but a good software engineer will soon learn them.

I think what he really means is that just because a developer has 2 years solid C# experience, it doesn't mean a better software engineer with a Java background, who has never done C# before couldn't come along, learn C#, and quickly become a better C# developer than the first guy.

In other words, you shouldn't necessarily discount the Java guy for a job, JUST because he has "done the time" in C#.

Title: How would you explain that software engineering is more specialized than other engineering fields?

Body:
I work with someone who insists that any good software engineer can develop in any software technology, and experience in a particular technology doesn't matter to building good software. His analogy was that you don't have to have knowledge of the product being built to know how to build an assembly line that manufactures said product.

In a way it's a compliment to be viewed with an eye such that "if you're good, you're good at everything", but in a way it also trivializes the profession, as in "Codemonkey, go sling code". Without experience in certain software frameworks, you can get in trouble fast, and that's important.

I tried explaining this, but he didn't buy it. Any different views or thoughts on this to help explain that my experience in one thing, doesn't translate to all things?


答:
I agree to an extent with the person you work with.  A good software engineer deals with general principles of design and software production.  The actual languages and frameworks are details.

That's not to trivialise the ease with which you can pick up new languages and frameworks.  There's always a learning curve associated with them but the point is it is a curve, not a vertical wall to a good software engineer.

A good software engineer has a wide range of experience in a number of different tools and technologies.  If he doesn't, how can he pick the best tool for the job?  To wheel out the old cliche, to a man who knows how to use a hammer, every problem looks like a nail.  Even if you are not an expert with a screwdriver, it pays to have a passing understanding of them so you can recognise a screw as not just a funny looking nail.


答:
Are all road construction workers able to use every piece of equipment and machinery on the job site? The answer is no. There are pieces of machinery that they know and are likely familiar with the others. The same should be true for software engineers, there x number of languages and frameworks you know because you work with them everyday, but shouldn't be expected to know the exact operations of others without some training. Its like taking the jackhammer worker and assigning him the task of driving the cement mixer.

Programming languages and frameworks are just tools in a software engineers tool belt. There are some tools which you will know better than others because of experience. Ultimately, the best tool is the understanding the core concepts and principles of computing. Picking languages and frameworks is just selecting which screwdriver to use on which screw.


答:
His analogy was that you don't have to have knowledge of the product
  being built to know how to build an assembly line that manufactures
  said product.

This is almost certainly incorrect. Specialist production engineers do need to understand quite a lot about the products under their care.

In any case, a better analogy is with graduates of mechanical engineering courses: even though everyone starts off (in both mech and software) with much the same skils, no-one remains "a mechanical engineer", but instead specialises in the types of things they build. Likewise, software development also has very distinct subfields.

To return to the assembly line analogy, every assembly line is different for each product, and different types of software development require different methodologies - you wouldn't build your security software the same way that you build a game.


答:
TLDR version: Other engineering disciplines need knowledge of the materials they are using (e.g. architects need to know how much load the materials they are using in their design can bear). The languages and frameworks we use for software engineering have certain limits and we need to be familiar with them to design and develop effectively against them.

There are two distinct phases to what we do. The first is conceptual design. That is high-level and low-level system design (e.g. using UML). High-level designs can theoretically be implementation agnostic (although sometimes a High-level design has to take into account specifics like, database platform, off the shelf middleware, etc.). Low-level designs are a bit trickier. You can design the specifics of the business logic without putting the infrastructure details into them and again, these can theoretically be platform agnostic.

The second phase is actual programming. While some view programming as construction, others (including me) argue that coding is still a design discipline (in PPP, Bob Martin refers to an article where the author puts forward a very good argument to this effect, I don't have it with me now, but I'll update this answer with a link to that article). The actual construction happens when you hit compile and is in effect free.

Just like an architect has to take into account things like tensile and compressive strength of the building materials he is using, so does a software engineer have to know the capabilities of the platform they are developing against when writing code. I would argue that a low-level system design is not very effective if it doesn't take into account the platform choices as well.


答:
There is a learning curve involved with different specializations.  I'm talking about differences between Embedded/Real-time programming, Web-App programming, Systems/OS programming, Thick-client programming, Mobile development, etc.

Someone who is an expert in one type of programming might not able to cross over into another right away because of different requirements.  Sure, a software engineer has the basics to do so, but it takes time to specialize in something.


答:
As someone who graduated from a Software Engineering degree program, I can say that your coworker is partially correct. A good software engineer focuses on applying mathematics, statistics, computer science, and domain experience in order to build a system. The methods that a software engineer uses are typically technology and language agnostic - the tools don't matter as much as the underlying principles.

That said, your coworker's analogy is flawed. Understanding the domain problems are essential to any engineering discipline. If you don't fully understand the problem that you are trying to solve and the people that you are attempting to satisfy, it becomes infinitely more difficult to build the best possible solution to their problems.

Ultimately, software engineering (and any engineering discipline) is about applying a number of concepts to solve a problem. If you frequently use the same tools, you'll become more proficient with those tools. It will be easier for you to identify problems that those tools can solve, the risks or pitfalls with using those tools, and then using those tools to construct a solution.


答:
I work for a helicopter company and the aviation engineers here are specialised by the types of aircraft they can work with. They need to be "type rated". Technically they could work on anything from a Robinson R22 to a Jumbo Jet, but not without the conversion training.

I think this is pretty similar to software engineering except that the "conversion training" is more informal for software engineers.


答: Case in point:  the software framework which you feel is so critical to have specialized experience with likely did not exist 10 years ago, or has undergone significant transformation if it did.  The very nature of our profession makes it impossible to specialize for the entirety of one's career.  Depending on your respective skill levels, your specialization gives you an advantage for somewhere between 1 and 6 months over someone who has never used your particular framework.  After that, you are on par.


答: I'd prefer not to have to create another user name and password. OAuth/OpenId is the way to go. That being said nothing is more annoying than submitting a form only to get a "username already taken" error. I can't remember seeing a signup form that validates on keyup. Lost focus is acceptable to me. And as you mentioned less chatty from a technical perspective.</p>


答:
I was running Xenu's link sleuth on our intranet to try and clear up some of the many broken links that have built up over the years (most, unsurprisingly enough were links from the wiki to the shared network drive).

After about 30 minutes I started noticing some of the new items had some odd pictures, it looked like people had used some of the grainy old stock photos that were on the system but I ignored that thinking that maybe there just wasn't anything newer that had what they wanted.

Another 10 minutes later I noticed the featured items were changing randomly for some reason. At this point it dawned on me what was happening. The intranet uses windows authentication and some of the functions (such as selecting news images and featured items) were coded to response to HTTP GET requests. The link checker had been using my authentication and had crawled to pages on the admin side, loyally doing its job and following everylink it found including ones like

/admin/displayItems/icon_update.asp?image=eastereggs.jpg&itemID=3174

Title: Biggest mistake you've ever made

Body:
Similar to the question I read on Server Fault, what is the biggest mistake you've ever made in an IT related position. Some examples from friends:

I needed to do some work on a production site so I decided to copy over the live database to the beta site. Pretty standard, but when I went to the beta site it was still pulling out-of-date info. OOPS! I had copied the beta database over to the live site! Thank god for backups.

And for me, I created a form for an event that was to be held during a specific time range. Participants would fill out the form for a chance to win, and we would send the event organizers a CSV from the database. I went into the database, and found ONLY 1 ENTRY, MINE. Upon investigating, it appears as though I forgot an auto increment key, and because of the server setup there was no way to recover the lost data.

I am aware this question is similar to ones on Stack Overflow but the ones I found seemed to receive generic answers instead of actual stories :)

What is the biggest coding error/mistake ever…


问:
Can scrum master allocate tasks?
We are following scrum in our project. I see most of the times the scrum master allocates the tasks for us. However, I read from many scrum books that scrum works the other way around (the 'pull' approach) and team members pick up tasks or features. Is scrum master assigning tasks the correct approach or does it go against the agile ideology?</p>

答:
I've been a scrum master in both types of environments (where I pushed tasks to individuals and where individuals pulls tasks).

O the Push team, the development resources were not interchangeable.  The Windows Client work had to go to the windows developer and the web work to the web developer.  So I was able to push tasks to resources during planning sessions.  I was also able to do individual capacity planning to know when to stop pushing.

The pull method worked well on a team where any task could be picked up by any resources.  But, I couldn't do individual capacity planning during the planning session, instead I had to depend on average velocity to know when enough was enough.  (It took ~3-4 sprints before we had a good idea on velocity).

I came across an interesting article outlining pros/cons of Push vs. Pull.

Title: Can scrum master allocate tasks?


问:
Is it just me or is this a baffling tech interview question?

Background

I was just asked in a tech interview to write an algorithm to traverse an "object" (notice the quotes) where A is equal to B and B is equal to C and A is equal to C.

That's it.  That is all the information I was given.

I asked the interviewer what the goal was but apparently there wasn't one, just "traverse" the "object".

I don't know about anyone else, but this seems like a silly question to me.  I asked again, "am I searching for a value?".  Nope.  Just "traverse" it.

Why would I ever want to endlessly loop through this "object"??  To melt my processor maybe??

The answer according to the interviewer was that I should have written a recursive function.

OK, so why not simply ask me to write a recursive function?  And who would write a recursive function that never ends?

My question:

Is this a valid question to the rest of you and, if so, can you provide a hint as to what I might be missing?  Perhaps I am thinking too hard about solving real world problems.  I have been successfully coding for a long time but this tech interview process makes me feel like I don't know anything.

答:
While the question was poorly worded and the interviewer was clearly unhelpful in providing any direction, I have a slightly different take on what was being asked.

I think interviewer was looking for a solution that traversed the object structure using some type of reflection.  The information that the three objects were equal should have prompted a conversation of object identity comparison (A == B means the objects are really the same object in memory), or object equality comparison (A == B means the values of the objects are the same).

The fact that the interviewer said that the answer was a "recursive" function, probably indicated that a discussion of deep versus shallow copying and comparison was expected.


问:
Dapper and object validation/business rules enforcement
This isn't really Dapper-specific, actually, as it relates to any XML-serializeable object.. but it came up when I was storing an object using Dapper.

Anyways, say I have a user class.
Normally, I'd do something like this:

```<code>class User
{
    public string SIN {get; private set;}
    public string DisplayName {get;set;}

    public User(string sin)
    {
        if (string.IsNullOrWhiteSpace(sin))
            throw new ArgumentException("SIN must be specified");
        this.SIN = sin;
    }
}
</code>```

Since a SIN is required, I'd just create a constructor with a sin parameter, and make it read-only.

However, with a Dapper (and probably any other ORM), I need to provide a parameterless constructor, and make all properties writeable.
So now I have this:

```<code>class User: IValidatableObject
{
    public int Id { get; set; }
    public string SIN { get; set; }
    public string DisplayName { get; set; }

    public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
    {
      // implementation
    }
}
</code>```

This seems.. can't really pick the word, a bad smell?

A) I'm allowing to change properties that should not be changed ever after an object has been created (SIN, userid)

B) Now I have to implement IValidatableObject  or something like that to test those properties before updating them to db.

So how do you go about it ?

答:
Generally speaking, your database is going to assign the ID on an insert operation, not you. If you fail to provide the ID for an read, edit or delete operation, the operation will simply not work. In other words, the database is performing the validation on the ID, not your DTO class.

Often, DTO classes are populated by some automated process, either by reading from a database, binding to a web form, or deserialization.  All of the fields are populated simultaneously.  There's no way to tell, ahead of time, whether the ID is going to be populated properly.  That's why the validation is done after the fact.


答:
Have a required user name length and when it gets close, start getting ready to notify the user whether or not it is unique.

Sometimes it is better to let them know what is available than what has been taken. There has to be a security concern if someone can just send keys to this field and capture all of your user names.


问:
Conditional checks against a list
I was wondering how computers do this.

The most logical way I can think is that they are iterating trough all elements of the list until they find one that matches the condition :)

For example if you call function_exists(), PHP should iterate trough all defined functions until it meets the one that matches the name you're looking for.

Is this true that this is the only way? If it is, it sounds like it's not very efficient :s

答:
I'm a little confused by your question but here are a couple of ways that may speed up evaluating conditions:

If the list is sorted, then a binary search could be done that is more efficient than a brute force search through the list to find an element.

There can be short-circuit evaluations though can also speed up conditional evaluation.

Title: Conditional checks against a list


问:
try-catch in javascript... isn't it a good practice?
There is a provision for try-catch block in javascript. While in java or any other language it is mandatory to have error handling, I don't see anybody using them in javascript for greater extent. Isn't it a good practice or just we don't need them in javascript?

答:
One should avoid throw errors as the way to pass error conditions around in applications.

The throw statement should only be used "For this should never happen, crash and burn. Do not recover elegantly in any way"

try catch however is used in situation where host objects or ECMAScript may throw errors.

Example:

```<code>var json
try {
    json = JSON.parse(input)
} catch (e) {
    // invalid json input, set to null
    json = null
}
</code>```

Recommendations in the node.js community is that you pass errors around in callbacks (Because errors only occur for asynchronous operations) as the first argument

```<code>fs.readFile(uri, function (err, fileData) {
    if (err) {
        // handle
        // A. give the error to someone else
        return callback(err)
        // B. recover logic
        return recoverElegantly(err)
        // C. Crash and burn
        throw err
    }
    // success case, handle nicely
})
</code>```

There are also other issues like try / catch is really expensive and it's ugly and it simply doesn't work with asynchronous operations.

So since synchronous operations should not throw an error and it doesn't work with asynchronous operations, no-one uses try catch except for errors thrown by host objects or ECMAScript

Body:
One should avoid throw errors as the way to pass error conditions around in applications.

The throw statement should only be used "For this should never happen, crash and burn. Do not recover elegantly in any way"

try catch however is used in situation where host objects or ECMAScript may throw errors.

Example:

var json
try {
    json = JSON.parse(input)
} catch (e) {
    // invalid json input, set to null
    json = null
}

Recommendations in the node.js community is that you pass errors around in callbacks (Because errors only occur for asynchronous operations) as the first argument

fs.readFile(uri, function (err, fileData) {
    if (err) {
        // handle
        // A. give the error to someone else
        return callback(err)
        // B. recover logic
        return recoverElegantly(err)
        // C. Crash and burn
        throw err
    }
    // success case, handle nicely
})

There are also other issues like try / catch is really expensive and it's ugly and it simply doesn't work with asynchronous operations.

So since synchronous operations should not throw an error and it doesn't work with asynchronous operations, no-one uses try catch except for errors thrown by host objects or ECMAScript


答:
So far my only stomach-twisting, heart-rate-increasing, suddenly-get-hot-and-itchy mistake was running an UPDATE query without a WHERE clause. Luckily there was a backup from the last 15 minutes and the data didn't change very often which meant I was able to fully restore the data within 10 minutes without anybody knowing.

Nothing too bad but I've had some close calls. They are and remain close calls because I've heard enough horror stories in this industry that everything I do that could screw things up gets a good going over.

Title: Biggest mistake you've ever made


问:
Is javascript worth learning if you do not plan on being a web developer?
I heard Javascript is a full language just like c++. Is this true? What else is it good for programming besides web stuff?</p>

答: Creating Metro style app using JavaScript would be using JavaScript for Windows 8 that may be interesting to see where this goes.  Just another idea to add to the other answers here.</p>


答: Do some research on data structures, especially hash tables, which are frequently used for things like symbol tables.  They use a function called a hash function to decide where to store the data, which has properties that make it very quick to retrieve at the expense of using some extra memory.</p>

Title: Conditional checks against a list

Body:
I was wondering how computers do this.

The most logical way I can think is that they are iterating trough all elements of the list until they find one that matches the condition :)

For example if you call function_exists(), PHP should iterate trough all defined functions until it meets the one that matches the name you're looking for.

Is this true that this is the only way? If it is, it sounds like it's not very efficient :s


答:
What you are talking about here is Search Algorithms.

The most common of these are:

1) Sequential Searches

2) Binary Search

Title: Conditional checks against a list


答:
When talking to a painter, would you tell him he'd have no problems with sculpting?

Learning a new language or specifics to a new domain is similar to an artist who primarily deals with pencil and ink, learning how to paint (or vice-versa).  This is what most of the other answers are talking about, how your friend is partially correct - a lot of the same concepts apply.

But teaching a painter how to sculpt a 3D object, or write a novel (Both forms of artistic expression) is a different beast entirely.  That's the viewpoint you're coming from.

Web-based software requires an entirely different type of thinking than desktop software.  Both are completely different when applied to games versus a work environment.  I suspect working on an OS or integrated systems also require thinking a different way (but I have no experience with them).  And I have no doubt there are other domains that also require a different way of thinking.

Summary and examples:

"Art" includes sculptures, novels, comics, and paintings.  Skill overlaps include:

Body form and color theory:  Sculptures, comics, and paintings

Textual communication:  Novels and comics

... And so on.  But as mentioned above, a comic artist is unlikely to do well on their first novel.  They need to think differently.

Likewise, there is overlap in different fields of programming/software engineering, but most of them are too distinct to be able to just jump in.  For example:

Algorithms:  OS/integrated systems, games, and other places you often need to optimize for speed or memory.  Rarely a big deal in web development

Design:  Everywhere in web development, but not very important in integrated systems without a UI.

Client/server software:  The "don't trust the client" mentality, which doesn't necessarily exist in some domains (single-player games and other standalone desktop software, which I admit is rarer these days).


问:
Synchronous vs. asynchronous for publish subscribe communication between JavaScript objects
I implemented the publish subscribe pattern in a JavaScript module to be used by entirely client-side oriented JavaScript objects. This module has nothing to do with client-server communications in any way, shape or form.

My question is whether it's better for the publish method in such a module to be synchronous or asynchronous, and why.

As a very simplified example let's say I'm building a custom UI for an HTML5 video player widget:

One of my modules is the "video" module that contains the VIDEO element and handles the various features and events associated with that element. This would probably have a namespace something like "widgets.player.video."

Another is the "controls" module that has the various buttons - play, pause, volume, scrub, fullscreen, etc. This might have a namespace along the lines of "widgets.player.controls."

These two modules are children of a parent "player" module ("widgets.player" ??), and as such would have no inherent knowledge of each other when instantiated as children of the "player" object.

The "controls" elements would obviously need to be able to effect some changes on the video (click "Play" and the video should play), and vice versa (video's "timeUpdate" event fires and the visual display of the current time in the controls should update).

I could tightly couple these modules and pass references to each other, but I'd rather take a more loosely coupled approach by setting up a pubsub type module that both can subscribe to and publish from.

SO (thanks for bearing with me) in this kind of a scenario is there an advantage one way or another for synchronous publication versus asynchronous publication? I've seen some solutions posted online that allow for either/or with a boolean flag whereas others automatically do it asynchronously. I haven't personally seen an implementation that just automatically goes with synchronous publication... is this because there's no advantage to it?

I know that I can accomplish this with features provided by jQuery, but it seems that there may be too much overhead involved here. The publish subscribe pattern can be implemented with relatively lightweight code designed specifically for this particular purpose so I'd rather go with that then a more general purpose eventing system like jQuery's (which I'll use for more general eventing needs :-).

答:
I always try to go with Async just for the fact that it stops the ui from locking up and allows you to continue to do "other" stuff on the page. You can always display some kind of spinner somewhere so that the user is aware that the element is waiting for something to come back.

If you go with sync then the system just locks until the request is returned. Normally this is a bad thing.


答:
Write an algorithm to traverse an "object" (notice the quotes) where A
  is equal to B and B is equal to C and A is equal to C.

It seems like most people assume that A, B, and C are pointers, but they could just as easily be clowns, too. (Or members of the clown class.) Or they could be clown names. (Or class names. Or subclasses of the clown class.)

I would have turned the tables and asked if this is how they typically prepare development specifications, and then tell them how I could help them with the requirements specification stage of development. Poor communication of expectations leads to poor work product. Either they would get it or they wouldn't, If they didn't get it, I would walk away.


答:
I believe that much of the reason that try..catch is rare in JavaScript is because the language has a pretty high tolerance for error. The vast majority of situations can be handled by using code checks, good defaults, and asynchronous events. In some cases, simply using a pattern will prevent issues:

```<code>function Foo() {
    //this may or may not be called as a constructor!!
    //could accidentally overwrite properties on window
}

function Bar() {
    if (!(this instanceof Bar)) {
        return new Bar();
    }
    //this will only work on Bar objects, and wont impact window
}
</code>```

Some of the major issues in other languages that cause exceptions to occur simply don't exist in JS. Type casting isn't needed the vast majority of the time. Instead, the preferred method is typically to feature check (enforcing a particular interface):

```<code>function doFoo(arg) {
    if (arg.foo) {
        arg.foo();
    } else {
        Bar.prototype.foo.call(arg);
    }
}
</code>```

With the addition of async/await to the language, try..catch is becoming more prevalent. Promises being the asynchronous form of try..catch, it makes sense that one should expect:

```<code>doSomething().then(
  doSomethingWithResult,
  doSomethingWithError
)
</code>```

to instead be written as:

```<code>try {
  const result = await doSomething()
  doSomethingWithResult(result)
} catch (e) {
  doSomethingWithError(e)
}
</code>```

Title: try-catch in javascript... isn't it a good practice?

Body: There is a provision for try-catch block in javascript. While in java or any other language it is mandatory to have error handling, I don't see anybody using them in javascript for greater extent. Isn't it a good practice or just we don't need them in javascript?

Body:
I believe that much of the reason that try..catch is rare in JavaScript is because the language has a pretty high tolerance for error. The vast majority of situations can be handled by using code checks, good defaults, and asynchronous events. In some cases, simply using a pattern will prevent issues:

function Foo() {
    //this may or may not be called as a constructor!!
    //could accidentally overwrite properties on window
}

function Bar() {
    if (!(this instanceof Bar)) {
        return new Bar();
    }
    //this will only work on Bar objects, and wont impact window
}

Some of the major issues in other languages that cause exceptions to occur simply don't exist in JS. Type casting isn't needed the vast majority of the time. Instead, the preferred method is typically to feature check (enforcing a particular interface):

function doFoo(arg) {
    if (arg.foo) {
        arg.foo();
    } else {
        Bar.prototype.foo.call(arg);
    }
}

With the addition of async/await to the language, try..catch is becoming more prevalent. Promises being the asynchronous form of try..catch, it makes sense that one should expect:

doSomething().then(
  doSomethingWithResult,
  doSomethingWithError
)

to instead be written as:

try {
  const result = await doSomething()
  doSomethingWithResult(result)
} catch (e) {
  doSomethingWithError(e)
}