答:
I think you are looking at the problem the wrong way. What you should ask yourself is this: What do we require from a candidate for them to be able to do the job? You should properly evaluate the position and what it entails. Below are some suggestions on when to hire a junior developer and when not to.

When to hire a junior developer:
- If there is an overflow of easy work to be done, which would be a waste of time for a more senior developer.
- If you are willing to mentor and train this person over the next few years.
- If you are trying to grow the company and want someone who will stay for a long time. A junior developer who stays for only a year would be a waste of company resources, they would do little to produce anything, and most of the results would be in their own personal growth.
- When you feel like spending money on someone's growth. Since again, most of the benefits will be what they learn.

When not to hire a junior developer.
- When the work is too complicated. In this case it is just out of their league.
- When you want to save money. A senior developer should complete the same tasks in a fraction of the time with better quality results, and thus should always be cheaper.
- When the work is outsource-able or isn't enough to keep an employee busy. In such cases it would be better to offload some of the work to a private contractor.

One last important point. Don't hire a junior developer because "that is all we can afford", or "that is all we are willing to spend" when they are not suited to the job. In the end all you will end up doing is flushing money down the toilet. Besides, once they acquire those skills they will request the big bucks anyway.

About me:

Degree in physics with almost no formal training.

Two years of work experience. So I know what the learning process is all about.

Start software developer. I have done very demanding work and have seen all different skill levels from various individuals. Many of them can't handle a lot of what I do.


问:
What standards can be expected from graduate/junior engineers?
Are buffer overflows acceptable from a graduate developer? Are we setting the bar too high? What are the expected capabilities of graduate/junior engineers?

Context:

We are currently recruiting for a Junior Developer position working mainly in C on Linux.

As part of the process, we require candidates to complete a code test at their leisure in C.

So far we have rejected two candidates on the basis that their code, although readable and in one case rather idiomatic, suffered from buffer overflow errors due to unbounded buffer writes.

[Edit]:

We explicitly ask for error-checked, production quality code.

We provide a test & build framework for the candidates

[Update]:

As a result of this thread, and conversations we have had with other developers in person, we are changing the way we carry out code tests and who we target with our recruiting.

We decided that a candidate being unable to fix or understand a buffer overflow means that he would be unsuitable for the work we carry out, in particular he would take more mentoring than we are comfortable with. We will therefore still reject candidates that cannot eventually submit a robust code sample.

However, we have put in place some measures to make the recruitment process more productive for both us and the candidates.

In particular:

We make our expectation more explicit, with clear explanation of what we mean by production quality, and a warning that the code is expected to be robust with respect to input and errors.

We now link candidates to resources on defensive programming and the C standard library in the description of the code test.

We changed our target audience from Junior developers and graduates to target people with some relevant experience.

In case the submitted code fails in some way but would otherwise be accepted, we now provide a minimum test case that causes the error condition and give the candidates a chance to correct their mistakes (unless the code is rejected for some other reason). We'll also point out problematic lines/functions if appropriate.

The goal of the tests itself has now slightly changed from a front end filter to a chance to build a better picture of the candidate, in particular it will inform our phone discussion. That said, we are still willing to reject based solely on code.

[Update 2015-07-09]:
Andy Davis from Nujob has written an interesting and relevant article on the use of a code test from the candidate's perspective, and the article is worth looking at. Find it here.

答:
As others mentioned, junior positions may have little experience with C.  I personally only briefly was taught about buffer overflows in C and even if I could watch out for them, it is likely I would still introduce some (especially if given an assignment that lends itself to creating buffer overflows).  Likely, many junior developers will be a similar situation where they may know of buffer overflows, but they have not been prepared to identify and handle them in any extensive manner.

Given this, I would think the appropriate response is to have the issue brought up in the next possible interaction and ask them what they know about buffer overflows to test their overall knowledge.  After that, tell them that you found one in their supposed production ready code.  This would give you a good window to judge how they would react to correction and instruction.

Isn't the common thought that a junior developer who knows less but is willing and able to learn and improve is more valuable than a junior developer who knows more but who cannot or will not improve?

That being said, in one of your comments you mentioned you handed them tests that would have pointed out the buffer overflow in their code if they had used them.  So perhaps the bigger question is why didn't they run the tests (of if they did, why did they turn in buggy code)?

ContentLicense: CC BY-SA 3.0


问:
Is Moving Entity Framework objects over a webservice really the best way?
I've inherited a .NET project that has close to 2 thousand clients out in the field that need to push data periodically up to a central repository. The clients wake up and attempt to push the data up via a series of WCF webservices where they are passing each entity framework entity as parameter. Once the service receives this object, it preforms some business logic on the data, and then turns around and sticks it in it's own database that mirrors the database on the client machines.

The trick is, is that this data is being transmitted over a metered connection, which is very expensive. So optimizing the data is a serious priority. Now, we are using a custom encoder that compresses the data (and decompresses it on the other end) while it is being transmitted, and this is reducing the data footprint. However, the amount of data that the clients are using, seem ridiculously large, given the amount of information that is actually being transmitted.

It seems me that entity framework itself may be to blame. I'm suspecting that the objects are very large when serialized to be sent over wire, with a lot context information and who knows what else, when what we really need is just the 'new' inserts.

Is using the entity framework and WCF services as we have done so far the correct way, architecturally, of approaching this n-tiered, asynchronous, push only problem? Or is there a different approach, that could optimize the data use?

答:
There's no doubt you could optimize this application - any application can be optimized. But before you dive in are you sure you need to do this? Is there a problem with the current process - is it too slow, too expensive, is someone complaining? If you're just doing this as an iterative improvement & imagine you'll be a hero if you can reduce data transfer by 30%, the risks are far bigger than the benefits. Rewriting your service contracts will mean you'll need to add transformation code at each end, which means rehydrating EF objects and ensuring they have the correct state to reattach to the data context. It sounds easy but it's a big change.

You should definitely profile how expensive the EF objects are compared to equivalent DTOs. You're running on a hunch at the moment. How much data will you save by making this change?

Are there simpler, more obvious improvements? When optimizing WCF services in the past I've identified that a huge overhead in service request size was Windows Authentication headers - enormous security tokens being passed between client and server - which can be replaced with a much smaller certificate. Is all the data being sent completely necessary? I assume you're sending binary (net.tcp) rather than text (http), but if you're not that's an obvious improvement.

DTOs are a useful pattern, and they are championed heavily by MVC guys, but this isn't because of any data-saving concern - it's because they provide a service interface, an abstraction from the database. Without a DTO you add a dependency to your database model. This doesn't apply in your case because it seems you have the same database model on both ends. The simplest approach will be to send the EF objects over the wire and directly insert them, just as you're currently doing.

Reducing data traffic will save some money. How much money? Enough to warrant your time developing this solution, additional maintenance time due to increased application complexity?


问:
Do delegates defy OOP
I'm trying to understand OOP so I can write better OOP code and one thing which keeps coming up is this concept of a delegate (using .NET). I could have an object, which is totally self contained (encapsulated); it knows nothing of the outside world... but then I attach a delegate to it.

In my head, this is still quite well separated as the delegate only knows what to reference, but this by itself means it has to know about something else outside it's world! That a method exists within another class!

Have I got myself it total muddle here, or is this a grey area, or is this actually down to interpretation (and if so, sorry as that will be off topic I'm sure). My question is, do delegates defy/muddy the OOP pattern?

答:
But what does it really know? By passing in a delegate, such as a callback, event handler, factory method, etc, all that is known by the code that gets this delegate reference is that it has a reference to something it can or should call at a specific time, or for a specific purpose. It doesn't have to know exactly what that call will do (outside of any return value expected), where the actual code that will run lives, how it was chosen to be used as a delegate, etc. It needs no knowledge about this delegate other than it has it, and knows how to call it, which are the minimum requirements (in C# at least).

The delegate definition is therefore little more than a mini-interface; you define a delegate type, possibly named as to its ostensible purpose in consuming code, that expects a certain number of named parameters and is expected in turn to return a particular value. This is simplified even further with .NET 3.5's built-in generic delegate types like Action, Func, Predicate, Comparison etc; you don't even have to define your own strongly-typed delegate, just ask for a Func<string, string> (the downside being that general-purpose generics are, well, general-purpose and generic; you can't use the delegate type name or parameter names to self-document what the delegate is expected to do for the calling code, or what types of things you should give it).

It's similar, then, to a full interface definition, which defines a list of such methods, by name, with fully-defined signatures, all of which must be available in an implementing class. In Java, this is more or less how the same functionality you get with .NET delegates is achieved; an interface is defined with a single method representing the delegate method, classes exposing this method for use as a delegate are marked as implementing the interface, and a reference to the class is given, on which the method can be called. Delegates simply remove the middleman; you no longer care that the class containing the method implements any defined interface, you care that the actual method in question matches the required signature (here, signature is just parameter list and return type, not including method name). The class containing that method could then have a dozen methods with the same parameters and return type, but different names, and some machination your code doesn't have to care about can choose a specific one to give to you as a delegate.

Understand that while C# is considered an object-oriented language, it is also a multi-paradigm language, incorporating procedural and functional aspects of other languages into itself on request or demonstrated need. Delegates were a lesson learned by observing Java programmers and their travails of setting up simple event-driven, multi-tier applications in a strictly-enforced object-oriented paradigm, requiring hundreds of highly specific single-method interfaces. Java eventually worked around this problem by allowing anonymous interface implementations, so code that needed to inject an interface could define a one-off implementation inline, but it can still be a bit verbose. The rumor mill is also churning that Oracle has given in to popular demand, and lambda statements and other delegates will be part of the upcoming Java 8 specification (along with a lot of other syntax sugar goodness that Java devs are salivating over after looking across the fence to the C# side).

C++ avoided that by retaining the highly pointer-based flexibility of the C lineage, but its limitation was that, unlike interfaces, function pointers couldn't self-document; all you could know, without external documentation or traversing source code, is that you need to pass the address of a function, but you couldn't know anything about what parameters the consumer would try to pass, what it might expect as a return value, what your function might be expected to do and when it might be called, etc. As the ability to write self-documenting code was a key tenet of C#'s language spec, the designers combined the two, by allowing function pointers in a sense, but requiring a strong definition of the method's I/O signature as a type, allowing compiler-checked, self-describing function pointers without needing full interfaces.

Title: Do delegates defy OOP


问:
Should multi-threading be used for tasks which does not involve IO operation?
I was reading a book on OS and got confused between different terminologies.
I hope i will get my doubt cleared here.
These questions might be very basic for some experts, but i find this platform best suitable for such clarifications.

Processes are run by CPU and this whole operation is managed by OS.
For Single core CPU, at any instant only one process will be running.
CPU saves the state of a process to Process Control Block and starts running another process which was waiting and this switching is so fast that it feels like all processes are running simultaneously.

Need of different threads in a process was felt to get more fine-grained control over process , that means if process is waiting because of some I/O bound operation then even if this process is selected by CPU, it will not do anything.

So, if multiple threads are running under one process, then if one thread takes care of I/O activity , other threads can do some real computation, provided this process is selected by CPU.

Here are my questions:
Is Multi-threading effective only if task involved I/O activity?
Why is Multi-threading preferred over Multi-processing ? (is it because threads will share same memory space? )

Why Multi-core processors are better for multi-threading? (I think they will be better even if you don't use multi-threading, why so excitement in name of multi-threading?). And anyway threads in different processes will not share same memory, so two threads running in different processes on different cores are like running different processes. It is just that they will be parallel, and the real parallel, not the pseudo parallel.

答:
One of the main reasons for using threads even in a completely CPU-bound process is to allow interaction or update progress output via a UI of some sort. While running the calculation in the foreground without allowing interaction would be more efficient, the slight cost of task switching and handling UI events usually outweighs the penalty of forcing a user to wait indefinitely for a process.

Another case where running multiple threads on a single core would be more efficient is when a multi-stage process involves one stage that produces a lot of temporary results that are processed by a later stage. Running these stages in series might exhaust available memory. Running them in parallel allows the second stage to free up memory as it processes results.

Finally, as we add more caches to our architectures, threads can often become idle when a cache miss occurs while accessing memory. This gives some time for another thread to activate and do some work.

The main benefits of multi-threading over multi-processing include

shared memory

less overhead for context-switching

easier abstraction

Most modern operating systems provide some method of sharing memory across processes, too. Even still, allowing the OS or virtual machine to shift threads across multiple processors when available is very appealing. For example, when you move a multi-threaded Java program from a single-core machine to one with multiple cores, the JVM will automatically make use of those other cores.


问:
When does "proper" programming no longer matter?
I've been building an android game in my spare time. It's using the libgdx library so quite a bit of the heavy lifting is done for me.

While developing, I carelessly selected datatypes for some procedures. I used a hashtable because I wanted something close to an associative array. Human readable key values. In other places to achieve similar things, I use a vector. I know libgdx has vector2 and vector3 classes, but I've never used them.

When I come across weird problems and search Stack Overflow for help, I see a lot of people just reaming the questions that use a certain datatype when another one is technically "proper." Like using an ArrayList because it does not require defined bounds versus re-defining an int[] with new known boundaries. Or even something trivial like this:

```<code>for(int i = 0; i < items.length; i ++)
{
    // do something
}
</code>```

I know it evaluates item.length on every iteration. However, I also know items will never be more than 15 to 20 items. So should I care if I evaluate items.length on every iteration?

I ran some tests to see how the app performs using the method I just described versus the proper, follow the tutorial and use the exact data types suggested by the community. The results: Same thing. Average 45 fps. I opened every app on the phone and galaxy tab. No difference.

So I guess my question to you is this: Is there a threshold when it no longer matters to be proper? Is it ok to say - "so long as it gets the job done, I don't care?"

答:
If a furniture maker was making a piece of furniture to be used where the quality wasn't of utmost importance or where the quality might go unnoticed, should they still try to make their cuts straight, and do a proper job joining the pieces together?

Many people see software as craftsmanship. What we build shouldn't only perform a function, it needs to be reliable, maintainable, robust. Making such software requires skill, and that skill comes from practice.

So, even though the choice of a looping construct for what you are working on today may not matter, the fact that you strive to use the proper constructs at all times will, over time, make you a better programmer.


问:
Unit Tests work but there are still bugs?
Brief History

I am new to Automated Unit Testing and Mocking objects world; previously we used to do Unit Testing (including Integration Testing and we mistakenly referred that as Unit Testing) manually, but now we have planned to change all of that to I am pushing our organization to do Automated Unit Testing.

Problem is: I have a component for which I have written unit Tests (note: I am not using any TDD here, code is written first and then Unit Tests are written) covering each and every branch(if/ else or loops) of code. If I run the Unit tests suite it says that every method works as expected. That's good; but when I try to traverse the entire flow, I see there are many bugs( missing method) that should have been added. Is there a way to check this automatically?

Update
As per the below Answers from KeithS and Schleis, it seems that I need Functional tests (or integration tests). Are there some useful links on automated functional tests? I tried it on Google but they are all showing generic results talking about manual testing.

答:
You want functional tests that run through all components working together.  A test where you give your application an input and have it work with all the actual objects and then check your output.  These tests verify that the connection between the tests work (as well as mocked methods actually exist).

Even with writing tests, you want to have the entire application run either by yourself or a QA.  You will likely have missed things or not considered certain scenarios.


答:
There seem to be a few misconceptions underneath your question.

Although it is possible to have an architecture where each CPU has its own, dedicated, memory, this is not the case for multi-core processors. You might encounter such an architecture when working with super-computers or computing clusters.

In a multi-core processor, each core has its own cache, but the bulk of the memory (all the RAM) is shared between the cores. This means that it is possible for two threads of the same process (application) to be executing on different cores at the same time.

It is not the CPU that selects a task to execute, but it is (the scheduler in) the OS that selects the tasks to execute on each CPU. In this selection, only tasks will be considered where the OS knows that the task can make some progress. Tasks that wait for something (an IO operation to complete, a lock to be released, etc.) will not be considered for scheduling until the OS knows that the condition has been satisfied.

To answer your questions:

It is usually recommended to have a separate thread for user-interaction that does no long-running computations or potentially blocking I/O, because that improves the perceived responsiveness of the application.

It might also be beneficial to have multiple threads that perform computations, because they might get executed on different cores (if there are multiple cores available) and it can make the design of the application simpler, which is an advantage even if you only have a single CPU.

Multi-threading is often preferred over multi-process, because inter-thread communication is often easier to understand/specify than inter-process communication, because threads share the same memory. Also, depending on the thread implementation in the OS, task-switching between threads can be more efficient than task-switching between processes.

Title: Should multi-threading be used for tasks which does not involve IO operation?

Body:
I was reading a book on OS and got confused between different terminologies.
I hope i will get my doubt cleared here.
These questions might be very basic for some experts, but i find this platform best suitable for such clarifications.

Processes are run by CPU and this whole operation is managed by OS.
For Single core CPU, at any instant only one process will be running.
CPU saves the state of a process to Process Control Block and starts running another process which was waiting and this switching is so fast that it feels like all processes are running simultaneously.

Need of different threads in a process was felt to get more fine-grained control over process , that means if process is waiting because of some I/O bound operation then even if this process is selected by CPU, it will not do anything.

So, if multiple threads are running under one process, then if one thread takes care of I/O activity , other threads can do some real computation, provided this process is selected by CPU.

Here are my questions:
Is Multi-threading effective only if task involved I/O activity?
Why is Multi-threading preferred over Multi-processing ? (is it because threads will share same memory space? )

Why Multi-core processors are better for multi-threading? (I think they will be better even if you don't use multi-threading, why so excitement in name of multi-threading?). And anyway threads in different processes will not share same memory, so two threads running in different processes on different cores are like running different processes. It is just that they will be parallel, and the real parallel, not the pseudo parallel.


答:
Unit tests are just one level of the hierarchy of automated tests. Unit tests exist to verify that the code you (the developer) have actually written behaves the way you thought it should when you wrote it.

There are two caveats inherent in unit testing. First, coverage is not exercise. You may execute every line of code in your codebase via one or more unit tests, but if you do not assert, somewhere, that code which needed to do something actually did it, then as long as you don't get an exception, the test passes with or without the code doing this key thing.

Second, unit tests by definition exercise small, isolated pieces of your code (units), making sure each piece behaves the way the developer thinks it should. They don't test that these units play nicely with each other (that's an "integration" test), nor do they assert that the code, at any level, behaves the way the client thinks it should (that's an "acceptance" and/or an "end-to-end" test).

This second problem is your main issue in the case in point. You have 100% unit test coverage, but no integration testing, which would prove that the little pieces are put together the right way to do the larger job you expect. You also seem to have no automated acceptance testing, which approaches the entire program from the top down from the perspective of an end user. These are the levels of testing, which can be automated, that will identify your "missing" code based on failure to satisfy acceptance criteria.

Title: Unit Tests work but there are still bugs?

Body:
Brief History

I am new to Automated Unit Testing and Mocking objects world; previously we used to do Unit Testing (including Integration Testing and we mistakenly referred that as Unit Testing) manually, but now we have planned to change all of that to I am pushing our organization to do Automated Unit Testing.

Problem is: I have a component for which I have written unit Tests (note: I am not using any TDD here, code is written first and then Unit Tests are written) covering each and every branch(if/ else or loops) of code. If I run the Unit tests suite it says that every method works as expected. That's good; but when I try to traverse the entire flow, I see there are many bugs( missing method) that should have been added. Is there a way to check this automatically?

Update
As per the below Answers from KeithS and Schleis, it seems that I need Functional tests (or integration tests). Are there some useful links on automated functional tests? I tried it on Google but they are all showing generic results talking about manual testing.


问:
What is constructor injection?
I have been looking at the terms constructor injection and dependency injection while going through articles on (Service locator) design patterns.

When I googled about constructor injection, I got unclear results, which prompted me to check in here.

What is constructor injection? Is this a specific type of dependency injection? A canonical example would be a great help.

Edit

Revisiting this questions after a gap of a week, I can see how lost I was... Just in case anyone else pops in here, I will update the question body with a little learning of mine. Please do feel free to comment/correct.

Constructor injection and property injection are two types of Dependency Injection.

答:
I will try as much as possible to make this very elementary. That way, you can build on the concept and create your own complex solutions or ideas.

Now imagine we have a church called Jubilee, which has branches world wide. Our aim is to simply get an item from each branch. Here would be the solution with DI;

1) Create an interface IJubilee:

```<code>public interface IJubilee
{
    string GetItem(string userInput);
}
</code>```

2) Create a class JubileeDI which would take the IJubilee interface as a constructor and return an item:

```<code>public class JubileeDI
{
    readonly IJubilee jubilee;

    public JubileeDI(IJubilee jubilee)
    {
        this.jubilee = jubilee;
    }

    public string GetItem(string userInput)
    {
        return this.jubilee.GetItem(userInput);
    }
}
</code>```

3) Now create three braches of Jubilee namely JubileeGT, JubileeHOG, JubileeCOV, which all MUST inherit the IJubilee interface. For the fun of it, make one of them implement its method as virtual:

```<code>public class JubileeGT : IJubilee
{
    public virtual string GetItem(string userInput)
    {
        return string.Format("For JubileeGT, you entered {0}", userInput);
    }
}

public class JubileeHOG : IJubilee
{
    public string GetItem(string userInput)
    {
        return string.Format("For JubileeHOG, you entered {0}", userInput);
    }
}

public class JubileeCOV : IJubilee
{
    public string GetItem(string userInput)
    {
        return string.Format("For JubileCOV, you entered {0}", userInput);
    }
}

public class JubileeGTBranchA : JubileeGT
{
    public override string GetItem(string userInput)
    {
        return string.Format("For JubileeGT branch A, you entered {0}", userInput);
    }
}
</code>```

4) That is it! Now let us see DI in action:

```<code>        JubileeDI jCOV = new JubileeDI(new JubileeCOV());
        JubileeDI jHOG = new JubileeDI(new JubileeHOG());
        JubileeDI jGT = new JubileeDI(new JubileeGT());
        JubileeDI jGTA = new JubileeDI(new JubileeGTBranchA());

        var item = jCOV.GetItem("Give me some money!");
        var item2 = jHOG.GetItem("Give me a check!");
        var item3 = jGT.GetItem("I need to be fed!!!");
        var item4 = jGTA.GetItem("Thank you!");
</code>```

For each instance of the container class, we pass a new instance of the class we require, which enables loose coupling.

Hope this explains the concept in a nutshell.

Title: What is constructor injection?

Body:
I will try as much as possible to make this very elementary. That way, you can build on the concept and create your own complex solutions or ideas.

Now imagine we have a church called Jubilee, which has branches world wide. Our aim is to simply get an item from each branch. Here would be the solution with DI;

1) Create an interface IJubilee:

public interface IJubilee
{
    string GetItem(string userInput);
}

2) Create a class JubileeDI which would take the IJubilee interface as a constructor and return an item:

public class JubileeDI
{
    readonly IJubilee jubilee;

    public JubileeDI(IJubilee jubilee)
    {
        this.jubilee = jubilee;
    }

    public string GetItem(string userInput)
    {
        return this.jubilee.GetItem(userInput);
    }
}

3) Now create three braches of Jubilee namely JubileeGT, JubileeHOG, JubileeCOV, which all MUST inherit the IJubilee interface. For the fun of it, make one of them implement its method as virtual:

public class JubileeGT : IJubilee
{
    public virtual string GetItem(string userInput)
    {
        return string.Format("For JubileeGT, you entered {0}", userInput);
    }
}

public class JubileeHOG : IJubilee
{
    public string GetItem(string userInput)
    {
        return string.Format("For JubileeHOG, you entered {0}", userInput);
    }
}

public class JubileeCOV : IJubilee
{
    public string GetItem(string userInput)
    {
        return string.Format("For JubileCOV, you entered {0}", userInput);
    }
}

public class JubileeGTBranchA : JubileeGT
{
    public override string GetItem(string userInput)
    {
        return string.Format("For JubileeGT branch A, you entered {0}", userInput);
    }
}

4) That is it! Now let us see DI in action:

        JubileeDI jCOV = new JubileeDI(new JubileeCOV());
        JubileeDI jHOG = new JubileeDI(new JubileeHOG());
        JubileeDI jGT = new JubileeDI(new JubileeGT());
        JubileeDI jGTA = new JubileeDI(new JubileeGTBranchA());

        var item = jCOV.GetItem("Give me some money!");
        var item2 = jHOG.GetItem("Give me a check!");
        var item3 = jGT.GetItem("I need to be fed!!!");
        var item4 = jGTA.GetItem("Thank you!");

For each instance of the container class, we pass a new instance of the class we require, which enables loose coupling.

Hope this explains the concept in a nutshell.


问:
At what size of data does it become beneficial to move from SQL to NoSQL?
As a relational database programmer (most of the time), I read articles about how relational databases don't scale, and NoSQL solutions such as MongoDB do.
As most of the databases I have developed so far have been small to mid scale, I have never had a problem that hasn't been solved by some indexing, query optimization or schema redesign.

What sort of size would I expect to see MySQL struggling with. How many rows?

(I know this is going to depend on the application, and type of data stored. the one that got me thing was basically a genetics database, so would have one main table, with 3 or 4 lookup tables. The main table will contain amongst other things, a chromosome reference, and a position coordinate. It will likely get queried for a number of entries between two potions on a chromosome, to see what is stored there).

答:
It might also be worthwhile in mentioning that your data model has a big influence on things. If you find yourself needing to create some form of tree structure (ie you have a self referencing foreign key on a table that contains said foreign key in a compounded primary key) you should probably look at doing that in some form of database that handles those types of data really well (such as mongodb or couchdb).

Like other people have said you should also take into consideration what is happening in your application. if you really need ACID across multiple tables then you really do need to stick with a RDBMS, but if you have something where you can have some slightly stale data and you need the flexibility of a NoSQL schema (call it schemaless if you like but it still has some form of implicit schema) then you might consider grabbing a NoSQL store (http://www.10gen.com/customers/craigslist here is an example of why craigslist switched over... but admittedly they are archiving ~10TB of data, which I know doesn't fit into your small to mid sized database size at all. But the use case might be helpful).

Keep in mind that NoSQL systems are not necessarily there to replace RDMS's but in many instances you can supplement your RDBMS through the idea of Polyglot Persistence and you can store most of your data in an RDBMS but in specific niche instances you can offload some of your data to some form of NoSQL store.


问:
How big should a single commit be?
A discussion has come up at work and I want to get the opinion of other programmers.

During my time in college, we only used SVN for sourcecontrol. Everybody commits to the same server and all changes are pulled to all machines. In this system, it's easy when you should push your changes: when you're done with your changes. However, this makes merging changesets by multiple developers a complete nightmare.

However, for the past year or so that I've been programming professionally, we've been using Mercurial for source control. At first, I was using it like SVN: work on a featur, commit and push in one go, but only when it's finished.

Gradually, my habits started to change. I learned about branches, how commits could be a draft, public or secret and even used a USB stick as a central repository. My commits became smaller, but they increased in quantity. Instead of committing and pushing in one go, I would make commits for every change in a named branch.

Here's what the repository for one my personal projects looks like:

I see a couple of advantages in this approach.

Small commits mean they are focused on a single subject. Every commit gets a one-line description of the changes, which makes them easy to follow even after weeks of inactivity.

Named branches keep you on topic. If you're working in the "refactor-text-rendering" branch, for example, you shouldn't make changes to the math library, because that's not related to the branch's topic.

However, the lead developer is annoyed by my methodology. He feels that the small commits clutter up the repository's history. His preferred methodology is to work in a patch. When the feature is done, he merges the commits and pushes them in one go.

So, what do you prefer? A flow of consciousness history of commits or a patch of changes every now and then? Or something else entirely?

答:
I went looking for book references for this, but sadly cannot find them.

In general, I believe that small commits are widely considered to be best practice. Or more accurately: the smallest commit that represents a cohesive feature that is in a build-able state.

Why?

Small, frequent check-ins prevents you from losing work in case of hardware failure, earthquake, zombie apocalypse.

Your peers can get your changes sooner than if you wait until the end and make one huge commit.

If a feature needs to be rolled back, you can rollback one changeset not "half" of a changeset.

Smaller check-ins mean less area of change, which means less likely conflicts with other people's work.

Title: How big should a single commit be?


答:
I prefer your approach when using Mercurial.  Modern source control systems like Git and Mercurial are built around the idea that fast commits enable you to commit frequently.  You shouldn't save up a large number of changes and commit them in one go.

Git allows you to condense multiple commits down into a single commit using its "squash" feature, but this isn't provided by default in Mercurial.  Changing commit history goes against the Mercurial ethos, which states that history should be immutable.  However, if you do want to try and replicate Git's squashing feature - so that you can continue to use your tools properly whilst still adhering to the nutty behaviour of your lead dev - this question might help:

https://stackoverflow.com/questions/1725607/can-i-squash-commits-in-mercurial

Title: How big should a single commit be?

Body:
A discussion has come up at work and I want to get the opinion of other programmers.

During my time in college, we only used SVN for sourcecontrol. Everybody commits to the same server and all changes are pulled to all machines. In this system, it's easy when you should push your changes: when you're done with your changes. However, this makes merging changesets by multiple developers a complete nightmare.

However, for the past year or so that I've been programming professionally, we've been using Mercurial for source control. At first, I was using it like SVN: work on a featur, commit and push in one go, but only when it's finished.

Gradually, my habits started to change. I learned about branches, how commits could be a draft, public or secret and even used a USB stick as a central repository. My commits became smaller, but they increased in quantity. Instead of committing and pushing in one go, I would make commits for every change in a named branch.

Here's what the repository for one my personal projects looks like:

I see a couple of advantages in this approach.

Small commits mean they are focused on a single subject. Every commit gets a one-line description of the changes, which makes them easy to follow even after weeks of inactivity.

Named branches keep you on topic. If you're working in the "refactor-text-rendering" branch, for example, you shouldn't make changes to the math library, because that's not related to the branch's topic.

However, the lead developer is annoyed by my methodology. He feels that the small commits clutter up the repository's history. His preferred methodology is to work in a patch. When the feature is done, he merges the commits and pushes them in one go.

So, what do you prefer? A flow of consciousness history of commits or a patch of changes every now and then? Or something else entirely?


答:
There are valid arguments either way, on the one hand, source control isn't a backup mechanism, you should use shelving, a local repository or plain old backup to make sure your work is safe until committed to production. On the other hand, if a set of changes represent a complete and discrete bug fix, feature, etc. then it seems reasonable to commit them when ready. In the future, reviewing smaller, more "modular" commits may prove easier rather than wading through a revision with 100s of changed files.

Also, trying to maintain purity in a source control log seems like a losing game in the long run, and is focused on managing an artifact of the development process rather than the software itself.

Title: How big should a single commit be?


问:
When can you call yourself good at language X?
This goes back to a conversation I've had with my girlfriend. I tried to tell her that I simply don't feel adequate enough in my programming language (C++) to call myself good. She then asked me, "Well, when do you consider yourself good enough?"

That's an interesting question. I didn't know what to tell her. So I'm asking you.

For any programming language, framework or the like, when do you reach a point were you sit back, look at what you've done and say, "Hey, I'm actually pretty good at this."? How do you define "good" so that you can tell others, honestly, "Yeah, I'm good at X".

Additionally, do you reach these conclusions by comparing what others can do?

Additional Info

I have read the canonical paper on how it takes ten-thousand hours before you are an expert on the field. (Props to anybody that knows what this paper is called again)

I have also read various articles from Coding Horror about interviewing people. Some people, it was said, "Cannot function outside of a framework." So they may be "good" for that framework, but not otherwise in the language. Is this true?

答:
I'm going to take part of this question to be asking 'what are some criteria to evaluate my competence at a programming language'

I've found this matrix to be pretty useful in that regard. Most of the items are actually more about being a competent programmer in general, but once you get down the the Programming, Experience, or Knowledge headings you'll see some that depend on language used.

Of course, as with any somewhat-arbitrary divisions into categories it isn't perfect. But I think it is pretty useful nonetheless. It can give you at least some idea of where you are and where you should go.

ContentLicense: CC BY-SA 2.5


问:
Which layer does async code belong?
I am developing an application that consumes data from an external service.  The application is being implemented following a typical layered architecture with UI, Presentation, Domain and Data layers.  The service client resides within the Data layer.

As is typically the case, I do not want the UI to 'lock-up' while waiting for calls from the external service to complete.  However, implementing the service agents with asynchronous methods results in a complicate model chaining async methods up the layers so the UI can stay responsive.

For example:

In the ViewModel:

```<code>TheRepository.LoadDataAsync().ContinueWith(t => { _data = t.Result; });
</code>```

In TheRepository:

```<code>public Task<TheData> LoadDataAsync()
{
    return ServiceClient.GetDataFromServiceAsync();
}
</code>```

(Note, this is a significant over-simplification meant to convey what I mean by task chaining.)

Because the requirement is a UI requirement (prevent the UI from 'locking'), doesn't it make sense to keep the Domain and Data layers synchronous and leave it up to the Presentation layer to decide when it needs to perform some operation asynchronously?

On the other hand, it is so easy and natural to implement the service client/proxy with async methods (VS will auto-generate them if needed) because this is what we think of when we think about the need for async.

If the application was pulling data out of a database instead of making a service call, the layers wouldn't be any different and it shouldn't really change how the UI, Presentation or Domain layers have been implemented, right?  In this case, we wouldn't think twice about having the data access be synchronous.

Would it be a better design to model the Domain synchronously and leave it to the Presentation layer to address performance issues in the UI?  Or, in the emerging async world, should we just accept async as the norm and make everything fit this model?

答:
Whenever I deal with asynchronous web calls that populate UI data I start by throwing in a busy indicator of some sort (unless it is something that the end user does is not specifically waiting to happen). Once the data is ready I either place it in a property that gets synced with the UI on the next UI thread loop or marshal a message back to the UI thread depending on the type of application and what platform I am developing on. Here is a quick and dirty example in C#:

```<code>// Method executed in some other non UI thread!
private void OtherThreadMethod() {
    //Invoke the method that should change the control in the UI thread
    this.Dispatcher.BeginInvoke( UIThreadMethod );
}

private void UIThreadMethod() {
    //Perform the change of the control
    this.Cursor = Cursors.Wait;
}
</code>```

The goal being that if the user is waiting for something to happen or some background data needs to be handled the program should not just freeze and wait. For example if I am copying a file in Windows Explorer, I want to be able to browse my pictures while I wait.

Title: Which layer does async code belong?

Body:
Whenever I deal with asynchronous web calls that populate UI data I start by throwing in a busy indicator of some sort (unless it is something that the end user does is not specifically waiting to happen). Once the data is ready I either place it in a property that gets synced with the UI on the next UI thread loop or marshal a message back to the UI thread depending on the type of application and what platform I am developing on. Here is a quick and dirty example in C#:

// Method executed in some other non UI thread!
private void OtherThreadMethod() {
    //Invoke the method that should change the control in the UI thread
    this.Dispatcher.BeginInvoke( UIThreadMethod );
}

private void UIThreadMethod() {
    //Perform the change of the control
    this.Cursor = Cursors.Wait;
}

The goal being that if the user is waiting for something to happen or some background data needs to be handled the program should not just freeze and wait. For example if I am copying a file in Windows Explorer, I want to be able to browse my pictures while I wait.


答:
I'm almost certain there is a decent amount of opinion in this space, but I tend to follow some rules from which tend to dictate the size of commits, some thoughts about this:

Single commits should be "rollback-able", does your feature impact the working ability of the system if the commit is rolled out?  Commits should be cohesive units, and those cohesive units should "map" nicely (as possible) into the feature.

Branch privately where possible to shield the "ugly-ness" from your team, ultimately your commits, large or small, shouldn't impact their work on Feature B.

I think if you follow both of those rules of thumb, your commits may or may not necessarily be "large" or "small" (relatively speaking).  Sure small commits are nice, and sometimes easier to reason about, but if they're all strongly coupled together, it might make it a bit tougher to deal with.  I am ok with a "large" commit (within reason) as long as it's reduced to it's smallest cohesive functional grouping.

Title: How big should a single commit be?


问:
Using source code under LGPL in .NET, converted from JAVA?
I found one JAVA project useful to our commercial software which is developed using C#. The JAVA project is under LGPL. My understanding is (please correct me if I am wrong) if I use one compiled LGPL library (for example, .dll in Windows), I don't even need to disclaim the license information. But if I need to make some modifications in the source code, I need to include the LGPL license, and make my modification part which uses the library also under LGPL.

Since our software is in .NET, I clearly need to modify from the JAVA source code (starting by converting using Sharpen in Eclipse and then make some manual modification). So my question is, if I convert it to a C# project and compile as a library, and include the license when we are distributing it, is it enough? Do I need to make the source code of the whole new project available (upon request)?

答:
Covering a LGPL java program to C# is creating a derivative work, and the conversion must follow the terms of the lgpl.

So long as you keep a separation between the C# conversion and the rest of your code, you only need to provide source code to the conversion upon request of anyone to whom you give the program to.

(insert standard "I'm not a lawyer, ask your own or check with the java project owner" disclaimer here.)

OwnerDisplayName: tete


问:
How to factor in responsive design when providing an estimate for web applications?
In the past usually I have only had to estimate web applications based on browser support.  But for more recent projects device and platform support are also very important as well (screen resolution).

I am having a hard time providing an estimate to account for "responsive design".  How much additional time (estimate only) is needed to account for this over the entire implementation of a web based project?

答:
That depends entirely on how you go about your responsive design, how complex the structure of the site has to be, and how proficient you are at making it happen (as well as your billing style).

Generally speaking, though, I've seen recommendations for the ballpark of 50% more than a non-responsive site.

Again, though, it comes down to your methods. Mobile-first is generally regarded as less painful, because it's really largely "content first" and more progressive enhancement (in other words, your mobile first site won't crash and burn even on IE6). Conversely, some people work "desktop first," because they can knock out the "desktop" version faster, then retrofit the adjustments to make it responsive (in some cases, "graceful degradation").


问:
Subclassing to change default settings?
I have a class called Timeline. I want to allow several defaults in my code, such as a Timeline with a Start event (The details are not needed. All that matters is that I have a class, and I want to be able to have a few different default setting). Here are the options I thought of:

1) Following a GUI/Swing inspired idea, I might want to subclass the Timeline class and, in its constructor, use the public functions to set the default. Then, I could later just instantiate those objects instead of the superclass

2) A factory class could have functions like "getTimeLineWithExplosion" and set everything up.

Which of those two is the better idea? Is there a design pattern better than both of them?

PS: This is implemented in Java, but could easily be in another language.

答:
About your options.

I don't think subclassing here is a good idea. As I see you don't follow the "is - a" relationship here. If they have slightly different defaults - than it is different objects of the same class, but not different classes, since they don't have different behavior.

Factory option looks much better. You don't need to create new class for each new defaults you want. And factory abstracts the underlying logic nicely.

I propose you another idea. Implement something like "Builder" pattern, to achive constructions like this:

```<code>createTimeline().withStartEvent().build()
</code>```

or

```<code>createTimeline().withStartEvent().withAnotherDefault("def").andWithSomeAddition(42).build()
</code>```

I don't know Java well, but I sure this could be implemented, and won't be significantly harder then factory, but readability would be better (as for me).

If Java allows a way to declare implicit type conversions - you could end up without that build() call

Title: Subclassing to change default settings?

Body:
About your options.

I don't think subclassing here is a good idea. As I see you don't follow the "is - a" relationship here. If they have slightly different defaults - than it is different objects of the same class, but not different classes, since they don't have different behavior.

Factory option looks much better. You don't need to create new class for each new defaults you want. And factory abstracts the underlying logic nicely.

I propose you another idea. Implement something like "Builder" pattern, to achive constructions like this:

createTimeline().withStartEvent().build()

or

createTimeline().withStartEvent().withAnotherDefault("def").andWithSomeAddition(42).build()

I don't know Java well, but I sure this could be implemented, and won't be significantly harder then factory, but readability would be better (as for me).

If Java allows a way to declare implicit type conversions - you could end up without that build() call


答:
It is extremely difficult to provide any sort of flat "responsive design support" fee, percentage, or even algorithm, because in practice the devil is very much in the details.

The problem is (and what you absolutely must define in writing), what constitutes a "supported device"? By the gods, do not permit "mobile devices" and leave it at that. My first foray into that world was a trip to the school of hard knocks, and I'm endlessly grateful I wasn't on an hourly, contract, or time pressure.

The thing to know is you must treat each device and operating system version very much like you would an additional browser. As you are use to supporting multiple browsers, I'm sure you are familiar how much work can go into something as simple as "also, I want this to support Internet Explorer 7"; this can be easy, or it can be an amazing head ache depending on what technologies you are using.

Be aware that to many clients it's just another buzz word they don't fully understand. Maybe they just want their website/application to work on an iPad and iPhone/Android smart phone (last 2 versions of each with stock browsers), and that's it. Well, now you have at least 8 different new configurations to test, and in my experience even the newest/best tools from the top design softwares are unable to accurately tell you what's going to happen beyond a static HTML/CSS design; add in javascript and advanced features of any kind and all bets are off.

What about Windows RT and Surface? How about older Androids, or the first/2nd generation iPad? iPod touch? What tablet sizes and models must be supported? Will you need to test Firefox and Dolphin and Opera for mobile devices?

In practice, I quickly found (rather to my surprise) that using HTML/CSS/javascript/jQuery/SVG (uh oh) even in very basic ways generated a plethora of problems across devices. An app might look and work perfectly on Windows and Macintosh desktops of a dozen different screen resolutions and windows sizes, on Firefox, Safari, IE 7-9, and Opera, and you know how that can be. Then I found iPad didn't like a certain feature and wouldn't work, Windows RT exhibited bugs only otherwise encountered on IE <= 6 but when 'fixed' would randomly exhibit unreliable behaviors, and managed to completely crash all browsers on Android 2.2 and 2.3 but worked fine on newer devices.

Meanwhile, W3C validators and Adobe Browser Lab tools all reported no expected problems.

Bottom Line Advice

A multiple of 1.5-3X, depending on amount and age of devices supported, is not unreasonable. The only way to get better is to do it and get your hands on as many actual devices as you can manage and test, test, test. Its the new version of 1990s browser wars where the rules are made up and the points don't matter, you'll inevitably have to get dirty and spend whole days trying to fix one stupid thing that should work and works in 20 other platform tests but not on this one particular thing....

So define your terms, limit the officially supported devices (and specify models!), browsers, and configuration, and be prepared to feel like a bug-hunting noob. You an do it, just be prepared to spend significant amounts of extra time, avoid taking more than one job at a time to start with, and give yourself some intelligent leeway to avoid looking bad.

I'm personally a big fan of picking the most important configuration and delivering that, then locking down the other configurations on a staggered timetable. If it's all or nothing without incremental delivery you are asking for an unhappy client.

Most of all: good luck!

Title: How to factor in responsive design when providing an estimate for web applications?

Body:
In the past usually I have only had to estimate web applications based on browser support.  But for more recent projects device and platform support are also very important as well (screen resolution).

I am having a hard time providing an estimate to account for "responsive design".  How much additional time (estimate only) is needed to account for this over the entire implementation of a web based project?


问:
Big-O of this algorithm?

How can I describe the growth function in terms of n for the following algorithm?

What is the bounding function (the Big-O)? Is it O(n^3)?

```<code>for(i = 0 to n - 1)
{
    c = i + 1
    for(j = c to n)
    {
        arr[j] += arr[i];

        for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
    }
}
</code>```

答:
It is clearly O(n^3), since it involves three loops. And for every loop you have, upper bound of times is 'n'(even the innermost loop), because it doesn't involve constant in any loop. Hence it is n^3 solution.

I have written a dummy count program to verify the same

```<code>    int count = 0;
    for(int i = 0; i < 100; i++) {
        int c = i + 1;
        for (int j = c; j < 100; j++) {
            for(int k= c; k >= 0; k--) {
                count ++;
            }
        }
    }
</code>```

OwnerDisplayName: positiveimpact

Title: Big-O of this algorithm?

Body:
It is clearly O(n^3), since it involves three loops. And for every loop you have, upper bound of times is 'n'(even the innermost loop), because it doesn't involve constant in any loop. Hence it is n^3 solution.

I have written a dummy count program to verify the same

    int count = 0;
    for(int i = 0; i < 100; i++) {
        int c = i + 1;
        for (int j = c; j < 100; j++) {
            for(int k= c; k >= 0; k--) {
                count ++;
            }
        }
    }

OwnerDisplayName: Karthikeyan


答:
This is the rule in general :

for k nested loop you will have O(n^k) in the below case you will have O(n^3)

```<code>for(i = 0 to n - 1)
{
    c = i + 1
    for(j = c to n)
    {
        arr[j] += arr[i];

        for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
    }
}
</code>```

For k loops next to each other you will have kxO(n) which comes back to O(n)

like below :

```<code>       for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
       for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
       for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
</code>```

you have O(3xn) which is O(n)

You can also read this: https://stackoverflow.com/questions/766939/finding-big-o-with-multiple-nested-loops

Title: Big-O of this algorithm?

Body:
How can I describe the growth function in terms of n for the following algorithm?

What is the bounding function (the Big-O)? Is it O(n^3)?

```<code>for(i = 0 to n - 1)
{
    c = i + 1
    for(j = c to n)
    {
        arr[j] += arr[i];

        for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
    }
}
</code>```

Body:
This is the rule in general :

for k nested loop you will have O(n^k) in the below case you will have O(n^3)

for(i = 0 to n - 1)
{
    c = i + 1
    for(j = c to n)
    {
        arr[j] += arr[i];

        for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
    }
}

For k loops next to each other you will have kxO(n) which comes back to O(n)

like below :

       for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
       for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }
       for(k = c to 0 step -1) // what does the keyword "step" mean?
        {
            arr[k] *= arr[j];
        }

you have O(3xn) which is O(n)

You can also read this: https://stackoverflow.com/questions/766939/finding-big-o-with-multiple-nested-loops

OwnerDisplayName: Mehdi Karamosly


答:
The question is about complexity but first, I was curious to know if I could compute the number of times this algorithm is doing the multiplication.

The 2 last inner loops are doing c * (n - c) iterations. This is equal to nc - c².

The very first loop make the total number of iterations: sum(c=1 to n) of (nc - c²)

```<code>sum(c=1 to n) of (nc - c²)
= n*sum(c=1 to n) of c - sum(c=1 to n) of c²
= n*(n² + n) / 2 - (2n³ + 3n² + n) / 6
= (n³ - n) / 3
</code>```

So the number of iterations is (n³ - n) / 3 (answer to Q.1). And the complexity is then O(n³) (answer to Q.2).

Title: Big-O of this algorithm?

Body:
The question is about complexity but first, I was curious to know if I could compute the number of times this algorithm is doing the multiplication.

The 2 last inner loops are doing c * (n - c) iterations. This is equal to nc - c².

The very first loop make the total number of iterations: sum(c=1 to n) of (nc - c²)

sum(c=1 to n) of (nc - c²)
= n*sum(c=1 to n) of c - sum(c=1 to n) of c²
= n*(n² + n) / 2 - (2n³ + 3n² + n) / 6
= (n³ - n) / 3

So the number of iterations is (n³ - n) / 3 (answer to Q.1). And the complexity is then O(n³) (answer to Q.2).

OwnerDisplayName: Maxime


答:
I agree with the already posted answers. However, I would like to present an alternative way of obtaining an asymptotic lower bound without having to obtain the closed form.

Consider only cases of n>100. For over n/4 iterations, c is both greater than n/3 and less than 2n/3. Each of those iterations of the outer loop does at least n/3 iterations of the middle loop, each of which does at least n/3 iterations of the innermost loop. Thus the total number of innermost loop iterations is at least (n/4) * (n/3) * (n/3).

The number of innermost loop iterations is bounded above by n^3, because each of the three nested loops does no more than n iterations.

A function that is bounded below by (n^3)/36 and above by n^3 is Theta(n^3).

Title: Big-O of this algorithm?

OwnerDisplayName: Patricia Shanahan


问:
Dirty hack to avoid GPL licensing
I've just found something strange in a code written by company which I work for. In an embedded software where dynamic linking doesn't exists, shared library (released on a GPL licence) is copied into an object which is statically linked then. Here is a piece of a makefile:

```<code> $(TARGET_DIR)/$(PHOST)_P_LIBxxxxxx.o: $(TARGET_DIR)/$(BINIMAGE)
 $(ECHO) --- Storing dynamically linked library as ELF object ---
 $(QUIET)cd $(TARGET_DIR) && \
 powerpc-eabi-objcopy --input-target binary --output-target \
 elf32-powerpc --binary-architecture powerpc:common \
   --keep-global-symbol=_binary_$(PHOST)_P_LIB_xxxxxx_start \
   --keep-global-symbol=_binary_$(PHOST)_P_LIB_xxxxxx_end \
   --keep-global-symbol=_binary_$(PHOST)_P_LIB_xxxxxx_size \
   --rename-section .data=.rodata,alloc,load,readonly,data,contents \
   $(BINIMAGE)  $(PHOST)_P_LIBxxxxxx.o
 $(RM) $(TARGET_DIR)/$(BINIMAGE)
 $(ECHO)
 $(ECHO) --- P library ready ---
</code>```

Does it somehow bypass GPL rules? Or simply it's illegal?

答:
The first question, as @Steven Burnap asks, is whether the code in question is under the GPL or LGPL.  If it's under the GPL and you're linking it with your code in any way and you're not providing the source to your code, you're in violation.

If the code is under the LGPL, then you need to provide a way for a user to modify the LGPL portion.  This is usually done using dynamic linking, but it doesn't have to be.  Providing the object files of your application along with the source of the library is also permitted (so that the user could re-link your application against a modified library if desired).  This lets you avoid distributing your source code, although the object files have quite a bit of detail (symbol names, etc.) about how the source words.  You can provide a written offer to make the object files available, as long as you're willing and able to fulfill it if someone asks; odds are no one will ask.

In other words, what you're doing is legal only if you make your .o files available or offer to make them available upon request.

For more details, see section 6 of the LGPL 2.1 or section 4d of the LGPL 3.

OwnerDisplayName: doomed

Title: Dirty hack to avoid GPL licensing


答:
Look into the Prototype pattern.

Basically, create a base class with a virtual Clone method. For every set of defaults, create a subclass.

```<code>ITimeline
-- TimelineWithExplosions.Clone();
-- TimelineWithLasers.Clone();
</code>```

Make the Clone method static and each child becomes its own factory.

Title: Subclassing to change default settings?

Body:
I have a class called Timeline. I want to allow several defaults in my code, such as a Timeline with a Start event (The details are not needed. All that matters is that I have a class, and I want to be able to have a few different default setting). Here are the options I thought of:

1) Following a GUI/Swing inspired idea, I might want to subclass the Timeline class and, in its constructor, use the public functions to set the default. Then, I could later just instantiate those objects instead of the superclass

2) A factory class could have functions like "getTimeLineWithExplosion" and set everything up.

Which of those two is the better idea? Is there a design pattern better than both of them?

PS: This is implemented in Java, but could easily be in another language.

Body:
Look into the Prototype pattern.

Basically, create a base class with a virtual Clone method. For every set of defaults, create a subclass.

ITimeline
-- TimelineWithExplosions.Clone();
-- TimelineWithLasers.Clone();

Make the Clone method static and each child becomes its own factory.


答:
Take your commit history, for your personal project as an example. There's 13 commit messages for 1 day (ie. the "2 days ago"). Now imagine what that history would look like for the same time period if 50-200+ developers worked on the project in the same manner. That's 650-2600 commit messages a day. The commit history for a week would intractable for a human.

So it depends on the team size: On small teams, it's good detailed information. As the team gets larger it quickly explodes into a mess of noise, making the history functionally useless.

Title: How big should a single commit be?


问:
Organizing a git repository with several projects sharing code
I have several small projects running on different embedded hardware, and about 50% of their code is identical (typically some drivers, their operating system, and some libraries).

I want to merge those small projects into a single git repository so that it becomes easier to centrally maintain them, for example to update a driver.

However, when modifying the code shared between the different projects, let's say a driver, I don't want to have to test it on every hardware platform before pushing to the git repo. It  would not scale at all as to test the code for a given project I have to test it on a specific per-project hardware and if necessary correct the project-specific bugs which could be introduced by the modification of the shared code. It is a lot better to delay the testing of the shared-code modification on a given project the next time I want to modify this project.

At the moment, here is the solution I came with:
the directory structure would be as such:

```<code>                 .
                 |--shared_code
                 |--projects
                    |--projectA
                    |--projectB
                    |--projectC
</code>```

I would create a git branch per project, which would only represent until which commit the code was tested for a given project. Hence I would push code only to the master branch, and merge the code from the master branch to a project branch once it has been tested on this platform. Like this a project branch would always be in a stable (tested) state. The master branch would be unstable for most of the projects.

git structure:

```<code>                                             master
                                               |
  commits: 1 <-- 2 <-- 3 <-- 4 <-- 5 <-- 6 <-- 7
                 ^     ^                       ^
                 |     |                       |
  branches:      A     B                       C
</code>```

Is this the correct way to solve this problem? Is there a better solution?

答:
I would suggest to keep the shared code in its own repository, and projects in its own as well.

I suggest keeping stable code in master, and unstable code in branches.

For the shared code repo, I suggest making a branch for each project as needed. When you have tested code on all projects, merge to main.

I think it would be confusing to try to manage all projects together in the same repo.


问:
Will high reputation in Stack Overflow help to get a good job?
In a post, Joel Spolsky mentioned that 5 digit Stack Overflow reputation can help you to earn a job paying $100k+. How much of that is real?

Would anyone like to share their success in getting a high paid job by virtue of their reputations on Stack Exchange sites?

I read somewhere that, a person got an interview offer from Google because a recruiter found his Stack Overflow reputation to be impressive. Anyone else with similar stories?

答:
I hate to break it to you but...

High SO rep != great programmer

Actually, many of them are. However, there are some users that are on the site so much, answering so many questions but their average score per answer is very low yet that still have a 5 digit rep due to their high activity.

If there's enough data there, an interviewer could possibly read answers to gleen insights into their approaches to solving problems but to go on straight score would make a company look downright silly.


问:
Can certain expectations of behavior be part of an interface's contract?
Given the following code:

```<code>public interface IUserDataProvider {
    ICollection<SomeClass> getSomeClassRecordsForUser(int idUser);
}
</code>```

Is it possible to define (via documentation) an expectation that any implementing class returns null instead of an empty collection (or vice versa) when no records are found? I realize interfaces do not have explicit control over how they are implemented, but considering that interfaces are said to define a contract, I'm wondering how far the jurisdiction of that contract can rightfully extend.

Thanks in advance for your responses.

答:
The standard library also documents stringent contracts for its interfaces. Like Comparable which has quite a long list of behavior requirements.

Usually there are always some implied contracts when you have an interface. When you, for example, have a method getNewestRecord(), there likely is an (unwritten?) contract that it really returns the newest one, even though an implementation could technically return any record.

But when you create APIs for other people to use, it's generally better to follow the principle of least surprise. The behavior that null is returned when no records are found can be surprising for a consumer and the implementor of your interface. A better design would be to define the interface method with throws NoRecordsFoundException. That way it should be clear to both implementors and consumers what behavior is expected in that case. Also, the consumer can hardly forget to handle this case properly, because a try/catch block is required. That will likely save you from some NullPointerExceptions.


问:
What standards can be expected from graduate/junior engineers?
Are buffer overflows acceptable from a graduate developer? Are we setting the bar too high? What are the expected capabilities of graduate/junior engineers?

Context:

We are currently recruiting for a Junior Developer position working mainly in C on Linux.

As part of the process, we require candidates to complete a code test at their leisure in C.

So far we have rejected two candidates on the basis that their code, although readable and in one case rather idiomatic, suffered from buffer overflow errors due to unbounded buffer writes.

[Edit]:

We explicitly ask for error-checked, production quality code.

We provide a test & build framework for the candidates

[Update]:

As a result of this thread, and conversations we have had with other developers in person, we are changing the way we carry out code tests and who we target with our recruiting.

We decided that a candidate being unable to fix or understand a buffer overflow means that he would be unsuitable for the work we carry out, in particular he would take more mentoring than we are comfortable with. We will therefore still reject candidates that cannot eventually submit a robust code sample.

However, we have put in place some measures to make the recruitment process more productive for both us and the candidates.

In particular:

We make our expectation more explicit, with clear explanation of what we mean by production quality, and a warning that the code is expected to be robust with respect to input and errors.

We now link candidates to resources on defensive programming and the C standard library in the description of the code test.

We changed our target audience from Junior developers and graduates to target people with some relevant experience.

In case the submitted code fails in some way but would otherwise be accepted, we now provide a minimum test case that causes the error condition and give the candidates a chance to correct their mistakes (unless the code is rejected for some other reason). We'll also point out problematic lines/functions if appropriate.

The goal of the tests itself has now slightly changed from a front end filter to a chance to build a better picture of the candidate, in particular it will inform our phone discussion. That said, we are still willing to reject based solely on code.

[Update 2015-07-09]:
Andy Davis from Nujob has written an interesting and relevant article on the use of a code test from the candidate's perspective, and the article is worth looking at. Find it here.

答:
I see a few issues here.

The first is assuming that an average computer science graduate knows, well, anything. They don't. Quite frankly, I'm pleasantly surprised when I see a computer science graduate that knows how to install and setup Visual Studio. Heck, I recently worked with a guy claiming to have more than five years experience on the Microsoft stack writing .NET code that couldn't figure out what TFS was or how to connect.

The second is your very limited pool. We also have candidates do a programming test. There are five separate "programs" they have to write. They do it at home and ship the code over. The tests are extremely simple (no database, no external dependencies) and can easily be done using the Express version of Visual Studio. The tests themselves are easily completed by a senior guy in about 30 minutes. Note that we generally only do these for recent graduates on up to three years of verifiable work experience.

What we've quantified is that around 70% of those given the test simply never get back to us. Roughly 15% turn in stuff that won't compile, usually due to blatant syntax errors (for example, missing ;). Another 10% compiles but fails to perform the required actions.

This leaves a whopping 5%. At this point, we aren't even considering conditions such as entering an alpha character as input when a numeric one is required. It's purely on given a very limited set of X as input the application does the appropriate output. Also, these numbers come from about 500 candidates over the past four years: we kept statistics because we wanted to know.

If we were to look more at code structure and defensive coding techniques such as properly disposing unmanaged resources or usage of try .. catch statements then almost no one would pass.

The question, of course, is why?

Why can't a kid with a degree in this field from a four year university accomplish what are simple programming tasks? The answer is that colleges are completely out of touch with business needs and lag many years behind what we consider state of the art. 10 years ago coding standards were such that security was something you did after the fact; and unit tests weren't even in vogue yet.  Whereas today security better be at the forefront of your mind with every feature or enhancement. Just remember: most professors have either never actually worked in this field OR haven't worked in it for a long time. Once you know that, then you start to understand why they are so far behind. Worse, some of those professors spend too much time on a particular technology (Java, PHP, whatever) and fail to discuss serious foundational issues such as code structure or acceptable approaches (and WHY!).

Just a side example. A recent graduate was telling me about some of his experience writing a mobile OS for one of his classes, but he couldn't explain, even in basic terms, how a web server worked. He simply didn't know. 15 or 20 years ago was probably the right time for understanding how to make an OS. Today... not so much.  Yet this was a required class when a class on defensive programming would be so much more useful to them AND the outside world.

So, what do we do?

Out of those 5%, we will interview a bit further to get an idea of their personality and fit. Then we pick the "best" ones in full knowledge that we are going to spend around six months "reprogramming" them to get rid of the crap their professors filled them with.


答:
In laymans' words:

As the things you want to set are already exposed with public methods, you don't need to subclass.

Even if those things were not exposed, changing the value of protected members is not reason enough for subclassing. You should have another reason like needing to change some behavior.

The factory pattern ( 2nd option ) is a better option. There are some other creational patterns that you may want to consider but Factory is OK.

Title: Subclassing to change default settings?


答:
In laymans' words:

An empty collection is more elegant because the same code you use for traversing a populated collection, works fine with an empty one, only that nothing is processed. Example: a for each loop.

An empty collection is a valid object. Not having items is part of the valid state of a collection.

If having no items violates the business rules, then add a throw  a NoDataFoundException clause to the method signature in the interface

If for some reason you really want the method to return null in case no records are found, then name the method  getSomeClassRecordsForUserOrNull(), but I don't recommend it.

EDIT: the last two points are ways to let the implementors know you expect null instead of an empty collection.

Title: Can certain expectations of behavior be part of an interface's contract?

Body:
Given the following code:

```<code>public interface IUserDataProvider {
    ICollection<SomeClass> getSomeClassRecordsForUser(int idUser);
}
</code>```

Is it possible to define (via documentation) an expectation that any implementing class returns null instead of an empty collection (or vice versa) when no records are found? I realize interfaces do not have explicit control over how they are implemented, but considering that interfaces are said to define a contract, I'm wondering how far the jurisdiction of that contract can rightfully extend.

Thanks in advance for your responses.


答:
Of course it's possible to document an interface's expected behaviour in prose. But as long behaviour is only documented in prose, there is no guarantee that implementations will actually honour these requirements.

Right now I can think of two alternative ways of specifying expected behaviour in such a way that it becomes verifyable / testable:

Specify expected behaviour as a unit test and make the unit tests available to the end user:

@Test public void getSomeClassRecordsForUser_NeverReturnsAnEmptyCollection() {
    IUserDataProvider provider = …;
    Collection<SomeClass> result = provider.getSomeClassRecordsForUser(…);
    Assume.assumeNotNull(result);
    Assert.assertTrue(result.count() > 0);
}
```

<p>I've learnt about this approach from the book, "Growing Object-Oriented Software Guided By Tests". Basically, interfaces are characterized as "static" contracts ("What parts is a component made out of?"), with unit tests being the "dynamic" counter-parts ("How does a component interact with others?").  </p></li>
<li><p>Use Design By Contract. Some languages support this directly (e.g. Eiffel), others support it through a library and/or compiler extensions; e.g. with .NET's Code Contracts:</p>

<pre class="lang-csharp prettyprint-override"><code>[ContractClassFor(typeof(IUserDataProvider))]
public class IUserDataProviderContract
{
    public ICollection<SomeClass> GetSomeClassRecordsForUser(…)
    {
        Contract.Ensure(result == null || result.Count > 0);
    }
}
</code>```

(Whenever program execution crosses a method boundary, pre-conditions and post-conditions are verified. Depending on the language and/or library used, these check may even be performed at compile-time.)

Body:
Of course it's possible to document an interface's expected behaviour in prose. But as long behaviour is only documented in prose, there is no guarantee that implementations will actually honour these requirements.

Right now I can think of two alternative ways of specifying expected behaviour in such a way that it becomes verifyable / testable:

Specify expected behaviour as a unit test and make the unit tests available to the end user:

@Test public void getSomeClassRecordsForUser_NeverReturnsAnEmptyCollection() {
    IUserDataProvider provider = …;
    Collection<SomeClass> result = provider.getSomeClassRecordsForUser(…);
    Assume.assumeNotNull(result);
    Assert.assertTrue(result.count() > 0);
}

I've learnt about this approach from the book, "Growing Object-Oriented Software Guided By Tests". Basically, interfaces are characterized as "static" contracts ("What parts is a component made out of?"), with unit tests being the "dynamic" counter-parts ("How does a component interact with others?").

Use Design By Contract. Some languages support this directly (e.g. Eiffel), others support it through a library and/or compiler extensions; e.g. with .NET's Code Contracts:

[ContractClassFor(typeof(IUserDataProvider))]
public class IUserDataProviderContract
{
    public ICollection<SomeClass> GetSomeClassRecordsForUser(…)
    {
        Contract.Ensure(result == null || result.Count > 0);
    }
}

(Whenever program execution crosses a method boundary, pre-conditions and post-conditions are verified. Depending on the language and/or library used, these check may even be performed at compile-time.)


问:
Are areas a good organizational feature, or just extra work?
Do Areas in ASP.NET MVC end up being a help or just a drag in the end (because of the URL construction)? Would it be better to have subdirectories inside the main Controllers folder? or are there any other options to organizing a project?

EDIT

For example, this is your average link without Areas:

```<code>@Html.ActionLink("Home","Index","Home")
</code>```

and this is your average link with Areas:

```<code>@Html.ActionLink("Home","Index", new { Area = "", Controller = "Home"})
</code>```

Could the following work? (Main controller with subdirectories)

I'm just trying to find out if implementing Areas in a project is worthwhile, because I also read that it can be problematic when using Dependency Injection. And is there an alternative to Areas?

答:
In 2013, I think the telling sign is that they were shoved under the carpet by Microsoft and my personal experience has been rather ugly -- if something was big and complex enough to need separate areas I would probably build separate apps and stitch them together using reverse proxies and service calls rather than employing areas directly.

As for your project, it is hard to tell what you are trying to do. If you just want to namespace your controllers a bit and use more than the default routing, that certainly works -- you'll need to tell MVC where to find them when you declare the routes using the string[] namespaces parameter on your route declarations. Linkage would use the standard actionlink options -- with no controller.


问:
How to use my proprietary framework on a new job without making it open-source?
I have been working on a framework for years. It is solid, extensive and tested. It is exactly what the employer needs for the foundation of its new project. There is no point in rewriting the whole thing from scratch or using a competing open-source alternative.

My desire is to give a free, non-exclusive, non-redistributable license to the employer for access to the binaries and sources, so the employer can change the code. I understand that the employer cannot depend on closed-source code so I am willing to give my sources to the employer for free (the equivalent to two years of my work for free). I just want to protect my copyright and prevent the employer from giving the code to someone else. I believe many programmers will find themselves in this situation when starting a new job.

However, making it open-source is out of question for a variety of reasons that do not matter for the purpose of this question.  I want to keep the source closed, but provide a free copy under a non-exclusive, non-redistritubable license.

So my questions are:

When do I bring it up that I have a framework that I would like to use? Probably before I take the job because if they don't want to use it OR don't accept my license I am not taking the job.

What kind of license should I use to make this deal with my employer?

Any other considerations or comments?

UPDATES:

One thing I can say is that there are other companies using the software (with licenses) so I cannot make it open-source or simply transfer the copyright to my new employer, which is what actually happens if you use it in your job without having this discussion.

答:
If you won't take the job if they won't use the framework then you must bring it up before accepting an offer.

If I was the company there is no way I would use your code without a license that allows the company to do pretty much anything it wants to with the code. Restrictions that seem reasonable to you now might cause problems for the company in the future as business needs change.

The BSD or Apache license might be acceptable to the company but it sounds like that might be more free than you would like.

But, in any case, because money is involved (directly or indirectly) I would recommend you get a lawyer involved in the details of the negotiation if it gets that far.


问:
Solving which bugs will give greatest cost benefit
I wanted to get an idea of categorizing bugs based on how easy is it to solve and how much benefit it will give me. for e.g., if there is a bug which will take say an hour (double file close etc.) to solve vs another which takes a day (segmentation fault). But if solving the first bug is not very important, then I'll probably work on the second one.

Is there a practical method or an approach to categorize bugs based on cost-benefit or similar metric?

Let's say it is possible to categorize bugs based on bug characteristics e.g. security vulnerability, memory error, logic error etc. On the other dimension there could be parameters like difficulty (easy, medium, hard). Are there other dimensions I should be looking for. To simplify things, I can assume two things:

Every programmer in the team is equally capable of solving any bug

There is no deadline

答:
The problem you are describing is very common and the best answer might be "use your gut feeling".

I usually divide bugs in three categories: Crashing, Annoying, Cosmetic (they might be called 1, 2, 3 - that doesn't really matter) and then put down an overall estimate on the time needed to fix every bug (all bugs must have a rough updated estimate at all times).

When solving bugs Crashing > Annoying > Cosmetic and then I simply do a "shortest job first" to get as much initial throughput as possible.

I find it VERY difficult to calculate any kind of direct financial benefit from solving any bug - unless it is a very tightly scoped paid job.

One note you might need is that you really should live up to the fifth point on The Joel Test - this might be influenced by team size and distribution among various other "local" issues - but it is generally a sign of good practice.

ContentLicense: CC BY-SA 4.0


答:
Never deliberately make a commit that will leave the repository in a broken state, even if you intend to shortly make another that will fix it.

Prefer small commits to large commits. When tracking down the source of some issue by chopping through the repository, it is easier to track down the source of a problem if the steps are small; and it is easier to quickly understand the changes in a small commit.

Prefer a single commit for a single feature, fix or other logical unit of work; avoid "partial" commits that introduce changes that are not functional without further commits, and avoid compound commits that contain several unrelated changes. If you are making a stylistic change that does not change functionality, commit that separately. All this increases the likelihood of leaving the build unbroken, and makes it much easier for another person unpicking codebase issues to understand the sequence of functional changes that took place and to grasp each individual change quickly.

If you are working on a very complex feature or refactor that cannot be made safe or useful to commit while partially written, work on a private branch, commit to that often, try to stay up to date with trunk, and if at all possible, when finally merging to trunk, do so in a manner that leaves future maintainers a way to get at the private branch's history.

So, to sum up: always aim to make the smallest commit you can that is both necessary and sufficient to complete a single logical unit of work.

Title: How big should a single commit be?


答:
As a potential employer, this would set off a lot of red flags for me.

Proprietary frameworks are typically significantly less used, documented and tested than their competition. More eyes = more bugs found/fixed, more documentation written, etc.

It shows you oppose standardization in your community. What's wrong with the existing frameworks? You are assuming yours is better. Unless you're hiring for a lead role, this is usually a negative for me.

You're already causing legal problems for you and the company. I'd only consider this if it was MIT or similar licensing (I can do whatever I want) - anything else is severely limiting in the future. Nobody wants to deal with IP issues, and creating them at hiring-time is a horrible idea. Considerations: what if the company or product changes ownership? What if they try and raise money? If you've already left, there is a potential law suit waiting to happen.

It suggests you like to hoard knowledge and do things that better you rather than the community or your company. If you leave the team, are they left in a tight spot?

Typically, these types of frameworks are useful for you, but actually detrimental to the technical team working with it -- no matter how good it is.

Title: How to use my proprietary framework on a new job without making it open-source?

Body:
I have been working on a framework for years. It is solid, extensive and tested. It is exactly what the employer needs for the foundation of its new project. There is no point in rewriting the whole thing from scratch or using a competing open-source alternative.

My desire is to give a free, non-exclusive, non-redistributable license to the employer for access to the binaries and sources, so the employer can change the code. I understand that the employer cannot depend on closed-source code so I am willing to give my sources to the employer for free (the equivalent to two years of my work for free). I just want to protect my copyright and prevent the employer from giving the code to someone else. I believe many programmers will find themselves in this situation when starting a new job.

However, making it open-source is out of question for a variety of reasons that do not matter for the purpose of this question.  I want to keep the source closed, but provide a free copy under a non-exclusive, non-redistritubable license.

So my questions are:

When do I bring it up that I have a framework that I would like to use? Probably before I take the job because if they don't want to use it OR don't accept my license I am not taking the job.

What kind of license should I use to make this deal with my employer?

Any other considerations or comments?

UPDATES:

One thing I can say is that there are other companies using the software (with licenses) so I cannot make it open-source or simply transfer the copyright to my new employer, which is what actually happens if you use it in your job without having this discussion.


问:
BDD and behavior based on complex state
I'm wondering how to write BDD test cases for a real system. All examples I can find are trivial and do not answer the question.

Sample use case/story basically goes like that:

User is on the main application page

He clicks retrieve to fetch some order to work on

He fills 4 textboxes and hits submit.

Something happens

The next order is presented to the user

So, point 4 is a little vague, but there is a lot of logic involved, there's a workflow underneath, etc. You could basically define it this way:

```<code>Given order of types A+B+C+E+F (20 possible values with arbitraty combination)
  and subtype a1 and the order has attribute X = 1, attribute Y=asdasd, (and much more)
When user enters some specific kind of value in here, and other in here and clicks submit
Then order does this, this, this, this, this, this and that
</code>```

It does not look good...

So the other way is to write:

```<code>Given the order with type A (and the rest is "default")
When user does ...
Then the order does things-depentant-only-on-A
</code>```

Seems nicer, but - is it really the right approach to define that "default state" of the system? It cannot be arbitrary because "things-dependant-only-on-A" are not really independant - they might not even get a chance to kick in if do-not-take-A-into-account-flag is on, or any other weird special case.
(yes, my current project is: some not too complex logic + man-years of special cases)

A note - when we describe requirements we sometimes specify parameters required for the story to make sense, sometimes not - it works for us, because we know other stories. But in BDD it seems that the test case should be specific and unequivocal.

答:
You should be describing it using terminology that makes sense to the business, not to a HTTP client. For example,

```<code>Scenario: Mark Order as Pending
  Given we have an Order Y        // creates order
   When the user edits Order Y    // click/load edit page
    And marks it for review       // toggles tickbox #3
   Then it should show up in the pending review list
</code>```

BDD is all about describing the intended behaviour.  Focus less on describing implementation. While the latter is easier, and typically what you see in tutorials, you end up with a ton of repetition and confusing tests.

Title: BDD and behavior based on complex state

Body:
You should be describing it using terminology that makes sense to the business, not to a HTTP client. For example,

Scenario: Mark Order as Pending
  Given we have an Order Y        // creates order
   When the user edits Order Y    // click/load edit page
    And marks it for review       // toggles tickbox #3
   Then it should show up in the pending review list

BDD is all about describing the intended behaviour.  Focus less on describing implementation. While the latter is easier, and typically what you see in tutorials, you end up with a ton of repetition and confusing tests.


问:
Why would you use MVC over Web Forms?
Recently an architect described our company as offering a Rolls-Royce solution (MVC) when all he needed was a Toyota (Web Forms).

I'm curious to find out what you think about web forms vs MVC as an architectural choice.

答:
An ASP.NET MVC solution doesn't have to be any more complicated than a WebForms solution. Personally, I find ASP.NET MVC to actually be a lot simpler than WebForms, and it definitely seems to be inherently cleaner.

From my experience, a lot of the MVC frameworks (ASP.NET, Rails, CodeIgniter, etc.) have much of the same core functionality and conventions. WebForms is really the odd duck from a web perspective. My guess is most web programmers would be much faster at picking up ASP.NET MVC than WebForms.

Title: Why would you use MVC over Web Forms?