问:
What's the best way to version a multi-component project
I have a program which is built of 5 major components. I find the standard version numbering too limiting because I would like to see what version each compoment is at.

Has anyone found an easy way to do this other than list each separately?

答:
Summary

For me, the only reliable way to version software is to use the the hash or changeset identifier from your version control system.

An overall build version number can be useful, but it's only really guaranteed to be unique if you have a build server and/or you sign each release. For many of us though, this simply isn't viable.

If your project is split over multiple version control repositories, you will also need to build a mechanism whereby your user interface can query each dependent repository and report it's hash back to the user.

Example from personal experience

In a project at a previous employer, where we had problems with our (internal) customer modifying software and recompiling it, I instituted a process whereby the mercurial hashes were compiled into each application and library. Whenever the software was started, a revisions string was built up by querying all of the software components.

This revision string was displayed when you went to the about page and was written to the log file every time the application was started. It was of the form:

```<code>Application name     (6a72e7c61f54)
    Library1         (b672a13a41e1)
        Library2     (9cc35769b23a)
    Library2         (9cc35769b23a)
    Library3         (4e9f56a0186a+)
        Library2     (9cc35769b23a)
    Library4         (2e3b08c4ac76)
        Library1     (b672a13a41e1)
            Library2 (9cc35769b23a)
</code>```

From this I could easily see that they'd modified Library3 and hadn't committed those changes to the repository, so they are using code that is not controlled. I could also compare the hashes with my current test system, thus I might be able to identify that they have reverted (say) Library1 to an older version.

This meant that whenever they reported a bug, I could always rebuild exactly the code in use at the time the problem occurred, or at the very least know for certain that I could not reproduce the setup.

For more details of the build system I used, how I accomplished this, what problems I had, and what people suggested to avoid them, have a look at my Stack Overflow question.

Note: This system is only really viable if you use a revision control system where a given hash is guaranteed to result in the same set of files in your working directory (e.g. git and mercurial) if a given working directory can contain a mixture of files and directories from several revisions (e.g. svn) then all bets are off regarding the state of the working directory and this method won't work at all.

Body:
Summary

For me, the only reliable way to version software is to use the the hash or changeset identifier from your version control system.

An overall build version number can be useful, but it's only really guaranteed to be unique if you have a build server and/or you sign each release. For many of us though, this simply isn't viable.

If your project is split over multiple version control repositories, you will also need to build a mechanism whereby your user interface can query each dependent repository and report it's hash back to the user.

Example from personal experience

In a project at a previous employer, where we had problems with our (internal) customer modifying software and recompiling it, I instituted a process whereby the mercurial hashes were compiled into each application and library. Whenever the software was started, a revisions string was built up by querying all of the software components.

This revision string was displayed when you went to the about page and was written to the log file every time the application was started. It was of the form:

Application name     (6a72e7c61f54)
    Library1         (b672a13a41e1)
        Library2     (9cc35769b23a)
    Library2         (9cc35769b23a)
    Library3         (4e9f56a0186a+)
        Library2     (9cc35769b23a)
    Library4         (2e3b08c4ac76)
        Library1     (b672a13a41e1)
            Library2 (9cc35769b23a)

From this I could easily see that they'd modified Library3 and hadn't committed those changes to the repository, so they are using code that is not controlled. I could also compare the hashes with my current test system, thus I might be able to identify that they have reverted (say) Library1 to an older version.

This meant that whenever they reported a bug, I could always rebuild exactly the code in use at the time the problem occurred, or at the very least know for certain that I could not reproduce the setup.

For more details of the build system I used, how I accomplished this, what problems I had, and what people suggested to avoid them, have a look at my Stack Overflow question.

Note: This system is only really viable if you use a revision control system where a given hash is guaranteed to result in the same set of files in your working directory (e.g. git and mercurial) if a given working directory can contain a mixture of files and directories from several revisions (e.g. svn) then all bets are off regarding the state of the working directory and this method won't work at all.


问:
Naming for a REST webservice
I have a rest webservice with an endpoint www.foobar.com/service.svc/MAC  (migration authorisation code). Posting and getting to that adds and gets one MAC respectively. I now need to impliment a new enpoint for all MACs. What would that be? www.foobar.com/service.svc/MAC/All seems wrong. What would be correct and why?

答:
RESTful way for listing all MACs is:

```<code>GET www.foobar.com/service.svc/MAC
</code>```

Why? Well, because it's a convention and people expect REST service to behave that way.

If you want to read more on that topic, check out how RESTful routing is done in Rails.

ContentLicense: CC BY-SA 3.0

Title: Naming for a REST webservice

Body:
RESTful way for listing all MACs is:

GET www.foobar.com/service.svc/MAC

Why? Well, because it's a convention and people expect REST service to behave that way.

If you want to read more on that topic, check out how RESTful routing is done in Rails.


问:
Should a developer accept a workload estimation done by a Excel macro?
In a new project, a friend had to write tests where the time required to write them was calculated by an Excel macro written by his non-developer manager.

In such circumstances, should a developer accept the responsibility to write and run the tests in the calculated time? Are the results of these test trustworthy?

For information, my friend refused to be responsible for estimations he didn't made, ask succeed to work on another project, and have been replaced by an inexperienced out-of-the-school yes-guy.

答:
Easy and short answer:

You don't care where the estimation is coming from.

What you actually care is the estimation itself. Agree with it or disagree and explain why and how much you would estimate. That is the most important.


问:
What's the best way for me to get started using version control in an opensource project?
It was suggested that I take my project open source due to its size and my lack of skills, so I checked out Google Code, and started making a project and now it's asking me if I want the project to have Git, Mercurial, or Subversion code hosting.

I don't even know what code hosting is, and a search just confused me more with the debates between all these things, and this is made even worse as Google Code is asking me which type of license I want.

I think I'm not quite understanding what open source really means, can someone pretty much make a quick layman's cheat sheet on what all this is? Much appreciated.

Edit There have been a lot of great responses on these three versions of code hosting, but I think I failed to communicate the real question: Basically I've no idea how this open source stuff works, why would I host the code somewhere like this? And would that mean I have to take the site off of my current hosting, or is this an entirely different type of hosting? What happens when I make my site open source, what rights do I have, what rights do I give away. How does it work, do people just come and throw code at me for free? Perhaps these are stupid questions, and if that's the case then I guess I need stupid answers, I seriously have no idea what open source is, except for the concept of sharing code...

答:
why would I host the code somewhere like this?

A key point of open source software development is to share the source code. There are several ways to do this, like putting tar/zip files on a web or ftp server. Services like google code (or sourceforge.net, gitorious.org, bitbucket.org, and many others) take away the need to run your own servers for this purpose.

And would that mean I have to take the site off of my current hosting, or is this an entirely different type of hosting?

These services are not general-purpose web hosts, but run very specialized services. They are not meant to be the homepage of a product, but more a developer dashboard.

With google code you get

a wiki

a bugtracker

regular file download space

a version control server

Of course you can set up these software on a regular web server (the version control stuff might be tricky, but that depends to much on details), but the main benefit of using a development hoster is that you don't need to take care of these systems for your own. The main drawback is that you have no control about what software is used on the server, you have to live with what is available on that host. You also need to consider what happens if the service gets out of business(ok, google never fails), and if you can take the data from the current host to another one or your own server (think of backups).

What happens when I make my site open source, what rights do I have,

This is a difficult question, since it depends on the law of the country where you live.

what rights do I give away.

This depends on the license you give to the product. It can go from proprietary open source (think of PGP) where the user basically can't do anything with the code, on the other end of the scale is public domain, where every one can do whatever he wants.

How does it work, do people just come and throw code at me for free?

This is very unlikely to happen, since your product need enough popularity in order to attract other developers.

[...] and now it's asking me if I want the project to have Git, Mercurial, or Subversion code hosting.

These are three different version control systems, where Subversion is a centralized one, while Git and Mercurial are distributed.

There are religious wars about which one to use, but the main point is to use one. See http://martinfowler.com/bliki/VersionControlTools.html for more details.

When to choose Subversion:

You have binary files, which can't be easily merged, and need the lock->modify->commit->unlock workflow, which subversion supports¹

You need to check out only a part of the directory structure.

¹ There is a lock extension for mercurial, but I have no experience with it, and can't say if it is usable.

When you don't need the former features, it is better to use Mercurial or Git. Both have the following advantages over Subversion:

fast (and with fast I really mean fast)

easy branching and merging (this got better since Subversion >= 1.5, but it is not the same)

commit and publish is decoupled, so you can work without disturbance on a feature and publish the work when it is done

they track the state of the product directory as whole

you get a full copy of the whole version history when you clone a remote repository

cryptographically secured revision numbers, which means that even when someone breaks in the server, he can't put code in place without changing the revision history

but since no one checks these revisions, this feature is practically not effective

OwnerDisplayName: Nathan


问:
Overused or abused programming techniques
Are there any techniques in programming that you find to be overused (I.E. used way more excessively than what they should be) or abused, or used a bit for everything, while not being a really good solution to many of the problems which people attempt to solve with it.

It could be regular expressions, some kind of design pattern or maybe an algorithm, or something completely different. Maybe you think people abuse multiple inheritance etc.

答:
Properties. I know this is controversial, but I feel that properties are vastly overused in .net.

What's the difference between these two lines?

```<code>public string Property { get; set; }

public string Field;
</code>```

TO the developer, the difference is: absolutely nothing. The compiled form is a tiny bit different, so if you are writing a library, and that library is going to be upgraded in programs, and you can't recompile the programs themselves (for example if you're writing an interface for plugins that should work across versions of your software), then you shouldn't use public fields because you can't replace them with properties. In any other case, there's absolutely no difference between using a field or an auto-property without modifiers.

ContentLicense: CC BY-SA 2.5

Body:
Properties. I know this is controversial, but I feel that properties are vastly overused in .net.

What's the difference between these two lines?

public string Property { get; set; }

public string Field;

TO the developer, the difference is: absolutely nothing. The compiled form is a tiny bit different, so if you are writing a library, and that library is going to be upgraded in programs, and you can't recompile the programs themselves (for example if you're writing an interface for plugins that should work across versions of your software), then you shouldn't use public fields because you can't replace them with properties. In any other case, there's absolutely no difference between using a field or an auto-property without modifiers.


答:
Here's what REST usually looks like

```<code>GET www.example.com/service.svc/MAC - gets a list of all the MACs
GET www.example.com/service.svc/MAC?{property}={value} - search MACs by specified properties
POST www.example.com/service.svc/MAC - creates a new MAC
GET www.example.com/service.svc/MAC/{id} - gets the MAC with the specified id
PUT www.example.com/service.svc/MAC/{id} - updates the MAC with the specified id
DELETE www.example.com/service.svc/MAC/{id} - deletes the MAC with the specified id
</code>```

There are a few less used operations as well: PUT /MAC would replace the entire collection of MACs, DELETE /MAC would delete everything, and POST /MAC/{id} would create subitems in the MAC, but it looks like you won't be needing those.

Title: Naming for a REST webservice

Body: I have a rest webservice with an endpoint www.foobar.com/service.svc/MAC  (migration authorisation code). Posting and getting to that adds and gets one MAC respectively. I now need to impliment a new enpoint for all MACs. What would that be? www.foobar.com/service.svc/MAC/All seems wrong. What would be correct and why?

Body:
Here's what REST usually looks like

GET www.example.com/service.svc/MAC - gets a list of all the MACs
GET www.example.com/service.svc/MAC?{property}={value} - search MACs by specified properties
POST www.example.com/service.svc/MAC - creates a new MAC
GET www.example.com/service.svc/MAC/{id} - gets the MAC with the specified id
PUT www.example.com/service.svc/MAC/{id} - updates the MAC with the specified id
DELETE www.example.com/service.svc/MAC/{id} - deletes the MAC with the specified id

There are a few less used operations as well: PUT /MAC would replace the entire collection of MACs, DELETE /MAC would delete everything, and POST /MAC/{id} would create subitems in the MAC, but it looks like you won't be needing those.


问:
best practice when unit testing for embedded development
I am looking for some best practice strategies for unit testing code written for embedded system. By embedded system, I mean code such as device drivers, ISR handlers etc., stuff that are pretty close to the metal.

Most of the unit tests are not possible without testing it on the hardware with the aid of a ICE. Sometimes, the embedded unit also needs to be hooked up to other stimulus such as a mechanical switches, stepper motors and light bulbs. This usually occurs in a manual fashion, automation would be great but hard and expensive to achieve.

Update

I came across a C testing framework that seems to be quite successful in testing embedded projects. It uses the ideas of mocking hardware. Check out Unity, CMock, and possibly Ceedling.

Update 06Jul2016

Came across cmocka - seems to be more actively worked on.

答:
As with non-embedded TDD, mock objects are definitely your friend.

Keep the interface to your underlying hardware clean and simple so that everything above the lowest level can be mocked out and you will have a much easier time of it - if you design your embedded application with testability in mind then testing will always go much more smoothly.

Also, just because you might not be able to test on-line until quite late in the project doesn't mean that you shouldn't prepare a suite of on-line tests too.

These should (initially) only need to test the bits that couldn't be tested offline. Sure, it's not TDD (since you are creating the tests in advance) but your offline TDD development should give you a good idea of what your hardware interface needs to look like and thus what online tests you need to perform.

Also, if online development costs much more than offline development (as it does where I work) then it could save you lots of time online having a well understood set of tests to run through.


问:
How should C++ Unit Test code be organized for maximum Unit Test efficiency?

This question is not about Unit Testing Frameworks.

This question is not about writing  Unit Tests.

This question is about where to put the UT code written and how/when/where to compile and run it.

In Working Effectively with Legacy Code, Michael Feathers asserts that

good unit tests ... run fast

and that

A unit test that takes 1/10th of a second to run is a slow unit test.

I think these definitions do make sense. I also think that they imply that you have to keep a set of Unit Tests and a set of Those Code Tests That Take Longer separately, but I guess that's the price you pay for only calling something a Unit Test if it runs (very) fast.

Obviously the problem in C++ is that to "run" your Unit Test(s), you have to:

Edit your code  (production or Unit Test, depending on which "cycle" you're in)

Compile

Link

Start Unit Test Executable(s)

Edit (after weird close vote): Before going into the details, I'll try summarize the point here:

How can C++ Unit Test code be effectively organized, so that it's both efficient to edit the (test) code and to run the test code?

The first problem then is to decide where to put the Unit Test code so that:

it's "natural" to edit and view it in combination with the associated production code.

it's easy/quick to start the compilation cycle for the unit your currently changing

The second, related, problem then is what to compile so that the feedback is instantaneous.

Extreme options:

Each Unit-Test-Test-Unit lives in a separate cpp file and this cpp file is compiled+linked separately (together with the source code unit file it tests) to a single executable which then runs this one Unit Test.

(+) This minimizes startup (compile+link!) time for the single Test Unit.

(+) The test runs super fast, because it only tests one unit.

(-) Executing the whole suite will need to start a bazillion of processes. Can be a problem to manage.

(-) The overhead of process starts will become visible

The other side would be to have -- still -- one cpp file per test, but all the test cpp files (together with the code they test!) are linked into one executable (per module / per project / pick your choice).

(+) Compile time still would be OK, as only changed code will compile.

(+) Executing the whole suite is easy, as there's just one exe to run.

(-) The suite will take ages to link, as each recompilation of any object will trigger a re-link.

(-)(?) The suit will take longer to run, although if all Unit Tests are fast, the time should be OK.

So, how are real world C++ Unit Tests handled? If I only run that stuff nightly/hourly, the second part doesn't really matter, but the first part, namely how to "couple" the UT code to the production code, so that it's "natural" for developers to keep both in focus always matters I think. (And if developers have the UT code in focus, they'll want to run it, which brings us back to part two.)

Real world stories and experience appreciated!

Notes:

This question intentionally leaves unspecified platform and make/project system.

Questions Tagged UT & C++ is a great place to start, but unfortunately too many questions, and especially answers, are too heavily focused on the details or on specific frameworks.

A while ago, I answered a similar question on structure for boost unit tests. I find this structure to be lacking for "real", fast Unit Tests. And I find the other question too narrow, hence this new question.

答:
First, I disagree with "1) Edit your (production) code and your Unit Test". You should modify only one at a time, otherwise if the result changes you won't know which one caused it.

I like to put unit tests in a directory tree that shadows the main tree. If I have /sources/componentA/alpha/foo.cc and /objects/componentA/beta/foo.o, then I want something like /UTest_sources/componentA/alpha/test_foo.cc and /UTest_objects/componentA/beta/test_foo.o. I use the same shadow tree for stub/mock objects and whatever other sources the tests need. There will be some edge cases, but this scheme simplifies things a lot. A good editor macro can pull up the test source alongside the subject source effortlessly. A good build system (e.g. GNUMake) can compile both and run the test with one command (e.g. make test_foo), and can manage a bazillion such processes -- just the ones whose sources have changed since they were last tested -- quite easily (I have never found the overhead of starting these processes to be a problem, it's O(N)).

In the same framework, you can have larger-scale tests (no longer unit tests) which link many objects together and run many tests. The trick is to sort these tests by how long they take to build/run, and work them into your daily schedule accordingly. Run the one-second-or-less test whenever you feel like it; start the ten-second test and stretch; five-minute test and take a break; half-hour test and go for lunch; six-hour test and go home. If you find that you're wasting a lot of time e.g. relinking a huge test after changing only one small file, you're doing it wrong-- even if the linking were instantaneous, you'd still be running a long test when it wasn't called for.

OwnerDisplayName: Martin


问:
What are common Silverlight specific mistakes/pitfalls developers should avoid?
What are some common mistakes/pitfalls, specific to Silverlight development, that developers should avoid?

PS: Please, if you don't have hands on experience with Silverlight and want to simply state that people should just not use it, refrain from doing so.

Thank you for you time and consideration.

Here is a compilation of input from users on both StackOverflow and programmers.stackexchange.com to this question:

Thinking it's the same as WPF

Not using the MVVM design pattern

Not knowing that it doesn't support ADO.Net Connections

Not knowing that it only supports basicHttpBinding (no wsHttpBinding allowed)

Not knowing that RelativeSource bindings don't support AncestorType

Forgetting to setup IIS MIME types

Thinking that Silverlight works the same way as WPF

5mb limit on XAP files and the need for third party solutions to work around that

Not abstracting out the service layer calls.

Abstracting out the service layer calls so that the silverlight pages
  load in the designer (either Visual Studio or Expression Blend)
  without the presence of the service helps out. Especially if the UI is
  being designed in Expression Blend. Some dummy data can be returned
  without calling the service and the UI designers still get a feel for
  the look and feel of the application with data.

Not using MVVM

You can program Silverlight like a winforms app but you are in for a
  world of grief. The whole platform was designed to use MVVM and if you
  don't work with that you are going to be swimming upstream the whole
  way.

Networking: there are limits on sockets, e.g. no UDP, only the async model

Networking: two (3.0) different HTTP stack, the browser one and the client one - each has its own quirks (a lot of applications ends up using both);

Security: some API are marked as [SecurityCritical] and you won't be allowed to use them, even if it will compile just fine, at runtime (e.g. but that code has been working for years in my other application)

Security: security policies on HTTP[S] and sockets (but works so well on your own computer)

ditran.net/silverlight-common-errors

Using MVVM but not truely understanding it

blindly obeying its principles as if they were the 10 commandments,
  some people really make things hard for themselves I bet most don't
  have any separate UI design team nor are using Unit tests, so the
  benefits of MVVM would be minimal

Not grasping the Asynchronous nature of Silverlight.

Over using UserControls when they should be using a Templated control

Thank you for constructive input to the following people:
  Rachel, maple_shaft, Jesse C. Slicer, ChrisF, Jon Raynor, poupou, RKitty, DShah, AnthonyWJones

答:
The main problems I encountered when building a Silverlight app were:

Thinking it's the same as WPF

Not using the MVVM design pattern

Not knowing that it doesn't support ADO.Net Connections

Not knowing that it only supports basicHttpBinding (no wsHttpBinding allowed)

Not knowing that RelativeSource bindings don't support AncestorType

Forgetting that clients needed to install Silverlight framework to run it

Forgetting to setup IIS MIME types

I'm sure there's others issues, but I forget them. I usually do WPF develpment, and have only done a handful of silverlight apps. The biggest issue I had was thinking that Silverlight was the same as WPF... it's not. There are a lot of things you can do in WPF that you can't do in Silverlight.


问:
What is the most egregious waste of money you have seen, and what did you do about it?
Often we as programmers see large organisations wasting huge sums of money on bloated and inefficient solutions to problems. This pains me greatly because I like organisations to benefit from best of breed solutions. However, my abilities as a programmer are limited when it comes to influencing the key decision makers and often my perspective on the matter is constrained to my own little technical world.

So, my question is this. After encountering an egregious waste of money on some software and/or hardware that really got your goat, what did you do about it to get it fixed or were you doomed to bite the bullet and mutter forever under your breath? I'm interested in hearing your overall experiences and especially what lessons you learned about how to tackle this sort of thing in the future. Let's not name names, the experience of how to tackle the problem is more important than the actual offending product.

答:
I work in the performance testing profession and I witness (literally) millions of dollars a year being flushed down the drain by organizations for four reasons

Hiring an outsourcer based on price alone, not qualifying skills and not regularly auditing the skills of the performance testers.  Hiring an amateur performance tester is a lot like hiring an amateur plumber or an amateur electrician, it will take them a lot longer to work through basic tasks, a lot of checks and balances in process are lost, and when you do find out just how bad they were its horribly expensive to fix (in production).    As a moderator for half a dozen forums in this field I observe regularly people showing up who lack fundamental skills in testing, communication, project management, development, systems analysis, etc... and they have simply been thrown at a tool.    To the person that noted LoadRunner as a waste of money earlier, if you throw a fool at a tool there is only one result you should expect.   The irony is that open source tools require an even more mature skill set to be successful with them.

Not collecting performance requirements.   This impacts the whole organization because you will have a different perspective on performance in Architecture, Platform engineering, Application Engineering, Functional QA and performance QA, none of which may actually match the business stakeholders (and frequently doesn't).    This is a process problem for in many organizations the performance test team is asked both to collect the performance requirements and to test against them.  For proper checks and balances you should do one and not the other.   Related to 1 above with immature staff you will have people who cannot even recognize a proper performance requirement, do not have a measurement point to validate against with a load profile, and yet they are still building "scripts to run."   This is a collosal waste of time and effort and does little to improve quality.   Performance needs a common perspective across the organization and is not something that can just be tacked on at the end if it wasn't engineered in to begin with.

Performance Test Environment Management.   I cannot tell you how many organizations are delayed to to test environments not being ready to run at the time that the test organization is ready to proceed.  Just in one client I can see this as a multi-million dollar problem in terms of hours lost while waiting

Project managers who have no understanding of what performance testing is, what tasks are involved or the level of effort in place, but who are dictating how long the activities should take place.   This leads to variances in the project schedule which are entirely related to how items were scheduled (and cost overruns as a result).  This is directly related to 1 above as well for immature testers are not able to accurately project either the number and types of tasks nor how long the tasks should take.   It is an axiom that if you allow someone who does not understand what you do and why you do it to dictate how you work and how long you will take, then this path will lead to failure.   It happens all too often in performance testing.


问:
Are the different available programming languages redundant?
Off course this doesn't apply to all languages. But I was wondering if some languages only exists due to the market culture of concurrence.

For example, we all know that C is widely used for built in and light weight systems. And, as far as I know, no one bit them.

But how about JAVA, C#, Ruby, PHP, ASP.NET, Python, Perl and son on?

I know that PHP is much more light weight then ASP.NET and JAVA and some  would say it is its differential, because you can deploy applications much faster. Others would say that, despite that, in the future, you'll realize that you'll need a more robust language.

There are different cases, like in the twitter case, using SCALA.

What would you say if, for example, tomorrow you wakeup in Garden of Eden, where everyone works together without competitors. Which programming languages would you merge or discontinue?

My point is: Is there programming languages that exists only due to competition or all of them have very specific applications and cannot be thrown away or have their functionality merged?

答:
The problem with this is that different programmers prefer or even need to think in different ways. For example, I personally would discontinue pretty much every interpreted implementation or dynamically typed language, as I simply don't see the need for them and vastly prefer statically typed compiled implementation languages. And then I would discontinue every language without deterministic destruction or where you can't choose per instance how to allocate your memory- which pretty much just leaves C++. But another programmer might find that suddenly he doesn't have the tools he needs. Not everyone is up to the same challenges. Some people prefer debugging type errors in run-time type languages to debugging wrong overload errors in statically typed languages.

Edit for clarity: If you ask two programmers what languages matter, you'll get three different answers.


答:
Yes, they are terribly redundant.  If we would all just use the best programming language, the others could fall by the wayside.  Now, if we could just agree on what the best programming language was...

Jokes aside, there are good reasons for there to be many programming languages:

a.) a programming language which is good for low-level bit-bashing may (and usually does) lack higher-level abstractions, making it poorly suited for programming in the large

b.) a programming language with high level abstractions will often depend on a very heavyweight runtime environment (often even a complete virtual machine environment written in another language), and thus cannot be used directly for bare-metal programming (or even for native code generation)

c.) different programming languages often encourage very different ways of thinking about a problem -- and since there are many different kinds of problem in the world, some languages and problems make natural pairings, while other pairings may be awkward or even unusable (beyond the `turing tarpit' level at which any language could be used for any purpose).

Title: Are the different available programming languages redundant?

Body:
Off course this doesn't apply to all languages. But I was wondering if some languages only exists due to the market culture of concurrence.

For example, we all know that C is widely used for built in and light weight systems. And, as far as I know, no one bit them.

But how about JAVA, C#, Ruby, PHP, ASP.NET, Python, Perl and son on?

I know that PHP is much more light weight then ASP.NET and JAVA and some  would say it is its differential, because you can deploy applications much faster. Others would say that, despite that, in the future, you'll realize that you'll need a more robust language.

There are different cases, like in the twitter case, using SCALA.

What would you say if, for example, tomorrow you wakeup in Garden of Eden, where everyone works together without competitors. Which programming languages would you merge or discontinue?

My point is: Is there programming languages that exists only due to competition or all of them have very specific applications and cannot be thrown away or have their functionality merged?


答:
The only language I know that came from competition was J++ from Microsoft and that was killed in 2004.

A lot of languages are created to fit a particular need by the author. Examples of this are Perl and Ruby.

Perl was created by Larry Wall in 1987 to make report processing easier. Ruby was created by Yukihiro Matsumoto because of discontent with other languages. He wanted to make a "...scripting language that was more powerful than Perl, and more object-oriented than Python...".


问:
Videos on Unit Testing
I've been searching for good presentations (slides+audio or video preferred) on Unit Testing but all I seem to find are books and blog posts. The presentation should not be longer than 50 minutes since it will be shown at a brown-bag lunch. General concepts or how to do it on the .NET-platform is what I'm looking for.

Can you recommend a presentation that fits that description?

答: Perhaps take a look at James Shore's Let's Play TDD videos. I haven't watched nearly all of them (only just started, actually) but they seem to be good material, working with a chunk of code at a time.</p>

Title: Videos on Unit Testing


问:
How do I store the OAuth v1 consumer key and secret for an open source desktop Twitter client without revealing it to the user?
I want to make a thick-client, desktop, open source twitter client. I happen to be using .NET as my language and Twitterizer as my OAuth/Twitter wrapper, and my app will likely be released as open source.

To get an OAuth token, four pieces of information are required:

Access Token (twitter user name)

Access Secret (twitter password)

Consumer Key

Consumer Secret

The second two pieces of information are not to be shared, like a PGP private key. However, due to the way the OAuth authorization flow is designed, these need to be on the native app. Even if the application was not open source, and the consumer key/secret were encrypted, a reasonably skilled user could gain access to the consumer key/secret pair.

So my question is, how do I get around this problem? What is the proper strategy for a desktop Twitter client to protect its consumer key and secret?

答:
The consumer key and secret are application bound and not user bound. With this in formation the OAuth provider knows with what application it is dealing. The rest, Access token and secret will be obtained after the first steps are done.

See this blog post for more information as it shows how the protocol works.


答:
Yes, different programming languages are redundant to a large degree, but this is not necessarily a bad thing.  Programming languages that succeed usually become entrenched and are virtually impossible to change.  (An exception that proves the rule is C++1x, where change is absolutely glacial.)  When this happens, new languages that are somewhat redundant but improve the old language comes along to learn from the mistakes and bring in the best of other paradigms.  Often there's disagreement about what exactly the good and bad of the old language is and what the best features of other paradigms are, so there needs to be multiple new languages to try out a variety of approaches.  If you need compatibility and stability you use the old language.  If you need productivity, cool new features and less cruft, you one of the new languages.  Examples:

C is a great language for low-level bit bashing.  C++ added basically every productivity feature that could be added onto C without major loss of backwards compatibility, with zero overhead, and within the bounds of compiler technology at the time.  D and Go are attempts to make a better systems programming language based on what's been learned since C++ became entrenched, with more modern compiler technology, and with small but nonzero overhead that's more acceptable nowadays than when C++ was created.  D focuses more metaprogramming and expressiveness and being a better C++, Go focuses more on simplicity and being a better C.

BASIC was among the earliest attempts at a high-level dynamic language, but was too limited to be very useful.  Perl made dynamic languages useful for real work, but accumulated tons of cruft because it evolved more than it was designed.  Python and Ruby try to take the best of Perl and make a language with a cleaner, more consistent design.  Of course the designers of Python and Ruby have somewhat different ideas about what the good parts of Perl are.

Java pioneered the idea of an industrial strength VM language with super-efficient garbage collection that can easily be JIT compiled into code with performance comparable to native.  They arguably went overboard favoring simplicity over expressiveness, but it's too late to change.  C# is kind of similar to Java, but being new had much more freedom to innovate and make the language more expressive.

Functional flavored languages used to have a very academic, steep-learning-curve feel, despite their advantages in terms of reasoning about code and concurrency and in some cases terseness.  Recent attempts to make them more approachable and real-world oriented include Scala and F#.


问:
Development platform for .NET development?
I'm currently in discussions with my boss about getting a new pc since my old one is getting ... old...

I am the only "real" developer in the company (it's not a software company) and as such they haven't really bought any pc's with these kind of specs before.

So, I made a list, because building my own, is cheaper than buying finished. http://www.prisjakt.no/product_list.php?do=lista&k=10529

And he thought it was kind of overkill. And I can admit, I may have gone a bit far on some choices (the raided SSD's for example), but I though it was better to go out high, then come down a bit during discussions.

But what would you say is a comfortable platform to do .NET development on? I currently use Visual studio 2010, local SQL Server 2008 R2 (Developer Edition), 1-3 local VM's for doing testing, and I use Windows 7 Enterprise x64 as OS.

I myself don't feel that this list is very overkill, not to mention that it's very future proof. I put on 240Gb of system-disk, and 4Tb of storage, so I won't run out of space anytime soon. It's a i7 quadcore, 16Gb memory... It's not the bare minimum, but it's not very exaggerated?

10000 NOK is about $1900 USD.

答: I would say its a bit overkill, no need to break the budget for a development box. Maybe investing in a quality test system would be better than running virtual machines the same PC you develop in. I also don't know how future-proof your system will be, considering new development PC's would probably be bought every few years anyways. Other than that, seems like a killer setup for a solo dev!</p>


问:
How can I practice implementing data structures and algorithms?
I just finished learning the basics on data structures and algorithms using Python and C, completing some of the exercises from the book I read. I feel that it is necessary to implement some of these data structures and algorithms to enhance my understanding about the material that I just learned, such as the red-black tree and priority queue.

Are there any good websites with material for me to use when practicing?

答:
Pick up a copy of Introduction to Algorithms. Implement some of the algorithms.

Here is a list that will cover several interesting uses for data structures --

linked lists

binary search tree

hash table

Dijkstra's shortest path

KMP string matching

OwnerDisplayName: Alcott


答: In my opinion you should be fine with a i5 and 8GB ram. The most important part actually is the hard drive speed, Visual Studio is VERY I/O bound.</p>

Title: Development platform for .NET development?

Body:
I'm currently in discussions with my boss about getting a new pc since my old one is getting ... old...

I am the only "real" developer in the company (it's not a software company) and as such they haven't really bought any pc's with these kind of specs before.

So, I made a list, because building my own, is cheaper than buying finished. http://www.prisjakt.no/product_list.php?do=lista&k=10529

And he thought it was kind of overkill. And I can admit, I may have gone a bit far on some choices (the raided SSD's for example), but I though it was better to go out high, then come down a bit during discussions.

But what would you say is a comfortable platform to do .NET development on? I currently use Visual studio 2010, local SQL Server 2008 R2 (Developer Edition), 1-3 local VM's for doing testing, and I use Windows 7 Enterprise x64 as OS.

I myself don't feel that this list is very overkill, not to mention that it's very future proof. I put on 240Gb of system-disk, and 4Tb of storage, so I won't run out of space anytime soon. It's a i7 quadcore, 16Gb memory... It's not the bare minimum, but it's not very exaggerated?

10000 NOK is about $1900 USD.


问:
How do you decide site availability requirements?
I work on a web application to file a specific kind of county taxes. Our company wants our state to mandate that counties must accept electronic filings (as opposed to paper) from any system that meets some sensible requirements for uptime, security, data validation, etc. (Yes, this would help us as a business, but it would also force county governments to be more efficient.)

We're creating a draft of those requirements to be reviewed and tweaked with the state. One of the sections is "availability." We want to specify something reasonably high, but not so high that any unexpected problem will get us (or a competitor) penalized.

How do we decide what's reasonable for availability requirements?

答:
We're creating a draft of those requirements to be reviewed and tweaked with the state. One of the sections is "availability." We want to specify something reasonably high, but not so high that any unexpected problem will get us (or a competitor) penalized.

I question the ethics of trying to impose requirements on a potential customer. It just doesn't seem right to me. Perhaps rather than trying to come up with specific requirements to be "reviewed and tweaked", you should be eliciting requirements from the customer from day one. Customer involvement will help you understand the domain and be able to build a system that adds value, and customers will be more likely to purchase a system that adds value..

How do we decide what's reasonable for availability requirements?

A good rule is that no new system should have a lower availability than an existing system. If there are any existing systems (and they don't have to be software systems, either, but any combination of hardware, software, and people) in place, start there as a point of reference. Otherwise, I would expect the customer to have some idea of the minimum availability that they would need to function.

Also, you don't need to simply specify uptime in terms of percent of a year. You can give ranged value. Perhaps during certain times of the year, you need a higher uptime. Or during business hours, you need a higher uptime than nights, weekends, and holidays.


答: I have basically the same software running, but with 4GB RAM, and a Core Duo 3.17Ghz processor.  The only performance issues I have ever experienced are related to IO, which the machine does not affect, and once a out of memory issue due to a VS 2010 memory leak that no amount af RAM could have solved. This seems like overkill as far as using a machine today or in the next year is concerned. Beyond that, $200 worth of upgrades could get you through another couple years (RAM, storage, etc.). Future proofing is almost always a bad idea, due to cashflow and infeasability (how do you future proof something with features that do not even exist yet?). </p>


答: Not using MVVM is the biggest mistake I have seen. You can program Silverlight like a winforms app but you are in for a world of grief. The whole platform was designed to use MVVM and if you don't work with that you are going to be swimming upstream the whole way.</p>

Title: What are common Silverlight specific mistakes/pitfalls developers should avoid?

Body:
What are some common mistakes/pitfalls, specific to Silverlight development, that developers should avoid?

PS: Please, if you don't have hands on experience with Silverlight and want to simply state that people should just not use it, refrain from doing so.

Thank you for you time and consideration.

Here is a compilation of input from users on both StackOverflow and programmers.stackexchange.com to this question:

Thinking it's the same as WPF

Not using the MVVM design pattern

Not knowing that it doesn't support ADO.Net Connections

Not knowing that it only supports basicHttpBinding (no wsHttpBinding allowed)

Not knowing that RelativeSource bindings don't support AncestorType

Forgetting to setup IIS MIME types

Thinking that Silverlight works the same way as WPF

5mb limit on XAP files and the need for third party solutions to work around that

Not abstracting out the service layer calls.

Abstracting out the service layer calls so that the silverlight pages
  load in the designer (either Visual Studio or Expression Blend)
  without the presence of the service helps out. Especially if the UI is
  being designed in Expression Blend. Some dummy data can be returned
  without calling the service and the UI designers still get a feel for
  the look and feel of the application with data.

Not using MVVM

You can program Silverlight like a winforms app but you are in for a
  world of grief. The whole platform was designed to use MVVM and if you
  don't work with that you are going to be swimming upstream the whole
  way.

Networking: there are limits on sockets, e.g. no UDP, only the async model

Networking: two (3.0) different HTTP stack, the browser one and the client one - each has its own quirks (a lot of applications ends up using both);

Security: some API are marked as [SecurityCritical] and you won't be allowed to use them, even if it will compile just fine, at runtime (e.g. but that code has been working for years in my other application)

Security: security policies on HTTP[S] and sockets (but works so well on your own computer)

ditran.net/silverlight-common-errors

Using MVVM but not truely understanding it

blindly obeying its principles as if they were the 10 commandments,
  some people really make things hard for themselves I bet most don't
  have any separate UI design team nor are using Unit tests, so the
  benefits of MVVM would be minimal

Not grasping the Asynchronous nature of Silverlight.

Over using UserControls when they should be using a Templated control

Thank you for constructive input to the following people:
  Rachel, maple_shaft, Jesse C. Slicer, ChrisF, Jon Raynor, poupou, RKitty, DShah, AnthonyWJones


答:
I have just purchased new dev PC, mostly for .NET and web development (including DBs, graphics tools - Photoshop, Expression Blend). It has i5 2500k, 12GB RAM, SSD 80GB + HDD 500GB, 2 x 23" LCD. Working with various projects, from small (1 - 3 projects) to medium sized (5 - 15 projects), it works really fast, my CPU and RAM graph is mostly at bottom! I have also two more dev PCs (desktop - intel e2160 1.8ghz oclocked to 3ghz, 5gb ram, hdd, and one 2core 11.6" netbook), it's faster, a lot (3x - 5x compilation time), but I would never go to i7, difference is unnoticeable, or even SSD Raids, that's just waste of money in my opinion. Better investment would be third monitor, high end mouse/keyboard, or even chair you sit on.

Difference between low end i5 and high end i7 is so low I wouldn't notice it, or it would take me some time.

So optimal configuration is: mid i5, 12gb ram, fast ssd (like x25m), HDD, 2 big LCDs (LEDs,...), and good mouse and keyboard, or decent speaker for grooveshark in background. If you're not doing some crazy stuff, like enormous DB, high end 3d, or similar, you'll be fine.


答:
My company just purchased a new PC for me in July 2011. I do .NET and C++ development.

Windows 7 Professional (64-bit)

Intel Xeon W3565 (3.20 GHz, 4 hyper-threaded cores)

6 GB DDR3

Western Digital WD3000HLFS (300 GB, 10k rpm, 16 MB cache, SATA 3.0 Gbps)

ATI FirePro V5800 (PCI Express 2.0, 1024 MB GDDR5)

Dual 1280x1024 LCDs

I would prefer larger widescreen monitors and an SSD, but overall the machine keeps up with me.


问:
What is a good practice for reading culture (language) info for users of a web app?
I am trying to get an idea of what would be a better practice / implementation for the users of an application that I am going to localize.

Which would be better and why?

Read the culture info (preferred language) from the browser.

or

Have a language selection option in the application, commonly
implemented using flags (icons) or a drop down.

Or suggest a better idea.

答: If your target market is significantly from one region, stick with that region as the default and let your other users select their language from a flag icon, or clearly defined drop-down. I work in an environment (due to firewall/router restrictions) that have caused quite a few sites (including Google!) to force me to a culture that I am unfamiliar with. Don't try to get fancy. Provide the most common solution to your users and point them to another localization that they can choose to use if they so desire.</p>


问:
Good way to learn how to solve questions on InterviewStreet

Possible Duplicate:

  How do I adapt to pre-interview challenge questions?

InterviewStreet is a new company that essentially acts as a filter for companies to find programmers that can code. My problem is my math is fairly weak and I'd like to study it, even if it's from the ground up, to be able to solve questions such as this one, that is found on their site:

Find the no of positive integral solutions for the equations (1/x) + (1/y) = 1/N! (read 1 by n factorial) Print a single integer which is the no of positive integral solutions modulo 1000007

Now, please do NOT post the answer to that question, it is taken directly from InterviewStreet and should not be posted here. It is not the answer I'm seeking for in this thread. What I'm asking is a more fundamental question which probably can be answered by some of the hackers in the SO community.

How does one prepare for such a question? What resources are available for me to study/learn how to solve this type of problem? Is this covered on MIT open courseware? Khan Academy? Any particular books? I'm not even sure where to begin to start solving the problem above and I'd like to learn what steps I can take to do so.

答:
This particular problem requires you to know basic number theory, specifically ideas like factoring composite numbers, some properties of prime numbers and an understanding of relatively prime pairs of numbers.

The other problems on the site require an understanding big O notation, simple data structures, basic algorithms like sorting, and combinatorics. I've passed 3 of the 5 problems and I'm almost done with my 4th, and I haven't used any specific knowledge from after my first year of CS classes in college. That said, these are difficult problems. Some of them require a surprising amount of mathematical intuition.

To prepare for this sort of stuff, you have to be good at mathematical problem solving. Look into the Olympiad (if you're in high school) or Putnam exam (if you're in college) and do the practice problems you find. They're hard, but you get better at them eventually.

Also, don't do the 30 point question - Quadrant Queries - first. It's the hardest by far.

OwnerDisplayName: randombits


问:
What's your favourite quote about programming?
What's your favourite quote about programming?

One quote per answer, and please check for duplicates before posting!

答:
The whole history of this invention has been a struggle against time.

    — Charles Babbage on the Analytical Engine, 1837

LastEditorDisplayName: Roger Pate


问:
Difference between free and open software?

Possible Duplicate:

  Open Source but not Free Software (or vice versa)

I recently was at talk were Stallman was the keynote speaker, and he stated he hated the term open software, because it was geared to confuse people.

Now, I have since then read on to understand his stance, but I am unable to draw a line where free software becomes open source, and which licenses can be considered in each group.

For example I know that GPL, LGPL are free software licenses, but they are also open source licenses as well.

Is there a pure open source license? like MIT license? or is it all shades of grey.

Can a line be drawn?

Thanks!

答:
In the general case, there is no difference. 'Open Source' is a marketing term created to promote free software in the business world. The goal was to remove the ambiguity around the world 'free'.

Licenses which are Open Source Initiative approved

Licenses which are Free Software Foundation Approved


答:
The difference here is between being implicit or explicit.

Setting the default language based on browser's preferences is implicit in nature. I personally find it frustrating to always find myself at a localized Google page, while I'm used to the English version.

However, providing a list so that user can select an option from, is explicit.

AMAIK, W3C in all of its specifications, asks browsers (User Agents) to be user-centric and explicit when something should be based on users decision-making process. This issue I think falls directly with user-centric implementation. In other words, I think the UI language and culture is something that user should explicitly select.

Title: What is a good practice for reading culture (language) info for users of a web app?

Body:
I am trying to get an idea of what would be a better practice / implementation for the users of an application that I am going to localize.

Which would be better and why?

Read the culture info (preferred language) from the browser.

or

Have a language selection option in the application, commonly
implemented using flags (icons) or a drop down.

Or suggest a better idea.


答:
Open source software is, what its name says, software with source available to the public (or whoever).

Free software is software that is, in the most wide term, not commercial. Not sold.

Most of other things fall in between, with variations on the subject. And I'm not exactly a fan of Stallman, since he's one of the main guilty ones for making the confusion with his GPL and whatever licences.

In any case, rant aside, if you're interested in the subject and are willing to go a little deeper in it, there is a nice book by O'Reilly,
Understanding Open Source and Free Software Licensing which deals with it in a gentle way.

Title: Difference between free and open software?

Body:
Possible Duplicate:

  Open Source but not Free Software (or vice versa)

I recently was at talk were Stallman was the keynote speaker, and he stated he hated the term open software, because it was geared to confuse people.

Now, I have since then read on to understand his stance, but I am unable to draw a line where free software becomes open source, and which licenses can be considered in each group.

For example I know that GPL, LGPL are free software licenses, but they are also open source licenses as well.

Is there a pure open source license? like MIT license? or is it all shades of grey.

Can a line be drawn?

Thanks!


答: Another way of looking at it is that the software is free, however, various "open source" licensing agreements restrict how you can modify and re-distribute the code.</p>


答: Do both: default to the language indicated by the Accept-Language HTTP header (because that's your most reliable information, much better than IP-Geolocation), but allow the user to choose a different language from a prominently placed menu, and remember that choice both in a browser cookie and in the URLs (so that it can be bookmarked and discovered and indexed by search engines). Here's an answer of mine where I give a details description how this can work.


答: Most silverlight apps use services to get data.  I would add that abstracting out the service layer calls so that the silverlight pages load in the designer (either Visual Studio or Expression Blend) without the presence of the service helps out.  Especially if the UI is being designed in Expression Blend.  Some dummy data can be returned without calling the service and the UI designers still get a feel for the look and feel of the application with data.</p>


问:
Google is good or bad for programmer?
Recently I was being interviewed by a company and faced one question. The interviewer asked me a question and at that time I didn't know the answer but if I had been asked about just 4 months ago, I could have answered it.

The question was from new language that I learned just 4 months ago. But I just get overview of the language and just get started working on that. Whenever I face difficultly, I google it. That means we do not have to memorize the whole programming language book! So in that situation I felt that Google screwed my job!

Not talking subjectively, Is it good to google all the time?

答:
So in that situation I felt that Google screwed my job!

The problem was not Google or the web in general. The problem was that you didn't know the answer to the question. You seem to feel that you would have remembered the answer had you learned from a book rather than from one or more web sites. Again, the problem is not the existence of the web sites, it's that you learned (or rather, failed to learn) in some way that didn't suit you. And please remember: the notion that you would have known the answer had you learned from a book instead of a web site is pure speculation on your part.

If you had successfully answered the interviewer's question, would you send a fruit basket to Google thanking them for getting you a job? Of course not -- you'd take full credit for being smart enough to know the answer.

Is it good to google all the time?

No, of course it isn't. It's wonderful that we have a resource that can provide answers when you're stuck, but using the net as a crutch in place of learning is, as you have found out, not beneficial for you in the long term. It's like watching the movie versions of all the books assigned in a literature course instead of reading, or using the solution manual for your calculus text to complete a problem set. You might get credit for knowing the basic plots or turning in your homework on time, but you'll do poorly on your final exams and ultimately you'll have learned little.

Title: Google is good or bad for programmer?


问:
Ruby on Rails downsides and caveats
This is not an opening gambit for RoR bashing - honest!

I'm learning Ruby and the Rails framework. Prima facie it appears to be pretty cool, and a wonderful experience compared to PHP. (In fact, it's reminding me of happier days with C# and .NET.)

However, going into this, I have no experience with this framework or language, and I'm curious - what are the current downsides or things you'd wish you'd known when you were beginning?

(Maybe this should be made a community wiki?)

答:
Rails has a lot of niceties that hide complexity from you. (ActiveRecord associations, the whole validation / saving lifecycle, the interpretation of request data based on provided headers)  When you're just starting, this is awesome.  As you grow, you will find that you begin to fit your app to "the Rails way" of handling things - sometimes this is good, sometimes this is harmless, and sometimes it's actually counter-intuitive to the thing you are trying to do.  Not all database tables should be modelled as objects, a validation step may need to happen elsewhere, etc.  A lot of Rails programmers eschew not fighting the framework (which usually is wise), but the long term effect of this is...you will carry the habits of Rails with you to places where they are not necessarily called for.

The community has a habit of writing software that is billed as "magic" - caching libs that magically work! Evented I/O that magically makes you faster! Magic magic! What usually is the case here is that a very attractive API is provided for a technical solution which is lacking, and you are fooled by the very pretty examples that the thing does what you intend, and only later find that it covers an incomplete solution.  The cycle of this is pretty constant, and you learn to roll with it, but you should definitely get familiar with the idea of reading lots and lots of the code you depend on (a good thing!).  Rails community magic solutions are not nearly as magic as the README may suggest, I'm saying.

Corollary to above: The more you use Rails, the more you should be reading its source.  The better you understand the framework internals, the happier you will be long term. Not really Rails specific in this, but I'm just telling you from experience here. Method names sometimes promise something you're not actually getting.

Cargo cultism is an issue w/ Rails, but that is probably true w/ all framework / lang communities. It seems more pronounced (to me) in Rails, and as such tends to give a weird generational look to Rails code - as you work on different Rails projects, you will notice certain tendencies that tend to betray the time period in which they were created. As you can guess from that statement, the community tends to move pretty fast in adopting new solutions and deprecating old ones. You should really be on top of your Ruby news, just to understand some of the code that you'll experience on a daily basis.

Generally speaking, I think the issue of data concurrency is usually not well addressed by the community - as you grow an app, when you hit the point where you need to shard data, rollback physically remote changes and lock access to data, the solutions become a bit more hand tuned, which makes some of the nice looking Rails things you do get all muddied up w/ the technical necessities of accuracy. Rails doesn't solve every problem you'll have with a web app, I guess I'm saying, and while the creators certainly don't preach that message it's easy to be fooled into thinking that it's implied.

Title: Ruby on Rails downsides and caveats


问:
Will real world applications ever need a 128-bit flat address space?
This is a bit "one megabyte should be enough for anyone", but...

A 64-bit flat address space allows up to 4.3ish billion times more space than a 32-bit address space. That's 17,179,869,184 GiB.

Obviously, the transition from 8 bits to 16 bits was pretty quick (I'm viewing things in a teen-during-the-80s way, ignoring all those mainframes and minis because they couldn't run a port of Elite). The transition from 16 bits to 32 bits took a bit longer, and 32 bits actually lasted quite a while.

Now we have 64 bits, would it be stupid to say "17,179,869,184 GiB should be enough for anyone"?

This is a programmers question because I really have the programming viewpoint in mind. Even if a computer some day has a seemingly infinite amount of working memory, that doesn't mean that applications will need to see a seemingly infinite flat address space.

Basically, can we programmers breath a sigh of relief and say "well, whatever integers or floats may do, at least I don't have to worry about my pointers growing any more?".

答:
What would happen if every memory location had a globally unique address?

Network protocols could become a whole lot simpler.

Distributed objects would be interesting -- all objects could exist in the same memory space.

Maybe we'd switch to "write once" memories and include time as part of the address structure. You could read objects that existed in the past.

All secondary storage would be directly addressable. Goodbye FILE, fopen(), etc.

You could be arrested for writing to a bad pointer and hosing somebody else's machine.

Students would have to have to be screened before taking their first CS class: very few people can withstand the Total Perspective Vortex.


答:
Lines can be drawn:

Public domain.  This is completely open.

Free to use and modify and sell but must retain author's name internally.  (BSD-ware)

Optional clause: Must not advertise that it contains content made by the author.  (Since the author didn't oversee the modifications, the author isn't associated with the final product.)

Free to use and modify and sell but must redistribute the original material.  (GNU-ware)  GNU is not free; it is viral and infects anything it touches with it's own license restrictions.

Free to use for a limited time and share with others, but not modifiable.  (Share-ware)

Free to use but not modifiable.  (Free-ware)

Pay to license source code and modifiable.  (Commercial open source)

Several Operating Systems are distributed like this for example, because it is too difficult to distribute a binary of an operating system which can link with custom software.  ThreadX RTOS, Nucleus RTOS come to mind.

Pay to use but not modifiable. (Commercial-ware)

Pay to use and extendable but not modifiable.  (Commercial-ware with third-party plugins)


答: It's more than just googling.  It's what I call the "art" of using google.  Some people, no matter what you do, take forever to find something on google because they do not know the best words to use to conduct the search.  How long does it take you to find and implement the code you need?  That's really the issue.</p>

Title: Google is good or bad for programmer?

Body:
Recently I was being interviewed by a company and faced one question. The interviewer asked me a question and at that time I didn't know the answer but if I had been asked about just 4 months ago, I could have answered it.

The question was from new language that I learned just 4 months ago. But I just get overview of the language and just get started working on that. Whenever I face difficultly, I google it. That means we do not have to memorize the whole programming language book! So in that situation I felt that Google screwed my job!

Not talking subjectively, Is it good to google all the time?


答:
Google is demonstrably changing people's memory structures- all throughout the populace. People remember where to find information instead of information itself. This is not specific to programmers or you in particular at all- it's a general trend amongst the population that have dependable Internet access.

The simple fact is that whilst it might be somewhat slower to Google than to remember it, Google and/or other online references that are more specific like MSDN contains a vast, vast, vast quantity of data- far more than you could possibly remember. This makes it simply more efficient to depend on Google for facts, and save memory space for real understanding.

That is, it's trivial to Google the syntax for C++ partial specializations, and it's quite another thing to actually be able to write partial or explicit specializations- their specification can throw up quite a few surprises if you're not experienced in how they work, and the knowledge of that can be significantly more useful than the knowledge of what the syntax is.

In addition, it's arguable that the ability to use those references themselves is a very significant job advantage when dealing with a language or framework with which you are not inherently familiar.

Title: Google is good or bad for programmer?


答:
All the time it's an exaggeration. You could be perceived as a copy-paster. Those guys are locusts: they disrupt projects, pollute them with 3rd party insecure copyrighted snippets they don't really understand. (and thus cannot be optimized)

Googling by itself isn't bad. You gotta show the interviewer you have a working, knowledgeable, brain, behind those googling little fingers, though.

If I don't remember the information, I'd tell them the exact google query I'd input, and the second best one, and the third one. And then go on talking about how I would handle the results. And what I suppose those results could be related to. And what I more or less expect. And how I expect them to relate to the matter at hand. And more. And more.

You're just supposed to show you can dig your way around obstacles.

Title: Google is good or bad for programmer?


答:
I'll consider that you talk about free licenses in the sense of the Free Software Foundation, and open source as advocated by the Open Source Initiative.
(Note : Free software licences does NOT forbid charging for the distribution of a software)

The main difference is based on ethics : FSF value the conservation of freedom above everything else (freedom to modify and redistribute, but also assuring that freedom can't be withdrawn from users), whereas open source value the technical aspects of being able to look at the source code (because more people can review the source code, thus theoritically leading to better, more reliable software).

Thus all free software licenses are automatically open source licenses because they automatically allow you to have access to the source code, but it's not always true the other way (even if it often is).

For example, the NASA Open Source Agreement is approved by the OSI but not by the FSF.

Read Why Open Source misses the point of Free Software if you haven't already ; of course it's the FSF point of view and is biased, but I still find it interesting.


问:
How can one manage thousands of IF...THEN...ELSE rules?
I am considering building an application, which, at its core, would consist of thousands of if...then...else statements. The purpose of the application is to be able to predict how cows move around in any landscape. They are affected by things like the sun, wind, food source, sudden events etc.

How can such an application be managed? I imagine that after a few hundred IF-statements, it would be as good as unpredictable how the program would react and debugging what lead to a certain reaction would mean that one would have to traverse the whole IF-statement tree every time.

I have read a bit about rules engines, but I do not see how they would get around this complexity.

答:
Expert Systems have been mentioned, which are an area of AI. To expand a little on these, reading up on Inference Engines may help you with this. A Google search might be more use - writing the DSL is the easy part, you could do this trivially with a parser like Gold Parser. The difficult part comes from building up your tree of decisions and efficiently running through them.

Many medical systems already use these engines, for example the UK's NHS Direct website.

If you're a .NET'er then Infer.NET might be useful for you.


问:
Testing Data : Should I Create a bogus test case?
I've written an Integration program that produces files from a source set of data and converts it to a target data file. These files contain field/record information that must be validated by our clients using their validation methods.

I plan to create numerous test cases and expect to receive information on how well the data validated so I can tweak my program.

I want to create a test case that I know will not pass their validation, however I need to know if their validation methods are picking up basics such as the file structure and layout.

I am trying to prevent the situation if all my test cases pass, but later on the files were not in the correct format the client needed.

Do you feel this is a good idea and would I get any valid information from it?

答:
Yes

that's not a bogus test case, it's a valid test for expected exceptions


问:
best practice when unit testing for embedded development
I am looking for some best practice strategies for unit testing code written for embedded system. By embedded system, I mean code such as device drivers, ISR handlers etc., stuff that are pretty close to the metal.

Most of the unit tests are not possible without testing it on the hardware with the aid of a ICE. Sometimes, the embedded unit also needs to be hooked up to other stimulus such as a mechanical switches, stepper motors and light bulbs. This usually occurs in a manual fashion, automation would be great but hard and expensive to achieve.

Update

I came across a C testing framework that seems to be quite successful in testing embedded projects. It uses the ideas of mocking hardware. Check out Unity, CMock, and possibly Ceedling.

Update 06Jul2016

Came across cmocka - seems to be more actively worked on.

答:
A necessary tool to develop is a signal injector.  The embedded system will have some way of interfacing with a host system (typically via a serial port reserved for debugging).  Use this to send test data (best option is terse ascii formatted so it is easily simulated by humans too).

I completely disagree with this part of your question: "automation would be great but hard and expensive to achieve."

Using TeraTerm as a serial port signal injector, and writing some TeraTerm macros (takes about 20 minutes), there is a huge suite of automated tests which can be run against any part of an embedded system -- whether driver layer, O/S, layer 4-5, etc.  TeraTerm: http://en.sourceforge.jp/projects/ttssh2/

If serial port is not available on the embedded system, then use a hardware tool to convert USB/serial port data to digital signals (also inexpensive and easy to achieve).  As you read this, I am using a $30 microcontroller board (UBW: http://www.schmalzhaus.com/UBW32/ ) to test an embedded system for production, by injecting stimulus via TeraTerm macros which is sent via USB/serial to the microcontroller, which is running modified firmware which exercises digital inputs and monitors digital outputs of the target embedded system.   In conjunction with this, we developed a python script (uses pyserial and pexpect) to automate the data injection and data validation.  None of it is hard and none of it is expensive.  In my experience, the managers spend the big bucks (such as $30,000 test equipment) when the test team is inexperienced and can't conceive of these easy solutions -- unfortunately, the general purpose big-iron equipment often does not include the test cases which catch the worst-case timing/etc of the target system.  So the inexpensive method is preferrable for test coverage.  Believe it or not.


问:
What are common Silverlight specific mistakes/pitfalls developers should avoid?
What are some common mistakes/pitfalls, specific to Silverlight development, that developers should avoid?

PS: Please, if you don't have hands on experience with Silverlight and want to simply state that people should just not use it, refrain from doing so.

Thank you for you time and consideration.

Here is a compilation of input from users on both StackOverflow and programmers.stackexchange.com to this question:

Thinking it's the same as WPF

Not using the MVVM design pattern

Not knowing that it doesn't support ADO.Net Connections

Not knowing that it only supports basicHttpBinding (no wsHttpBinding allowed)

Not knowing that RelativeSource bindings don't support AncestorType

Forgetting to setup IIS MIME types

Thinking that Silverlight works the same way as WPF

5mb limit on XAP files and the need for third party solutions to work around that

Not abstracting out the service layer calls.

Abstracting out the service layer calls so that the silverlight pages
  load in the designer (either Visual Studio or Expression Blend)
  without the presence of the service helps out. Especially if the UI is
  being designed in Expression Blend. Some dummy data can be returned
  without calling the service and the UI designers still get a feel for
  the look and feel of the application with data.

Not using MVVM

You can program Silverlight like a winforms app but you are in for a
  world of grief. The whole platform was designed to use MVVM and if you
  don't work with that you are going to be swimming upstream the whole
  way.

Networking: there are limits on sockets, e.g. no UDP, only the async model

Networking: two (3.0) different HTTP stack, the browser one and the client one - each has its own quirks (a lot of applications ends up using both);

Security: some API are marked as [SecurityCritical] and you won't be allowed to use them, even if it will compile just fine, at runtime (e.g. but that code has been working for years in my other application)

Security: security policies on HTTP[S] and sockets (but works so well on your own computer)

ditran.net/silverlight-common-errors

Using MVVM but not truely understanding it

blindly obeying its principles as if they were the 10 commandments,
  some people really make things hard for themselves I bet most don't
  have any separate UI design team nor are using Unit tests, so the
  benefits of MVVM would be minimal

Not grasping the Asynchronous nature of Silverlight.

Over using UserControls when they should be using a Templated control

Thank you for constructive input to the following people:
  Rachel, maple_shaft, Jesse C. Slicer, ChrisF, Jon Raynor, poupou, RKitty, DShah, AnthonyWJones

答:
Networking:

there are limits on sockets, e.g. no UDP, only the async model - the later is a good thing IMO;

two (3.0) different HTTP stack, the browser one and the client one - each has its own quirks (a lot of applications ends up using both);

There quite a few security considerations as well. The major pitfalls (it works in some cases, not in my app) are:

some API are marked as [SecurityCritical] and you won't be allowed to use them, even if it will compile just fine, at runtime (e.g. but that code has been working for years in my other application);

security policies on HTTP[S] and sockets (but works so well on your own computer);


问:
ASP.Net MVC ambigious action methods - why the path choosen
Is there someone who could shed a light on why ambiguous methods are not allowed in ASP.Net MVC?
I updated my question just to clarify it (using Carson63000 example from his answer), the question itself remains the same.

So, lets say we have the following action

```<code>/article/list/sport
</code>```

which calls

```<code>public ActionResult List(string category) { }
</code>```

and want to be able to have the following action as well:

```<code>/article/list/sport/20110904
</code>```

which we would like to call accompanying method

```<code>public ActionResult List(string category, DateTime date) { }
</code>```

Currently the framework throws an AmbiguousMatchException since it found two methods called List. That's the only reason for throwing the exception, that more than one method with was found that matches the actions name.

After the framework has figured out what method to use and decided that it is not ambigious, it will then try to map the supplied data from the request to the parameters of the method. Why not do this the other way around? First get all applicable methods, and then try to find the best fit by mapping parameters.

If ambiguous methods where allowed, I think the following is still possible to do.

Given that /article/list/sport uses the route /{controller}/{action}/{category} and that /article/list/sport/20110903 uses the route /{controller}/{action}/{category}/{date}
 it would then still be possible to map data for url /article/list/sport?date=20110903 since it will match the route for just category, but can still map the data for method public ActionResult List(string category, DateTime date) { }.

At the moment I fail to see the reason for not allowing ambiguous methods from a design perspective. The only thing I can think of myself is that it will slow down the framework too much, and therefor the current solution is the more logical one. Or am I missing another point here?

答:
If I understand your question correctly, I would say it is because you generally don't have explicit control over the parameters passed to an action.

Remember that the model binding will, by default, take them from a number of different places, including ones that are outside your control, like querystring.

It sounds like you're thinking that you should be able to have something like this:

```<code>/article/list/sport
</code>```

Which calls ArticleController.List(string category);

And also:

```<code>/article/list/sport/20110901
</code>```

Which calls ArticleController.List(string category, DateTime date);

But what happens when someone types the URL /article/list/sport?date=20110902 ?

It just sounds like a recipe for unpredictable behaviour, and in return, what real benefit would you get from this sort of action overloading?

Body:
If I understand your question correctly, I would say it is because you generally don't have explicit control over the parameters passed to an action.

Remember that the model binding will, by default, take them from a number of different places, including ones that are outside your control, like querystring.

It sounds like you're thinking that you should be able to have something like this:

/article/list/sport

Which calls ArticleController.List(string category);

And also:

/article/list/sport/20110901

Which calls ArticleController.List(string category, DateTime date);

But what happens when someone types the URL /article/list/sport?date=20110902 ?

It just sounds like a recipe for unpredictable behaviour, and in return, what real benefit would you get from this sort of action overloading?


答:
Use Accept-Language and any other quality info you have to display a best-guess default.

Display 2 languages if it's close

Let the user easily change language and order the choice by probability.

also, just to point out

localisation is more that just flags and languages.

flags = sovereign governments not languages, not geographic regions

1 gov can have many languages

1 language can be used in multiple(possibly mutually hostile) (or no) govs


问:
What is the most compatible, widely used production language to export knowledge and skills gained from Haskell?
I like Haskell, plain and simple. While Haskell is used in production software, it's not especially widely deployed from what I've seen. What is the most similar and still widely used language in regards to production projects so that I might have a snowball's chance of using something similarly awesome in industry?

Also is the same language from the first part available on large numbers of platforms? If not, what is the best alternative that has wide platform deployment? I'd like a single language to put on my to-do list rather than a massive swarm or family. Hard evidence would be a plus.

答: I never used it myself, but I see Scala popping up in blogs or project descriptions sometimes and I believe it took major concepts from Haskell. Scala compiles down to the JVM and can interoperate with Java.</p>


问:
Composition of a dev team
I'm in a team of fifteen people and the team is in transition after a few changes of management. The current line of management is pushing for an agile approach to developing software but without providing any lead. The team suffers from a big communication problem both inside and with other departments in the company who are our customers.

Management has recently created a sub-team composed by the technical specialists. They have great knowledge of the code base but have been in the company for up to ten years and are not so open to change. There goal is to provide technical direction.

I've joined the team in the last six months. I have a good six years experience developing different software but don't have the same knowledge of the code base as others. I have good communication and organisation skills and can relate to the customers easily.

The company's focus is to deliver innovative new products, but based on my observations we break down in project organisation (we seem to lose focus of the customer, get buried in the code base and misinterpret requirements).

I think I can provide direction in delivering projects with a good focus on the customer, however I don't hold the same technical expertise as the technical specialist team. I also think I'm the only one with previous agile experience in the team.

I've got two questions:

Is there room in a dev team for technical specialists and those that are good at delivering and making the customer happy, i.e the two working in tandem with each other?

Do you need to be a technical specialist to lead a dev project team?

答:
This takes bits of some other answers, but it sounds like you have a development team that isn't as customer-focused as it should be, and a manager who hasn't realized this and hasn't forced focus into your workgroup.  The inmates are running the asylum.  Sounds like what you need is manager and customer contact.  The manager makes the list of things the customer wants and the devs need to make that happen.  In other words, you need to get into hamburger mode ("make me a cheeseburger, no I don't care about your mustard pattern, neither does the customer, just get the burger done so you can get started on the fries") until you get back on track.  This doesn't mean the manager has to be rough, just that it sounds like you need strong real leadership (from someone outside the dev team).

In terms of your questions:

1: Yes, but the arrangement is work with the customer to find out what they want (frequently), and then tell the devs what to build.  The person working with the customer helps the customer figure out what they want, the devs don't sit around wasting money building little pet projects that no one actually wants or will pay for.  You don't want the devs in on this because 15 vs 1(or 2) is confusing for the customer, who are they really dealing with?

2: No, you don't have to be a specialist, but you have to know enough to detect the falsehoods or BS.  I saw a dev team go forever (overbudget and late) because the "lead" was completely non-technical and had to rely on a developer on the team.  Of course, he had his own agenda and was just following his flight and fancy.  Poor "lead" didn't have a clue she was being BSed.  Just smile and nod, smile and nod.  Back to your question, sometimes a technical expert is a bad thing as the lead, because he or she will often go off and make (or remake) something big, over-architected, and excessively complicated.  In a nutshell: A good lead has a sound technical backing, and an equally-sound or better understanding of how that team and project fit into the business objectives.

Don't sweat the agile thing, your manager heard the word somewhere.  Just do what works and get the customer in there early and often, and demo early and often.

Title: Composition of a dev team


答:
The largest difference between Open Source and Free Software is that Free Software provides The Four Freedoms, where Open Source software is generally taken to be a lesser-form of openness compared to  Free Software because it does not guarantee the same freedoms as a Free Software license though still provides access to the source code, or includes additional restrictions on top of The Four Freedoms while still providing access to the source code.

Example, the JSON license is Open Source, but is not Free Software because it adds the additional restriction "The Software shall be used for Good, not Evil", while the GPL is Free Software because it does guarantee all of those freedoms and imposes no additional restrictions.

Drawing a line is easy.  Does your license provide The Four Freedoms, and does it add additional restrictions on top of said Freedoms?

Yes,No= Free Software

No,Yes= Open Source

Yes,Yes=Open Source

No, No= Open Source


问:
Where to look for challenging jobs with a relaxed atmosphere?
I'm a dev at one of the big-name tech companies. I like the job for many reasons:

I do interesting work on a cool product

I solve challenging problems and use a lot of high-level skills (quantitative, creative, writing, presenting)

It pays well

The problem is that I feel I need a more relaxed atmosphere (shorter hours, less performance pressure, and more flexibility), in order to free up time for other pursuits and reduce stress. The ideal would be a job that's around 30-35 hours a week, where there is flexibility to work more or less in a given week. Can anyone suggest where to look for a job like this, where I wouldn't have to sacrifice too much on the above points? (Obviously I would have to sacrifice pay.) My employer does not generally offer part-time employment.

The closest thing I can think of is when I did summer internships at my university's CS department. The work was very intellectually challenging, but if I needed to go home a couple hours early or get flexibility on a due date, nobody batted an eyelash. However, I'd like to find out if there are alternatives to academia since from what I've seen the pay there is a gigantic drop from what I'm currently making.

I've done freelance development before, but I do like that as an employee of a large company I have a lot of things taken care of for me (e.g. benefits and guaranteed stable employment).

答: I have found that working in an academic environment for software research (specifically in HCI) provides very interesting intellectual challenges, an extremely relaxed environment (especially compared to my previous job), very interesting projects, and by definition the work is "cutting edge" (it's research!). It doesn't hurt if you have an interest in others learning too, which would lead you to becoming a lecturer or professor of sorts.</p>


答:
Haskell is most closely related to the ML family of languages. This includes things like OCaml, of course, but also F# on the .NET platform. These languages share with Haskell the foundation of the type system and how data is used--algebraic data types, pattern matching, type inference, etc. They can differ substantially from Haskell on other points, of course--most MLs are strict and impure, to start with, and the popularity of Haskell as a vehicle for research in type systems and language design means that most ML-style languages tend to have less powerful (but potentially easier to understand) type systems. It's probably safe to say that while you may miss some things about Haskell, particularly at first, most Haskell programmers would probably feel comfortably at home in an ML pretty quickly, at a basic getting-things-done level. If you want a language with the same overall structure as Haskell, an ML is your best bet.

The functional side of Scala draws heavily from the ML tradition, as well, and also pulls in some advanced type system features familiar from Haskell, as well as a more standard OOP system integrated with the above. While OO in ML-style languages tends to be approached as more of a "model OO with basic functional tools" Scala lives and breathes Java-style OO. This has benefits for Java interop, as you might imagine, and presents more familiar working environment for OO programmers. However, coming from a Haskell background, you're more likely to be annoyed by ways that blending things together in Scala makes functional idioms clumsier, and find most Java APIs to be badly designed and needlessly difficult to use. So if you want something with a sophisticated type system that permits direct translations of many things in Haskell (with some extra syntactic overhead) and don't mind compromising on functional style, you might enjoy Scala.

Finally, while it may seem odd to consider, Clojure actually has a lot of things in common with Haskell at a more philosophical level. Most of what you'll find in Clojure's approach to state and values vs. identities is very close in spirit to what Haskell formalizes through the type system. Correspondingly, Clojure emphasizes Java interop to a smaller degree and doesn't worry as much about dragging in OOP, so in some ways Clojure's approach to functional programming itself may be closest to what you're already familiar with. I think it's telling in this regard that, to the best of my knowledge, Clojure is the only language besides Haskell that has an implementation of STM that's simple, effective, and just works. On the other hand, Clojure comes from the Lisp tradition and thus lacks the static type system and emphasis on algebraic data types and pattern matching found in ML-influenced languages. And of course it's a Lisp, which is itself a negative to some people (though I really don't know why).

Speaking for myself, with the disclaimer that my first experience with functional programming was in Scheme, I'd probably lean toward Clojure, with OCaml a likely second choice.

Title: What is the most compatible, widely used production language to export knowledge and skills gained from Haskell?

Body:
I like Haskell, plain and simple. While Haskell is used in production software, it's not especially widely deployed from what I've seen. What is the most similar and still widely used language in regards to production projects so that I might have a snowball's chance of using something similarly awesome in industry?

Also is the same language from the first part available on large numbers of platforms? If not, what is the best alternative that has wide platform deployment? I'd like a single language to put on my to-do list rather than a massive swarm or family. Hard evidence would be a plus.


问:
Are By-Design "Bugs" a Bad Sign?
Is it a bad sign if users submit bug reports for things that are by design?

Does it typically mean that the application is confusing or unclear, or should I just chalk it up to a one-off user mistake unless specifically stated?

(I don't actually have any such reports.  This is a purely hypothetical question about whether or not the existence of by-design "bugs" is a bad thing.)

答:
If you have a user that is an expert in their field, you could have a major problem. Imagine an accountant that finds your software, by design, isn't following general accounting procedures or an engineer who discovers you have an incorrect formula. This shouldn't be too hard to research to see if they are correct. Redesign and fix it if needed-quick.

One opinion on a particular UI feature or a field they think should have a currency symbol or some other formating, should be considered, at least until you get more feedback. Researching this could be a little more difficult.

Title: Are By-Design "Bugs" a Bad Sign?


答:
Not necessarily. It could be that the reported bug is in a use of the software which is just outside of its originally defined scope. Consider software which was designed to do A, B, and C (for a trivial example, draw lines, triangles, and rectangles). If D is a logical next step (e.g. pentagons), the user may assume it should do that as well, and that not doing so is a bug. But if this is outside of the original scope, it's not a bug. It could instead be an oversight (bug) in design, or a gray area in the specifications, or a different set of assumptions made by the developer and the user.

(Edit - added my comment to the answer per @Marjan Venema's suggestion.

Title: Are By-Design "Bugs" a Bad Sign?

Body:
Is it a bad sign if users submit bug reports for things that are by design?

Does it typically mean that the application is confusing or unclear, or should I just chalk it up to a one-off user mistake unless specifically stated?

(I don't actually have any such reports.  This is a purely hypothetical question about whether or not the existence of by-design "bugs" is a bad thing.)


答:
This wasn't touched on in previous answers thus far so I will add that it could also be a sign of an ignorant user base.  I don't use the word "ignorant" in a derogatory or condescending way, merely as a way to express that they are without proper knowledge or education in their domain or of the complexities of the software itself.

Most users are not aware of just how complicated software has to be to meet certain requirements.  Something to the effect of 80% of effort goes into only 20% of functionality (fringe and exception cases).

They sometimes don't understand why the software inherently needs to behave in a certain way, many times to prevent a multitude of defects or corruption of data, etc...

This isn't worrying as this becomes better with clear and concise documentation and communication.

Title: Are By-Design "Bugs" a Bad Sign?