问:
How to protect my php code running on a client server?
I'd like to ask how to protect my code that is running on a client server from being altered and/or copied.

It's running on Ubuntu Server with the standard Apache Php Mysql stack.

Any software needed would preferably be open-source.

I'd also like to terminate the application when there is a license problem.

Doing this using my code is possible but since it's php the client could alter the code to prevent this from happening.

答:
Any software needed would preferably be open-source.

To the best of my knowledge, you're out of luck on this one. Making PHP 'encryption' is a business, and open sources solutions just won't/don't cut it as well (from the ones I found, it took me under 10 minutes to defeat them because all they really did was base64_encode the code, rotate it a few times, then eval the reversed process in order to execute the code. Replacing eval with echo made it trivial to defeat. The best one I saw used magic variables like __LINE__ in order to prevent this kind of thing, but was still pretty easily defeatable for any experienced PHP dev once you noticed this.).

IonCube is still pretty hard to defeat, you have to pay someone upwards of $5 - $8 per file to decrypt it. If you have a lot of files: this is a financial barrier. They also have licensing options so you can prevent the code being copy/pasted onto other servers and just run as-is.


问:
How can I track quality attributes on my team's Kanban?
My team uses a Kanban system for tracking day-to-day progress and it's worked out really well for understanding progress on features (captured as user stories).  We have largely allowed our system design to emerge as we develop features which worked out well until recently.  In the last two week we've had several discussions about architectural trade-offs specifically related to performance and modifiability quality attributes.

I think what's happening is as we implement features and design the system, we're implicitly making decisions about the architecture but not considering those decisions in terms of our known quality attribute requirements.  It would be really great if I could track/capture/visually depict how these important design decisions are being made so team members have a better chance to not create additional tension with in the system's architecture as it is being implemented.  And of course, to complicate things more, features on our board aren't exclusively functional and sometimes hide architectural complexity!

How can I track progress on quality attributes (or other architecturally relevant decisions) visually on my team's kanban?

答:
we're implicitly making decisions about the architecture but not considering those decisions in terms of our known quality attribute requirements.

I think you can visualize this by creating a "architectural review" step in your workflow.  The step would be represented by a Kanbad board column with its own WIP limit.  The WIP limit will depend on how many architects/designers you have to participate in these reviews.

The development team is responsible for the horizontal, left-to-right flow of user stories.  The architect(s) will, in most cases, touch the stories only when they are in the architectural/technical review column.  The intersection of the column with a horizontal swimlane visualizes the meeting of developer(s) and architect(s).

One of the teams where I work has a similar step where they do a database schema review with the chief data architect.  They don't use Kanban, but if they did, they would be very likely to have this column on their board.

The known quality attributes could then be represented as:

the definition of done for the architectural review step.

acceptance tests around the already-done user stories representing non-functional requirements.  Then the definition of done for a new user story would include not breaking those tests.

ADDED: The "architectural review" workflow step may be suspect to a problem called tragedy of the commons.  Here is a great blog post about how Kanban visualization can help deal with it and possible solutions.

ContentLicense: CC BY-SA 2.5

ContentLicense: CC BY-SA 3.0


问:
How much to test in TDD?
I am newbie to TDD (writing first project following TDD practices).

I have fairly basic interface IProfiler and an implementation Profiler.

```<code>interface IProfiler
{
  bool IsBusy {get;}
  long Elapsed {get;}
}
</code>```

A Simple Test

```<code>    IProfiler profiler = default(Profiler);
    [TestInitialize]
    public void Initialize()
    {
        profiler = new Profiler();
    }

    [TestMethod]
    public void ProfilerInitializationTest()
    {
        Assert.AreEqual(false, profiler.IsBusy);
        Assert.AreEqual(true, profiler.ElapsedMilliSeconds == default(long));
    }
</code>```

The question is : As I will have more state, Number of asserts will increase. Should I keep separate Assert to test each field or should i include all here, or should I group into 3-4 similar asserts?

答:
Stick to one assertion per test, but not necessarily one Assert.

In my experience, the best way to get the right balance, is to name each method Should...

In your example, that would be ShouldInitializeWithCorrectDefaults(). That is a single assertion, regardless of how many Assert methods you call. As soon as I run into a situation where I'm struggling to not use "And" in my method name, I suspect I'm testing too much.

Also, try to keep in mind the question, "if I introduce a bug here, how many tests will break?" The ideal (but not always practical) answer is 1. I introduce a bug which stops it initializing correctly, the ShouldInitializeWithCorrectDefaults() test should break, because it should and now it doesn't.

Unfortunately, initialization is one of those examples where you'll probably break every test in the class. Which raises the question, why bother testing it by itself? Sometimes there are good reasons, but often you just go in and think, "Well, I'll know that if every test breaks, it's something common to every test, which is probably class instantiation. So does it need its own test?"

Title: How much to test in TDD?


答:
Dan North answered this question with BDD in 2006, this might interest you:

http://dannorth.net/introducing-bdd/

To sum up the idea, we need a paradigm shift and stop thinking about tests but more about specifications/behaviour.

When we write our test we want first to write a specification of the object we are going to implement.

By following this philosophy we quickly find out that our "test" methods name should actually be a sentence that describes an expected behaviour. That's because we want to read a specification and not tests.

We also want to keep our "tests" methods name short, because it's easier to read and enforce the idea that the object under specification should have one Responsibility (SRP).
That's why we encourage the one assert per test guideline.

As an example if we would write a specification for your Profiler, the test method name could be:

```<code>Profiler

    ShouldNotBeBusyWhenCreated

    ShouldHaveNotSpentAnyTimeInProfilingWhenCreated
</code>```

Which reads nicely as a specification. If you were to put all your asserts in one test then the specification would read as a long sentence like

```<code>Profiler

    ShouldNotBeBusyAndHaveNotSpentAnyTimeInProfilingWhenCreated
</code>```

Which is not really nice, specially when the test fails you wouldn't be able to figure out precisely for which reason it's failing.

If you come back to your specification weeks later, you should be able to understand what the object is supposed to do by just reading your "tests" methods names.

Title: How much to test in TDD?

Body:
I am newbie to TDD (writing first project following TDD practices).

I have fairly basic interface IProfiler and an implementation Profiler.

```<code>interface IProfiler
{
  bool IsBusy {get;}
  long Elapsed {get;}
}
</code>```

A Simple Test

```<code>    IProfiler profiler = default(Profiler);
    [TestInitialize]
    public void Initialize()
    {
        profiler = new Profiler();
    }

    [TestMethod]
    public void ProfilerInitializationTest()
    {
        Assert.AreEqual(false, profiler.IsBusy);
        Assert.AreEqual(true, profiler.ElapsedMilliSeconds == default(long));
    }
</code>```

The question is : As I will have more state, Number of asserts will increase. Should I keep separate Assert to test each field or should i include all here, or should I group into 3-4 similar asserts?

Body:
Dan North answered this question with BDD in 2006, this might interest you:

http://dannorth.net/introducing-bdd/

To sum up the idea, we need a paradigm shift and stop thinking about tests but more about specifications/behaviour.

When we write our test we want first to write a specification of the object we are going to implement.

By following this philosophy we quickly find out that our "test" methods name should actually be a sentence that describes an expected behaviour. That's because we want to read a specification and not tests.

We also want to keep our "tests" methods name short, because it's easier to read and enforce the idea that the object under specification should have one Responsibility (SRP).
That's why we encourage the one assert per test guideline.

As an example if we would write a specification for your Profiler, the test method name could be:

Profiler

    ShouldNotBeBusyWhenCreated

    ShouldHaveNotSpentAnyTimeInProfilingWhenCreated

Which reads nicely as a specification. If you were to put all your asserts in one test then the specification would read as a long sentence like

Profiler

    ShouldNotBeBusyAndHaveNotSpentAnyTimeInProfilingWhenCreated

Which is not really nice, specially when the test fails you wouldn't be able to figure out precisely for which reason it's failing.

If you come back to your specification weeks later, you should be able to understand what the object is supposed to do by just reading your "tests" methods names.


问:
OO Design related questions in technical interviews
I've been attending quite a few interviews recently and have been asked by companies to answer "design a [insert model]" questions more than a few times.

Is this normal in the industry nowadays? I've been in the software world for more than two  decades and have attended my share of interviews, but I am seeing this pattern in interviews emerge only recently.

I feel the question is very open ended. For example: I was asked to draw a class diagram to "Design a parking lot". I am not sure what level of detail the interviewer is expecting. This was in an online test where I was expected to attach a visio diagram, so I couldn't ask them what their expectations were.

Do you use these kind of questions in your interview process? Are they related to only class diagrams or do you also ask sequence, flowcharts and ERDs (ofcourse based on the nature of the position) Have they been effective in your hiring process?

* Edit for Kevin's response *

For example: A complete question could be "Design a parking lot management system that can be used to find vacant slots"

I can be done with 2 classes, ParkingLot and Slot or I could go on to add IVehicle and Vehicle and Car and Motorcycle classes. Where do I draw the line?

```<code>public class ParkingLot
{
   IVehicle Vehicle {set; get;}

   List<Slot> GetEmptySlots() { };
}

public class Vehicle : IVehicle
{
  Slot SlotNum {set; get;}
}

public class Slot
{
  int Row {set; get;}
  int Column {set; get; }
}
</code>```

答:
The OOP questions are open-ended. There is no right or wrong answer, but there are some principles the interviewers expect to see (like using a constructor to initialize variables, keeping your methods small, using encapsulation/composition/polymorphism/inheritance when applicable, etc).

Always expect data structure, OOP, and database related questions in interviews, they are very common. Books like "cracking the coding interview" and "programming interviews exposed" can help you to prepare.


问:
would like help understanding javascript throttle function
A user on Stack Overflow posted a question related to overriding a native JS function. The question is here and this is the code:

```<code>function throttle(fn, time) {
  var handle;

  var execute = function() {
    handle = null;
    fn.apply(this, arguments);
  };

  var throttled = function() {
    if(!handle) {
      handle = setTimeout(execute.bind(this), time);
    }
  };

  throttled.toString = function() {
    return fn.toString() + "\n// throttled to " + time + "ms";
  };

  return throttled;
}

var makeAjax = throttle(function(callback) {
  $.getJSON("/path", callback);
}, 500);
</code>```

I have a pretty good handle (I think) on JavaScript, but there are some areas that remain very grey to me. I would like to know what is happening in this code?

I don't really understand what bind and apply are doing, or what the end result of this all would be. I've looked up bind and apply on Mozilla's JS documentation, but the "official" definition has done little to help me understand what they are doing in this context.

I appreciate your help!

答:
I found it quite hard to read as well, context juggling code is in general hard to read, and therefore error-prone.

this in JavaScript often refer to the parent of the function, that is, when a function is stored as the field of an object like:

```<code>function fun(){
    return this
}
obj = {f:fun}
</code>```

Calling obj.f() will return obj, simply calling fun() however will return the window element as the function is not called as a member, so the value of this depend on context. When making a wrapper like the one you show the context for this will invariably change, the bind and apply methods are made for dealing with situations like that. fun.bind(cont) will make a version of fun where this is always cont. fun.apply(cont,args) will run fun with this set to cont and the values in the array args as parameters.

The code in question demonstrate how convoluted these things get by failing to pass the given arguments to the function. The real parameters are passed to throttled, but the arguments array that is used come from execute, it is empty.

Using the bind function is unnecessary, this could just as well be stored in a simple variable.

Here is a fixed, and in my opinion easier to read, version, along with code that demonstrate the functionality:

```<code>function throttle(fn, time) {
    var handle;
    function throttled() {
        var args;
        var context;
        if(!handle) {
            args = arguments;
            context = this;
            handle = setTimeout(execute, time);
        }

        function execute() {
            handle = null;
            fn.apply(context, args);
        };
    };

    throttled.toString = function() {
        return fn.toString() + "\n// throttled to " + time + "ms";
    };

    return throttled;
}

obj = {
    toString:function(){
        return "obj's toString";
    }
    ,f:throttle(function(input){
        console.log(input+", "+this);
    },1000)
}
obj.f("input string 1")
obj.f("input string 2")
obj.f("input string 3")
obj.f("input string 4")
</code>```

Body:
I found it quite hard to read as well, context juggling code is in general hard to read, and therefore error-prone.

this in JavaScript often refer to the parent of the function, that is, when a function is stored as the field of an object like:

function fun(){
    return this
}
obj = {f:fun}

Calling obj.f() will return obj, simply calling fun() however will return the window element as the function is not called as a member, so the value of this depend on context. When making a wrapper like the one you show the context for this will invariably change, the bind and apply methods are made for dealing with situations like that. fun.bind(cont) will make a version of fun where this is always cont. fun.apply(cont,args) will run fun with this set to cont and the values in the array args as parameters.

The code in question demonstrate how convoluted these things get by failing to pass the given arguments to the function. The real parameters are passed to throttled, but the arguments array that is used come from execute, it is empty.

Using the bind function is unnecessary, this could just as well be stored in a simple variable.

Here is a fixed, and in my opinion easier to read, version, along with code that demonstrate the functionality:

function throttle(fn, time) {
    var handle;
    function throttled() {
        var args;
        var context;
        if(!handle) {
            args = arguments;
            context = this;
            handle = setTimeout(execute, time);
        }

        function execute() {
            handle = null;
            fn.apply(context, args);
        };
    };

    throttled.toString = function() {
        return fn.toString() + "\n// throttled to " + time + "ms";
    };

    return throttled;
}

obj = {
    toString:function(){
        return "obj's toString";
    }
    ,f:throttle(function(input){
        console.log(input+", "+this);
    },1000)
}
obj.f("input string 1")
obj.f("input string 2")
obj.f("input string 3")
obj.f("input string 4")


问:
Do higher resolution laptop displays matter for programmers?
I'm buying a new laptop that I'll be using mainly for programming.  A couple of options that really intrigue me are the Asus Zenbook UX31A and the new Retina Macbook Pro.  It's obvious that the high-resolution displays on these laptops is useful for entertainment, photo-editing, and other things.  My question is this:  Do these displays provide any benefit for programmers?  Do these displays make code any easier to read?  Are they any easier on the eyes after a whole day of staring at the screen?</p>

答:
Yes resolution makes a big difference, in that you have crisper text.  Just open up terminal on a retina macbook, turn the font size down and see how easy it still is to read it.

Now if you are using colorful IDE color schemes in anything from VIM to XCode it also makes a big difference.  Fonts are smoothed on most LCD screens using subpixel rendering which takes advantage of the red, green and blue bars in a common LCD pixel, using them as partial pixels, and then compensating for perception of colors at the edge to produce much "clearer" text.  This works really well with black and white text, but much less with colored text, especially at low point sizes.  As a result a low-res laptop displaying a lot of code in a smallish (9-10px) size, looks pretty bad.  Retina displays effectively double the font size and half the screen size (on each dimension) reducing the effects of sub-pixel rendering on color text.

Also, refuting another post, the inverse square law does exactly not apply here - we perceive (size and hence) detail in any given dimension linearly related to our distance from it - this is why we can measure things in minutes of arc/angle in astronomy and marksmanship ( http://en.wikipedia.org/wiki/Minute_of_arc ).  The other post does not actually claim other wise, but may imply that doubling the distance from an object Quaters its clarity, when really its half.

Megapixels in a display, scale in both dimensions (so does cost!) but we can safely consider detail in terms of distance and/or resolution by looking at single dimension proportions.  That makes the retina displays about doubly clear, though maybe 4 times more expensive.


问:
Multitasking in C#
I would like to use a timer in my C# program with millisecond accuracy to keep a camera in sync with some events and keep shooting a picture every 250ms (or 1/4 sec, or I might adjust it to even shorter times like 200ms or 100ms). The normal timer event can be used for this.

But I wonder what would be the best way to do this.

Also I think I should NOT write the whole capture routine in it, but instead just raise another thread (multi-threading) to process the image with some vision logic on it, as my vision logic takes about 1 seconds, so I will get some queue here.

If my vision algorithms would take 1 seconds per thread, would this mean that on a multicore (12 cores) PC that such code thread would go to the next available free processor or am I thinking to easily about multitasking?

答:
Use the Multimedia Timer. It works well with even 10mS intervals (and perhaps less).

When the timer event occures, you may have to dispatch to the main thread (or another single thread), depending on whether or not your camera API and image processing API support access from multiple threads. Use the Dispatcher class for this.

Make sure your event handler is shorter than the timer interval, when the timer event occurs, check if the event handler is busy and if so decide what to do (e.g. ignore event).

Decide what to do with the images, either create a new image at each event (not recommended due to GC cost), or reuse image buffer so long as the image size and color depth hasn't changed. You may want to create an output image for each stage of your image processing, to enable pipe-lining the image processing and enable the image processing to modifying image size/color depth. If your image processing API supports multi-threading, then you will need to make sure you are not using the same image buffer simultaneously (e.g. using pipe-line synchronization or using different images for each event).

If your processing takes ~1Sec, then you will end up with a growing queue of images (or amount of threads) because you won't be able to keep up. If you can't wait a long time for the processing to end after the capturing does, you will need to refactor the image processing code. Try moving it to the GPU (using GPGPU).

Title: Multitasking in C#


问:
Should I log trivial fixes?
I'm in a code shop of two. And while I understand that a bug tracker is useful where the number of programmers is greater or equal to one, I'm not so convinced that logging bugs, changes, and fixes is worth the time when they're trivial. When I find a simple bug, I understand it, fix it, and run it through some testing. And THEN I realized I need to go log it.

I know in theory that bug logging should be done somewhere between finding the bug and fixing the bug, but if fixing it is faster than logging it, it seems like a drag. In larger code-shops, the boss pays attention to who is doing what and it's nice to know where others are mucking about.

I find myself describing things that I've already fixed and then instantly closing them. I have doubts that anyone will ever look at this closed bug again. Is it time to trim the process fat?

答:
Why you shouldn't track bugs, by Jon Arid Torresdal - fix them instead.

During development: You encounter a bug for a feature; you add a test case that breaks the build, then check in the fix against the feature.

After release: document the behaviour. If you plan on releasing an update, goto 1. If you're not in charge of that release, keep the test+fix stashed in a private branch.

After code is released, there may be other priorities, and while fixing the bug may be trivial, distribution of the fix may not be economical on its own, unless you're doing continuous deployment.

Title: Should I log trivial fixes?


答:
I have seen this type of interviews at least 12 years ago. It is the approach I have used for the last 6 years.  Experience shows that it selects better candidates for the job than the ask 20 questions and give them a score out of 20 approach.

Again, I would make it very open ended too.  The goal is to provide space for the candidate to demonstrate ability. Having a candidate that asked relevent questions at this stage would be a plus. As is a candidate making good assumptions, but flagging up that they were assumptions, and would need to be reviewed before implementation.

I do requre all potential employees to demonstrate the skills they need for the job at interview. For programmers, they will need to implement some code, and talk about their design for it. It is very effective for preventing bad hires, but be prepared for a 90% failure rate at interview.

Title: OO Design related questions in technical interviews

Body:
I've been attending quite a few interviews recently and have been asked by companies to answer "design a [insert model]" questions more than a few times.

Is this normal in the industry nowadays? I've been in the software world for more than two  decades and have attended my share of interviews, but I am seeing this pattern in interviews emerge only recently.

I feel the question is very open ended. For example: I was asked to draw a class diagram to "Design a parking lot". I am not sure what level of detail the interviewer is expecting. This was in an online test where I was expected to attach a visio diagram, so I couldn't ask them what their expectations were.

Do you use these kind of questions in your interview process? Are they related to only class diagrams or do you also ask sequence, flowcharts and ERDs (ofcourse based on the nature of the position) Have they been effective in your hiring process?

* Edit for Kevin's response *

For example: A complete question could be "Design a parking lot management system that can be used to find vacant slots"

I can be done with 2 classes, ParkingLot and Slot or I could go on to add IVehicle and Vehicle and Car and Motorcycle classes. Where do I draw the line?

```<code>public class ParkingLot
{
   IVehicle Vehicle {set; get;}

   List<Slot> GetEmptySlots() { };
}

public class Vehicle : IVehicle
{
  Slot SlotNum {set; get;}
}

public class Slot
{
  int Row {set; get;}
  int Column {set; get; }
}
</code>```


答:
If you need to protect some magnificent algorithm you could have the code sitting on your own server with an authenticated API to access it, then distribute programs that use that API and sell credentials to use that API. It would then be possible to control code access as you pleased. This would be a sort of a software as a service type system that can be very effective in combating software piracy.

However this system has many potential flaws, one of which is it will be very difficult to persuade customers to trust this system knowing that if your company removes it's servers then they also lose theirs along with any investment of time/money into using the service.

Also the cost/maintenance would be substantial considering you would need to be able to support the combined traffic of all your customers received.

It would probably be easier to provide updates/support so people continue to pay for your services. I think it would be worth considering advice given on how to disable copying data from a webpage that any sort of protection that can easily be broken may not be worth the development effort and may annoy legitimate users and instead add value to continuing to pay for a licence.

Title: How to protect my php code running on a client server?

Body:
I'd like to ask how to protect my code that is running on a client server from being altered and/or copied.

It's running on Ubuntu Server with the standard Apache Php Mysql stack.

Any software needed would preferably be open-source.

I'd also like to terminate the application when there is a license problem.

Doing this using my code is possible but since it's php the client could alter the code to prevent this from happening.


问:
Asking people to disable Java for security - what's next for developer?
I don't know what best to give as title to this so pardon me if it sounds weird.

I saw this question asked on IT Security and another site asking people to disable Java from their system or browser because it's vulnerable.

As a lover of Java, though currently doing C#, I would love to still do more Java in future, but this news is giving a bad name to the good old Java.

Wouldn't this drive developers like me away from Java? Wouldn't it spell a bad name for Java among developers and prospective clients?

答:
Does this tarnish some of Java's luster? Absolutely, but this issue is about Java's use on the client side as an applet. Java's far more prevalent use is in the enterprise, creating server side applications where this vulnerability is irrelevant.

In short, no, this will not drive good developers away from the use of Java. As a good developer, you should analyze the problem and choose an appropriate technology based on situation.

A non-technical client who has heard of this "incident" of course may be concerned, but it is your job to inform them of what is the right answer to their problem. After all, they came to you for your expertise.


答:
It is only browser plugins that suffer from the security flaw, since desktop apps generally aren't required to be perfectly sandboxed. That said, there is no doubt that the name of Java will take a reputation hit.

While developers should be able to differentiate, I don't think it is humanly possible to be completely objective, at least not for the vast majority of people. So while there is no great aversion to Java, neither is there a lot of hype. Although it used to be the second coming of Jesus Christ, that is certainly not the case any more, and while a lot of that decay may be ascribed to the age of the news, Oracle takeover and general neglect certainly have their share of the blame.

Still, more serious to the future of Java is the mobile phone market -- Java doesn't look like the cross-platform solution that will prevail.

As for the job market, although I think Java will take a dive, it is not like it will die any time soon -- if nothing else there is plenty legacy code to keep a Java programmer occupied.  If it is what you want you can most likely keep doing Java for the rest of your life, but depending on future developments you could find yourself to be the equivalent of present day COBOL programmers in 40 years.

Title: Asking people to disable Java for security - what's next for developer?

Body:
I don't know what best to give as title to this so pardon me if it sounds weird.

I saw this question asked on IT Security and another site asking people to disable Java from their system or browser because it's vulnerable.

As a lover of Java, though currently doing C#, I would love to still do more Java in future, but this news is giving a bad name to the good old Java.

Wouldn't this drive developers like me away from Java? Wouldn't it spell a bad name for Java among developers and prospective clients?


问:
Is the 80 character limit still relevant in times of widescreen monitors?
on a widescreen monitor one can easily see more than 80 characters at a time, without scrollbars. even linus torvalds sees the 80 character limit as outdated.

so, is the 80 character limit still relevant in times of widescreen monitors?

答:
To coding?

Certainly yes. Normal human been can't read well too wide. With few columns you move your eyes less, you focus better and delay the tiredness. It's a minimum gain but an important one.


问:
Fastest Haskell library sort implementation
I am implementing an application in Haskell and, for sorting, I use the library function Data.List.sort. However, I was wondering whether this is the fastest sort implementation in the Haskell standard library (perhaps lists are not the best choice for efficient sorting).

I have found different alternatives, e.g. heap sort on arrays, sort on sequences (but the documentation does not say what kind of algorithm is used).

My question is: what is the fastest sorting implementation (container type + sort function) provided by the Haskell standard library? Is there some documentation page listing all library sort functions and comparing them wrt performance?

EDIT

To provide some more context, I am running a benchmark. I have written a simple program in C, Java, Python and Haskell that

Reads 1000000 strings (lines) from a text file.

Sorts the strings using a built-in (library) sorting algorithm.

Writes the sorted list of strings to a file.

For each implementation, I only measure the sorting time (leaving out the time needed for disk IO).
Running the benchmark on Ubuntu 12.04, I get

C (gcc 4.6.3, qsort on char **): 0.890 s

Java (OpenJDK 64-Bit 1.7.0_09, Collections.sort() on java.util.LinkedList<String>): 1.307 s

Python (Python 2.7.3, list.sort()): 1.072 s

Haskell (GHC 7.4.1, Data.List.sort on [Data.ByteString.UTF8.ByteString]): 11.864 s

So I wonder if there is another data type / library function in Haskell that can give better performance.

答:
The problem with Data.List.sort is that it uses merge sort, which creates new lists during each pass. So a lot of time is spent on allocating and freeing memory.

Surprisingly, AFAIK there isn't a sorting library for mutable arrays, which are likely to be faster. So I tried to make one and put it on github: marray-sort. It needs rigorous testing, polishing and optimizing too, but so far it already seems to be significantly faster than Data.List.sort.

If you make any experiments with it, I'd be happy to see the results. I put your (slightly modified) benchmark to src-test/Test.hs for convenience. Don't forget to compile everything with -O2 to trigger the necessary compiler optimizations.

Edit: I found out now that there is an implementation if introsort for mutable vectors in vector-algorithms. According to my measurements, it is slightly faster (5-10%) than my attempt above for MArrays
See also: How does one sort with Data.Vector.Generic.Mutable?.


问:
Is Prolog professionally useful?
I learned Prolog many years ago in University. During my professional life, I have never needed to use Prolog. Have I missed something special?

As far as I remember Prolog requires completely different mindset comparing to prominent programming languages.

Is Prolog really ever used to implement something professionally useful?

答:
I have used Prolog professionally on a (significant) handful of occasions (diagnostic expert system; HTML transformation; set membership). I have a deep affection for the language so, yes, there's bias here but it's easy to be objective about when Prolog is (more/just as) suitable- you really need to be processing recursive structures; the best example I can give is a relational database table but there are countless other examples (it's probably easier to enumerate counter-examples such as random user input or (most) mathematical functions (however, many mathematical functions do have a recursive structure and hence are perfectly appropriate (discrete fast fourier transform, for example)).

But, of course, very few 'end-to-end systems' can be defined solely in terms of the processing of recursive structures, (exception: theorem proving- but this is a rather academic exercise*) so it's fortunate that a prolog process can be grafted on to a 'more standard imperative process' using all sorts of different techniques (it hardly matters what but a web-service interface is probably generally suitable); so you can deal with the UI, and random event processing etc and then hand-over when necessary (for doing complex database queries or any number of things you might want to do with your recursive structures). I find it works beautifully- better than, for example, LINQ.

So- grab your recursive structures by the sensitive bits and write some lovely, clean, elegant, maintainable Prolog! :)

PS when I'm not using Prolog, I fall back to C#

Although, I long for the day when, at least some aspects of, commercial programs are proved correct as a standard practice.

Title: Is Prolog professionally useful?


答:
I want to add another point to Danny Varod's already good answer, focusing on the question in your last paragraph.

Assuming you're handling the events raised by the multimedia timer or another high-resolution timer, you now need to dispatch your heavy processing task in another thread. .NET's libraries make this relatively easy using the Task Parallelism Library (TPL) if you're using .NET 4.0, or directly using the ThreadPool for earlier versions.

Let's say you have this (very sketchy) code:

```<code>private void ProcessImage(object imageToProcess)
{
    // Do whatever. Process the image, save the results, etc.
    // This is the 1-sec process.
}

private void myTimer_Elapsed()
{
    Image capturedImage = myCamera.CaptureImage(); // or whatever.
    Task.Factory.StartNew(ProcessImage, capturedImage);
}
</code>```

This starts a new Task (a wrapper around an asynchronous method) that is launched on a ThreadPool thread. If your machine has multiple CPUs and multiple cores, the ThreadPool will have a lot of available threads, and will process many of these requests in parallel. Hopefully, this will allow the processing tasks to keep up with the image capture tasks. You might have to read up on the threadpool and see how to tweak the available threads for machines with lots of CPUs, but the worst case scenario is that the processing tasks get backlogged, but the threadpool (which is at the heart of the Tasks library) will just queue them up and get to them eventually.

Note, though, that you are not guaranteed that the tasks will be executed in the order they are captured.

If you're using an older version of C#, replace the call to Task.Factory.StartNew with calls to ThreadPool.QueueUserWorkItem, which in this case (where we're not using continuations and aggregated error handling) will be practically identical in usage.

Title: Multitasking in C#

Body:
I would like to use a timer in my C# program with millisecond accuracy to keep a camera in sync with some events and keep shooting a picture every 250ms (or 1/4 sec, or I might adjust it to even shorter times like 200ms or 100ms). The normal timer event can be used for this.

But I wonder what would be the best way to do this.

Also I think I should NOT write the whole capture routine in it, but instead just raise another thread (multi-threading) to process the image with some vision logic on it, as my vision logic takes about 1 seconds, so I will get some queue here.

If my vision algorithms would take 1 seconds per thread, would this mean that on a multicore (12 cores) PC that such code thread would go to the next available free processor or am I thinking to easily about multitasking?

Body:
I want to add another point to Danny Varod's already good answer, focusing on the question in your last paragraph.

Assuming you're handling the events raised by the multimedia timer or another high-resolution timer, you now need to dispatch your heavy processing task in another thread. .NET's libraries make this relatively easy using the Task Parallelism Library (TPL) if you're using .NET 4.0, or directly using the ThreadPool for earlier versions.

Let's say you have this (very sketchy) code:

private void ProcessImage(object imageToProcess)
{
    // Do whatever. Process the image, save the results, etc.
    // This is the 1-sec process.
}

private void myTimer_Elapsed()
{
    Image capturedImage = myCamera.CaptureImage(); // or whatever.
    Task.Factory.StartNew(ProcessImage, capturedImage);
}

This starts a new Task (a wrapper around an asynchronous method) that is launched on a ThreadPool thread. If your machine has multiple CPUs and multiple cores, the ThreadPool will have a lot of available threads, and will process many of these requests in parallel. Hopefully, this will allow the processing tasks to keep up with the image capture tasks. You might have to read up on the threadpool and see how to tweak the available threads for machines with lots of CPUs, but the worst case scenario is that the processing tasks get backlogged, but the threadpool (which is at the heart of the Tasks library) will just queue them up and get to them eventually.

Note, though, that you are not guaranteed that the tasks will be executed in the order they are captured.

If you're using an older version of C#, replace the call to Task.Factory.StartNew with calls to ThreadPool.QueueUserWorkItem, which in this case (where we're not using continuations and aggregated error handling) will be practically identical in usage.


问:
While learning is it better to use other's plugins or develop my own?
As I have been learning to program, be it in my intern-ship or school, I have often come across situations where an extra piece of software is needed (from fairly basic to quite complex) and I am almost always told that I shouldn't waste my time developing a solution and use something someone else has already done.

Does it make sense to do this or should I take the time to research and develop my own? At the moment I'm doing my final project which I have 15 weeks to complete, but the tutor and my classmates tell me not to bother. I can't help but think I am letting opportunities pass me by.

答:
If you have little time to complete a project, it's a good idea to use third-party code. The only thing is to understand how it works (in the level of interfaces) in order to use it correctly and not to get any "surprises".

The most rational approach, I think, is to use the third-party code and complete your project. If after that you have time left, you could start developing your own code and replacing the third-party code with yours. You could start with the most interesting/difficult/challenging pieces. And you could leave the ones that are based, for example, on covering many various and obvious cases (like a calendar drop-downs). This way you would avoid the risk of not having the project done on time.

When developing your code and replacing the third-party one with it, you could study the techniques used in those codes and try to improve them. Besides, there are libraries which are very efficient and  beautifully designed, so studying them would be much more useful than creating the same functionality by yourself.


问:
Why shouldn't you use JDBC in Java applets?
I've heard people saying usage of JDBC (Java Database Connectivity) isn't recommended in Java applets. All I they say is: 'because of the security reasons'. What 'security reasons'  do they mean? What would a potentially 'bad person' do when he/she found out about JDBC used in an applet, placed somewhere on a website?
To make one's applet safe, it is wise to place a servlet between an applet and a database. I believe most programmers do it, I would like to know why.</p>

答:
because you'd need to expose your database to the internet

you need to let the applet have access to the password used to connect to the database, a hacker can easily pull that password out of a debugger

most people don't think to use different DB accounts with different privileges

you can't change the DB structure easily after the first release


答:
At the most basic level, the database server ought not be opened up to the public internet.  If you want random users running a Java applet to access the database directly, that implies that the database is configured to accept connections from anyone on the internet.  If that's the case, an attacker can attack your database at their leisure without worrying about first penetrating a firewall or getting access to the internal network.

Since the Java applet runs on the client machine, that means that it is easy enough for an attacker to see exactly what the applet is doing so they can easily extract the username and password for the database.  Since we've already established that the database server has to be open to the internet for the applet to work, that means that an attacker has a username and a password that they can use from any tool they want.  So now the attacker can do anything the database account your applet uses can do (bypassing any security in your applet) but they can also look for attacks that allow them to escalate their privileges.

Title: Why shouldn't you use JDBC in Java applets?

Body:
I've heard people saying usage of JDBC (Java Database Connectivity) isn't recommended in Java applets. All I they say is: 'because of the security reasons'. What 'security reasons'  do they mean? What would a potentially 'bad person' do when he/she found out about JDBC used in an applet, placed somewhere on a website?
To make one's applet safe, it is wise to place a servlet between an applet and a database. I believe most programmers do it, I would like to know why.</p>


问:
Advices on structure and names for namespaces and classes
I'm resistant to calling the "main" class the same as the namespace, but I sometimes find myself needing it. Considering I'm using the Vendor.Namespace.[Subnamespace].Class formula, imagine this scenario:

```<code>[MyFramework]
    [Database]
        Database
        Sql
        Schema
        DriverAbstract
        DriverInterface
        [Drivers]
            Mysql
            Postgresql
            Sqlite
</code>```

obs: [] are for namespaces, the others are classes.

Now, I could call the Database class Connection instead, but when I import the namespace MyFramework.Database I would only see Connection in the code (but connection to what?). Other solution would be calling it DatabaseConnection, but is that really necessary? I would like to hear your thoughts and ideas on that problem. Thank you (:

Sidequest: also, what are your thougths on DriverAbstract and DriverInterface? Should they fit better in the [Drivers] namespace? Should I call DriverAbstract just Driver?

答:
While you haven't specified a language, some of the tips provided for .Net laguages apply to all languages: Names of Namespaces.

Do not use the same name for a namespace and a type in that namespace. For example, do not use Debug for a namespace name and also provide a class named Debug in the same namespace. Several compilers require such types to be fully qualified.

Do not introduce generic type names such as Element, Node, Log, and Message. There is a very high probability it would lead to type name conflicts in common scenarios. You should qualify the generic type names (FormElement, XmlNode EventLog, SoapMessage).

If the Database class is public, I'd think about naming it MyFrameworkConnection.  At a minimum I would avoid naming it Database due to it conflicting with the namespace.

Consider this scenario.

```<code>namespace Database
{
    public class Database
    {
        public static object Schema { get; private set; }
    }

    public class Schema {
        ...
    }
}
</code>```

What happens when you refer to:

```<code>Database.Schema
</code>```

Does it return the value of Schema from the Database class, or does it return the Schema type from the Database namespace?

Body:
While you haven't specified a language, some of the tips provided for .Net laguages apply to all languages: Names of Namespaces.

Do not use the same name for a namespace and a type in that namespace. For example, do not use Debug for a namespace name and also provide a class named Debug in the same namespace. Several compilers require such types to be fully qualified.

Do not introduce generic type names such as Element, Node, Log, and Message. There is a very high probability it would lead to type name conflicts in common scenarios. You should qualify the generic type names (FormElement, XmlNode EventLog, SoapMessage).

If the Database class is public, I'd think about naming it MyFrameworkConnection.  At a minimum I would avoid naming it Database due to it conflicting with the namespace.

Consider this scenario.

namespace Database
{
    public class Database
    {
        public static object Schema { get; private set; }
    }

    public class Schema {
        ...
    }
}

What happens when you refer to:

Database.Schema

Does it return the value of Schema from the Database class, or does it return the Schema type from the Database namespace?


问:
When is Efferent / Afferent coupling good or bad
I have a software patterns exam this week and one of the topics we are to study is Efferent and Afferent coupling.

I understand a package has a high Ce (efferent coupling) if it depends on a number of other types.

For example:

```<code>class Car{
    Engine engine;
    Wheel wheel;
    Body body;
}
</code>```

This class would have a high efferent coupling because it depends on the Engine, Wheel and Body types.

Whereas the type "Wheel" would have a high Ca (afferent coupling) if several other packages depended on it (Car, Plane, Bicycle).

One of the possible questions on our exam is, when is Efferent / Afferent coupling good or bad? This seems odd to me because logically a program would need packages / classes with both high Efferent / Afferent coupling.

Does anybody have an example of when / where high efferent or afferent coupling is good / bad??

Thanks !

答:
Speaking in generalities, loose coupling:

positive: protects a portion of the system from changes in something that it depends on (afferent coupling)

negative: the relationship may be more difficult to understand

For example, if I were developing a system that relied on HTTTP, I would decide if I need to tightly or loosely couple to HTTP.  If I thought that the system were likely to switch to a different protocol, I may choose to loosely couple to it, while if I accepted that HTTP were my protocol, I could tightly couple to that protocol for simplicity in understanding.

Consider that some of the complexities in WS* are in its decoupling from HTTP as a protocol.


问:
Why are cryptic short identifiers still so common in low-level programming?
There used to be very good reasons for keeping instruction / register names short. Those reasons no longer apply, but short cryptic names are still very common in low-level programming.

Why is this? Is it just because old habits are hard to break, or are there better reasons?

For example:

Atmel ATMEGA32U2 (2010?): TIFR1 (instead of TimerCounter1InterruptFlag), ICR1H (instead of InputCapture1High), DDRB (instead of DataDirectionPortB), etc.

.NET CLR instruction set (2002): bge.s (instead of branch-if-greater-or-equal.short), etc.

Aren't the longer, non-cryptic names easier to work with?

When answering and voting, please consider the following. Many of the possible explanations suggested here apply equally to high-level programming, and yet the consensus, by and large, is to use non-cryptic names consisting of a word or two (commonly understood acronyms excluded).

Also, if your main argument is about physical space on a paper diagram, please consider that this absolutely does not apply to assembly language or CIL, plus I would appreciate if you show me a diagram where terse names fit but readable ones make the diagram worse. From personal experience at a fabless semiconductor company, readable names fit just fine, and result in more readable diagrams.

What is the core thing that is different about low-level programming as opposed to high-level languages that makes the terse cryptic names desirable in low-level but not high-level programming?

答:
Mostly it's idiomatic. As @TMN says elsewhere, just as you don't write import JavaScriptObjectNotation or import HypertextTransferProtocolLibrary in Python, you don't write Timer1LowerHalf = 0xFFFF in C. It looks equally ridiculous in context. Everyone who needs to know already knows.

Resistance to change might arise, in part, from the fact that some C compiler vendors for embedded systems deviate from the language standard and syntax in order to implement features more useful to embedded programming. This means that you can't always use the autocomplete feature of your favourite IDE or text editor when writing low level code, because these customisations defeat their ability to analyse code. Hence the utility of short register names, macros and constants.

For example, HiTech's C compiler included a special syntax for variables that needed to have a user-specified position in memory. You might declare:

```<code>volatile char MAGIC_REGISTER @ 0x7FFFABCD;
</code>```

Now the only IDE in existence that will parse this is HiTech's own IDE (HiTide). In any other editor, you'll have to type it out manually, from memory, every time. This gets old very quickly.

Then there's also the fact that when you're using development tools to inspect registers, you'll often have a table displayed with several columns (register name, value in hex, value in binary, last value in hex, etc). Long names mean you have to expand the name column to 13 characters to see the difference between two registers, and play "spot the difference" across dozens of lines of repeated words.

These might sound like silly little quibbles, but isn't every coding convention designed to reduce eye strain, decrease superfluous typing or address any one of a million other little complaints?

Body:
Mostly it's idiomatic. As @TMN says elsewhere, just as you don't write import JavaScriptObjectNotation or import HypertextTransferProtocolLibrary in Python, you don't write Timer1LowerHalf = 0xFFFF in C. It looks equally ridiculous in context. Everyone who needs to know already knows.

Resistance to change might arise, in part, from the fact that some C compiler vendors for embedded systems deviate from the language standard and syntax in order to implement features more useful to embedded programming. This means that you can't always use the autocomplete feature of your favourite IDE or text editor when writing low level code, because these customisations defeat their ability to analyse code. Hence the utility of short register names, macros and constants.

For example, HiTech's C compiler included a special syntax for variables that needed to have a user-specified position in memory. You might declare:

volatile char MAGIC_REGISTER @ 0x7FFFABCD;

Now the only IDE in existence that will parse this is HiTech's own IDE (HiTide). In any other editor, you'll have to type it out manually, from memory, every time. This gets old very quickly.

Then there's also the fact that when you're using development tools to inspect registers, you'll often have a table displayed with several columns (register name, value in hex, value in binary, last value in hex, etc). Long names mean you have to expand the name column to 13 characters to see the difference between two registers, and play "spot the difference" across dozens of lines of repeated words.

These might sound like silly little quibbles, but isn't every coding convention designed to reduce eye strain, decrease superfluous typing or address any one of a million other little complaints?


问:
Great Lunch and Learn Topics
We recently revived the lunch in learns for the programming department in the company I work for. We were all asked if we had any ideas for a session, and if we would be interested in doing a presentation. I've had a few ideas ranging from various topics such as:

How to think like a user when designing UI

or Differences in HTML5

A few coworkers I tossed these ideas around to seem to like them. However, I'd like some more ideas before I dig too far into creating a presentation.

What are some great lunch and learn topics?

答:
Some general ones:

Test Driven Development

Debugging in [IDE of choice]  (you can throw in things like remote or virtualised debugging as well)

What's new in the latest version of  (could be an IDE, an database system, whatever)

Design patterns

Security factors in [technology of choice]

Performance factors in [technology of choice]

Continuations & closures  (been reading Eric Lippert's fantastic series on this)

Overview of [new language or technology of choice]

But remember you don't have to pick general topics, you can do L&L topics on your own work as well.  Arguably, this is even more valuable because the audience can get a feel for what you do (rather than assuming it all happens by magic).  For example, your install guy could do a topic on how the install works, your QA lead could do a topic on preparing test environments, your build guy could do a topic on the build process, and if your project has an interesting architecture that maybe not everyone's aware of, then do a topic on that.

Also remember that your audience is not necessarily only composed of programmers.  You may have QA guys and project managers in there as well, so don't assume that "Design patterns" isn't a valid topic because everyone must know design patterns.

Obviously you can't go into too much detail on some of these (for example, don't engage in a deep analysis of the pros and cons of every single pattern).

Title: Great Lunch and Learn Topics


问:
How do you approach database design?
I am primarily a web developer and I have a couple of personal projects which I want to kick off.

One thing that is bugging me is database design. I have gone through in school db normalization and stuff like that but it has been a couple of years ago and I have never had experience with relational database design except for school.

So how you do you approach database from a web app perspective? How do you begin and what do you look out for? What are flags for caution?

答:
I found Bill Karwin's book, SQL Antipatterns, to be really useful for database planning. The point it makes most comprehensively is that the database offers many opportunities for protecting the integrity and meaningfulness of your data, and that it's a common mistake of designers to ignore these features for various tempting reasons. Considering these issues right from the start and letting them inform the entire design is worthwhile and beats trying to paper over cracks later.

I prefer to use a database that has comprehensive constraints to enforce business logic and integrity at the database level. Often I see the database as the application and anything that accesses it as a mere interface. This makes the addition of other "interfaces" a more pleasant and straightforward experience, and has positive benefits for security.

I also think it's important to consider the structure of the database as a changing entity, rather than assuming you need to wrap it up and seal it before starting anything else. You should plan for change and accommodate the DB in your versioning system. There is a nice essay on this: Evolutionary Database Design by Martin Fowler & Pramod Sadalage (and also a whole book on the subject by Sadalage, though I haven't read this).

Lastly, peripheral issues of user accounts/roles, hardware/location/connection of host, etc. are important and sometimes overlooked. Keep these in mind too when planning.

Title: How do you approach database design?


答:
I have never participated in an L&L but it seems like you're basically working with:

something easily digested over the course of a lunch break

something that will help inspire discussion and interactive feedback

I think something like posing a question as to "how do you think we do X" and eventually revealing the current implementation would be interesting and thought-provoking for your listeners.  You can abstract all the programming out of the equation so even non-coders could have a whack at it.

You could even abstract a complicated problem that your company faced as a riddle or puzzle.  Like if you had to work with a square peg and round hole and eventually just chiseled down the square peg into a circular shape -- changing stock software to suit your company's needs.

I think any introduction that encourages technical thinking automatically opens up interesting conversation.

e.g. Time/Process optimization

How do you speed up your pie-serving waiter's operation?  He serves a piece of pie and waits for the person to finish.  He grabs their plate and takes it to the kitchen, then serves the next person.  How can you satisfy your hungry customers more quickly if you don't care about dishes piling up?

I think simple metaphors to describe paradigms you use at work would be great food for thought while munching on a sandwich.

Title: Great Lunch and Learn Topics

Body:
We recently revived the lunch in learns for the programming department in the company I work for. We were all asked if we had any ideas for a session, and if we would be interested in doing a presentation. I've had a few ideas ranging from various topics such as:

How to think like a user when designing UI

or Differences in HTML5

A few coworkers I tossed these ideas around to seem to like them. However, I'd like some more ideas before I dig too far into creating a presentation.

What are some great lunch and learn topics?


问:
As a programmer, are you required to do timesheets?
Timesheets are something that I've never been fond of, but none the less something that is a requirement within my company. They don't bother me so much, but they seem to really grind some other people's gears. I suppose I have a few questions, and feedback would be great.

Are you required to do timesheets, assuming you aren't a contractor? (That is understandable to me).

What is the granularity of timesheets that you would be comfortable with or that you use? (ex: all entries must be under two hours).

Would timesheets ever factor into your reasons for not accepting a job or leaving a current one?

How has management within your organization justified timesheets if you aren't billing to a client?

答:
I've never had to fill out a timesheet and don't think I'd join a company that would require me to. At all the companies where I have worked, I've always been judged based on what I got done and not how long it took. Results and performance are far more important than how long it took to get them. In fact, the former includes the latter: if I got as much done in a year as another developer in a similar position got done in a month, my evaluation probably wouldn't be very good. The other way around doesn't work as well: knowing that one person spent 60 hours at work this week and another spent 40 is not enough to make any meaningful judgement. Some of the most effective developers spend the least time at work precisely because they are efficient.

Moreover, I've been a salaried employee at each job, so I didn't get paid any more or less because I put in more or less hours. So the info on a timesheet would never be to my advantage. Finally, what business is it of yours what I spend my time doing to get a project done? If I produce the best software in the company but you discover that I surf the web 4 hours a day, would you fire me? How do you know that the web surfing isn't essential to my mental process? Moreover, even if I did surf the web 4 hours a day, I probably wouldn't put it on my timesheet, which means the info is fairly useless anyway. I think I'd be tempted to fill it out with BS and hand it in with my TPS report at the end of the week...


答:
I suggest agile practices such as:

continuous integration

pair programming

stand up meetings

information radiator

planning poker

Title: Great Lunch and Learn Topics


答:
The best book I ever bought regarding database design was Database Design for Mere Mortals by Michael Hernandez ISBN: 0-201-69471-9. Amazon Listing I noticed he has a third edition.

Link to third edition

He walks you through the entire process of (from start to finish) of designing a database. I recommend you start with this book.

You have to learn to look at things in groups or chunks. Database design has simple building blocks just like programming does. If you gain a thorough understanding of these simple building blocks you can tackle any database design.

In programming you have:

If Constructs

If Else Constructs

Do While Loops

Do Until Loops

Case Constructs

With databases you have:

Data Tables

Lookup Tables

One to One relationships

One to Many Relationships

Many to Many relationships

Primary keys

Foreign keys

The simpler you make things the better. A database is nothing more than a place where you put data into cubbie holes. Start by identifying what these cubbie holes are and what kind of stuff you want in them.

You are never going to create the perfect database design the first time you try. This is a fact. Your design will go through several refinements during the process. Sometimes things won't seem apparent until you start entering data, and then you have an ah ha moment.

The web brings it's own sets of challenges. Bandwith issues. Statelessness. Erroneous data from processes that start but never get finished.

Title: How do you approach database design?

Body:
I am primarily a web developer and I have a couple of personal projects which I want to kick off.

One thing that is bugging me is database design. I have gone through in school db normalization and stuff like that but it has been a couple of years ago and I have never had experience with relational database design except for school.

So how you do you approach database from a web app perspective? How do you begin and what do you look out for? What are flags for caution?


问:
Why doesn't the .NET world have anything like rails/grails/django/roo?
It seems to me that rapid-development web platforms are going to radically change the world of web applications.

It has been five years since Rails 1.0 was released for Ruby, and since that time we have seen Grails for Groovy, Django for Python, and Roo for Java.

But to my knowledge (which is probably limited, being a Java/Groovy progammer) there is no similar framework for C#.

Does such a thing exist?  If not, why not?

Edit:  It's quite possible I'm not using the right words when I say "rapid-development," but I'm talking about frameworks that can conceivably allow you to build a working blog engine in 30 minutes.  You couldn't reasonably do this with, say, Java, Spring, and Hibernate, given the various configuration needed to allow your controllers to be found, and both configuration and code necessary for your entities to persist and be retrieved.

So I'm talking about frameworks that handle all of the CRUD with a convention-over-configuration mentality.  If someone has the right words for what I'm talking about, let me know.

答:
Because .NET web applications have a build cycle.

Ruby/Python happen to be very agile/nimble and dynamic languages.

Where I work, we have a huge .NET web application, and the compilation times are comparable to a typical medium-to-large C++ program.

In my spare I develop web apps in python, and the compilation time is 0. There's just no compilation step at all. The running interpreter just reloads .py files as you save them.


答:
We mostly use our Lunch and Learns to cover new technologies that are coming out of the software stack we currently use.

So currently we are on a .NET 3.5/4, C#, Visual Studio 2010, etc. stack so we're doing some lunch and learns on the following topics:

ASP.NET MVC 3

Nu-Get (.NET Package Manager)

etc., etc.

Obviously your company may be on a different stack, but you could take the same approach.

This has worked really well for us as far as keeping up with technology, especially since the ASP.NET MVC framework and associated software is growing at a rapid pace.

Title: Great Lunch and Learn Topics


答:
I start with a big whiteboard and a bunch of different colors of pen.  Different colors mean different things.  And I just start drawing.  Usually I draw things that are definite in black, things that are likely in blue, and things that are unlikely in green.  Red is for important notes.  I erase and redraw copiously.  I think about what kinds of things I need to query and make sure the model supports it.  If it doesn't I'll tweak until it does.

Eventually if the model gets too big I'll move it to Visio and work on pieces back on the whiteboard.

Last I think about extension points.  The biggest mistake I see most people make is design their database and then say "I'm done with the database" and move on.  You're never done with the database.  Every single change request you get is likely to go all the way down to that level.  So think about how to add on to it.  Think about what kinds of requests are likely and see if you're able to hook them in.  If you don't think at all about extensibility, you're going to go into major design debt when those change requests come up.

As for "SQL then ORM" or vice versa, that's up to you.  Just make sure that your model makes a good foundation first.

Title: How do you approach database design?


问:
How do you explain refactoring to a non-technical person?
How do you go about explaining refactoring (and technical debt) to a non-technical person (typically a PHB or customer)? ("What, it's going to cost me a month of your work with no visible difference?!")

UPDATE Thanks for all the answers so far, I think this list will provide several useful analogies to which we can point the appropriate people (though editing out references to PHBs may be wise!)

答:
It's kinda like cleaning up the house after a wild and crazy party from the night before.

Let's say the living room got totally trashed. The house is still a house, the living room is still a living room. It works but it's not the way it could be. After staring at the mess you realize that it needs to get cleaned up.

So, you start bagging the trash. It looks better already. So, you look around the room and decide to straighten out the furniture. You put one piece back, then the next and the next. Wow, the room looks really good. You are proud.

Your sister walks in and says the room looks like trash, you should fix the bookshelf and vaccuum the carpet. She's right. The room looks really, really good.

You look around and see that the window shades would look much better if they were all at the same height. Done. Wow, the room is amazing.

Treat your code the same way.


答:
Easy!

Take it with an example ... everyone has in their lives written a letter to a dear one. It has to be someone dear because in those letters we usually pay attention to composition as well.

So, you have your text, ... the meaning will go through either way, but you want the entire thing to sound nice! Right?

Refactoring, same thing ... same pieces of information, more or less, but the composition is better. And it will probably result in a better review by the reader.

Another example - writing an article for  a magazine. Two writers, both know "their stuff", the only difference is one knows "how to write" and the other writes like he learned to write from answers like these.

Whose article will you remember?

Title: How do you explain refactoring to a non-technical person?

Body:
How do you go about explaining refactoring (and technical debt) to a non-technical person (typically a PHB or customer)? ("What, it's going to cost me a month of your work with no visible difference?!")

UPDATE Thanks for all the answers so far, I think this list will provide several useful analogies to which we can point the appropriate people (though editing out references to PHBs may be wise!)


问:
Are asserts or unit tests more important?
Both asserts and unit tests serve as documentation for a codebase, and a means of discovering bugs.  The main differences are that asserts function as sanity checks and see real inputs, whereas unit tests run on specific simulated inputs and are tests against a single well-defined "right answer".  What are the relative merits of using asserts vs. unit tests as the main means of verifying correctness?  Which do you believe should be emphasized more heavily?</p>

答:
When talking about assertions, keep in mind that they can be turned off at the flick of a switch.

Example of a very bad assertion:

```<code>char *c = malloc(1024);
assert(c != NULL);
</code>```

Why is this bad? Because no error checking is done if that assertion is skipped due to something like NDEBUG being defined.

A unit test would (likely) just segfault on the code above. Sure, it did its job by telling you that something went wrong, or did it? How likely is malloc() to fail under the test?

Assertions are for debugging purposes when a programmer needs to imply that no 'normal' event would cause the assertion to fire. malloc() failing is, indeed a normal event, thus should never be asserted.

There are many other cases where assertions are used instead of adequately handling things that might go wrong. This is why assertions get a bad reputation, and why languages like Go don't include them.

Unit tests are designed to tell you when something you changed broke something else. They are designed to save you (in most cases) from going through every feature of the program (however, testers are important for releases) every time you make a build.

There really isn't any distinct correlation between the two, other than both of them telling you that something went wrong. Think of an assert as a breakpoint in something you are working on, without having to use a debugger. Think of a unit test as something that tells you if you broke something that you aren't working on.

Body:
When talking about assertions, keep in mind that they can be turned off at the flick of a switch.

Example of a very bad assertion:

char *c = malloc(1024);
assert(c != NULL);

Why is this bad? Because no error checking is done if that assertion is skipped due to something like NDEBUG being defined.

A unit test would (likely) just segfault on the code above. Sure, it did its job by telling you that something went wrong, or did it? How likely is malloc() to fail under the test?

Assertions are for debugging purposes when a programmer needs to imply that no 'normal' event would cause the assertion to fire. malloc() failing is, indeed a normal event, thus should never be asserted.

There are many other cases where assertions are used instead of adequately handling things that might go wrong. This is why assertions get a bad reputation, and why languages like Go don't include them.

Unit tests are designed to tell you when something you changed broke something else. They are designed to save you (in most cases) from going through every feature of the program (however, testers are important for releases) every time you make a build.

There really isn't any distinct correlation between the two, other than both of them telling you that something went wrong. Think of an assert as a breakpoint in something you are working on, without having to use a debugger. Think of a unit test as something that tells you if you broke something that you aren't working on.


问:
What's the most absurd myth about programming issues?
To put it another way... What is the most commonly held and frustrating misunderstanding about programming, you have encountered?

Which widespread and longstanding myths/misconceptions do you find hard for programmers to dispel/correct.

Please, explain why this is a myth.

答:
As long as the computer understands the code you type in, that's all that matters.
Therefore typing in comments and using variable names that are more than two letters long is a waste of time. :-(</p>


答:
They are both tools used to help improve the overall quality of the system you are building.  A lot depends on the language you're using, the type of application you are building, and where your time is best spent.  Not to mention you have a few schools of thought about it.

To start, if you are using a language without an assert keyword, you can't use asserts (at least not in the way we are talking here).  For a long time, Java did not have an assert keyword, and a number of languages still don't.  Unit testing then becomes quite a bit more important.  In some languages the assertions are only run when a flag is set (again with Java here).  When the protections are not always there, it's not a very useful feature.

There is a school of thought that says if you are "asserting" something, you might as well write an if/throw meaningful exception block.  This thought process comes from many asserts placed in the beginning of a method to ensure all values are in bounds.  Testing your preconditions is a very important part of having an expected postcondition.

Unit testing is extra code that has to be written and maintained.  To many this is a drawback.  However, with the current crop of unit test frameworks out there, you can generate a larger number of test conditions with comparatively little code.  Parameterized tests and "theories" will perform the same test with a large number of data samples which can uncover some hard to find bugs.

I personally find I get more mileage with unit testing than sprinkling asserts, but that is because of the platforms I develop on most of the time (Java/C#).  Other languages have more robust assertion support, and even "Design by Contract" (see below) to provide even more guarantees.  If I were working with one of these languages, I might use the DBC more than the unit testing.

http://en.wikipedia.org/wiki/Design_by_contract#Languages_with_native_support

Title: Are asserts or unit tests more important?

Body: Both asserts and unit tests serve as documentation for a codebase, and a means of discovering bugs.  The main differences are that asserts function as sanity checks and see real inputs, whereas unit tests run on specific simulated inputs and are tests against a single well-defined "right answer".  What are the relative merits of using asserts vs. unit tests as the main means of verifying correctness?  Which do you believe should be emphasized more heavily?</p>


答:
Asserts are useful for telling you about the internal state of the program. For example, that your data structures have a valid state, e.g., that a Time data structure won't hold the value of 25:61:61. The conditions checked by asserts are:

Preconditions, which assure that the caller keeps its contract,

Postconditions, which assure that the callee keeps its contract, and

Invariants, which assure that the data structure always holds some property after the function returns. An invariant is a condition that is a precondition and a postcondition.

Unit tests are useful for telling you about the external behavior of the module. Your Stack may have a consistent state after the push() method is called, but if the size of the stack doesn't increase by three after it is called three times, then that is an error. (For example, the trivial case where the incorrect push() implementation only checks the asserts and exits.)

Strictly speaking, the major difference between asserts and unit tests is that unit tests have test data (values to get the program to run), while asserts do not. That is, you can execute your unit tests automatically, while you cannot say the same for assertions. For the sake of this discussion I've assumed that you are talking about executing the program in the context of higher-order function tests (which execute the whole program, and do not drive modules like unit tests). If you are not talking about automated function tests as the means to "see real inputs", then clearly the value lies in automation, and thus the unit tests would win. If you are talking about this in the context of (automated) function tests, then see below.

There can be some overlap in what is being tested. For example, a Stack's postcondition may actually assert that the stack size increases by one. But there are limits to what can be performed in that assert: Should it also check that the top element is what was just added?

For both, the goal is to increase quality. For unit testing, the goal is to find bugs. For assertions, the goal is to make debugging easier by observing invalid program states as soon as they occur.

Note that neither technique verifies correctness. In fact, if you conduct unit testing with the goal to verify the program is correct, you will likely come up with uninteresting test that you know will work. It's a psychological effect: you'll do whatever it is to meet your goal. If your goal is to find bugs, your activities will reflect that.

Both are important, and have their own purposes.

[As a final note about assertions: To get the most value, you need to use them at all critical points in your program, and not a few key functions. Otherwise, the original source of the problem might have been masked and hard to detect without hours of debugging.]


答:
This is a slightly more graphical version of the home theatre analogy.

If you want to add one more new appliance [aka, new functionality], at a pinch you can probably fit it in somewhere.

If you want to add yet another appliance, you can buy an extension lead, which will buy you some time.

But at each addition, it becomes more difficult to find a solution. And you're exposing yourself to a risk1 of fire [aka bugs], and you will have to pull out the big bucks to pay someone to put new sockets into the wall, which could quite possibly escalate all the way up to the main circuit board, or even further.

1 Another thing PHBs don't grok very well: "Well if it only might happen, what are you worrying about?"


问:
What are the warning signs of impending doom to watch out for on a project?
Having worked on a failed project is one of the few things that most programmers have in common, regardless of language used, industry or experience.

These projects can be great learning experiences, soul-crushing disasters (or both!), and can occur for a multitude of reasons:

upper management change of heart

under-skilled / under-resourced team

emergence of superior competitor during dev cycle

over/under management

Once you've worked on a couple of such projects, is it possible to recognise at an early stage exactly when a project is doomed to fail?

For me, a big sign is having a hard & fast external deadline combined with feature creep. I've seen projects which were well planned out and proceeding right on schedule go horribly off the rails once the late feature requests started to roll in and get added to the final "deliverable". The proposers of these requests earned the nickname of Columbo, due to rarely leaving the room without asking for "just one more thing".

What are the warning signs you look out for that set off the alarm bells of impending doom in your head?

答:
When management is too weak to say "No" to the business.

It leads to deadlines that will never be met,
which leads to a lack of confidence in the IT department
which leads to developers creating hacks (i.e. access db running on someone's machine...somewhere)
which leads to a nightmare for IT when the 'critical system' has to be migrated
which leads to...


答:
I enjoy talks that discuss the history of something that I work with, especially talks that go in depth just enough to give me additional insight into my many 'Why is this the way it is?' type of questions.

A lot of people, for instance have no idea that PHP started as a simple set of Perl scripts for management of a (P)ersonal (H)ome (P)age.

If your company uses a lot of free / open source software, there is a rich history to discuss. You'd be surprised how many people think that Linus Torvalds wrote bash (when in fact he only ported it very early on).

You can research and dig up humorous, interesting and often informative anecdotes on almost any technology if you spend enough time doing so.

This has the additional benefit of including people who might not otherwise participate.

Title: Great Lunch and Learn Topics


问:
Starting as a developer what are the possible career steps?
I would like to know what kind of jobs/roles one could expect on their career path if they start as a developer.

I also want to know how many years you'll be expected to stay in the same role until you progress to the next level.

The career path is of course, based on how good you do your job, the company etc. but assume a normal person who balances life and family with career.

Some examples of roles that I have in may head: developer, senior developer, architect, project manager etc.

答: Developer, Senior Developer, Architect, Project Manager (possibly also Principal Engineer, Program Manager, CTO, and God forbid, CEO). That's pretty much it, the only question is at which point you'd entirely switch from your editor/IDE to Microsoft Project/Word/Powerpoint.</p>


问:
What's a nice explanation for pointers?
In your own studies (on your own, or for a class) did you have an "ah ha" moment when you finally, really understood pointers? Do you have an explanation you use for beginner programmers that seems particularly effective?

For example, when beginners first encounter pointers in C, they might just add &s and *s until it compiles (as I myself once did). Maybe it was a picture, or a really well motivated example, that made pointers "click" for you or your student. What was it, and what did you try before that didn't seem to work? Were any topics prerequisites (e.g. structs, or arrays)?

In other words, what was necessary to understand the meaning of &s and *, when you could use them with confidence? Learning the syntax and terminology or the use cases isn't enough, at some point the idea needs to be internalized.

Update: I really like the answers so far; please keep them coming. There are a lot of great perspectives here, but I think many are good explanations/slogans for ourselves after we've internalized the concept. I'm looking for the detailed contexts and circumstances when it dawned on you.

For example:

I only somewhat understood pointers
  syntactically in C. I heard two of my
  friends explaining pointers to another
  friend, who asked why a struct was
  passed with a pointer. The first
  friend talked about how it needed to
  be referenced and modified, but it was
  just a short comment from the other
  friend where it hit me: "It's also
  more efficient." Passing 4 bytes
  instead of 16 bytes was the final
  conceptual shift I needed.

答:
I really get quite worried when I hear the "how did you get a grasp on pointers" question. I always thought the concept was incredibly simple, and a logical evolution of languages providing great power to the programmers.

The thing which worries me is that I never found it difficult to understand the concept of pointers. So when you here "when did you finally get it" over and over again, you start thinking:

Do I actually get it? Maybe I never did?

Maybe the reason why the concept seems to be a tricky one, is because we keep telling everyone who has yet to encounter them that pointers are so difficult, and here are a hundred ways in which you can learn?

Just throwing that idea out there, of course personally I love a good diagram and Steve Gibson always does a fantastic job of explaining anything!

Title: What's a nice explanation for pointers?


答: What do you expect? Money? Underlings? Self-fulfillment? Freedom? Power? Whenever I hear someone wants to make a career, I get a feeling that this someone has no clear goals.

Title: Starting as a developer what are the possible career steps?

Body:
I would like to know what kind of jobs/roles one could expect on their career path if they start as a developer.

I also want to know how many years you'll be expected to stay in the same role until you progress to the next level.

The career path is of course, based on how good you do your job, the company etc. but assume a normal person who balances life and family with career.

Some examples of roles that I have in may head: developer, senior developer, architect, project manager etc.


问:
What is the importance of XML in the world of JSON?
How important is it to learn XML when JSON is able to do almost all that I need? Having said that, I use JSON mainly for AJAX requests and obtaining data from various APIs.
I am a total newbie to web development and the reason I am asking this is that I want to know whether I should go ahead and buy a book on XML or whether I can just give it a pass.</p>

答:
You'll need to learn XML to get anywhere in the web world. It's what drives of lot of B2B communications and there are many standard XML formats describing important.

Just restricting yourself to JSON is hugely self-limiting. Yeah, you'll be chucking AJAX calls around but what happens when you need to communicate with a GeoServer? It'll be adhering to GIS standards and will be spurting out XML in WCS (Web Capabilities Service), WMS (Web Map Service) and WFS (Web Feature Service) formats among others. If you don't know how to handle XML, you'll have some trouble with that.

Of course, any marshaller (domain object to text format) worth its salt will be able to convert their objects to and from XML/JSON/YAML so you could make the argument that so long as you can hide behind the marshaller you only have to deal with the domain objects. Web services provide WSDL exactly for this purpose. But sooner or later you'll need to read and understand the contents of your requests and responses and that will certainly require an understanding of XML.

And let's not forget good ol' XHTML the old web standard for HTML pages. It's XML.

So, in short, learn XML - and keep JSON wherever you can 'cos it's lovely.


问:
Is it a good idea to do TDD on low level components?
I'm considering writing a low level driver or OS components/kernels.

The osdev.org folks seem to think that the important bits are not meaningfully testable this way, but I have read some discussions where people thought differently. I've looked around, but have failed to find any real life examples of TDD on low-level components.

Is this something people actually do, or just something that people talk about in theory because there is not a good way to do it in practice?

答:
I personally tend to believe one can get many of the benefits of TDD (without actually adhering to TDD), by:

Writing both the caller and the callee code at around the same time (definitely not more than 24 hours apart).

And use that to influence the design of the interface (objects, method calls and parameters).

For a component requiring a complicated algorithm/code, strongly consider implementing in a simpler but correct algorithm first, even if it is less efficient (or stupid, or only works in a narrower situation).

A very simple testing method would be running both algorithms and comparing their results.

Once a bug was discovered (by any means) in one part of the code, that part of code deserves to be tested much more aggressively. This means doing more sophisticated tests than TDD would call for. (based on the reasoning that bugs occur in clusters)

TDD seems to require you to have a pretty clear understand of what function you plan to implement, or what requirements you plan to satisfy by implementing the code. In some situations, there is simply too little understanding of the problem. This would have called for a Spike solution. Within the scope of this Spike solution, TDD can be applied because the problem has been narrowed down to a managable level. Once a few Spikes have been finished, each covering some aspects of the original problem, one can start working on the full solution, and applying TDD at that point might be feasible because of the improved understanding.

Edited:

After reading the page more carefully,

While it should be possible to test
  most kernel functions in a "testbed"
  test driver, the really "juicy" stuff
  like interrupt handling, process
  dispatching or memory management are
  probably not unit-testable.
  --- from http://wiki.osdev.org/Unit_Testing

They are clearly saying that most parts are testable, and that some parts require a different kind of testing: Stress Testing.


问:
Comparison with an outsourced dev center
We are part of a software company which was just acquired by a larger one. This company has a large development center in India; we are based in Europe.

We don't yet know what will happen with our projects, maybe they will be outsourced, maybe not but I want to know if we can rival an indian programmer as what salary is concerned.

I know there are a lot of factors involved here, not just the salary issue, but I just want to get an ideea of the difference.

Can someone mention salaries (in euros or dollars) and associated years of experience. I found some info on the web but it is not that recent.

Thanks in advance!

答:
This is very  subjective, it keeps on changing from the technology you work on the kind of work you want to get done in India etc etc. Plus some Developers are really expensive in India as well.

From what I know from peers in Europe a rule of thumb will be European Developers(5-6 years experience) will be at least three times as expensive than their Indian counterparts.

Also a lot of other things like Infrastructure/Electricity which companies consider will probably be cheaper in India.


答:
Broadly speaking I've seen people take the following routes:

1) Stay as a developer.  There's no reason to actually move on at all, developing is just fine and there are a lot of people I know into their 30s and 40s who have no intention of moving from something they enjoy into something they won't just for the sake of "progression".

2) Technical Architect.  Potentially still hands on to a degree but also involving higher level technical design and analysis, platform selection and so on.  Generally speaking a Technical Architect will have spent 5 - 10 years as a developer before moving into this sort of role.

3) Project Management.  The first of the hands-off options (a proper Project Manager won't code except maybe for the odd little tool to make their own life easier).  A Project Manager runs the project as a whole from start to finish, liaising with the business and the developers, ensuring the business case is valid, planning and managing the plan, monitoring risks and so on.  In terms of when you can move into Project Management, it can happen at any point, though the earlier you do it the smaller the projects you're given to manage are likely to be.

4) Business Analysis / General Consultancy.  Writing specifications, discussing what's needed with users and clients, documenting it, working with the developers and testers to make sure it's understood.  Again, a move into this sort of role can happen at any time, though more experience as a developer will tend to afford you better opportunities as an analyst.

5) Development Management.  Distinct from Project Manager though in some instances (particularly in smaller organisations) they'll be rolled into one.  The simplest distinction is that a Project Manager is responsible for the project, the development manager is responsible for the team.  A Development Manager will almost always have a technical background, may still be hands on, and will have a good understanding of development process and the associated tools.  Most of their time will be spent keeping the team productive and keeping the development work moving forward.  Generally speaking someone will have worked for 5 - 10 years as a developer before moving into this sort of role.

If you want to move beyond these into more senior management then Project Manager and Development Manager are the most likely routes out.

Which is best for you is entirely down to what you want to do and what your skills are and none of them should be seen as right or better than the others.  It's entirely possible to try them out and move back or move on again.  From my experience the only thing that stops that sort of move being possible is when you become senior enough that you won't take the salary drop which comes as part of moving into an area where you're less experienced.


答:
Hai Amir Rezaei,

I would like to suggest you, that A programmer can start the career as Junior level Developer after finishing the couple of projects in a fine style and also got one year experienced[ie some reasonable experience], then the he/she may promoted to Senior Level developer if the firm feels that he/she has both technical skills and management skills such as leadership qualities etc., By the Similar way he/she can switch to the next levels such as

Senior level Developer -> Team Lead Team Lead -> Architect Architect -> Project Manager


答: The number of years at a role can be calculated only at a very junior level in the Organization. As you grow vertically this formula fails miserably. Some people become CEO's at 40 some become CEO's at 50 and some never reach to that level even though they want to.</p>


答:
Well, I can't tell you for certain, but I can show you my "career" (outside uni studies) so far, and what I'd like to do (in brackets):

web admin -> volunteer research assistant -> cinema worker -> software tester -> call center worker (selling wine) -> developer in financial services -> self employed developer (financial services) -> developer in scientific instruments [-> get a doctorate in something CS related -> get a lecturing position -> get tenure -> retire]

I guess you're only interested in the steps where I'm a developer, the rest is there for completeness. The amount of money I earn in each step depends on who I'm working for more than my job title.

I've not stayed in the same role for more than 2 years, so far. A doctorate would obviously take longer, and I hope to be in my current role for a while. Getting to be a lecturer and getting tenured, well that could take forever.


答:
When well managed, an offshore team can be more efficient than a onsite team, and sometimes cost half the price.

A typical freelance C# developer can earn up to $100 per hour in western countries (sometimes lot more). The same guy (same experience) in india is 5 times cheaper (sometimes lot less).

A typical employed C# developer can earn up to $25 per hour in western countries (sometimes lot more). The same guy (same experience in india is 3 times cheaper (sometimes lot less).

I also discovered recently that you can take developers on leasing (or renting), just like objects (cars, etc)!

You tell the leasing/renting company you need 4 C# developers with knowledge of nHibernate. They will find them, they will hire them, they will pay their salaries, they will buy computers, they will put them in an office, they will add phones, emails, etc.

You pay a monthly flat fee for the service.

Want more ? Just tell the company they add more developers. Want less? No problem bob, they remove developers.

The world is changing... you have to do something.

I suggest you this great book:

My Job Went To India

It will helps you improve yourself in order to avoid being replaced by a cheaper (and more competent) offshore developer.

To summarize: offshoring will eventually become legion. And "simple developers" with no added value will be replaced.

Invest in yourself

Title: Comparison with an outsourced dev center

Body:
We are part of a software company which was just acquired by a larger one. This company has a large development center in India; we are based in Europe.

We don't yet know what will happen with our projects, maybe they will be outsourced, maybe not but I want to know if we can rival an indian programmer as what salary is concerned.

I know there are a lot of factors involved here, not just the salary issue, but I just want to get an ideea of the difference.

Can someone mention salaries (in euros or dollars) and associated years of experience. I found some info on the web but it is not that recent.

Thanks in advance!


问:
Career guidance books for programmers
I am currently reading the recently published Being Geek by Michael "Rands" Lopp and I can't get enough of it.

Is there any other career guidance books aimed directly or indirectly at programmers that are worth reading?

答:
I wrote a small blog post here:
I would add:

The Adventures of Johny Bunko - The last career guide you will ever need,

ReWork (does not fit 100% but gives you an insight to how things work in modern Software Development Environments)

Title: Career guidance books for programmers