答:
In your situation I would definatly use Entity Framework, I've found it works well with MVC.

Here are some real reason and pointers.

Linq is a pleasure to use, and the delayed execution is also extremely useful.

You can generate your models (however when using with mvc I'd recomment you use view models in conjunction with the data models, this makes validation and model binding alot easier, if you do take that approach use automapper to map the changes back onto your data model).

There are a number of things you'll need to learn about using an ORM however.

What the context does for you (entity tracking)

That a context should be used as a unit of work

Remember to thing about concurrency, EF can tell you when your object is out of date but it can be tricky if you want to handle concurrency properly across requests (as you need to keep a timestamp or something).

Things to consider

Triggers and ORM's don't work together, use the ORM events instead.

Make sure all your tables have promary keys.

I would also highly recommend the code first approach, even if you have an existing database.

The conventions mean you don't need to regen mappings or classes when you change the database.

It's eaier to place validation and other logic in the models.

You can use the code generator to help make them if you have a huge existing database.

Title: Should we use Entity Framework?


问:
Are there any major alternatives to Waterfall and Agile?
I am curious if anyone knows of any methodologies that are significantly different (not a recombination) and I would especially appreciate anyone who brought forward any experience with alternatives.</p>

答:
Plan

Sit down with the client (or end user) and design a series of use cases.

Design

Layout the system on paper / whiteboard over a few beers and pizza. Snicker when something looks phallic.

Confirm

Confirm design with client (or end user) and freeze requirements.

Code

Self explanatory.

ContentLicense: CC BY-SA 2.5


问:
Why were short, int, and long invented in C?
I'm having trouble understanding, what were the exact purposes of creating the short, int, and long data types in C?

The reason I ask is, it doesn't seem like their sizes are bounded -- they could be of any size, so long as short is smaller than an int, for example.

In which situations, then, should you use an unsigned int or unsigned long, for example, instead of a size_t, when doing so offers no hope of binary compatibility?

(If you don't know the size, then how would you know when to choose which?)

答:
It'd be defined by the architecture you were using. On a Zilog z80 chip (common embedded chip) they'd be one size while they could be an entirely different size on a x86 chipset. However, the sizes themselves are fixed ratios to each other. Essentially short and long aren't types but qualifies for the int type. Short ints will be one order of magnitude smaller than (regular) int and long ints will be an order of magnitude higher. So say your Int is bounded to 4 bytes, the short qualifier bounds it to 4 bytes though 2 bytes is also very common and the long qualifier boosts it potentially to 8 bytes though it can be less down to 4 bytes. Keep in mind that this is subject to word length as well so on a 32 bit system you'd max out at 4 bytes per int anyway making long the same as a regular int. Thus, Short ≤ Int ≤ Long.

However, if you lengthen it again, you can push in the int to the next cell giving you 8 whole bytes of storage. This is the word size for 64 bit machines so they don't have to worry about such things and just use the one cell for long ints allowing them to be another order above standard ints while long long ints get really bit.

As far as which to choose, it boils down to something that Java programmers for instance don't have to worry about. "What is your architecture?" Since it all depends on the word size of the memory of the machine in question, you have to understand that up front before you decide which to use. You then pick the smallest reasonable size to save as much memory as you can because that memory will be allocated whether you use all of the bits in it or not. So you save where you can and pick shorts when you can and ints when you can't and if you need something bigger than what regular ints you give; you'd lengthen as needed until you hit the word ceiling. Then you'd need to supply big number routines or get them from a library.

C may well be "portable assembly" but you still have to know thine hardware.

ContentLicense: CC BY-SA 3.0


问:
How can I prevent users from creating multiple accounts on a web site?
I'm building a site that needs to guarantee user reputation scores are accurate by preventing users from creating more than one account, at the cost of decreased user signups. So far, the only solutions I have thought of are allowing users to:

Link to their (verified) PayPal account through PayPal Account Authentication

Provide their PGP public key, and checking that the MSD (a metric of trustworthiness) is below a certain value

Of course, even these methods aren't bulletproof, but are likely to make creating a sock-puppet account very difficult. Are there any others I haven't considered?

答:
In South Korea and the PRC they do this by requiring users register with their personal ID number (Social Security # for U.S. folks). But in these societies that number is a lot less "secret" than it is in America.

While not legally/politically/socially acceptable in every country, this is the only really good method for limiting registrations that I've ever seen.

Not really a solution for you, probably, but of interest nonetheless.

OwnerDisplayName: Alek Storm


答:
https://stackoverflow.com/questions/589575/size-of-int-long-etc

So in the most commonly used architectures, char is 1 byte, short and int are at least 2 bytes, and long is at least 4 bytes.

And it's intended that 'int' should be the most natural/normal/efficient representation for the current CPU.

So the general rule is to use 'int' unless your values exceed +/-32K, making you (on older CPUs) use 'long'.  ...or unless you're making big arrays of small (<32K) values, and memory is an issue -- so you'd use 'short' to save memory (or maybe 'char' or 'byte').

Title: Why were short, int, and long invented in C?

Body:
I'm having trouble understanding, what were the exact purposes of creating the short, int, and long data types in C?

The reason I ask is, it doesn't seem like their sizes are bounded -- they could be of any size, so long as short is smaller than an int, for example.

In which situations, then, should you use an unsigned int or unsigned long, for example, instead of a size_t, when doing so offers no hope of binary compatibility?

(If you don't know the size, then how would you know when to choose which?)


问:
Where are programming languages published?
I have read that a number of new programming languages are created each year, however I have never seen a single one. Where exactly are these things published? Is there some site out there that keeps track of them?

(I don't have any intention to learn such languages - I am only interested)

答: I don't think there's one place that's generally agreed upon. A lot will depend on the type of language and on the source. Quite a few are invented by university students, and generally published in that student's thesis, dissertation, etc. Many companies have some sort of technical journal or other to publish their researchers' results. If it's somebody doing it on their own time, they might well publish it on their blog. If they decide to make the implementation an open source project, they might well publish it someplace like BitBucket, SourceForge, Github, etc. If it's (for example) a functional language, they might publish it someplace like Lambda the Ultimate. In some cases, it'll fit more than one category, and be published several of those places at once.


答:
Where exactly are these things published?

Many places.  Start with source forge, git hub and any other site that supports open source code.  Go to University research sites.  Read the Communications of the ACM and the IEEE Computer Society magazines.  Then read the various ACM publications on programming languages.

It's not secret.  It's very, very public.

Is there some site out there that keeps track of them?

No.

Wikipedia, however, tends to accumulate this kind of information. http://en.wikipedia.org/wiki/Lists_of_programming_languages

Title: Where are programming languages published?

Body:
I have read that a number of new programming languages are created each year, however I have never seen a single one. Where exactly are these things published? Is there some site out there that keeps track of them?

(I don't have any intention to learn such languages - I am only interested)


答:
The Spiral Model

The spiral model is a software development process combining elements of both design and prototyping-in-stages, in an effort to combine advantages of top-down and bottom-up concepts. Also known as the spiral lifecycle model (or spiral development), it is a systems development method (SDM) used in information technology (IT). This model of development combines the features of the prototyping model and the waterfall model. The spiral model is intended for large, expensive and complicated projects.

-Wikipedia

Title: Are there any major alternatives to Waterfall and Agile?

Body: I am curious if anyone knows of any methodologies that are significantly different (not a recombination) and I would especially appreciate anyone who brought forward any experience with alternatives.</p>


问:
Translating objects from one type to a another
I am working on a server-client app in c# and need to send an object from the client to the server via WCF. For simplicity I will call it WorkingClass as it is what does the work.

```<code>    public class WorkingClass
    {
        public WorkingClass (FileInfo uncompressedFile, FileInfo compressedFile)
        {
            UncompressedFile = uncompressedFile;
            CompressedFile = compressedFile;
        }

        public FileInfo UncompressedFile { get; private set; }
        public FileInfo CompressedFile { get; private set; }

        public void ZipFile()
        {
            //zip file
        }
    }
</code>```

Now I need to send it to the server via WCF. I don't need the whole WorkingClass FileInfo properties serialized and sent, so I have a simple class which I will call MessageClass that has simple strings.

```<code>public class MessageClass
    {
        public MessageClass(string uncompressedFileName, string compressedFileName)
        {
            UncompressedFileName = uncompressedFileName;
            CompressedFileName = compressedFileName;
        }

        public string UncompressedFileName { get; private set; }
        public string CompressedFileName { get; private set; }
    }
</code>```

I can add a ToMessage() instance method and a FromMessage static method to the WorkingClass. Or instead of the static FromMessage method, I could add a constructor to the WorkingClass that accepts a MessageClass as a parameter. To me these options seem to tie both classes tightly together and the WorkingClass should only have to worry about zipping a file, not converting itself for communication via WCF. Do I maybe create a converter class?

The Server will then need to convert from the message to its own working class.

Am I on the right path to handle this sort of thing? Is there a best practice or design pattern I can follow?

答:
All of the methods you've mentioned are perfectly valid.

The way I look at it though:

MessageClass is for communication via WCF only. What I mean by that is you have your server application which consists of the server component itself and a way for your client to communicate with it which in this case is WCF

WorkingClass is part of the server component itself, it should not worry about how the client communicates with the server

I'd put the code of converting between the two in the WCF using a helper/converter class.


问:
Why is Scheme my first language in university?
I hear about C, C++, Java every day whenever people starting talking about computer science, but in my first computer science class we are asked to write in Scheme (DrRacket).

Why is that?

What differences will this make to my future understanding of programming?

UPDATE: I have finished my first term, but not completely done with Scheme. In my second term (which is now) we got in to C programming. It was frustrated to learn pointers at first, but now I feel much better.

There's not much more to say than that. I'm trying to teach myself Java (or C++?) for the OOP part which I'm missing. So far, I still like functional programming best. Lambda is just fascinating. :)

答:
Sounds like a great school! Lisp dialects follow the mathematical paradigm of algorithms much more closely. They force programmers to learn recursion and the functional style. This is excellent experience. Your school is in the ranks with MIT, which still uses Abelson and Sussman for the required CS 6.001.

You might find this article encouraging and helpful in understanding the issue.


答: My school started with Scheme also.  One reason that was mentioned was this helped leveled the playing field.  Most 1st yr Comp Sci might have some, or a lot, of exposure to more common languages.  It was less likely that anyone person had a lot of knowledge of Scheme.</p>

Title: Why is Scheme my first language in university?

Body:
I hear about C, C++, Java every day whenever people starting talking about computer science, but in my first computer science class we are asked to write in Scheme (DrRacket).

Why is that?

What differences will this make to my future understanding of programming?

UPDATE: I have finished my first term, but not completely done with Scheme. In my second term (which is now) we got in to C programming. It was frustrated to learn pointers at first, but now I feel much better.

There's not much more to say than that. I'm trying to teach myself Java (or C++?) for the OOP part which I'm missing. So far, I still like functional programming best. Lambda is just fascinating. :)


答:
No one expects that as a freshman you'll be proficient enough in any language to get a real job, so why not start with one that's easy to learn? Expecting novices to learn programming by using a professional language in a professional IDE is kind of like giving a scalpel to a first-year med student and having them work on live bodies.

Don't worry; you'll eventually learn Java/C/C++, probably starting your second year. If you started learning Java 6 now, by the time you graduate Java 8 will be out. Or it will have been replaced by Python. Or some other language that hasn't been invented yet but takes the industry by storm. Better to put off learning the "popular" stuff as long as possible so it's not obsolete when you get out in the workforce.

Scheme/Racket will help you focus on the important concepts: algorithm design, data structures, and information manipulation. You know, the stuff that's common to all languages.


问:
Exploiting creativity with "free time"
Some companies have discovered, to their surprise and profit, that programmers are very creative people. I think of Google and Atlassian, for example, who allow regular (monthly, I believe) "free days" where programmers get to work on whatever they want (with approval) and the company reaps the rewards.

Examples cited were new products, bug fixes that no one had wanted to fix before, new teams forming, etc. Another result (and perhaps the original goal) is that for the remaining days between free time, programmers have more motivation.

Is there more backing to this theory, that allowing a "controlled" creative output is good for motivation and morale, or more examples of successes with this approach?

答:
Not really an answer per se, nor am I expert in any ways regarding or had direct experience being in such situation. But I too was/am quite interested in the subject, perhaps as a form of wishful thinking, here is what I gathered thus far :

Self-Actualization According to Maslow the tip of the pyramid is self-actualization.  Programmers usually tend to fare well materially speaking, most of us eat, have a place to call home and have friends and family around us.  As we gain experience we also tend to have fairly good self-esteem.  However our actual work does not always provide ways to feel accomplished and not all have the time or want to take time away from other aspects of their lives to get that by themselves.   So personal projects on company time will help a lot.

Cheap R&D sometimes these projects can be applicable directly to the business of the company.  And who more motivated to carry out the project than the person that came up and worked on the idea.

Motivation a bit related to point 1 above.  Even if we do not make it big with the idea to have the occasion to exercise the creative muscle every once in a while, or to be allowed to scratch an itch that doe snot necessarily fit in the company`s project plan allows us to remain motivated.  This RSA presentation illustrate this pretty well I think.

Productivity  Sometimes these project could be work related.  One can get tired of doing the same thing over and over and decides to automate this but without the freedom that comes with this initiative it could be difficult to convince management it is a worthwhile investment despite the zero business value the idea presents at first glance.

In all quite frankly I think everybody wins with such policy.  Sure it incurs a direct cost to the company and the (monetary) benefits are difficult to calculate, but life is sooo much more than numbers arranged in zero summed columns.

Title: Exploiting creativity with "free time"


答:
What differences will this make to my future understanding of programming?

That's a little like asking how reading Shakespeare will help you write term papers. Programming (in any language) is just a means for expressing your ideas in executable form. Computer science provides the conceptual building blocks that will give you something interesting to say. Scheme syntax is relatively simple, so you can get to interesting ideas quickly and without running into a lot of compiler errors, standard libraries, etc.

Pay close attention in class -- you're going to learn a lot of interesting stuff this semester.


问:
Are there any jobs in the programming field that don't require you to sit at a desk all day?
I'm new in the field of programming. I really enjoy it as a career, but I'm not sure I can handle sitting at a desk for eight hours a day. I don't mind it for short stretches of time of course, but I can't do it day in and day out.

Is there a field of programming that possibly has jobs that require less time spent at the desk?

答: At the worst companies, you won't be at a desk all day. Instead you'll be sitting at a conference table listening to how the company is going to make you more productive by implementing Scrum, agile, waterfall, Extreme Programming, blah, blah, blah. At that point, you'll pray to get back to your desk.</p>


问:
How to allow filtering Films in my app intuitively? (GUI design)
I am not sure if this is the right place to ask this but I wrote an app that shows all the movies in one's computer with the appropriate info such as genre, director, rating, etc.

I am wondering how can I make it so that the user can filter them based on criteria such as genre, rating, etc?

Most of them are enums, and I was thinking of using a ComboBox for these but they should be able to specify more than 1 genre. So should I use ListBox controls for these? Then it will be harder to present all these options in listboxes.

I haven't seen any examples of apps doing similar things, that's why I am not sure.

Any ideas?

答:
You can implement or get elsewhere a custom component that allows for checkboxes in front of items in a drop down list, similar to what you can find in Excel.

Another option would be to have a button that says "Filter..." and then you open a dialog box in which you have a drop down list with the criteria, e.g. "Director", "Genre", etc. Depending on the choice of the criteria you could then offer the values, e.g. when "Director" is selected, a list box could contain the names of directors. When "Genre" is selected in the drop down, the list box could contain the different genres. Each of the value lists could also contain the value "All" as the first entry. When you click this it ticks all entries in the list.

Upon closing this dialog box you probably want to also indicate somehow that a filter has been applied. Maybe in the column header.

Of course these are just some very simple suggestions. User interface have a gazillion options for how to represent something and you make it very flashy. At some point it is a matter of taste but you certainly want to try out your UI to see whether it works with others.


答:
Wikipedia lists these as methodologies/development processes:

Agile - based on iterative and incremental development, where requirements and solutions evolve through collaboration between self-organizing, cross-functional teams.

Cleanroom - the focus of the Cleanroom process is on defect prevention, rather than defect removal.

Iterative -  a cyclic software development process developed in response to the weaknesses of the waterfall model. It starts with an initial planning and ends with deployment with the cyclic interactions in between.

RAD -  uses minimal planning in favor of rapid prototyping. The "planning" of software developed using RAD is interleaved with writing the software itself.

RUP - The Rational Unified Process (RUP) is an adaptable iterative software development process framework, intended to be tailored by selecting the elements of the process that are appropriate.

Spiral - combining elements of both design and prototyping-in-stages, in an effort to combine advantages of top-down and bottom-up concepts. This model of development combines the features of the prototyping model and the waterfall model.

Waterfall - sequential through the phases of Conception, Initiation, Analysis, Design, Construction, Testing and Maintenance.

Lean -  a translation of Lean manufacturing and Lean IT principles and practices to the software development domain; everything not adding value to the customer is considered to be waste.

V-Model -  Instead of moving down in a linear way, the process steps are bent upwards after the coding phase, to form the typical V shape. The V-Model demonstrates the relationships between each phase of the development life cycle and its associated phase of testing.

TDD -  relies on the repetition of a very short development cycle: first the developer writes a failing automated test case that defines a desired improvement or new function, then produces code to pass that test and finally refactors the new code to acceptable standards.


问:
What are the available tools for creating cross-platform, cross-browser multiplayer online commercial games?
HTML5+Javascript is not viable as the client-side code will be visible and, thus, stealable. Flash is not viable since it's not supported on ipads and thus not cross-platform. Said that, what are the available tools for creating cross-platform, cross-browser multiplayer online commercial games?</p>

答:
The 'stealability' issue has been done to death in various game programming forums; the essence is that the only way to secure your code is not to distribute it at all - which means you need to keep a considerable portion of the code on the server, such that the client-side code by itself is useless. If it is more effort to reconstruct the server-side portion than it would be to just rewrite the whole thing from scratch, then you have succeeded.

Another thing about the 'stealability': You're going to expose artwork one way or another, and there is not really a way to technically protect that - it's going to show up on the user's screen at some point, and from there, a determined copyright infringer can just grab a screenshot.

Oh, and by the way, it's not 'stealing', the proper term is 'copyright infringement'. Those are not the same thing, regardless of what the record industry is trying to tell you.


问:
I am not a good programmer (in logic), how should I fix it?
Ok, so here is my problem:

I work for a big company, some how landed a job (frankly because the interview was easy). It's not that I don't know my stuff, I am pretty good at understanding java, it's libraries etc.

But, when ever I try to solve some logic problem, I find it really hard to come up with a solution.

For example, conversion of decimal to roman, when I saw the solution, I find that it's a simple problem. But I was not able to implement it after 1-2hrs of trying out!

I feel I am dumb and not worth being a software engineer. Puzzle solving abilities should come natively to a great programer. But when I try to solve some puzzles, I am not able to find a solution and I just google it up!....and I hate that!

When given a problem (like implement xyz feature) at work, I am fairly pretty quick at it and am respect at my work place for that, but I am not at all proud about it. Because when I try to solve any mathematically or logic wise challenging problem, I fumble. I still feel I love what I am doing (as an engineer) but feel really sad that I am not able to solve some tough logic problems which I friends come up with.

I feel demoralized :(

TL;DR: I understand stuff from a practical viewpoint (implementing
  features in our product) but when trying to work on problem from say
  ProjectEuler, I SUCK badly! And I need to Sharpen my brain!

So, my questions are:

How should I go about fixing it? Should I start with solving (and forcing my self to) project euler problems? Even if it takes hours for me to solve some basic problems?

Or should I go back to basics and study some basic math?

I don't really find puzzle solving fun. But I want to make it fun for my self! And I think if I understand them in a better manner, I will like it!

PS: I was never educated in CS (my undergrad was electrial). But that's not an excuse to be a sucky developer.

Thanks!

答:
I very much believe that you have just started off with your journey in programming, so first thing if it takes you some time to even grasp and get it right it seems to be a non issue.
The only difference what it makes is with each attempt are you learning something like WoW ! ! the last thing i did doesn't make sense at all coz i needed decimal and not double

If solving puzzle doesn't interest you then don't go about head hunting for that, there are other logical issues floating around once you know your code base, you may choose to work on them and present any suggested edits to your mentor or lead. (don't worry if you do some blunder they would help you know why your methodology is faulty, so be a keen observer and an apt listener)

It will take some time for you to settle down and then may be you might get going on firing on all cylinders. Needless to say avoid the urge of searching for a solution on google or SO, put in some efforts from your end and only fire up your browser when you are in doubt or absolutely clueless


答:
Let me just warn you, the more you know, the more you realize just how little you know.

Just don't get discouraged by that. Keep on learning and trying to work on areas you realize are lacking.

Now on to your question. My suggestion would be to start working on the problems on project euler.

My reasons for this are simple, start at the most popular question, these are normally the easier problems to solve.

When you are confronted with a problem, try and solve it, work on it on your own, try different approaches. The way project euler works allows you to check and test your answer.

If you decide that you can't solve this problem, start researching the problem (not looking for the answer). No try again.

Once you solve the problem, project euler has a section where they show you the best answers for each language implementation. Go over their answer in your preferred language, understand their solution and the thinking that went into it.

Now close the answer they provided, and try again on your own until you solve it again.

If you practice enough, the logic and thinking to solve these problems will get easier and easier to you.

Title: I am not a good programmer (in logic), how should I fix it?

Body:
Ok, so here is my problem:

I work for a big company, some how landed a job (frankly because the interview was easy). It's not that I don't know my stuff, I am pretty good at understanding java, it's libraries etc.

But, when ever I try to solve some logic problem, I find it really hard to come up with a solution.

For example, conversion of decimal to roman, when I saw the solution, I find that it's a simple problem. But I was not able to implement it after 1-2hrs of trying out!

I feel I am dumb and not worth being a software engineer. Puzzle solving abilities should come natively to a great programer. But when I try to solve some puzzles, I am not able to find a solution and I just google it up!....and I hate that!

When given a problem (like implement xyz feature) at work, I am fairly pretty quick at it and am respect at my work place for that, but I am not at all proud about it. Because when I try to solve any mathematically or logic wise challenging problem, I fumble. I still feel I love what I am doing (as an engineer) but feel really sad that I am not able to solve some tough logic problems which I friends come up with.

I feel demoralized :(

TL;DR: I understand stuff from a practical viewpoint (implementing
  features in our product) but when trying to work on problem from say
  ProjectEuler, I SUCK badly! And I need to Sharpen my brain!

So, my questions are:

How should I go about fixing it? Should I start with solving (and forcing my self to) project euler problems? Even if it takes hours for me to solve some basic problems?

Or should I go back to basics and study some basic math?

I don't really find puzzle solving fun. But I want to make it fun for my self! And I think if I understand them in a better manner, I will like it!

PS: I was never educated in CS (my undergrad was electrial). But that's not an excuse to be a sucky developer.

Thanks!


答:
Many programmers are also natural "puzzle solvers", but there is so much more to programming than that. If all programmers were focused on solving interesting algorithmical problems, we would have loads and loads of software which could solve cool problems, but none of them would be usable or maintainable.

I find that there are relatively few "puzzle-solving" type challenges in my work. Most of the challenges are more about studying old code, learning a new API, designing the architecture of some component in a way that people will not swear over it in three years time. All of this is challenging, but not so much of the logic puzzle kind. On the other hand, I have colleagues who spend most of their time thinking about compiler optimization algorithms, and who are very good at that.

I think it is important for programmers to constantly think about "how can I get better at what I do?", but being a good programmer doesn't necessarily require that you are great at puzzle solving.

Personally, I get my puzzle solving fix by solving "mystery geocaches".


答:
Most programming jobs don't require a lot of logic. But these might not be the jobs you like.

As a general guideline, try to learn algorithms and structures. I can advise Skiena's The Algorithm Design manual. Once you know these you'll start categorizing problems. This looks a lot like the traveling salesmen problem, here I can use a tree, here i can use a binary search...

Project Euler has a wide variation of puzzles. A lot of these are easily doable with a basic math knowledge. Others are easier solved once you know a few of these algorithms.


答:
You're supposed to learn how programming is being done and what the basic concepts are. The everyday languages used in most businesses might be well suited for producing the software needed today, but aren't necessarily best suited for teaching you the basiscs of programming.

Once you have grasped the concepts, it's easy to apply them to other languages.


问:
Communication Between Different Technologies in a Distributed Application
I had to a incorporate several legacy applications and services in a network-distributed application. The existing services and applications are written using different languages and technologies, including: java, C#.Net and C++; all running on MS Windows machines. Now I'm wondering about the communication mechanism between them. What is the simple and standard way? Thanks! PS. communications include simple message sending and remote method invocations.</p>

答: IP is the least common denominator of most computers in this world. All languages have access to the IP stack of the OS.</p>


问:
Programming language popularity: Is there data on migration trends?
I'm looking for historical statistics showing approximately how many developers of some language X switch to language Y. It should be the kind of data that answers question such as:

Are former VB6 developers using mainly C# or VB.NET now?

Have many Java developers switched their main development language to Scala so far?

etc.

I'm not doing a study, I'm mainly curious. Is there some website or institution that collects and publishes such data?

答: Well, there's popularity stats here and especially here - with deltas but I don't know of anything measuring who's moving to what.  It would be interesting to plot but I'm not sure if it would be an easy thing to capture.</p>


问:
Is it a good practice to code in English?

Possible Duplicate:

  Do people in non-English-speaking countries code in English?

I have a development comming that is intended to be sold across Latin America (Spanish speakers), but I've heard from some partners that is a good practice to always code in English, I mean just code (methods, classes, pages names, etc), labels on GUI are going to be all in Spanish...

Code will be edited in the future by developer of companies across Latin America and just maybe some from outside.

What do you think?, any experience with this?

答:
It's a dilemna from me: for mechanism and key words, or read documenation, no real problem.

My english is poor, and this language have no words for many subtle significant ideas.

I've tried to developp in english, it lead me astray, and I have to make it again with known words that represent the real world.

So, for core/essential code it is in French (nobody's perfect) with dual languages translation  with hope that for a native english it is not so diffucult to have the keys of understanding close to the some piece code (not all).

It is not proudness, just to enrich the work with different cultures and to do job in the best manner.


问:
How much design to do first?
I have never worked with a professional software development team. As such, analyzing and thinking about each and every aspect of my software does not come naturally to me.

Whenever I strike an idea that excites me I just start a new project in my IDE (after finishing the previous one) and I start designing the interface—which means to me as placing menubars, buttons and other components at their appropriate places—and start coding for them. Recently I started a chess game in Java and I followed that pattern: first programmed the black-white grid, then registered a mouse listener etc. without thinking about warriors/objects of chess game.

One thing that annoys me is that I have never been able to completely use object-oriented features of object-oriented programming, though I understand it. I have the habit of taking on things when it comes. This could be the reason of the poor design I end up with.

I complete all the projects that I start, but since they are personal projects I have never felt the need to refactor the code. But I know that if I am asked to modify any function of my program I could be in a mess because they are not properly designed (though they work as asked).

What is the correct/better way to start to design software that is somewhat complicated like a chess game?

答:
So you are always starting your developments first by writing the user interface ? I would say that this way of doing is generally associated with "prototype" development in professional environments, but then again not necessarily. In small companies writing "small" applications and starting with the UI happens very often (also it happens even more often that the "small" application you started grows and grows and grows and becomes a monster application requiring refactoring, additional developers... but I digress)

So it is not necessarily a bad idea, it depends on the size/complexity of the application that is being written and you said it yourself you are writing these programs for yourself. Psychologically, having an UI may also help in that you see your advancements and that gives you motivation. Whereas if you are writing your code-behind and test cases first it may take a dew days before you really start to dwelling into the UI... Unless your mind accepts that test cases are achievements too :)

However, as you said it yourself, doing the UI first without thinking about the backbone of the application will lead you into trouble. It is very tempting to start the "fun" part (I am like you, I like having neat interfaces). But, before that, and even for small programs, just stop for a moment, take a piece of paper and draw some diagrams about how your application works. How your components will reacts to UI events. What are the business (or game!) rules to implement. Prepare a quick to-do list of things to implement and prioritize them by what you think is critical. Also, when programming, resist the urge to implement not critical features/options that will inevitably come to your mind, note them down and take a look at them after cooling down.

You should strive to achieve maximum separation of UI and business/game logic. Ideally, your game code should work whether you have a command-line game (for example: "play e2e4"), a simple 2d UI, or a full-fledged 3d UI driven by the latest version of DirectX. Complete separation is not an easy job and it is where knowledge of Object-Oriented and event-driven programming will be most useful.

Now, the good thing is that you both love programming and writing programs, and you are just a little over-enthusiastic... No scratch that. You are enthusiastic and that is a good thing.

On the refactoring subject, you may not feel the need for it, but maybe it is because you know that your code is a mess and that it would take forever to change things. However, if you organize your ideas a little bit before starting, you should have less code to refactor (but there will (should?) always be a little voice in your head that says "this could work better if..."). Check out other questions on this website on the subject of refactoring, other people have covered much better than I could do it.

Finally, if you feel you are not writing proper OO code take a look some books you could read in order to improve on that, for example: https://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-programmer-should-read

Title: How much design to do first?


问:
Is it a good idea to use something like the Twitter Bootstrap in production?
I'm interning at a new startup, and I've been tasked with designing the front-end of the site.
I really, really want to use the new Twitter Bootstrap (http://twitter.github.com/bootstrap/). It's all CSS, looks amazing, works great, and lets me get to designing and not worrying about the little stuff.

However, is this a good idea if it's a demo of a webapp that we're building that could become production code? Will it look silly and amateur if I use this instead of coding it all myself? Is the bootstrap too Twitter-ish for a real company's brand?

答:
looks amazing, works great, and lets me get to designing and not worrying about the little stuff.

I think you answered your own question there. There's a variety of mature CSS frameworks and Javascript UI libraries out there, but Bootstrap has two very nice advantages:

It's supported by Twitter, which means that it will probably be around for a very long time, it will probably be very consistent across browsers, and it will probably grow nicely.

It combines basic CSS framework stuff with basic Javascript UI stuff. Although using let's say Blueprint with jQuery UI is an extremely simple task, it's always nice if all your front end needs are covered by one framework (same naming conventions, less chances you need to hack something to get css with js to play nicely)

And as for:

Will it look silly and amateur if I use this instead of coding it all myself?

There's nothing more silly and amateurish than reinventing the wheel. So, by all means, go for it.


问:
Do some programmers know some secrets that we others don't?
I will not bother you with details of my discussion so I will present it in the form of a short instance.

A java guy has been following articles and publications of a famous programmer (a kind of Martin Fowler of my country). He says that he is sharing some secrets which other famous programmers don't share.

I never believe that there are some secrets like wizards in the programming area. But some programmers who are not good yet in this area think that other famous programmers are success because they know some secrets that we don't.

I totally disagree with this and I discussed it with someone and finally he said to me you are 2 years in this area and he (java guy) is 20 years professional programmer so he knows better than you.

I wanted to be sure that I am not wrong. That's why I wanted to know this.

答:
Sorry if I am missing something, but I could not find this above, at least not explicitly stated.

The secret is actually using the right tools for the job. In fact it is the tools that old programmers cherish and do not disclose so easily. They will talk to you about your CONCRETE mistakes, but will rarely suggest which tool might help you to avoid them.
Their tools are one of the main secrets of their productivity.

Giving just an example,
one can memorize a 600-page book on web services, understand the intricacies of
WSDL specification (I tried it myself once.. to understand the intricacies), and still
not be able to understand what goes wrong with the API he uses when he tries to
make a call to an existing web service..

On the other hand, one may have little knowledge of the spec (but a clear general idea)
and use Wireshark..

One can remember all C++ (oh my..) and still not understand what goes wrong with
his code written with vi, and compiled with gcc (no warnings..). But a graphical IDE with a debugger might help..

And then Google. The biggest secret of all up to date.


问:
Explaining technical things to non-technical people
I often have to explain technical things and technical decisions to my extremely non technical manager and I'm pretty awful at it. What are good ways to essential dumb things down for the rest of the world who don't have a passion for programming?

Example questions I've been asked:

Why are you using Django instead of Java (Didn't accept that it was cheaper either)

Asking me to rephrase things in non technical words, my sentence was "Certain HTML tags are not allowed". How can I possibly dumb that down?

Other stuff that makes perfect sense to me, but is just so basic I don't know how to explain it

Why this, why that, why everything!

Also, how do I tell my manager to look the basic stuff up on Google, like "What is Pylons?"

答:
Don't feel bad. I had to explain what copy on write means to a complete and utter nitwit last week. Horrifically, that nitwit was one of our vendors.

If in person, find a white board, or at least some paper so you can become a human layer of abstraction.

If working with someone remotely, there are many sketch / white board tools available.

Attempting to simplify something abstract, by abstracting it further, without some kind of visual aid is just madness. It will lead to things like drug and alcohol abuse, disenfranchisement from your family and peers and worse, unicorn cruelty.


答:
Is the bootstrap too Twitter-ish for a real company's brand?

You can tweek the code in the less files provided with the bootstrap to make it look like you want and adjust it to the company's brand.
To do that, you have to install less and see the documentation http://lesscss.org

Title: Is it a good idea to use something like the Twitter Bootstrap in production?

Body:
I'm interning at a new startup, and I've been tasked with designing the front-end of the site.
I really, really want to use the new Twitter Bootstrap (http://twitter.github.com/bootstrap/). It's all CSS, looks amazing, works great, and lets me get to designing and not worrying about the little stuff.

However, is this a good idea if it's a demo of a webapp that we're building that could become production code? Will it look silly and amateur if I use this instead of coding it all myself? Is the bootstrap too Twitter-ish for a real company's brand?


问:
How do I handle projects in which my project manager is the same as the client?
I am a freelance worker taking on a new project with a company I'm already familiar with. My boss (the company owner) previously gave me a website project to work at while he also assigns a project manager to review the progress. But with my latest project, the setup here is a little different.

My boss assigned to me this project as well. He's only in the office two days out of a week. After the first meeting with the client, I wondered who was the PM since I wasn't introduced to him/her. When I told my boss that in most cases, I'd rather report to the PM because it's easier and more accessible, that's when he informed me there that my PM is the same person as the client! I was a bit shocked. I didn't want to tell him right out that I find something very wrong with that arrangement, but I'm stuck with this project for now.

So I end up being in direct contact with the client once a week, which is good in a few cases, but am responsible for meeting him for extended periods while my boss only sits in for a few minutes. Especially for a project of a scope which will last for a few months, I feel like I'm doing the job of both a project manager and programmer.

I didn't quote him for the project- the PM/client sent the quote to my boss, and my boss is handling my payouts based on that.** He also controls the schedule for the project. So I'm trying to tread carefully with completing the goals so I don't get short-changed.

My biggest concern, though, is the lack of good communication. The PM/client is not very technically inclined, sometimes states goals that are subtly different from what I perceive, and asks for things that are beyond the means of the tools I'm working with. My boss is better at explaining the situation in a broad sense, but like I said he's not always available, and pretty slow at responding online.

Basically, there's a lack of a dedicated PM and there is sparse communication among me, my boss and the PM/client. How would I track my own progress and ensure better performance, and avoid misinterpreting the tasks for the project? I want to stay on a good pace with the communication I receive without feeling stuck or overwhelmed.

I prefer face to face contact. Everyone else in the office updates their progress by discussing with PMs working in the office on a daily basis, and their projects go more smoothly. My boss isn't interested in having one of them work on this project because he says it'll take a lot of time away from their current work. I want to force in more communication in this project but my boss isn't doing much to help.

[Edit] Well, here's an update. What ended up happening is that our client was demanding other features that turned out to be out of scope, and the CMS that we had to use didn't permit addition of these features so easily. My boss and I struck out some of his demands in the essence of time and budget, and last week the client/PM ended up being dissatisfied and cancelled the project indefinitely.

In the future I will stay away from such arrangements with the client doubling as a PM. I think it gives someone far too much control over the direction of a project.

答:
The fact your client and PM are the same person is actually pretty nice.
There is no middle man so nothing get's lost in translation which is a real danger as you are already having trouble with just you and him... imagine if there are more people in between?

As Bernard already points you should use this time with the customer to flesh out what you will do in the upcoming week. Identify the features that are the most value and which you can tackle in that timespan and focus on them.

Focus on the details from his point of view. He's non technical and he shouldn't be. You cover the technical part and can tell him what is possible and what's not.

Then make sure you have your requirements written down in a verifiable manner. An issue tracker can be nice for this. Personally I like automated tests but business is not often willing to look at those even in business oriented tools like FitNesse or Twist.

As we're talking about weekly time boxed iterations you'll find you'll have to keep your tasks small as well.


答:
If you're building something like this, look at the competition. Copy what's good and improve what's not.

Here, you can take a look at how IMDB does it, they have a simple text search and an advanced search. This allow you to search all or your own movies by rating (0-10), year (e.g. all movies between 1960 & 1970), language, country, genre,...

Title: How to allow filtering Films in my app intuitively? (GUI design)

Body:
I am not sure if this is the right place to ask this but I wrote an app that shows all the movies in one's computer with the appropriate info such as genre, director, rating, etc.

I am wondering how can I make it so that the user can filter them based on criteria such as genre, rating, etc?

Most of them are enums, and I was thinking of using a ComboBox for these but they should be able to specify more than 1 genre. So should I use ListBox controls for these? Then it will be harder to present all these options in listboxes.

I haven't seen any examples of apps doing similar things, that's why I am not sure.

Any ideas?


问:
Delegate vs Interfaces-Any more clarifications available?
After reading the article-
When to Use Delegates Instead of Interfaces (C# Programming Guide),
I need some help  understanding the below given points, which I found to be not so clear (for me).
Any examples or detailed explanations available for these?

Use a delegate when:

An eventing design pattern is used.

It is desirable to encapsulate a static method.

Easy composition is desired.

A class may need more than one implementation of the method.

Use an interface when:

There are a group of related methods that may be called.

A class only needs one implementation of the method.

My Questions are,

What do they mean by an eventing design pattern?

How the composition turns out to be easy if a delegate is used?

if there is a group of related methods that may be called,then use interface-What benefit it has?

if a class only needs one implementation of the method,  use interface-how is it justified in terms of benefits?

答:
An eventing design pattern implies a structure which involves a publish and subscribe mechanism. Events are published by a source, every subscriber gets it's own copy of the published item and is responsible for it's own actions. That is a loosely coupled mechanism because the publisher doesn't even have to know the subscribers are there. Let alone having subscribers is not mandatory (ther can be none)

composition is "easier" if a delegate is used compared to an interface. Interfaces define a class instance as being a "kind of handler" object where as a composition construct instance appears  to "have a handler" therefore the appearance of the instance is less restricted by using a delegate and becomes more flexible.

From comment below I've found that I needed to improve my post, see this for reference:
http://bytes.com/topic/c-sharp/answers/252309-interface-vs-delegate


问:
How often to release in Scrum sprint
How often to you release during a sprint. Only at the end of the sprint or every time a feature is ready. And how to you handle bugfix releases?</p>

答:
What do you mean by release? If you mean PSP - probably shippable product you have two options:

Scrum by book (or Scrum level 2) you have PSP at the end of the sprint and that is what you show at retrospective meeting

I also met term Scrum level 3 where the team mastered their tools like Source control and Continuous integration and moved to Continuous delivery. Such team is able to have PSP after every nightly build (or every build in the best case). Having PSP after every build doesn't mean that you show it to the customer after every build - it is still just internal release.

The main difference between level 2 and level 3 is that in level 2 you must put some effort to make final PSP at the end of the sprint but in level 3 you put some money and effort initially to your tools and configurations and you have PSP prepared automatically all the time = there is no manual effort involved. Fully achieving level 3 is rare.

Title: How often to release in Scrum sprint


答: One thing to consider is that Bootstrap is licensed under Apache 2.0 license. You would probably want to check with your company's legal representative over using it. IIRC it's not a requirement of Apache 2.0 that you share any changes, but IANAL, and there may be other conditions which need to be considered.</p>


答:
Put a textbox in each Column Header.

Example :

Putting I inside the filter textbox filters the datagrid to only show Country starts with I

I agree that UX Stackexchange is a better place to ask.


问:
Why is C++ often the first language taught in college?
My school starts the computer science curriculum with C++ programming courses, meaning this is the first language that many of the students learn.

I've seen that many people dislike C++, and I've read a variety of reasons why.  It almost seems to be popular opinion that C++ isn't a very good language.  I get the impression it's not very liked based on some questions on StackExchange as well  as posts such as:

 http://damienkatz.net/2004/08/why-c-sucks.html

 http://blogs.kde.org/node/2298

 http://blogs.cio.com/esther_schindler/linus_torvalds_why_c_sucks

 http://www.dacris.com/blog/2010/02/16/why-c-sucks-part-2/

 etc.

(Note: It is not my opinion that C++ is a bad language.  In fact, it's the main language I use.  However, the internet as well as some professors have given me the impression that it's not a very widely liked language.  In fact, one of my professor constantly rags on C++, yet it's still the starting language at my college!)

With that in mind, why is this the first language taught at many schools? What are the reasons for starting a programming curriculum with C++?

Note: This question is similar to "Is C++ suitable as a first language", but is a little different since I'm not interested in whether it's suitable, but why it's been chosen.

答:
When I studied computer science, Java was tought first, but my university right now teaches two languages to us computational linguists: first Prolog and then C++.

C++ is taught for (at least) the following reasons:

It's a general-purpose language, you can write software for any operating system with it (because there exist many compilers). It is designed to be a good production language, it makes it easy to re-use program parts, interoperate with real-world hardware and software, etc.

It's really fast. You can't use Python or Scheme or Prolog for processing huge data sets, which are common these times. Think graph algorithms with millions of nodes. (That's also why computer games are usually written in C++.)

Students can learn what the compiler does. Actually, as long as I only learned Java (starting in high school), the compiler's work always seemed like magic to me. You just don't learn about the stack and heap, the whole static vs. dynamic linking thing, etc. as a Java beginner. C++ de-mystifies the whole computer.

For what it can do, it is ok in learning time (although it is probably one of the most complicated languages if you really dig into it). It offers a nice library which helps with a smooth learning curve. (There are different approaches to that, though. In my university, we were taught how to write our own string classes and smart pointers before we were allowed to use the library; Bjarne Stroustrup, the inventor of C++, encourages the opposite order.)


问:
Why is Scheme my first language in university?
I hear about C, C++, Java every day whenever people starting talking about computer science, but in my first computer science class we are asked to write in Scheme (DrRacket).

Why is that?

What differences will this make to my future understanding of programming?

UPDATE: I have finished my first term, but not completely done with Scheme. In my second term (which is now) we got in to C programming. It was frustrated to learn pointers at first, but now I feel much better.

There's not much more to say than that. I'm trying to teach myself Java (or C++?) for the OOP part which I'm missing. So far, I still like functional programming best. Lambda is just fascinating. :)

答:
Scheme will help you get good and think in the proper way to use functional programming languages. Scala for example is a Functional/OO hybrid that is quite brilliant, although a bit dense. Languages like this though mark the future - hopefully.

Lisp-like languages though have a purity and simplicity to their design that make them a bit easier for teaching. The nice benefit though is that you'll have a much easier time learning something like Scala afterward.


答:
It seems like you are very new to programming having no prior experience in it at all. So here are some clarifications:

Why Scheme and not C/C++/Java...?

When learning a programming language (an analogy could be made with the English language) you learn the syntax you need to follow so that your code is gramatically correct. However a language won't teach you the logic behind solving problems. In order to learn that logic, you learn different programming paradigms.

Each language can implement (more or less accurately) one or more paradigms. A paradigm is a way to structure your logic, and the paradigm implemented by Scheme is called Functional Programming(FP).

So the real question you're asking is: Why FP?

As you mentionned, C, C++ and Java (who don't implement FP) are far more popular. As a matter of facts, (and for various reasons, everyone have their opinion) FP is not very popular in the industry.

On the other hand, FP is very highly regarded in academic circles. It is closer to the common mathematical approach, focuses more on provability and optimization of algorithms, and most people will agree that it would make you a better programmer in general.

It's similar to schools that teach Latin in order to study English litterature.


问:
How to decrease errors before testing?
During last year, several of the projects of the company where I work failed.

We develop web software, that are not especially complicated (the most are CRUDS and search form about this data).

One of the problems that management has identified is the test phase.

Putting simple, our protocol is:

Analysis of the requeriments

Development

When construction is over, upload the executable to a server

Execute test plan

Repair the errors

Execute the test plan, to check if errors persist.

If all is ok -> Send to the client.

The problem is that when we finish phase 3 and start phase 4, the number of errors is to damn high, that the execution plan takes to much time, and we get an interminable list of things that we have to repair.

Until arrive to the test plan we are on time, but after this we spend more hours that were planned and then "fail" the project. We deliver with enought quality for the client but spend more hours repairing bugs.

The management is looking for a solution, and is planned a meeting to ask us for ideas to improve the quality before the first test plan. Any idea?

答:
Evidence supposedly says that one of the best things you can do to decrease errors, even more than testing itself, is formal code inspection.

The article also covers the effectiveness of many other techniques you might want to consider (though pre-dates TDD so doesn't include that - personally I'd be surprised if it beat formal code review but that's personal opinion and not supported by anything).

Title: How to decrease errors before testing?


答:
Firts of all, knowing your weakness is an actual strength, hence you know what to study to get a better game.

My advise would be, read a lot of code that solves logic problems. Everyone has their own style in solving puzzles, reading code might hint you at a way how you can learn to do this. Plus being able to understand the code probably also points you to the mathematical theory that describes the problem, so along the way you'll learn about the underlying problems as well.

Cheers,
Carlo


答:
Unfortunately there is no such thing as "the standard solution", so you have to figure out what your requirements are and from that choose the option that fits best.

Here are few options.

For a network application integration perspective SOAP over http might be the best(laborious but transparent) way to find a means to create the integration.

The windows platform itself provides different means of integration as well. Windows process to windows process communication  might be solved bij (D)COM or named pipes(if on same machine), even RPC might solve your needs.

For your java application you would be able to use JNDI to create a native integration to the c++ app and from there you would be able to go to (D)COM even, so there are plenty of options.

Title: Communication Between Different Technologies in a Distributed Application

Body: I had to a incorporate several legacy applications and services in a network-distributed application. The existing services and applications are written using different languages and technologies, including: java, C#.Net and C++; all running on MS Windows machines. Now I'm wondering about the communication mechanism between them. What is the simple and standard way? Thanks! PS. communications include simple message sending and remote method invocations.</p>


问:
Translating objects from one type to a another
I am working on a server-client app in c# and need to send an object from the client to the server via WCF. For simplicity I will call it WorkingClass as it is what does the work.

```<code>    public class WorkingClass
    {
        public WorkingClass (FileInfo uncompressedFile, FileInfo compressedFile)
        {
            UncompressedFile = uncompressedFile;
            CompressedFile = compressedFile;
        }

        public FileInfo UncompressedFile { get; private set; }
        public FileInfo CompressedFile { get; private set; }

        public void ZipFile()
        {
            //zip file
        }
    }
</code>```

Now I need to send it to the server via WCF. I don't need the whole WorkingClass FileInfo properties serialized and sent, so I have a simple class which I will call MessageClass that has simple strings.

```<code>public class MessageClass
    {
        public MessageClass(string uncompressedFileName, string compressedFileName)
        {
            UncompressedFileName = uncompressedFileName;
            CompressedFileName = compressedFileName;
        }

        public string UncompressedFileName { get; private set; }
        public string CompressedFileName { get; private set; }
    }
</code>```

I can add a ToMessage() instance method and a FromMessage static method to the WorkingClass. Or instead of the static FromMessage method, I could add a constructor to the WorkingClass that accepts a MessageClass as a parameter. To me these options seem to tie both classes tightly together and the WorkingClass should only have to worry about zipping a file, not converting itself for communication via WCF. Do I maybe create a converter class?

The Server will then need to convert from the message to its own working class.

Am I on the right path to handle this sort of thing? Is there a best practice or design pattern I can follow?

答:
It looks like you have some code duplication going on that keeps you from resolving your issue. The working class should contain a method that accepts a message (if neccesary store it in a local field) Then the message class is the only type that needs to be serializble(add datacontract) and even might be in a shared library on the client and server.

By doing so you can expose the zipfile(MessageClass msg) as an operation to WCF (using an interface off course) and it pretty much will take care of the rest.


答:
I tend to use analogies. Take whatever the topic is, and think of something completely non-technical that they would understand, and explain it to them that way.

Best example I can think of offhand is if I need to explain object orientation, I'll explain it using a deck of cards. Or, when I was trying to explain the idea of wireless internet to my great aunt (who's never used a computer), I used cordless phones to explain it.

I've yet to come across any topic I can't dumb-down this way.

Update

I see this continues to get upvoted, so here's some of how I'd explain OOP with a deck of cards:

A card is essentially a copy of the same object, a piece of stiff paper.

Each card has a set of properties (value [A-K], suit, face up/down), which may or may not be unique.

A card can be used in many different ways, without altering anything about the card (held in a hand, put in a deck, played on the field, etc.)

If you want to get into interfaces: A card must conform to certain standards, such as size and shape.

If you do something to one card, that doesn't affect any other card.

A deck is a "container" object, which holds <= 52 card instances.

The deck can have various operations done on it, such as shuffle, show the top card, draw 5, etc.

The deck doesn't need to know or care about a card's value/suit, only that it is a card.

A hand is another object, with a certain number of cards, and its own set of operations (play, add, remove, sort)

Title: Explaining technical things to non-technical people

Body:
I often have to explain technical things and technical decisions to my extremely non technical manager and I'm pretty awful at it. What are good ways to essential dumb things down for the rest of the world who don't have a passion for programming?

Example questions I've been asked:

Why are you using Django instead of Java (Didn't accept that it was cheaper either)

Asking me to rephrase things in non technical words, my sentence was "Certain HTML tags are not allowed". How can I possibly dumb that down?

Other stuff that makes perfect sense to me, but is just so basic I don't know how to explain it

Why this, why that, why everything!

Also, how do I tell my manager to look the basic stuff up on Google, like "What is Pylons?"

ContentLicense: CC BY-SA 4.0


答:
There are quit a few challenges in your story.

Things that spring to mind are a more agile way of development (TDD is a great one but there will be a massive gap in testcases since you already have a product out there). Continuous integration and continuous delivery will help resolving build and integration issues. Also a quick growing amount of unit tests will enable you to improve quality and maintain a regression base that will indicate wheter new features break existing code.

The hardest thing to change will be the actual process, things like continuous integration require deployment of a set of tools which is a walk in the park compared to changing the process.

Cheers,
Carlo

Title: How to decrease errors before testing?

Body:
During last year, several of the projects of the company where I work failed.

We develop web software, that are not especially complicated (the most are CRUDS and search form about this data).

One of the problems that management has identified is the test phase.

Putting simple, our protocol is:

Analysis of the requeriments

Development

When construction is over, upload the executable to a server

Execute test plan

Repair the errors

Execute the test plan, to check if errors persist.

If all is ok -> Send to the client.

The problem is that when we finish phase 3 and start phase 4, the number of errors is to damn high, that the execution plan takes to much time, and we get an interminable list of things that we have to repair.

Until arrive to the test plan we are on time, but after this we spend more hours that were planned and then "fail" the project. We deliver with enought quality for the client but spend more hours repairing bugs.

The management is looking for a solution, and is planned a meeting to ask us for ideas to improve the quality before the first test plan. Any idea?


答: If they all are running on windows machines I would look at msmq I'm sure that all have implementations.  If you need more then just communication I would then look at biz talk and lastly if ever need to work with different systems IBM MQ is the best product that IBM does and is rock steady reliable.   </p>


答:
Congratulations, you're now being turned into the equivalent of a vegan in the computer world, and in two years you won't be able to end up any discussion without informing people about the higher moral ground you stand up onto. ;)

Anyway you landed a very good school. Schools that are not industry-whipped are good.

As someone else said, they teach you the science, from which you derive the craft.

Many bad code-monkey-farms teach you the craft, and then you may happen to infer the science from it, but it's not guaranteed. (and you may end with pretty weird misconceptions about it)

Anyway, as an honored member of the functional crowd, when you get out of there, you'll always feel misunderstood and under-appreciated.

Which, let's admit it, for the average computer wiz is nothing new.

You're in now for an high risk of:

trying to wrap up in an academic career,

embark in the pursuit of a PHD,

...emacs.

You will also probably like open source, but you will never find enough collaborators for your functional projects.


答:
When we started our application five years ago we only had 4 Dutch programmers. But we wrote everything in English.

Today, our code is used by French colleagues and Indian developers. Thanks to using English, they can also use our code. The French colleagues have quite a bit of french in their comments and naming schemes. We can still make some sense of it but it's a lot easier if everything is in English.

In short, what if tomorrow you have a few Brazilian colleagues?

Title: Is it a good practice to code in English?

Body:
Possible Duplicate:

  Do people in non-English-speaking countries code in English?

I have a development comming that is intended to be sold across Latin America (Spanish speakers), but I've heard from some partners that is a good practice to always code in English, I mean just code (methods, classes, pages names, etc), labels on GUI are going to be all in Spanish...

Code will be edited in the future by developer of companies across Latin America and just maybe some from outside.

What do you think?, any experience with this?


问:
Which of these is the best strategy for dependency injection?
I am working on a Java project that uses a dependency injection framework built by the company itself. The framework enforces the following naming convention: suppose you have a class Foo that depends on an interface called org.company.IBar:

```<code>class Foo {
   @Injection
   private IBar bar;

   ...
}
</code>```

then the framework will search for a class called org.company.implementation.Bar, create a new instance of that class and then assign it to the attribute Foo.bar. The framework allows for some customization, though. In that @Injection annotation, you can declare your own factory, with which you can enforce your own conventions. But every time you want to use a certain factory, you will have to declare it explicitly in the annotation over the attribute to be injected.

This strategy, however, will make your classes tightly coupled to each other, because when you declare a dependency on an interface, you are already committing to a given implementation. So, I decided to implement my own factory to manually perform dependency injection. It is basically a class that instantiates all application objects and wires them together. Each object has its scope (singleton or prototype) controlled by the factory. Think of a Spring IoC configuration file (but written in Java, instead of XML).

My colleagues did not approve this decision. Their argument is that the factory I created “has too many responsibilities” and the instantiation of each object must be left to the framework. If you need to use another convention, you should create custom factories for each class (as described above). Definitely, according to them, there should not be one single factory where all the objects are instantiated.

I strongly disagree with their argument. The factory has only one responsibility: creating the object graph. Should the need arise to modify that graph, there is only one class that will have to change. But I may be missing something here. What are the pros and cons of each strategy?

答:
Have you looked into using Guice? It is a dependency injection framework like the one you described. However, it allows you to create different injection models that can specify a set of interface to implementation mappings.

```<code>public class BillingModule extends AbstractModule {
  @Override
  protected void configure() {
    bind(TransactionLog.class).to(DatabaseTransactionLog.class);
    bind(CreditCardProcessor.class).to(PaypalCreditCardProcessor.class);
    bind(BillingService.class).to(RealBillingService.class);
  }
}
</code>```

Link to their example implementation.

It seems like a good middle ground between the two options you described. The class objects are getting injected to does not have to explicitly know what class is in charge of doing the injecting. And as the user of the framework, you don't have to do the heavy lifting to ensure that the object graph is instantiated correctly.

Body:
Have you looked into using Guice? It is a dependency injection framework like the one you described. However, it allows you to create different injection models that can specify a set of interface to implementation mappings.

public class BillingModule extends AbstractModule {
  @Override
  protected void configure() {
    bind(TransactionLog.class).to(DatabaseTransactionLog.class);
    bind(CreditCardProcessor.class).to(PaypalCreditCardProcessor.class);
    bind(BillingService.class).to(RealBillingService.class);
  }
}

Link to their example implementation.

It seems like a good middle ground between the two options you described. The class objects are getting injected to does not have to explicitly know what class is in charge of doing the injecting. And as the user of the framework, you don't have to do the heavy lifting to ensure that the object graph is instantiated correctly.


答: ohloh.net collects information on open-source projects. It counts things like total number of lines committed for each language - number of contributors making commits for each language etc. It can be interesting to see the trends. For example, the number of contributors making commits of C code is seeing a small lift since 2010, although the total number of commits is still falling sharply. This would indicate that more people are committing C code, but in larger chunks. It's not possible from these stats to say where those extra contributors may have migrated from though..</p>

Title: Programming language popularity: Is there data on migration trends?

Body:
I'm looking for historical statistics showing approximately how many developers of some language X switch to language Y. It should be the kind of data that answers question such as:

Are former VB6 developers using mainly C# or VB.NET now?

Have many Java developers switched their main development language to Scala so far?

etc.

I'm not doing a study, I'm mainly curious. Is there some website or institution that collects and publishes such data?


问:
What are the pros and cons of directly exposing a Table/View entity class to the client?
I'm developing a multi-tier application. We separate our project into three logical layers: client, service and data access. However, almost all methods in the service layer don't do anything except returning table/view from DAL to the client and then the client continues processing data. More than 50% of the returned data is bigger than it really needs to be. For example the client needs a username and an email-address but the service layer returns way more data. This is the coding standard in my team. I tried to change this by shaping classes that return what the client really needs but they wanted me to change it back after I had done it.

I'm curious what are the pros and cons of doing things that way?

答:
Pro's of exposing entities directly to a client

Little overhead in translation between rdbms structure and entity structure and thus lightweigth solution

It provides a chunky interface which is good for network throughput/efficiency

Easy serialisation of data structures

Provides a means of optimistic concurrency (offloads the database concurrency checking and locking)

Enable cacheing of items for efficiency (at least using EF dbcontext)

Con's

When persisting values, there is no way to check wheter the instances
have gone through validation before submitted for persistence

Little gained by exposing entities instead of using a database connection from your client (e.g to manage concurrency)

There can be more than one version of your client out there so
business rules might vary which coulod create problems for your
database schema

change tracking and conflict resolution will require more effort than using a more granular option (field based changes)

Cheers,
Carlo


答:
I agree that the model of a single "default" implementation, or one factory per class is too rigid.

I see two potential problems with your approach:

wiring up everything in Java makes configuration changes awkward - you need to recompile and redeploy (part of) the app every time,

one factory to instantiate the whole object graph may be too coarse grained (depending on the size of the object graph). If the graph is huge, the factory logic becomes hard to maintain. This is why it may be better to have separate factories, although not necessarily one per class. Find a comfortable middle ground, by grouping together closely related / dependent classes.

Single Responsibility Principle is good to follow, but IMO the main point of it is to create (and keep) classes of manageable size. Note that responsibilities have different levels of abstraction. What may look like a single responsibility on a higher level, is divided into several distinct tasks on a lower level. I can define a "single responsibility" for my class: "satisfy the client's needs" and create a classic God class, which clearly violates the SRP :-)

Title: Which of these is the best strategy for dependency injection?

Body:
I am working on a Java project that uses a dependency injection framework built by the company itself. The framework enforces the following naming convention: suppose you have a class Foo that depends on an interface called org.company.IBar:

```<code>class Foo {
   @Injection
   private IBar bar;

   ...
}
</code>```

then the framework will search for a class called org.company.implementation.Bar, create a new instance of that class and then assign it to the attribute Foo.bar. The framework allows for some customization, though. In that @Injection annotation, you can declare your own factory, with which you can enforce your own conventions. But every time you want to use a certain factory, you will have to declare it explicitly in the annotation over the attribute to be injected.

This strategy, however, will make your classes tightly coupled to each other, because when you declare a dependency on an interface, you are already committing to a given implementation. So, I decided to implement my own factory to manually perform dependency injection. It is basically a class that instantiates all application objects and wires them together. Each object has its scope (singleton or prototype) controlled by the factory. Think of a Spring IoC configuration file (but written in Java, instead of XML).

My colleagues did not approve this decision. Their argument is that the factory I created “has too many responsibilities” and the instantiation of each object must be left to the framework. If you need to use another convention, you should create custom factories for each class (as described above). Definitely, according to them, there should not be one single factory where all the objects are instantiated.

I strongly disagree with their argument. The factory has only one responsibility: creating the object graph. Should the need arise to modify that graph, there is only one class that will have to change. But I may be missing something here. What are the pros and cons of each strategy?


答: If you can afford it, BizTalk is directly targeted at this kind of problem. It has a consistent programming model, so if you can create a BizTalk adapter for each of your isolated systems, you can create BizTalk orchestrations to control the flow of information between all of those systems. It's also quite performant in my experience.</p>


问:
I am not a good programmer (in logic), how should I fix it?
Ok, so here is my problem:

I work for a big company, some how landed a job (frankly because the interview was easy). It's not that I don't know my stuff, I am pretty good at understanding java, it's libraries etc.

But, when ever I try to solve some logic problem, I find it really hard to come up with a solution.

For example, conversion of decimal to roman, when I saw the solution, I find that it's a simple problem. But I was not able to implement it after 1-2hrs of trying out!

I feel I am dumb and not worth being a software engineer. Puzzle solving abilities should come natively to a great programer. But when I try to solve some puzzles, I am not able to find a solution and I just google it up!....and I hate that!

When given a problem (like implement xyz feature) at work, I am fairly pretty quick at it and am respect at my work place for that, but I am not at all proud about it. Because when I try to solve any mathematically or logic wise challenging problem, I fumble. I still feel I love what I am doing (as an engineer) but feel really sad that I am not able to solve some tough logic problems which I friends come up with.

I feel demoralized :(

TL;DR: I understand stuff from a practical viewpoint (implementing
  features in our product) but when trying to work on problem from say
  ProjectEuler, I SUCK badly! And I need to Sharpen my brain!

So, my questions are:

How should I go about fixing it? Should I start with solving (and forcing my self to) project euler problems? Even if it takes hours for me to solve some basic problems?

Or should I go back to basics and study some basic math?

I don't really find puzzle solving fun. But I want to make it fun for my self! And I think if I understand them in a better manner, I will like it!

PS: I was never educated in CS (my undergrad was electrial). But that's not an excuse to be a sucky developer.

Thanks!

答:
First, it's wonderful that you see this as a weakness in your skills. You actually know where you need to improve, which makes for a far easier time doing so, and indicates that you are better than you think.

I believe your primary problem, which I've seen many times before, is that you don't have a "problem solving toolset". When faced with a problem, what do you do? How do you go about solving it? I'm slow at math, but because I know how to use the little tools of math together, I aced calculus.

So, besides just working on problem solving, you need to look at what tools and skills you bring to the table when you do so. If you were going to work on a new feature at work, do you just sit down with no IDE, no debugger, no documentation, no internet, and no source code? Of course not!

There are tools for solving problems, you just don't know them....yet. The wikipedia article has some links to problem solving techniques. But the most important tool is the scientific method. The wikipedia article includes a pragmatic approach:

Define a question

Gather information and resources (observe)

Form an explanatory hypothesis

Test the hypothesis by performing an experiment and collecting data
in a reproducible manner

Analyze the data

Interpret the data and draw conclusions that serve as a starting
point for new hypothesis

Publish results

Retest (frequently done by other scientists)

All problems can be solved this way! Many people don't go through these steps though. It's like a developer who refuses to test his code. At all. He'll have problems figuring out bugs even exist.

Finally, the other primary tool for problem solving is break it down with simple steps. For example, the first problem in project Euler's examples:

```<code>If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.
</code>```

We have two facts, and a problem here. Fact one shows us how to define a multiple of three or five below 10. 3*1,3*2,3*3,5*1 are all valid. 5*2 is not because it equals 10. Then, fact two tells us that we add them together to get 23.

So we already have a method of finding values, and we can add them together to get our sum. Of course, we can look at the facts and apply a simple reverse of the order. 3, 5, 6 and 9 are multiples of 3 or 5. That is 3 % 3, 5 % 5, 6 % 3, 9 % 3 all give a mod of zero. So another approach would be to go through 999 to 1 and modulus each number with 3 and 5. Collect the list of values and add them together.

I would suggest The art of unix programming as an excellent example of using small tools in the programming world. Chaining them together allows you to solve very complex problems, and I can't count the number of times these concepts have helped me.

Body:
First, it's wonderful that you see this as a weakness in your skills. You actually know where you need to improve, which makes for a far easier time doing so, and indicates that you are better than you think.

I believe your primary problem, which I've seen many times before, is that you don't have a "problem solving toolset". When faced with a problem, what do you do? How do you go about solving it? I'm slow at math, but because I know how to use the little tools of math together, I aced calculus.

So, besides just working on problem solving, you need to look at what tools and skills you bring to the table when you do so. If you were going to work on a new feature at work, do you just sit down with no IDE, no debugger, no documentation, no internet, and no source code? Of course not!

There are tools for solving problems, you just don't know them....yet. The wikipedia article has some links to problem solving techniques. But the most important tool is the scientific method. The wikipedia article includes a pragmatic approach:

Define a question

Gather information and resources (observe)

Form an explanatory hypothesis

Test the hypothesis by performing an experiment and collecting data
in a reproducible manner

Analyze the data

Interpret the data and draw conclusions that serve as a starting
point for new hypothesis

Publish results

Retest (frequently done by other scientists)

All problems can be solved this way! Many people don't go through these steps though. It's like a developer who refuses to test his code. At all. He'll have problems figuring out bugs even exist.

Finally, the other primary tool for problem solving is break it down with simple steps. For example, the first problem in project Euler's examples:

If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.

Find the sum of all the multiples of 3 or 5 below 1000.

We have two facts, and a problem here. Fact one shows us how to define a multiple of three or five below 10. 3*1,3*2,3*3,5*1 are all valid. 5*2 is not because it equals 10. Then, fact two tells us that we add them together to get 23.

So we already have a method of finding values, and we can add them together to get our sum. Of course, we can look at the facts and apply a simple reverse of the order. 3, 5, 6 and 9 are multiples of 3 or 5. That is 3 % 3, 5 % 5, 6 % 3, 9 % 3 all give a mod of zero. So another approach would be to go through 999 to 1 and modulus each number with 3 and 5. Collect the list of values and add them together.

I would suggest The art of unix programming as an excellent example of using small tools in the programming world. Chaining them together allows you to solve very complex problems, and I can't count the number of times these concepts have helped me.


答:
There's absolutely no rules in Scrum about when new features may be deployed.  Every team needs to have a "definition of done", which always should include some criteria about testing.  Once a feature is "done", it's ready for the real world and if there aren't any other dependencies or conditions that need to be met before it can be deployed, then there is no reason to wait for the end of the Sprint to deploy it.

None of which means that it isn't presented at the Sprint Review/Planning meeting.  The concept is that everything that the Team has completed is shown to the PO (and other customer SME's) so that they can incorporate it into their growing understanding of the system as it evolves.

Title: How often to release in Scrum sprint

Body: How often to you release during a sprint. Only at the end of the sprint or every time a feature is ready. And how to you handle bugfix releases?</p>


问:
Communication Between Different Technologies in a Distributed Application
I had to a incorporate several legacy applications and services in a network-distributed application. The existing services and applications are written using different languages and technologies, including: java, C#.Net and C++; all running on MS Windows machines. Now I'm wondering about the communication mechanism between them. What is the simple and standard way? Thanks! PS. communications include simple message sending and remote method invocations.</p>

答:
It depends on how low level each service is. For the lower level services, I would use a binary messaging approach, like Google's protobuf library.

For the higher level services (and certainly for external facing services), I'd use SOAP or REST via an application server (WebLogic, JBoss) or something simpler (Apache, IIS).


答:
Try to answer not in terms of the underlying technology, but in terms of the problem domain.  "when a customer using firefox tries to place an order, his browser wont display the BUY IT button - that browser doesn't support the HTML tag we are using"

Often this is really the type of answer management wants.  If he really does want to understand the low level details, the best bet is to make analogies to technology you know he does understand.


问:
Programming language popularity: Is there data on migration trends?
I'm looking for historical statistics showing approximately how many developers of some language X switch to language Y. It should be the kind of data that answers question such as:

Are former VB6 developers using mainly C# or VB.NET now?

Have many Java developers switched their main development language to Scala so far?

etc.

I'm not doing a study, I'm mainly curious. Is there some website or institution that collects and publishes such data?

答:
I'm not sure that "migrated from" is even an easily defined metric, let alone easily measured.  For example, I learned python last year for internal-use scripting, but our product is still written in C++.  You could say I migrated from C++, but python really replaced perl for me, which I gave up because none of my colleagues knows it anymore.  I've done projects in Java and php in the last year as well, but I wouldn't say I "migrated to" those either, both of which were "day job" languages for me in the late 90s.

In other words, measuring migration assumes almost everyone is a monoglot, which isn't a valid assumption.


答:
I suggest that you require developers to unit test and to commit their tests to Source control along with the code. Nothing goes to Qa without a set of unit tests that have been certified as run by the developer. TDD is a great idea (where you write the tests before you write the code) but clearly your devs weren't testing their code at all, so start there. Just becuase you have QA department does not relieve the developer of the responsibilty to test his code.

Next code review should be a requirement in your company. No code is realesed until reviewed and coded reviewers will be instructed to not only review the code for techinical accuracy but for compliance with the requirements. Working code that does the wrong thing is a bug too.

Next sit down with the players (devs and qa) from the failed projects and go through the bugs found and see if there are patterns you can see. Are certain types of errors common? Then maybe your developers need training on those topics. This is not a blame session, you don't care who created the bug, you are looking to improve process and the first step is gathering data on what went wrong so you can prevent it in the future.

Next have the managers take a good hard look at the skill level of the developers you have. It is less expensive to train existing personnel to improve their skills than to fire them and hire new people. However, if you have some people who repeatedly make the same mistakes and never learn from their mistakes, it may be time to consider if they are contributing to the company. I would start with providing training (I suspect your corporate culture probably hasn't given them a chance to improve, I've seen devs have their stuff fixed by someone else and didn't even know it was bad.) and then see if the same mistakes continue. Then in about 6 months, review performance and see if some poeple just aren't improving to level you need to have.

Title: How to decrease errors before testing?


问:
Is it a good practice to code in English?

Possible Duplicate:

  Do people in non-English-speaking countries code in English?

I have a development comming that is intended to be sold across Latin America (Spanish speakers), but I've heard from some partners that is a good practice to always code in English, I mean just code (methods, classes, pages names, etc), labels on GUI are going to be all in Spanish...

Code will be edited in the future by developer of companies across Latin America and just maybe some from outside.

What do you think?, any experience with this?

答:
English:

```<code>GetUserInvoices(int userId);
</code>```

Spanish:

```<code>ObtenerFacturasDelUsuario(int idDeUsuario);
</code>```

English words are usually shorter and easier to read, that's one of the reasons why I usually code in English (I am from Spain). The other one is that I find ugly to mix Spanish words with the English language keywords and framework classes and members.

Body:
English:

GetUserInvoices(int userId);

Spanish:

ObtenerFacturasDelUsuario(int idDeUsuario);

English words are usually shorter and easier to read, that's one of the reasons why I usually code in English (I am from Spain). The other one is that I find ugly to mix Spanish words with the English language keywords and framework classes and members.


问:
Why were short, int, and long invented in C?
I'm having trouble understanding, what were the exact purposes of creating the short, int, and long data types in C?

The reason I ask is, it doesn't seem like their sizes are bounded -- they could be of any size, so long as short is smaller than an int, for example.

In which situations, then, should you use an unsigned int or unsigned long, for example, instead of a size_t, when doing so offers no hope of binary compatibility?

(If you don't know the size, then how would you know when to choose which?)

答:
C was designed to actively deal with memory at different levels. There are cases where the difference between short, int, and long, and between float and double, mattered because of memory constraints, architecture, etc.  Though it matters less now, there are still environments where it does (e.g, embedded, and in cases where the data is massive), and the transition from mainly 32-bit architectures to 64 bit makes it somewhat of an issue again. (In ten or twenty years when we transition to 128 bit architectures and C/C++ is still popular, it'll again be an issue).  You're right though that binary compatibility suffers, which is why you don't want to use these variable type sizes where that matters.

You asked how you would know which to use if you don't know the size, but you do know the size on a given architecture/compiler combination, and if you need to optimize memory at that level, you'd better know it.  You can't optimize it that simply across platforms because you can't know their sizes, so you wouldn't want to use those features for that purpose.  But a lot of things written in C are platform-specific, which, despite the fashion for "cross platform", does allow for some advantageous optimizations.


问:
List of reserved words a username can't be?

Possible Duplicate:

  Is there a list of common usernames to reserve in a new system?

I'm working on a site where users will have a custom URL e.g.: http://domain.com/username

I want to avoid the situation where a user registers and creates a username that I later need, e.g. if I want a page at domain.com/about and someone's already named themselves 'about'.

Does anyone have a list of generic words that could be added to a blacklist for this?

答: What about using a prefix for site pages, like domain.com/site/about? And just make sure usernames can't include the '/' character.