问:
How do you address the gap on your resume after a self-funded sabbatical?
There are a ton of questions on Programmers.SE about whether or not taking extended time off is a good idea and what to do during that time off to maintain your skill level:

https://softwareengineering.stackexchange.com/questions/31536/will-taking-two-years-off-for-school-in-a-related-field-destroy-a-mid-level-devel

https://softwareengineering.stackexchange.com/questions/102009/can-i-take-a-year-off-without-hurting-my-career

If you take a year or two out from being a developer, is it really that hard to get back into it?

https://softwareengineering.stackexchange.com/questions/91176/is-taking-a-break-in-career-to-learn-stuff-a-bad-idea

They've been really helpful, but I still have a question about the logistical details of take a self-funded sabbatical.

I'm coming to the end of a year off from working as a software developer (after 7 years in the field.) I've taken this year to let myself explore interests that I'd never had enough time for: baking, sewing, photography, and making new and interesting friends. During this time, I've also been working on pet development projects in technologies and disciplines that I would never have had the chance to explore otherwise. in addition, I've read all of those software development books I'd never had time to read and kept up with programming news and blogs.

The development projects have all had an eye towards being part of a Micro ISV, but only one of the projects has made it to any sort of production stage. That project is impressive, but not very successful (yet!)

I've got a reasonably active programming blog that I believe reflects a high dedication to software development and demonstrates that I haven't just put my programming skills on a shelf for a year.

My question is: What is the best way to transmit this information to a potential employer at the resume/cover letter level?

I'm reasonably confident that I can explain this sabbatical in an interview setting. I know that at the resume level though, hiring managers will use any excuse they can to throw my resume out (I've done hiring and I would probably have thrown out my own resume if it didn't handle this time off really well, maybe it's karma.) So I feel like the resume/cover letter is the really tricky part in getting a kick-ass new job.

I have a few ideas about what to do, but I'm not sure what the larger community sees as acceptable. Here are the approaches I'm considering:

Put a special section on my resume for the sabbatical time in which I outline the personal projects. If I do this, what's a good way to label it?

Create a personal company name and put these projects in the work
experience section of my resume under that company. This seems like the most go-getter
way to do it, but I'm worried it could be perceived as trickery when
I get to the interview stage. Also if I do this, what do I put as my
title?

Leave my resume as-is and explain everything in my cover letter,
with a link to my active blog.

There's probably something I'm not thinking of, I'm open to any
other ideas.

I know I've included a bunch of special-snowflake information about my personal situation, but I would prefer answers for the more general case. The personal details are here more as an example than as a request for answers designed specifically for me.

答:
I'm on a sabbatical myself right now so maybe we can share notes.  I'm going to start by agreeing with other answers that you're thinking too much.

First step is to have a plan and if you have a favorite recruiter or linkedin/monster/dice etc... accounts announce your plan and time off.  Even if your plan is to surf all the California beaches or pub crawl Islay, you're doing something and not just loafing around and that's all anyone cares about.  No one likes the surprise of you just disappearing for a year, many will want to hear your stories when you come back.

I would recommend doing personal projects, even if small it helps to keep the physical act of coding fresh and practiced plus it gives you a little something to show.  Contribute to an open sourced project as an alternative, same reasons.

I update the recruiters I work with occasionally.  When I reenter the coding workforce there won't be any surprises.  I agree with other answers that this needs to be on your resume.  On my resume it's going down as "sabbatical" with relevant projects and accomplishments listed.

So no, I don't think that taking extended time off is a bad thing and I think that breaking out of the intensely focused environment of software development can actually be a good thing.

You don't have to "explain" the sabbatical, you will want to describe what you did and what you learned during your time off.  It's a great chance to show how your diverse experiences can add to any team, your wide interests can lead to creative solutions, and now that personal time is over how you really want to work at where you're applying and not there just because you need a job.


问:
Is it wrong or bad to use autocomplete?

Possible Duplicate:

  Should newbies use IDE autocomplete (Intellisense)?

I have a friend at school who wrote a program in VB.net in notepad, took it home fixed any errors that came up, and then compiled it. He used a textbook to get the hang of the relatively basic methods and properties he'd need (nothing complicated like network sockets etc) and then wrote it without looking much up.

This makes me wonder if it is frowned upon to use or rely on autocomplete? In Objective-c the method names are quite descriptive, and mostly I know what I want to do and now roughly the name of the method I want to use, though not necessarily letter for letter.

I could, if I wanted use the Documentation or headers to find method names, and I do sometimes. But naturally this is slower.

So should I focus more on learning parts of the language, than actually programming for a while, or is it ok to use Auto complete a lot?

Also as a subquestion, is better to know one language without much autocomplete needed. or to rely more on autocomplete and be able to use other languages (although not as efficiently and easily) once the syntax is understood.

答:
One method of learning a new language or algorithm is to re-type the example(s) totally from scratch.  I find that re-typing an algorithm (even if the example is is cut-n-pasteable) focuses my attention and causes me to question every operator, every function call. Auto-complete in this circumstance would detract from my learning.

To address your question direction: It depends on the circumstance. If you're learning, or you just want to avoid Cargo Cult Programming, then avoid auto-complete.

ContentLicense: CC BY-SA 3.0

Title: Is it wrong or bad to use autocomplete?


答: School is different from the real world.  I would only use it at school if it was going to be available during your examinations.  In the real world, there's really no reason not to.  It's like relying on GPS when you move to a new city.  It takes you longer to learn how to get around without it, but you still do eventually, and you get lost a lot less in the meantime.  </p>

Title: Is it wrong or bad to use autocomplete?

Body:
Possible Duplicate:

  Should newbies use IDE autocomplete (Intellisense)?

I have a friend at school who wrote a program in VB.net in notepad, took it home fixed any errors that came up, and then compiled it. He used a textbook to get the hang of the relatively basic methods and properties he'd need (nothing complicated like network sockets etc) and then wrote it without looking much up.

This makes me wonder if it is frowned upon to use or rely on autocomplete? In Objective-c the method names are quite descriptive, and mostly I know what I want to do and now roughly the name of the method I want to use, though not necessarily letter for letter.

I could, if I wanted use the Documentation or headers to find method names, and I do sometimes. But naturally this is slower.

So should I focus more on learning parts of the language, than actually programming for a while, or is it ok to use Auto complete a lot?

Also as a subquestion, is better to know one language without much autocomplete needed. or to rely more on autocomplete and be able to use other languages (although not as efficiently and easily) once the syntax is understood.


答:
A few years ago I had to let a programmer on my team go because he insisted on using a text editor rather than the .NET IDE. To be fair, the real reason was that he was slower getting his tasks done and his code was poorer quality and caused integration problems. It's possible that some programmer-savant could have done a better job with just a plain text editor but most of us regular folks need help like auto-complete and speling and grammer checking.

As I like to say, don't bark when you can hire a dog to do it for you.

Title: Is it wrong or bad to use autocomplete?


问:
From TFS to Git
I'm a .NET developer and I've used TFS (team foundation server) as my source control software many times. Good features of TFS are:

Good integration with Visual Studio (so I do almost everything visually; no console commands)

Easy check-out, check-in process

Easy merging and conflict resolution

Easy automated builds

Branching

Now, I want to use Git as the backbone, repository, and source control of my open source projects. My projects are in C#, JavaScript, or PHP language with MySQL, or SQL Server databases as the storage mechanism.

I just used github.com's help for this purpose and I created a profile there, and downloaded a GUI for Git. Up to this part was so easy.

But I'm almost stuck at going along any further. I just want to do some simple (really simple) operations, including:

Creating a project on Git and mapping it to a folder on my laptop

Checking out/checking in files and folders

Resolving conflicts

That's all I need to do now. But it seems that the GUI is not that user friendly. I expect the GUI to have a Connect To... or something like that, and then I expect a list of projects to be shown, and when I choose one, I expect to see the list of files and folders of that project, just like exploring your TFS project in Visual Studio. Then I want to be able to right click a file and select check-in... or check-out and stuff like that.

Do I expect much? What should I do to easily use Git just like TFS? What am I missing here?

答:
What do you mean, "the" git gui?  There are a gazillion of them, including a plugin for visual studio integration, if I remember correctly.  If one GUI doesn't work for you, try some more until you find one that does.  I personally use different GUIs for different tasks (and the CLI for others).

However, git is more of a version control framework than a fixed system.  You're still going to have to learn some basics to get the most out of it.

Title: From TFS to Git


问:
Stuff every programmer needs while working
I've been tasked with creating a fun and relaxing environment, one thing I know that I want is ergonomic mice and keyboards, others have suggested exercise balls and bands.

What is it that every programmer needs while working? What might not be necessary but would be nice to have anyway?

Note: this question was asked previously, but has been recommended to be posted here. See this link for the previous responses: https://stackoverflow.com/questions/3911911/stuff-every-programmer-needs-while-working-closed

答:
Time Allocated To Research

Be it tooling around with a potentially usable new tool/technology or reading up on a methodology, time to research is critical.

Anecdote:

When I started my current job, Fridays were terrible because all of the evening telemarketing staff worked the day shift on Fridays. I started working at home on Fridays and took 50% of that time at home and devoted it directly to researching. I got up to speed on the codebase, the vendor tools, methodologies that we used in no time and discovered some new techniques/processes that I ended up putting in place to great effect.

ContentLicense: CC BY-SA 2.5


答:
Remember that a language and a framework are two different things. None of the languages that I can think of have so many syntactic forms that a programmer with a bit of experience should have trouble remembering them.

Modern application frameworks, on the other hand, tend to have dozens or hundreds of classes and thousands of methods. You might be able to memorize all that if you really want to, but it'd be a lot like doing The Knowledge minus the licensing exam.

Don't use your IDE's autocompletion as a crutch -- you should work toward a solid understanding of the classes available and the methods they offer. If you have to pause every time you type NS or UI in Xcode and spend time looking at the list of options, you should spend some time with the docs. But there's nothing wrong with letting the compiler complete names for you if you know basically what you're doing.

Title: Is it wrong or bad to use autocomplete?


答:
I've seen people only being able to code by auto complete and try and error. That's bad because since they don't understand what they do, they can't solve anything beyond toy problems.

In all other cases anything helping you being more productive is a clear win.

Title: Is it wrong or bad to use autocomplete?


答: I see it frowned upon a lot by folks who code in dynamic languages or languages without a sophisticated IDE available. Java or .NET programmers love it. Even for APIs that I'm familiar with, it saves a ton of time so I don't have to remember spelling or argument lists for thousands of methods or keep the javadocs open all day. I've been doing some Python with Eclipse + PyDev recently and it's helpful, but limited. Dynamic languages in general aren't well-suited to autocomplete since methods may not be known at compile time and argument lists may be variable.</p>

Title: Is it wrong or bad to use autocomplete?


答:
I absolutely wouldn't be without Eclipse's fantastic autocomplete.

It helps you navigate your way round obscure APIs (Is it .put(), .add(), or .addElement() to add an item to an ArrayList?  What's the order of the parameters to System.arrayCopy() again?  Either navigate to the appropriate documentation page, or press Ctrl-Space to view a quick list of all methods available).

It slashes down the amount of typing you need to do (System.out.println() vs Sysout+Ctrl-Space)

It lets you know instantly if you've made a mistake.  If the autocomplete stops working, it's a sure sign you've gone wrong somewhere.

All of these things combine to make for a very productive environment for software engineering.

Title: Is it wrong or bad to use autocomplete?


问:
What were the reasons why Windows never had a decent shell?
I was reading a topic on SO: Why are scripting languages (e.g. ...) not suitable as shell languages?. Especially I liked the answer by Jörg W Mittag, from which I learned interesting things about Windows PowerShell. So after more than 20 years Windows finally has a well designed shell (Windows 1.0 - 1985, PowerShell stable release - 2009). On other hand Unix systems has a bunch of various shells since 1978 Bourne Shell. I've read some articles about MS job interviewing and I have an impression of very "geekish" company. I am wondering why didn't they had a need for command-line tools compared to Unix people who do all their work with those tools.

答:
Because there has never been enough call for one, I guess.

Windows Scripting Host has been installed as standard since Windows 98 (I assume it was around before that); VBScript was very capable; or you could easily write a command-line tool, which had access to the whole Windows API.

Powershell, put simply, is just another step in the same direction. COM isn't popular any more, so WSH has become quite a learning process. But .NET is the current Big Thing in the Windows world and learning Powershell from a .NET background is relatively easy.

One place I think Powershell has gone wrong though is in trying to appeal to the *nix crowd as well, with all its aliases that make it look like Bash when it clearly isn't.

Apart from the commandline switches, piping is very different in Powershell and is really the first thing you should learn when you pick it up.

And honestly, it is much more like a scripting language, a la Perl, than a shell, a la Bash. There are some serious gotchas if you try to use it as your primary shell.

For example, try doing a simple SVN dump from Powershell. It doesn't handle binary data in stdout very well. On the other hand, manipulating an SVN log is an absolute dream, thanks to its built-in xml type.


答:
Computers are good at exact string matching (especially in the case of hash-tables) - humans are not. Brains are associative constructions that recall code often using in-combinations of its sub-words and their synonyms and not neccessarily in the correct order. That's why IDEs exist and why there is still room for improvements in this area.

LLVM are taking innovative steps (thanks to Apple's money) in this direction through its IDE-plugin library libclang. libclang supports fuzzy spelling corrections of indentifiers based on the Levenhstein (Edit) Distance.

Title: Is it wrong or bad to use autocomplete?


答:
I'm old enough to remember when autocomplete made it into my IDE.

It made me explore much more sourcecode than I ever did before. Because of that, I strongly believe it made me a better programmer.

Title: Is it wrong or bad to use autocomplete?


答:
Autocomplete is good - if you know what you're doing.

Points in favor:

No need to memorize the whole of various libraries.

Easy to see what's available (I use this in Python a lot after importing something, to remind myself what's in the module, if I'm looking for something and uncertain how to use it)

Points against:

You have no need to memorize anything, so you're less likely to try and keep it in your mind.

In some cases, autocomplete can slow you down.  Offhand, Eclipse and Java pops into mind - if I know what I'm doing, the autocomplete popups distract me and break the flow.

Neutral points to keep in mind:

If you use a library function often enough, you'll have it memorized just because you see it so often.  This can help you memorize the correct spelling because it's pulled up automatically - or it can hinder memorization because you're relying on autocomplete to get it right.

If you don't use it often enough to memorize on its own, there's probably a reason.  In that case, best to look at the documentation to make sure you understand the function, and aren't just tossing it in because autocomplete found it.

Title: Is it wrong or bad to use autocomplete?


答:
Because there is little need and much pain in developing a second parallel Windows toolset.

Shells are made powerful through the number and power of helper programs on a GNU system, such as sed, find, xargs et al. Re-implementing these tools is a lot of work, and just building a POSIX compliance layer on top of Windows has proven much easier. Cygwin is such a POSIX compliance layer and provides for most of the needs shell users have when they are forced to use Windows.

I would personally guess that the developer community that is both unwilling to jump the POSIX and Linux bandwagon and still sufficiently devoted to shell programming is so small that it took 20 years to develop a stable shell.

Title: What were the reasons why Windows never had a decent shell?

Body: I was reading a topic on SO: Why are scripting languages (e.g. ...) not suitable as shell languages?. Especially I liked the answer by Jörg W Mittag, from which I learned interesting things about Windows PowerShell. So after more than 20 years Windows finally has a well designed shell (Windows 1.0 - 1985, PowerShell stable release - 2009). On other hand Unix systems has a bunch of various shells since 1978 Bourne Shell. I've read some articles about MS job interviewing and I have an impression of very "geekish" company. I am wondering why didn't they had a need for command-line tools compared to Unix people who do all their work with those tools.


问:
How can a large, Fortran-based number crunching codebase be modernized?
A friend in academia asked me for advice (I'm a C# business application developer).

He has a legacy codebase which he wrote in Fortran in the medical imaging field. It does a huge amount of number crunching using vectors. He uses a cluster (30ish cores) and has now gone towards a single workstation with 500ish GPUS in it.

However where to go next with the codebase so:

Other people can maintain it over next 10 year cycle

Get faster at tweaking the software

Can run on different infrastructures without recompiles

After some research from me (this is a super interesting area) some options are:

Use Python and CUDA from Nvidia

Rewrite in a functional language. For example, F# or Haskell

Go cloud based and use something like Hadoop and Java

Learn C

What has been your experience with this? What should my friend be looking at to modernize his codebase?

UPDATE: Thanks @Mark and everyone who has answered. The reasons my friend is asking this question is that it's a perfect time in the projects lifecycle to do a review.  Bringing research assistants up to speed in Fortran takes time (I like C#, and especially the tooling and can't imagine going back to older languages!!)

I liked the suggestion of keeping the pure number crunching in Fortran, but wrapping it in something newer. Perhaps Python as that seems to be getting a stronghold in academia as a general-purpose programming language that is fairly easy to pick up.

See Medical Imaging and a guy who has written a Fortran wrapper for CUDA, Can I legally publish my Fortran 90 wrappers to Nvidias' CUFFT library (from the CUDA SDK)?.

答:
I doubt Fortran will ever die -- it has such a large legacy of software and libs written in it that people are still working on it, only stabilizing this situation. Moreover it is still a very good language if you don't want to do anything more than number crunching -- syntax is very elegant and logical, plus the compiler can easily guess what is happening. Thus it is guaranteed that any new hardware accelerator technology will support C, Fortran and some kind of OpenCL (when it would finally converge to something solid).

So I would say you should just clearly separate numerical part, leave it in Fortran, make clear binding and write the rest in whatever you want.


答: Note that there's no reason that Microsoft can be the only one to write a shell for Windows.  The guys who write bash are different from the guys who write *nix kernels.  You don't even need root privileges.  I've compiled my own shells to use when I didn't like the one the sysadmin installed.  If there was a true demand for a better Windows shell, someone would have written one.  </p>


答:
Windows has design features that do not lend themselves to scripting.  This is a result of making the graphical interface the primary mode of operation.  Many tools do not have functional command line interfaces.  Without a decent command line interface it is very difficult to generate a good shell.

Often things that need to be scripted in Windows require mouse clicks and key strokes to be simulated at various locations on an applications window.  The resulting scripts can be quite fragile.  Describing where to script in a command language is not a trivial exercise as the relevant geometry is not readily available.

Windows also did not have a functional piping mechanism in early versions.  As it was described to be, the first process would run and its output would be saved to a temporary file.  That file would be used as input to the next command.  This could be disk intensive and would fail if sufficient temporary space was no available.  Unix pipes pass the data in memory and schedule the processes in a manner that minimizes delays.


问:
WCF/SOA - Why should I create parameter objects for simple requests
Our company is starting a fairly large SOA initiative.  We're doing a lot of stuff right: there's good communication; money for tools where appropriate; and we have brought on some good expertise to help us with the transition.

We're trying to develop standards that we can follow as a group, and one of the proposed standards is bothering me quite a bit:

We have standardized on the pattern where every operation takes a request object and returns a response object.

I realize that this is more or less a standard approach for a lot of folks, but I am asking why should I bother? (I'm not so good with received wisdom, I need some why).

Most of the services that I will be providing are simple organizational metadata retrieval.  For example, find the security policy for a particular user.  This needs a user id and nothing else.  The standard tells me that I should wrap this request in an object and wrap the returned policy in a response object.

My unease is amplified by a look at the WSDL that is generated from our contracts.  WCF generates request and response messages automatically and wraps even the request/response object.

I fully understand that if you're making a complex request then a complex input object is warranted.  That's what you would do even if services wren't involved.

My question is why should I automatically wrap requests and responses when:

It makes simple services less expressive

You would do it anyway for a complex service

WCF creates a request/response message anyway

I have found the following arguments in favor of this approach:

It supports versioning by allowing optional parameters to be slipped into the request object.

Back in the day, I did a fair bit of COM, and I would consider this almost an anti-pattern for versioning.  For some things, I suppose it would help, but I expect that where it would help, you already have a parameter object anyway.

It allows common data and behavior to be isolated to a base class

This one carries some weight with me.

It steers people away from an RPC style behavior and towards a messaging behavior

I've read this on Microsoft's site and heard it from our guru, but I still don't have a clear idea what they mean or why it's valuable.  Is it that natural looking interfaces make people tend to forget that they are calling a remote service?

I am looking at refactoring the signatures of perhaps 300 methods, so this is a non-trivial amount of pain.  I'm a huge fan of consistency in implementations, so I'm willing to take on the pain, it will just help to know that it will all be worth it in the end.

答:
I think versioning is probably the best argument. When you have an existing operation contract like

```<code>int GetPersons(int countryId);
</code>```

that you want to enhance, e.g. by another filter later on

```<code>int GetPersons(int countryId, int age);
</code>```

You would have to write a new operation contract and with a new name since it has to be unique. Or you would keep the name and publish a new v2 of your service with the old v1 still being around for backwards compatibility.

If you wrap the parameter into an object you can always extend it with default/optional parameters and all your existing clients will be unaffected when you reuse the same operation contract.

However I would also urge to name your objects appropriately. Even if it just wraps an int, if you start with IntMessage or something similar you're not doing yourself a favor extending it. You'd have to name it e.g. PersonFilter right from the start which means you have to think a little about what this service call should expect as parameter semantically and therefore what it's supposed to do. Maybe (and that's a very vague maybe) that's going to help in developing the right services and maintain a decent sized API.

It allows common data and behavior to be isolated to a base class

That's something to be cautious with. Inheritance and data contracts don't go that well together. It does work, but you'll have to specify all known subtypes of the contract that could go over the wire, otherwise the data contract serializer fails complaining about unknown types.

But what you could do (but still probably shouldn't, I'm still undecided on this) is reuse the same messages among different services. If you put the data contracts in a separate dll you can share that between client and service and you don't need to convert between types when you call different services that expect basically the same message. E.g. you create a PersonFilter and submit that to one service to get a filter list of persons and then to another service and have the same objects on the client. I can't find a good real-world example for that though and the danger is always that an extension to the data-contracts is not general enough for all services that use this contract.

Overall, apart from versioning, I can't really find the killer reason for doing it that way either.

Body:
I think versioning is probably the best argument. When you have an existing operation contract like

int GetPersons(int countryId);

that you want to enhance, e.g. by another filter later on

int GetPersons(int countryId, int age);

You would have to write a new operation contract and with a new name since it has to be unique. Or you would keep the name and publish a new v2 of your service with the old v1 still being around for backwards compatibility.

If you wrap the parameter into an object you can always extend it with default/optional parameters and all your existing clients will be unaffected when you reuse the same operation contract.

However I would also urge to name your objects appropriately. Even if it just wraps an int, if you start with IntMessage or something similar you're not doing yourself a favor extending it. You'd have to name it e.g. PersonFilter right from the start which means you have to think a little about what this service call should expect as parameter semantically and therefore what it's supposed to do. Maybe (and that's a very vague maybe) that's going to help in developing the right services and maintain a decent sized API.

It allows common data and behavior to be isolated to a base class

That's something to be cautious with. Inheritance and data contracts don't go that well together. It does work, but you'll have to specify all known subtypes of the contract that could go over the wire, otherwise the data contract serializer fails complaining about unknown types.

But what you could do (but still probably shouldn't, I'm still undecided on this) is reuse the same messages among different services. If you put the data contracts in a separate dll you can share that between client and service and you don't need to convert between types when you call different services that expect basically the same message. E.g. you create a PersonFilter and submit that to one service to get a filter list of persons and then to another service and have the same objects on the client. I can't find a good real-world example for that though and the danger is always that an extension to the data-contracts is not general enough for all services that use this contract.

Overall, apart from versioning, I can't really find the killer reason for doing it that way either.


答:
These days I would phrase the question the other way around ´Is it wrong to code without autocomplete?´.  If you are using descriptive naming you are very likely to misspell at least some references.  A good IDE will suggest a reasonable set of suggestions at any point.  </p>

<p>The things we are coding have become extremely complex, and it would be unreasonable to expect programmers to know all of the components they need to reference off the top of their head, and to spell all the references without mistakes.  Autocomplete simplifies the task significantly and allows the programmers to concentrate on the complexities of the code. </p>

Title: Is it wrong or bad to use autocomplete?

Body:
These days I would phrase the question the other way around ´Is it wrong to code without autocomplete?´.  If you are using descriptive naming you are very likely to misspell at least some references.  A good IDE will suggest a reasonable set of suggestions at any point.

The things we are coding have become extremely complex, and it would be unreasonable to expect programmers to know all of the components they need to reference off the top of their head, and to spell all the references without mistakes.  Autocomplete simplifies the task significantly and allows the programmers to concentrate on the complexities of the code.


答:
To offer what seems to be a contrarian view:

Remembering: A language library that is sufficiently "random" that you need auto-complete to help remember which method to choose (e.g. is it size or length?), is broken. Would be better to fix it, than to band-aid it. If you can't fix it, wrap it. (If you don't know what it means to wrap it, learn that.)

Typing: Already know exactly the name you want, and claim you're using auto-complete purely to "save keystrokes"? That seems to make sense, although just typing the name is faster than reaching for cursor keys or gods help you the frakking mouse. (If the name really is that long, see above: Fix it or wrap it.)

Programmers who can't type fast are like kids who want to be NBA players but can't make free throws. It's a basic skill you must have. It can be improved if you care and you aren't too lazy to practice.

Obviously there are many mediocre programmers and ball players. Is being mediocre "wrong", as the question puts it? Maybe not. But my answer is aimed at people who aspire to being more than "not wrong", i.e. to doing more than not-sucking. Which I think was the spirit of the question.

Title: Is it wrong or bad to use autocomplete?


答:
I have made the journy from visual source safe to tfs to svn to git.

Going from vss to tfs was a pleasant experience.
Going from tfs to svn was a pleasant experience.
Going from svn to git has been sort of an internal battle.

Often I find myself to be quite conservative and I try to hang on to what works.
A nice gui is for me preferable over the command line and I found myself searching for some gui that would let me play with the cool kids I work with. They all used git with the command line exclusively.

The eureka moment for me came once I gave up on the search for a silver bullet gui and started to give git bash a try (I'm still learning).

I have some guis installed and they do complement git from the command line.
Git extensions, Git source control provider for visual studio and tortoise git.
But I say get familiar with git bash.
The commands can be a little cryptic but once you learn them they are so much faster than the gui.

Branching with git is just AWESOME compared to the others.
Create branches and switching between branches it almost instant.
You can do stuff you would not bother doing with svn because svn basically copies your working copy (at least the way I did it).

I find Git to have a steeper learning curve than svn.
But once you "get it" with git you don't want to go back.

Git all the way.

Title: From TFS to Git

Body:
I'm a .NET developer and I've used TFS (team foundation server) as my source control software many times. Good features of TFS are:

Good integration with Visual Studio (so I do almost everything visually; no console commands)

Easy check-out, check-in process

Easy merging and conflict resolution

Easy automated builds

Branching

Now, I want to use Git as the backbone, repository, and source control of my open source projects. My projects are in C#, JavaScript, or PHP language with MySQL, or SQL Server databases as the storage mechanism.

I just used github.com's help for this purpose and I created a profile there, and downloaded a GUI for Git. Up to this part was so easy.

But I'm almost stuck at going along any further. I just want to do some simple (really simple) operations, including:

Creating a project on Git and mapping it to a folder on my laptop

Checking out/checking in files and folders

Resolving conflicts

That's all I need to do now. But it seems that the GUI is not that user friendly. I expect the GUI to have a Connect To... or something like that, and then I expect a list of projects to be shown, and when I choose one, I expect to see the list of files and folders of that project, just like exploring your TFS project in Visual Studio. Then I want to be able to right click a file and select check-in... or check-out and stuff like that.

Do I expect much? What should I do to easily use Git just like TFS? What am I missing here?


答:
The demands you have put actually put Fortran at the top of the list, for problems like this:

a) number crunching

b) parallelable

c) it was and still is the de facto language taught outside of CS studies (to engineers who aren't professional programmers).

d) has an incredible(!) industry backing, number-of-industry-grade-compilers-wise, with none of the vendors showing the least signs of abandoning that branch. One of Intel's representatives not far ago revealed that sales of their Fortran products are higher than any other in their development tools.

It is also a language which is incredibly easy to pick up. I don't agree that it takes time for bringing research assistants up to speed. My first textbook on it had no more than, oh I don't know, 30 (?) pages of sparse printed text. It is a language in which after learning 10 keywords, one can write medium-sized programs. I would dare say that those 30 pages written in default Word text would make a more than comprehensive "Fortran manual" for most users.

If you're interested in CUDA, you might want to check Portland Group's compiler, which supports it. I'm not familiar with the finer details, but people generally talk of it with praise.

Apart from that, for paralleling programs you have available OpenMP, MPI and now the upcoming (and long awaited) co-arrays, which Intel's compiler has recently implemented. To not waste words, Fortran has a very fine gamma of "libraries" for parallelizing programs.

Industry standard numerical libraries are developed for it foremost, other languages following more or less in the function/routines portfolio.

All that being said, I would however (depends on when it was originally written) recommend if it is, let's say, F77 code or older, rewriting it partially through time to newer dialects - F90 at least, if possible with F2003 features. A paper / thesis on that topic was recently published (medium-sized PDF file ahead). Not only can that, if done properly, ensure portability across multiple platforms, but will also make it more easy for future maintenance.

p.s. As far as "future maintenance" goes, just an anecdote which I sometimes like to mention. While writing my thesis, I reused some code from my mentor, written 35 years ago from the time of writing. It compiled with only one error; a statement missing at the end, due to copy-paste mistake :)

@DaveMateer (reply to comment) - I'm going to make a comment in the following which may be a bit impolite, but please don't take it the wrong way, for it is in the fair intentions.

It seems to me you're tackling this "problem" in the wrong way. What I mean in a
few short points (for it is very late in here, and my ability to make up
readable (let alone comprehensible) sentences leaves me after 10p.m.)

a) You mentioned you're trying to minimize extra coding time, yet you're
considering a rewrite from a language specialized for numerical computing to one from a
colorful choice of languages, if you'll pardon my expression

some of which don't have support for multidimensional arrays, amongst other
things

most of them are unsuitable for heavy numerical work (of parallel processing
capabilities of Haskell and Hadoop I admit, I know nothing about ... but have
never heard them even mentioned in those circles)

it possibly has been tried, but I've never heard of a rewrite from Fortran,
a language for discretized problems, to a functional language

there has been a discussion recently on comp.lang.fortran (try searching
through Google Groups) on the aspects of scientific computing "in the cloud"

(wouldn't like to demotivate you, but to be fair, no one was really sure what
that term even represents, let alone had an example of a successful application.
Most people agreed that potential exists, but so far they're happy the way things
work for now.). A lot of problems are not suitable for that kind of parallelisation either.

b) What would be the costs of such a rewrite? People/hours.

c) Correct versions of the libraries to compile...- is a problem in any
language that cannot be avoided, however you look at it.

d) I've heard of Python (a nice language really) used in parallel applications
on a few occasions, but its penetration of that market still doesn't seem to be
rising, and its ever changing nature makes it a very poor choice for a long term
project (think backward compatibility). Some people like it very much as a "glue" language.

Ugh, if I think of anything else, will add it tomorrow. Gotta get some sleep...

Title: How can a large, Fortran-based number crunching codebase be modernized?

Body:
A friend in academia asked me for advice (I'm a C# business application developer).

He has a legacy codebase which he wrote in Fortran in the medical imaging field. It does a huge amount of number crunching using vectors. He uses a cluster (30ish cores) and has now gone towards a single workstation with 500ish GPUS in it.

However where to go next with the codebase so:

Other people can maintain it over next 10 year cycle

Get faster at tweaking the software

Can run on different infrastructures without recompiles

After some research from me (this is a super interesting area) some options are:

Use Python and CUDA from Nvidia

Rewrite in a functional language. For example, F# or Haskell

Go cloud based and use something like Hadoop and Java

Learn C

What has been your experience with this? What should my friend be looking at to modernize his codebase?

UPDATE: Thanks @Mark and everyone who has answered. The reasons my friend is asking this question is that it's a perfect time in the projects lifecycle to do a review.  Bringing research assistants up to speed in Fortran takes time (I like C#, and especially the tooling and can't imagine going back to older languages!!)

I liked the suggestion of keeping the pure number crunching in Fortran, but wrapping it in something newer. Perhaps Python as that seems to be getting a stronghold in academia as a general-purpose programming language that is fairly easy to pick up.

See Medical Imaging and a guy who has written a Fortran wrapper for CUDA, Can I legally publish my Fortran 90 wrappers to Nvidias' CUFFT library (from the CUDA SDK)?.

ContentLicense: CC BY-SA 4.0


问:
Two factor authentication using time base key generator on smartphones
I recently enabled two factor authentication for my Google account. One of the ways of getting the second factor (the key that I have) is to install an Android app on my phone that displays a key for a short duration of time.

What does it take to create a web server solution paired with a smartphone solution?

I am using Windows and .NET on the server side and would be interested in both Android and iPhone apps. Are there existing libraries out there or do I need to start from scratch? Where is some starting documentation and explanations of the techniques used?

答:
This blog post, Using Google Authenticator For Your Website, talks about using google authenticator in your own website.

The Google code provides a command line program that can generate secret keys as well as a PAM module, but it turns out to be very little code to authenticate a TOTP, thereby providing two-factor authentication to your website very easily.

Otherwise take a look at OATH which is an open OTP solution, there are a number of libraries and hardware solutions supporting this technology.

Yubikey

OATH based OTP generation

"How do I generate One time passwords (OTP / HOTP)?" might provide some insight as well.

I've also provided a client-only library for the yubikey on bitbucket. The library implements the client-side api for the hardware yubikey.


问:
Is there such a thing as a "when" statement?
Is there a language or language feature that can handle "when" cases? That is, whenever some condition becomes true, in any scope or context, that extra code could be specified to execute?

Note that this is different from a simple if, which must be in a particular scope and explicitly written. This when clause would almost be like an if that applied to every case in the execution of the program after it.

答:
Does this (COMEFROM statement described on Wikipedia) count?

Summary:

COMEFROM is roughly the opposite of GOTO in that it can take the execution state from any arbitrary point in code to a COMEFROM statement. The point in code where the state transfer happens is usually given as a parameter to COMEFROM. Whether the transfer happens before or after the instruction at the specified transfer point depends on the language used. Depending on the language used, multiple COMEFROMs referencing the same departure point may be invalid, be non-deterministic, be executed in some sort of defined priority, or even induce parallel or otherwise concurrent execution as seen in Threaded Intercal.


答:
Something like event handling?

instead of func() handles event

you say when event do func

Or, maybe a callback on a particular varible?

Title: Is there such a thing as a "when" statement?

Body:
Is there a language or language feature that can handle "when" cases? That is, whenever some condition becomes true, in any scope or context, that extra code could be specified to execute?

Note that this is different from a simple if, which must be in a particular scope and explicitly written. This when clause would almost be like an if that applied to every case in the execution of the program after it.


答: The same reason that the iPod, iPhone (any phone for that matter), and the iPad don't: the command line is not the primary channel of user interaction with the computer in Windows. It is in UNIX or GNU/Linux - so that's why they're more mature. Same argument why the linux GUI desktops were rubbish for so long compared to Windows (Mac OS kind of cheats here since they got the unix command line kinda for free).</p>


问:
Start to understand an existing project for beginner programmer
I want to understand an existing project to improve myself more, but I am not sure if the project would be overwhelming for me or not. I am not sure if I am capable of understanding it. I even think that I will fail. When I look at projects at a glance, it makes me feel scared to see thousand line of codes.

I don't even know where to start reading code. Do I have to follow by debugging or is there something else?
Can you please guide me in this situation? I am totally getting confused at the start.

Edit : A few thing to specify about my question.

I know C# language and I have learned some WEB technologies like ASP.NET, MVC 2, and Web Forms but I am sure there still will be many thing which I don't know. I label myself as beginner but it is just because of a lack of professional experience in this area. But my OOP understanding is good enough. I am wanting to improve myself on WEB, so I am looking for WEB projects like blog engines which are simpler than others for starting.

答:
begin many paths:

from inputs: places a user/client launches the application

external system : tables on databases, other projects the one you're learning uses

diagrams if possible (meaning: if you have any)

core business (ask for what's the app supposed to do)


答: Your question is not clear but the Observer pattern seems to be the thing you are looking for http://en.wikipedia.org/wiki/Observer_pattern</p>


问:
How can I design an efficient moderation system for comments?
Here's the job I want to do:

My project is a website where there will be a lot of comments.
Those comments will be moderated: a moderator will connect, see comments and accept or refuse them.

I need those things:

the comments won't have any "moderator" associated. Which implies that when a moderator connects, the system "assigns" the 20 first comments to this moderator then sends them via an AJAX/JSON request

of course, this implies that those comments musn't be assigned to other moderators

How can I make a design so that I'll be sure "getting the 20 first comments for a moderator" can be an atomic operation?
And there's another thing to think of (I don't know if it may have an impact or not on my problem): if there are say 10 moderators connected, one of them has 20 comments to validate, and this guy leaves his PC for the whole day. I may implement kindof a "timeout" for this moderator, then, when he tries to validate, a message will tell him "sorry this comment has already been moderated by another moderator", and the AJAX script will get a "fresh new 20 comments).

My first idea was the simplest idea:

a moderator connects

a jQuery AJAX script asks the server for 20 comments

the server (1) makes immediately a request of the 20 first free comments to the database

the server (2) "freezes" the 20 free comments

the server (3) makes up a JSON response and sends it

But the operations (2) and (3) are not atomic, what happens if, in-between, another operator asks for the 20 first free comments? They both will get the 20 first free comments. That's not a good solution. I think this is a classical problem of atomic operation on db. Any idea how to design this (or where to look)?

Thank you very much indeed!

答:
In the past when I have had to make moderation or admin panels i make a CMS that is made just for working on that website. The reason I do this is simple. It is annoying to try to build to correct admin interface to work with a new site It takes time and you dont wanna have to bring down the main site everytime you make a change to the admin panel. Another reason is the way you look at data on a site verse admin'ing it is different. I would go with Donal Fellows method and maybe in itws own cms.

Edit:

And when I say i put it in its own cms i mean the new cms is only an admin panel. So there is no site just a admin panel.


答:
How to use Notify/Wait would seem to be close to this:

We've mentioned that the Java wait/notify mechanism is essentially a
  way to communicate between threads. In a nutshell, the idea is as
  follows:

one or more threads sits waiting for a signal;

another thread comes along and notifies the waiting threads (i.e. "wakes it/them up" with the signal).

Depending on the context there are some structures that can be close to this but you really have to clarify your question.

There is also a "when" statement in XSLT:

The  element is used to determine one course of action
  based on a series of tests. Each test is done inside an
  element. If a test succeeds, the body of the  element is
  executed. If no tests fail then a  element can be used
  to specify a default action:

The XSLT "when" is a conditional statement, more like a switch than an if.  However, the context of what was meant by a "when" in the initial question wasn't really well clarified.

I use XSLTs quite often in the Sitecore CMS where I work for presenting content so it can be used in a GUI environment in some cases.


答:
If you consider the Unix shells "decent", then there's been at least one shell for Windows that's been "decent" for decades. The Hamilton C shell is reasonably close to the Unix C shell (though note that the C shell has never had particularly huge market penetration on Unix). Quite a few people have also used JPSoft's various shells (4DOS, 4NT, now called Take Command) for quite some time -- as you can probably guess from the name, 4DOS goes back to the MS-DOS days.

If you insist on a shell distributed by Microsoft, 15 years ago or so the Windows NT Resource kit used to include an NT port of the PD Korn shell1, along with a fair number Unix-ish utilities. It probably didn't include enough to run a lot of shell scripts without modification, but was enough to handle a fair amount of use, especially quite a bit of interactive work.

1In all honesty, I don't know that it was a port of that exact shell, or just something quite similar -- I used it enough to verify that it was as annoying as I remembered Unix shells being, and left it at that.


答:
This is one of those questions that, ignoring conspiracy theories, probably doesn't have a single answer and is the kind of thing historians could argue about forever without ever finding a definitive answer.

My impression is that the power of the shell is not immediately obvious. I started in on programming in Windows 3.1 and there was very little use of the shell. Everything was done through the Visual C++ IDE, and I never looked at makefiles and DOS batch files were so limited that I rarely tried to use a batch file to automate anything more complicated than a basic backup. None of the Windows focused programming books (I have fond memories of Petzold) I was reading at the time discussed using the Windows shell for anything. It wasn't until I started using and programming Linux that I understood how useful a powerful shell could be. I remember when Windows came out it was so exciting because you didn't have to use old command.com anymore. We finally had a pretty interface with more than one font and multiple programs running at the same time without the need for a TSR...

I think that most programmers who start in Windows just don't have experience with a powerful shell and so, don't feel a pressing need to implement one for Windows. Programmers who work in Linux and appreciate the shell, prefer to work in Linux and so don't feel inclined to spend the time working in an environment they aren't as comfortable in to implement one for Windows, especially considering (as has been pointed out in another question) the need to also implement all the CLI tools that are needed along with the shell itself.

The increasing popularity of Linux is, probably, the main reason that Microsoft finally put a proper shell in. As more and more people realized what a shell is useful for it became more and more clear that Windows was missing an important tool.


答:
Maybe I'm oversimplifying, but I think of it as a cultural thing:

In Microsoft culture, developers focus on writing programs for their users. The programs are all GUI-based.

In Unix culture, developers focus on writing programs for other developers. The programs are small and focused on doing a specific thing well.


答:
Syntax wise, quite a few languages have a when keyword, but I am unaware of any language that uses it the way you describe.

The 'when X occurs, do Y' pattern is kind of the core of aspect-oriented programming: instead of defining a linear flow, you hook handlers into certain conditions (a.k.a. 'subscribing' to an 'event'). This kind of programming is popular in GUI applications, where the core routine of the program is an event dispatcher.

Some languages have extensive syntax features to provide such mechanisms through language constructs; an example would be C# with its delegates and events:

```<code>// 'when btnOK is clicked, run HandleOKClick'
btnOK.Clicked += this.HandleOKClick;
</code>```

Other languages use OOP constructs (Observer pattern, event listeners, etc.; an example in Java (my Java is a bit rusty, so feel free to edit):

```<code>Foobar f = this;
btnOK.registerClickHandler(
    new ClickHandler {
        public void handleClick(Event e) {
            f.handleOKClick(e);
        }
    });
</code>```

Yet another approach is using plain old callbacks. Example in javascript:

```<code>var btnOK = $('btnOK');
btnOK.click(handleOKClick);
</code>```

Body:
Syntax wise, quite a few languages have a when keyword, but I am unaware of any language that uses it the way you describe.

The 'when X occurs, do Y' pattern is kind of the core of aspect-oriented programming: instead of defining a linear flow, you hook handlers into certain conditions (a.k.a. 'subscribing' to an 'event'). This kind of programming is popular in GUI applications, where the core routine of the program is an event dispatcher.

Some languages have extensive syntax features to provide such mechanisms through language constructs; an example would be C# with its delegates and events:

// 'when btnOK is clicked, run HandleOKClick'
btnOK.Clicked += this.HandleOKClick;

Other languages use OOP constructs (Observer pattern, event listeners, etc.; an example in Java (my Java is a bit rusty, so feel free to edit):

Foobar f = this;
btnOK.registerClickHandler(
    new ClickHandler {
        public void handleClick(Event e) {
            f.handleOKClick(e);
        }
    });

Yet another approach is using plain old callbacks. Example in javascript:

var btnOK = $('btnOK');
btnOK.click(handleOKClick);


答:
Yes, there is such a keyword in Perl, as a statement modifier :

```<code>say 'Well done!'        when 'A';
</code>```

It's also part of the switch statement :

```<code>given ($foo) {
    when (/^abc/) { $abc = 1; }
    when (/^def/) { $def = 1; }
    when (/^xyz/) { $xyz = 1; }
    default { $nothing = 1; }
}
</code>```

Body:
Yes, there is such a keyword in Perl, as a statement modifier :

say 'Well done!'        when 'A';

It's also part of the switch statement :

given ($foo) {
    when (/^abc/) { $abc = 1; }
    when (/^def/) { $def = 1; }
    when (/^xyz/) { $xyz = 1; }
    default { $nothing = 1; }
}


答:
Nobody has yet mentioned INTERCAL's COMEFROM :

COMEFROM was initially seen in lists of joke assembly language
instructions (as 'CMFRM'). It was elaborated upon in a Datamation
article by R. Lawrence Clark in 1973, written in response to Edsger
Dijkstra's letter Go To Statement Considered Harmful. COMEFROM was
eventually implemented in the C-INTERCAL variant of the esoteric
programming language INTERCAL along with the even more obscure
'computed COMEFROM'. There were also Fortran proposals for 'assigned
COME FROM' and a 'DONT' keyword (to complement the existing 'DO'
loop).

On 1 April 2004, Richie Hindle published an implementation of
both GOTO and COMEFROM for the Python programming language. Despite
being released on April Fools' Day and not being intended for serious
use, the syntax is valid and the implementation fully works.


问:
Need advice on which route I should take for porting app from Android to iOS
I have developed this android application  and I am looking to port it to iOS.

My questions are:

1) I am planning to finance the iOS development with the money earn't from the android sales which is about $200 at the moment. Would it be reasonable to get the project done for this amount even if it is outsourced to elance or odesk etc?

2) I have heard the code quality for outsourced iOS projects to be bad, I dont want any memory leaks and crashes because of overflows etc.

3) I currently dont have a full time job so I can technically do the project myself, however I dont have a apple pc or iPhone (dont really want to get them either).

I know C pretty well but I haven't really released a major C project that must be 100% stable. How many hours to learn iOs and do the port? And would it be worth my time taking into consideration that if I do enjoy it I may get into it fulltime.

4) What would the demand be like for someone that can do Android and iOS?

Thanks

答:
$200 would pay for maybe half a day's work from a decent iOS developer. I'd recommend investing in a Mac (you can do development without an iPhone, at least to begin with) and learn how to do the port yourself. The employment opportunities for someone who can do both platforms are enormous.

(also, iPhone owners tend to be much more willing to spend money on apps, so the additional sales alone may make doing the port yourself a worthwhile investment)


问:
Standards in Enterprise Development
Is it perhaps time for enterprise systems to be developed to strict enforced standards? Many books list optional 'standards' and best practices, but these are purely suggested practices. Still, every time I look at the code for an enterprise system I have not been a part of, I spend a lot of time trying to work out the architecture.

Should we not have some form of ISO accreditation for our systems? We could have a selection of standard architectures such as Domain Model, Transaction Script etc, but once we choose one of these, we have to follow a strict architectural template. Systems could be audited to ensure we are working to these standards, and our companies would carry this accreditation.

This would be better for developers because when we take on legacy work that was written by another company, we will not have to spend time deciphering the architecture.

It would benefit clients because they would know that if they used the services of an accredited development company, they could used another company to maintain/amend it, and not be tied to the original developers.

答:
The very short answer is: You have to be very very very smart to define an architecture which works for every case. Barely anybody is so smart.

In my experience software starts in one of two way: Either with the idea "let's be fast to ship a product and refactor it once we have customers" which has less architecture in the beginnig and then no time for doing a big rewrite or "let's create a good architecture" which in the beginning looks nice but over time has more and more places bypassing the architecture either due to performance optimizations or features which don't fit in the architecture. so both times oyu get a mess out of it.

also mind that many "Enterprise" projects are long running and old. Software development is a relatively new thing so it changes fast what is considered good. So as new trends come in there is an interest in using them in the product ...

Title: Standards in Enterprise Development


答:
The main issue with Standard Architectural models are they that only work on standard systems. The problem with real world enterprise environments are that they are ALWAYS different.

In turn, the standards would end up being so vague that you might as well be better off without any.

Title: Standards in Enterprise Development

Body:
Is it perhaps time for enterprise systems to be developed to strict enforced standards? Many books list optional 'standards' and best practices, but these are purely suggested practices. Still, every time I look at the code for an enterprise system I have not been a part of, I spend a lot of time trying to work out the architecture.

Should we not have some form of ISO accreditation for our systems? We could have a selection of standard architectures such as Domain Model, Transaction Script etc, but once we choose one of these, we have to follow a strict architectural template. Systems could be audited to ensure we are working to these standards, and our companies would carry this accreditation.

This would be better for developers because when we take on legacy work that was written by another company, we will not have to spend time deciphering the architecture.

It would benefit clients because they would know that if they used the services of an accredited development company, they could used another company to maintain/amend it, and not be tied to the original developers.


问:
Do exceptions basically exist to prevent a system from crashing?
Second of all, I was wondering if anyone knew what the difference was between exceptions (in the realm of exception control flow) and Exceptions (such as used in Java).

But are they there to basically protect the system from crashing by terminating the user program?

答:
It's very simple.

To only crash the program and not the entire system - we have [good] Operating Systems.

To crash a program instead of ignoring a fatal error - we have exceptions.

Before exceptions were invented, every function had to return an exit code (error/success) and any result or output from the function had to be retrieved by passing it a pointer to memory to be set by it.

The problem was that many programmers did not remember/bother to check for erroneous exit codes for every single function, and hence fatal errors were sometimes ignored, leading to quite unexplainable behaviors.

Therefore, it was decided - when an error happens, which you did not take into consideration, crash immediately! AKA Exception Handling.


问:
Automating Unit Test Creation
What are some strategies that could be used to automate the creation of unit test cases? What aspects would you need to look at in each class to be able to generate at least a decent test case skeleton?

I realize a comprehensive automatic solution isn't practical, but I'd like to speed up the test creation a little at least by creating a skeleton. I'm not looking for code examples, just perhaps some suggestions for where to start or examples of where something like this has been done so that I can see how they approached it and what might be possible.

I'm particularly interested in methods for creating unit test skeletons in PHP, which doesn't provide all of the tools that other languages afford, like complete type hinting, for example.

答:
I wrote a generator to speed up unit testing for a .NET project a few years ago. There was a large codebase with no unit tests and it aimed to quickly increase the basic coverage. Here are a few notes that might be of help:

My chance was that the core framework on top of which the project was
developed provided standard operations and class naming. If you're
thinking of writing your own, a standard structure like this will
help greatly.

Using data-driven testing helps a lot, if your codebase permits. The test framework created a database table for each unit test to store test data, so that each row in that table was a separate test and no additional code was required (Rule of Representation). From this point on, the actual tests could be easily created automatically or entered manually.

The resulting unit tests were simple but they served as smoke tests at least. For areas of higher risk, additional manual tests were written.

To summarize, I agree that a generic solution would be impractical (if it's possible). I believe the chances are better if the codebase is suitable for test generation and the test framework can take advantage of its structure.

(As a side-note, there's Pex, but it's for .NET)

Title: Automating Unit Test Creation


答:
You're used to having a server which stores your files and is the omnipotent owner of them. To edit a file you must ask for permission from the server.

Git is not like that. Think of git this way: you have your local repository. Git lets you commit changes, reverse commits, easy and quick branching, etc.
When you want to backup your source-control history, you push your changes to another repository, which "just happens to be" a server, like GitHub.com.

Workflow:

Clone(Download)/Create repository

Make some changes. Continue with development without caring about others.

Push to another repository (could be a server like GitHub).

When you push to a repository, that other repository's owner is notified of the pending push, and must decide whether to accept those commits, decline them,  or only take a subset of them.

The cycle continues.

That is all.

Title: From TFS to Git


问:
Should I expect recent grads to be familiar with basic programming concepts?
It seems there's a HUGE discrepancy between what I expect someone who's studied programming for a few years at university, and what one actually knows.

I don't feel like I'm asking overcomplicated questions in interviews. Some of my usual questions are :

What's the difference between a reference type and a value type?

If it seems the interviewee doesn't really understand his own answer, or if he doesn't know the terminology I'm using, I get into more details by asking him to explain me what happens when I write int i=0; in a method, what about object o=0, object o = new MyClass(), etc...

Basically, I do everything I can to trick the interviewee into telling me about the callstack, the heap etc, and I try to stay into language-agnostics concepts. If the interviewee tells me he did a lot of C, or C++, or c#, I dive deeper into the specific language, and possibly into the implementation details.

If needed, I ask the interviewee what a callstack is, or where arguments passed to a function in the imperative language of his choice are stored.

most of the interviewees have just no idea about what a callstack is, let alone boxing considerations, etc.

What's the difference between an abstract class and an interface. In which cases should you use one over the other ?

Usually, I also ask them to imagine a design of a small library with a use case aiming at using some inheritance and some abstract factories

Most of the interviewee have just no idea of what inheritance real purpose might be. They usually know some keywords (virtual, override, etc), but don't really know when to use them, let alone explaining what a virtual-table is.

Even-though I screen CVs beforehand, even for people with 5 years of experience in real life projects involving complex architectures, I would say less than 25% of all my interviewees can answer those two questions properly. And when I say properly, I don't mean 'in-depth'... just to have an approximate idea of what the concept is.

Regarding juniors, I'm fine with hiring someone who doesn't know how to organize his time very well, or someone who's not used to industrial build processes for example, but I have the feeling that if one hasn't heard the word "callstack" after a few years of studying Computer Science, he's either stupid, or unmotivated, or chose his university very unwisely.

Do you think I'm too extremist here ? Is it common to learn these basic concepts after you've completed university ? Do you know of people who weren't familiar with these, and became very good software engineers after a few years ? And do you think my company might have an issue in attracting talented people, or do you experience the same kind of issues with in your own hiring process?

Edit. regarding the "immediate type" thing, it was just a literal translation from French to English, as we usually do our interviews in French. I've fixed it in my question. But still, I think you all understand perfectly what I meant, which kind of makes my point, doesn't it?

答:
As a Director who designed the interview process I can fill you in on what our company expects out of new grads: I expect people who can read documentation and apply knowledge.  Thus, we have a few very hands on tasks that we ask them to perform.  These are simple coding tasks, not much harder than your average college class exercise (experienced "good" developers can knock it out in about 15 minutes).  The candidate is given a workstation with internet access, a compiler (in our case visual studio), and help files.

If they can't write code under these conditions, they don't get consideration for hire.  Simple as that.  The whole "well I don't know the language" excuse never really jived with me because every candidate who comes to interview here knows there will be a test, they know the languages and tools we use up front.  You can download visual studio express at home and do some basics before coming in and pass the entry level test, those who don't bother... well that's what I call a red flag.


答:
```<code> or chose his university very unwisely.
</code>```

That's very unfair. When you're a student, all you can do is pick the highest ranked university your grades will get you into, or maybe that one that advertises letting you play with football-playing robotic dogs. Nothing more. You can only evaluate a university course after having done it, then gone away and worked in industry for a few years and built some non-trivial projects.

Even if you flashed up a huge neon sign on every such course saying "WE DON'T TEACH THE CALL STACK", then what are you expecting the students to do about it? Spend months researching it so that they can actually understand what that means and how much they'd need one that does teach it? For every course with every combination of signs?

People don't get to choose their education, realistically.

Title: Should I expect recent grads to be familiar with basic programming concepts?

Body:
It seems there's a HUGE discrepancy between what I expect someone who's studied programming for a few years at university, and what one actually knows.

I don't feel like I'm asking overcomplicated questions in interviews. Some of my usual questions are :

What's the difference between a reference type and a value type?

If it seems the interviewee doesn't really understand his own answer, or if he doesn't know the terminology I'm using, I get into more details by asking him to explain me what happens when I write int i=0; in a method, what about object o=0, object o = new MyClass(), etc...

Basically, I do everything I can to trick the interviewee into telling me about the callstack, the heap etc, and I try to stay into language-agnostics concepts. If the interviewee tells me he did a lot of C, or C++, or c#, I dive deeper into the specific language, and possibly into the implementation details.

If needed, I ask the interviewee what a callstack is, or where arguments passed to a function in the imperative language of his choice are stored.

most of the interviewees have just no idea about what a callstack is, let alone boxing considerations, etc.

What's the difference between an abstract class and an interface. In which cases should you use one over the other ?

Usually, I also ask them to imagine a design of a small library with a use case aiming at using some inheritance and some abstract factories

Most of the interviewee have just no idea of what inheritance real purpose might be. They usually know some keywords (virtual, override, etc), but don't really know when to use them, let alone explaining what a virtual-table is.

Even-though I screen CVs beforehand, even for people with 5 years of experience in real life projects involving complex architectures, I would say less than 25% of all my interviewees can answer those two questions properly. And when I say properly, I don't mean 'in-depth'... just to have an approximate idea of what the concept is.

Regarding juniors, I'm fine with hiring someone who doesn't know how to organize his time very well, or someone who's not used to industrial build processes for example, but I have the feeling that if one hasn't heard the word "callstack" after a few years of studying Computer Science, he's either stupid, or unmotivated, or chose his university very unwisely.

Do you think I'm too extremist here ? Is it common to learn these basic concepts after you've completed university ? Do you know of people who weren't familiar with these, and became very good software engineers after a few years ? And do you think my company might have an issue in attracting talented people, or do you experience the same kind of issues with in your own hiring process?

Edit. regarding the "immediate type" thing, it was just a literal translation from French to English, as we usually do our interviews in French. I've fixed it in my question. But still, I think you all understand perfectly what I meant, which kind of makes my point, doesn't it?

Body:
 or chose his university very unwisely.

That's very unfair. When you're a student, all you can do is pick the highest ranked university your grades will get you into, or maybe that one that advertises letting you play with football-playing robotic dogs. Nothing more. You can only evaluate a university course after having done it, then gone away and worked in industry for a few years and built some non-trivial projects.

Even if you flashed up a huge neon sign on every such course saying "WE DON'T TEACH THE CALL STACK", then what are you expecting the students to do about it? Spend months researching it so that they can actually understand what that means and how much they'd need one that does teach it? For every course with every combination of signs?

People don't get to choose their education, realistically.


问:
Agile development deployment process. Where do QA and Business Owners test?
I've been reading up a lot lately on various web application deployment processes using SVN or GIT, with a view to redesigning how we currently deploy where I work.

As is the way with many flavours of Agile, it's assumed that anything committed to master or trunk is production ready. Both GitHub and Etsy, http://codeascraft.etsy.com/2010/05/20/quantum-of-deployment/ say that they work on this basis (although Etsy actually have a staging environment).

This process assumes all unit test and CI tests have been run. You run the tests locally and on CI and then commit to trunk. SO, at this point your code is technically sound.

Your code may be technically correct, but user/functional testing may unearth more bugs, particularly when it comes to front end testing.

My question is this. Where do QA and Business owners test the feature changes you have implemented? On your local development machine before you commit to trunk, or on a QA/staging machine?

If you have a staging machine that runs off trunk, and you assume that all code committed to trunk is production ready ... eh .. then at what point is the code signed off and good to go into production from both a technical and business perspective? If you have only one staging machine, many developers and that is where the code is to be QA'd, then how can you deploy from trunk as many developer changes can be waiting for sign off.

I'd be interested to hear how others have approached this?

答:
For better or worse I usually see this done where the testing is done against the branch base and the business sign off is what the checkpoint is to merge to the deploy main.

I have seen this done both with development on "main" with a separate "deployed" branch or a development "feature" branch with a main as "deployed".

the workflow ends up looking something like this:

code something

run local tests

check in to working branch

(optional) build server builds ant tests

QA/Business testing

bugfixes (loop back to top)

merge to deploy branch

deploy

Some folks work out of a single branch, but if you are going to have manual testing that gets difficult.  Most people I have encountered that work on the assumption that anything can be deployed on commit that also work out of a single trunk are doing something small, or have a HUGE amount of automated testing, OR they consider the "deploy" in this conversation to be a build to a testing server and the process of QA that happens between the testing server and production is handled separately.

OwnerDisplayName: Bazza


答: Haskell has one. But it's not a special construct, just another function http://hackage.haskell.org/packages/archive/base/latest/doc/html/Control-Monad.html#v:when</p>


答:
The AspectJ language has a Join-Point Model, which is one solution for handling exactly this kind of situation.

A Join-Point in AspectJ is a dynamic event in a Java program that occurs when the program is executing. Example join-points are: (1) A method is called; (2) A method is executed; (3) A constructor is called; (4) A constructor is executed; (5) A field is set; or (6) A field is accessed.

You can then create sets of these join-points, called pointcuts. Pointcuts can then be joined, complemented, and intersected in the usual set theory way. Other point cuts can be conditioned on the values/types of variables (e.g., "only when x is positive", "only when the value being set is a subclass of this type") and based on the state of the program ("when this method is called, but only when this other method is on the stack of this thread [meaning that that method indirectly called it]").

Once you have all of these pointcuts describe events in the program, you can then use AspectJ to advise these events. You can choose to do something before the event happens (before advice), after the event happens (after advice), or instead of the event happening (around advice).

Around advice is particularly helpful for adding caching to your programs: When some method is executed, look up in a table to see if the same computation has already been performed and, if so, use the cached version. With AspectJ, it's so lightweight and expressive you can do such caching experiments on hundreds of different points in your code in order to find if and where caching adds values.

Many people outside of aspect-oriented programming believe AOP is mostly about "logging." You can use AspectJ to handle logging, and it does it quite well ("record in this log file when all public methods in this package are called, and what their results/error results were"). But there is so much more to AspectJ, including a clever trick to simulate dynamic scope called the Worm Hole Pattern [see slide 23 and following].

Outside of AOP, you are also talking about event-based programming, which includes [as others have noted] the Observer Pattern. The difference between the solutions is: (1) how the condition is detected; (2) where the condition is expressed; and (3) how the-code-to-execute is bound to the event.


答:
Are you looking for a language with a synchronous or an asynchronous when statement?

Sounds like an event (/subscription/callback) pattern to me.

E.g.

```<code>conditionOwner.Condition += listener.WhenCondition
</code>```

Whenever the condition owner notifies that the condition has taken place, the listener will do WhenCondition().

You could use a binding pattern with a converter that checks the state of several input variables (on change) and calculates the condition, then have an input property of listener binded to the output and act when that input is changed.

As of languages, .NET for example (i.e. C#) has built in synchronous subscriptions (events) and its Reactive Extensions (RX) adds asynchronous subscriptions.

Body:
Are you looking for a language with a synchronous or an asynchronous when statement?

Sounds like an event (/subscription/callback) pattern to me.

E.g.

conditionOwner.Condition += listener.WhenCondition

Whenever the condition owner notifies that the condition has taken place, the listener will do WhenCondition().

You could use a binding pattern with a converter that checks the state of several input variables (on change) and calculates the condition, then have an input property of listener binded to the output and act when that input is changed.

As of languages, .NET for example (i.e. C#) has built in synchronous subscriptions (events) and its Reactive Extensions (RX) adds asynchronous subscriptions.


问:
How will C# 5 async support help UI thread synchronization issues?
I heard somewhere that C# 5 async-await will be so awesome that you will not have to worry about doing this:

```<code>if (InvokeRequired)
{
    BeginInvoke(...);
    return;
}
// do your stuff here
</code>```

It looks like the callback of a await operation will happen in the original thread of the caller. It has been stated several times by Eric Lippert and Anders Hejlsberg that this feature originated from the need to make UIs (particularly touch device UIs) more responsive.

I think a common usage of such feature would be something like this:

```<code>public class Form1 : Form
{
    // ...
    async void GetFurtherInfo()
    {
        var temperature = await GetCurrentTemperatureAsync();
        label1.Text = temperature;
    }
}
</code>```

If only a callback is used then setting the label text will raise an exception because it's not being executed in the UI's thread.

So far I couldn't find any resource confirming this is the case. Does anyone know about this? Are there any documents explaining technically how this will work?

Please provide a link from a reliable source, don't just answer "yes".

答:
Yes, for the UI thread, the callback of a await operation will happen on the original thread of the caller.

Eric Lippert wrote an 8-part series all about it a year ago: Fabulous Adventures In Coding

EDIT: and here's Anders' //build/ presentation: channel9

BTW, did you notice that if you turn "//build/" upside down, you get "/plinq//" ;-)


答:
The Tcl language has traces on variables which allow arbitrary code to be executed whenever a variable is set (or read or deletion, but that's less important here). That arbitrary code can easily include evaluating an expression and executing some code if it holds. The main constraint is that while you can do this for local variables, it's not generally very useful because they tend to have very short lifespans, so such things are usually restricted to global and namespace variables. (Tcl doesn't have closures.)

But if you're doing this, you should be careful. While you don't officially have problems with reentrancy (the trace is disabled for the duration of the execution of the body) it's still a great way to write vastly unclear code and cause much confusion. It's also a truly terrible idea to use it with a loop variable (other than for debugging) as the performance hit can be quite significant.

An example (based on code from the linked manual page above) illustrates.

set foo 1
set bar 2
proc doMult args {
    global foo bar foobar
    set foobar [expr {$foo * $bar}]
}
trace add variable foo write doMult
trace add variable bar write doMult
doMult
```

From that point onwards, any time that either $foo or $bar becomes a new integer, $foobar becomes the product of the two. Automatically.

Tcl also allows setting up code to be run on other kinds of triggers, such as execution of commands, deletion of commands, timers, data becoming available on sockets, etc. With the Tk library added, this is expanded to include a whole large set of GUI events as well. It's true to say that Tcl is actually a very strongly event-oriented language (even if you can easily write code that never uses any of those features, too).

Body:
The Tcl language has traces on variables which allow arbitrary code to be executed whenever a variable is set (or read or deletion, but that's less important here). That arbitrary code can easily include evaluating an expression and executing some code if it holds. The main constraint is that while you can do this for local variables, it's not generally very useful because they tend to have very short lifespans, so such things are usually restricted to global and namespace variables. (Tcl doesn't have closures.)

But if you're doing this, you should be careful. While you don't officially have problems with reentrancy (the trace is disabled for the duration of the execution of the body) it's still a great way to write vastly unclear code and cause much confusion. It's also a truly terrible idea to use it with a loop variable (other than for debugging) as the performance hit can be quite significant.

An example (based on code from the linked manual page above) illustrates.

set foo 1
set bar 2
proc doMult args {
    global foo bar foobar
    set foobar [expr {$foo * $bar}]
}
trace add variable foo write doMult
trace add variable bar write doMult
doMult

From that point onwards, any time that either $foo or $bar becomes a new integer, $foobar becomes the product of the two. Automatically.

Tcl also allows setting up code to be run on other kinds of triggers, such as execution of commands, deletion of commands, timers, data becoming available on sockets, etc. With the Tk library added, this is expanded to include a whole large set of GUI events as well. It's true to say that Tcl is actually a very strongly event-oriented language (even if you can easily write code that never uses any of those features, too).


答:
I think you're getting a few things confused, here.  What you're asking for is already possible using System.Threading.Tasks, the async and await in C# 5 are just going to provide a little nicer syntactic sugar for the same feature.

Let's use a Winforms example - drop a button and a textbox on the form and use this code:

```<code>private void button1_Click(object sender, EventArgs e)
{
    Task.Factory.StartNew<int>(() => DelayedAdd(5, 10))
        .ContinueWith(t => DelayedAdd(t.Result, 20))
        .ContinueWith(t => DelayedAdd(t.Result, 30))
        .ContinueWith(t => DelayedAdd(t.Result, 50))
        .ContinueWith(t => textBox1.Text = t.Result.ToString(),
            TaskScheduler.FromCurrentSynchronizationContext());
}

private int DelayedAdd(int a, int b)
{
    Thread.Sleep(500);
    return a + b;
}
</code>```

Run it and you'll see that (a) it doesn't block the UI thread and (b) you don't get the usual "cross-thread operation not valid" error - unless you remove the TaskScheduler argument from the last ContinueWith, in which case you will.

This is bog-standard continuation passing style. The magic happens in the TaskScheduler class and specifically the instance retrieved by FromCurrentSynchronizationContext. Pass this into any continuation and you tell it that the continuation must run on whichever thread called the FromCurrentSynchronizationContext method - in this case, the UI thread.

Awaiters are slightly more sophisticated in the sense that they're aware of which thread they started on and which thread the continuation needs to happen on.  So the above code can be written a little more naturally:

```<code>private async void button1_Click(object sender, EventArgs e)
{
    int a = await DelayedAddAsync(5, 10);
    int b = await DelayedAddAsync(a, 20);
    int c = await DelayedAddAsync(b, 30);
    int d = await DelayedAddAsync(c, 50);
    textBox1.Text = d.ToString();
}

private async Task<int> DelayedAddAsync(int a, int b)
{
    Thread.Sleep(500);
    return a + b;
}
</code>```

These two should look very similar, and in fact they are very similar. The DelayedAddAsync method now returns a Task<int> instead of an int, and so the await is just slapping continuations onto each one of those.  The main difference is that it's passing along the synchronization context on each line, so you don't have to do it explicitly like we did in the last example.

In theory the differences are a lot more significant. In the second example, every single line in the button1_Click method is actually executed in the UI thread, but the task itself (DelayedAddAsync) runs in the background. In the first example, everything runs in the background, except for the assignment to textBox1.Text which we've explicitly attached to the UI thread's synchronization context.

That's what's really interesting about await - the fact that an awaiter is able to jump in and out of the same method without any blocking calls. You call await, the current thread goes back to processing messages, and when it's done, the awaiter will pick up exactly where it left off, in the same thread it left off in. But in terms of your Invoke/BeginInvoke contrast in the question, I'm sorry to say that you should have stopped doing that a long time ago.

Title: How will C# 5 async support help UI thread synchronization issues?

Body:
I heard somewhere that C# 5 async-await will be so awesome that you will not have to worry about doing this:

```<code>if (InvokeRequired)
{
    BeginInvoke(...);
    return;
}
// do your stuff here
</code>```

It looks like the callback of a await operation will happen in the original thread of the caller. It has been stated several times by Eric Lippert and Anders Hejlsberg that this feature originated from the need to make UIs (particularly touch device UIs) more responsive.

I think a common usage of such feature would be something like this:

```<code>public class Form1 : Form
{
    // ...
    async void GetFurtherInfo()
    {
        var temperature = await GetCurrentTemperatureAsync();
        label1.Text = temperature;
    }
}
</code>```

If only a callback is used then setting the label text will raise an exception because it's not being executed in the UI's thread.

So far I couldn't find any resource confirming this is the case. Does anyone know about this? Are there any documents explaining technically how this will work?

Please provide a link from a reliable source, don't just answer "yes".

Body:
I think you're getting a few things confused, here.  What you're asking for is already possible using System.Threading.Tasks, the async and await in C# 5 are just going to provide a little nicer syntactic sugar for the same feature.

Let's use a Winforms example - drop a button and a textbox on the form and use this code:

private void button1_Click(object sender, EventArgs e)
{
    Task.Factory.StartNew<int>(() => DelayedAdd(5, 10))
        .ContinueWith(t => DelayedAdd(t.Result, 20))
        .ContinueWith(t => DelayedAdd(t.Result, 30))
        .ContinueWith(t => DelayedAdd(t.Result, 50))
        .ContinueWith(t => textBox1.Text = t.Result.ToString(),
            TaskScheduler.FromCurrentSynchronizationContext());
}

private int DelayedAdd(int a, int b)
{
    Thread.Sleep(500);
    return a + b;
}

Run it and you'll see that (a) it doesn't block the UI thread and (b) you don't get the usual "cross-thread operation not valid" error - unless you remove the TaskScheduler argument from the last ContinueWith, in which case you will.

This is bog-standard continuation passing style. The magic happens in the TaskScheduler class and specifically the instance retrieved by FromCurrentSynchronizationContext. Pass this into any continuation and you tell it that the continuation must run on whichever thread called the FromCurrentSynchronizationContext method - in this case, the UI thread.

Awaiters are slightly more sophisticated in the sense that they're aware of which thread they started on and which thread the continuation needs to happen on.  So the above code can be written a little more naturally:

private async void button1_Click(object sender, EventArgs e)
{
    int a = await DelayedAddAsync(5, 10);
    int b = await DelayedAddAsync(a, 20);
    int c = await DelayedAddAsync(b, 30);
    int d = await DelayedAddAsync(c, 50);
    textBox1.Text = d.ToString();
}

private async Task<int> DelayedAddAsync(int a, int b)
{
    Thread.Sleep(500);
    return a + b;
}

These two should look very similar, and in fact they are very similar. The DelayedAddAsync method now returns a Task<int> instead of an int, and so the await is just slapping continuations onto each one of those.  The main difference is that it's passing along the synchronization context on each line, so you don't have to do it explicitly like we did in the last example.

In theory the differences are a lot more significant. In the second example, every single line in the button1_Click method is actually executed in the UI thread, but the task itself (DelayedAddAsync) runs in the background. In the first example, everything runs in the background, except for the assignment to textBox1.Text which we've explicitly attached to the UI thread's synchronization context.

That's what's really interesting about await - the fact that an awaiter is able to jump in and out of the same method without any blocking calls. You call await, the current thread goes back to processing messages, and when it's done, the awaiter will pick up exactly where it left off, in the same thread it left off in. But in terms of your Invoke/BeginInvoke contrast in the question, I'm sorry to say that you should have stopped doing that a long time ago.