问:
How do I know if the compiler broke my code and what do I do if it was the compiler?
Once in a while C++ code will not work when compiled with some level of optimization. It may be compiler doing optimization that breaks the code or it may be code containing undefined behavior which allows the compiler to do whatever it feels.

Suppose I have some piece of code that breaks when compiled with higher optimizations level only. How do i know if it's the code or the compiler and what do I do if it's the compiler?

答:
Getting a compile error on standard code or an internal compile error is more likely than optimizers being wrong. But i have heard of compilers optimizing loops incorrectly forgetting some side effects a method cause.

I have no suggestions on how to know if its you or the compiler. You may try another compiler.

One day i was wondering if it was my code or not and someone suggested valgrind to me. I spent the 5 or 10mins to run my program with it (i think valgrind --leak-check=yes myprog arg1 arg2 did it but i played with other options) and it immediately showed me ONE line that is ran under one specific case which was the problem. Then my app ran smoothly ever since with no weird crashes, errors or strange behavior. valgrind or another tool like it is a good way to know if its your code.

Side note: I once wondered why the performance of my app sucked. It turned out all of my performance problems was in one line as well. I wrote for(int i=0; i<strlen(sz); ++i) {. The sz was a few mb. For some reason the compiler ran strlen every time even after optimization. One line can be a big deal. From performances to crashes


问:
Is Perl still a useful, viable language?
I know it may have been asked before, but here goes nothing...

Is Perl still something that would be considered useful? If someone was a new programmer (either completely new to programming or just a few month/years of experience) would Perl be something to be considered worthwhile to learn?

Is Perl still used with frequency? Is it still popular?

Or is Perl dying out compared to languages like Python, Ruby, PHP, ASP.NET, etc.?

Basically it boils down to this:

Is it still used/is it still used frequently? If yes, is it dying? If no, will it make a come back?

Is it something that would be worth learning?

How does it compare in demand to languages like Python in both popularity and usability/viability? Could languages like Python or Ruby be considered replacements for Perl?

Also, will newer versions of Perl really bring a large improvement to the Perl community, and perhaps bring Perl back to centerstage compared to other languages?

EDIT:

Okay, I suppose here's a better, reworded question:

Is Perl still growing, or is it "dying"? Is it still a language worth learning and using? What projects does it really "shine" in compared to other languages? What makes Perl a language to choose? Essentially: is Perl growing obsolete compared to other languages, and if so, do you expect that to change, or to continue?

And thank you to everyone who has answered so far, the discussion has been really interesting!

答:
I was attracted to Python by its layout - the block structure is "what you see is what you get" - and don't understand why there are people who are put off by this. I think it was, and is, a good idea.

I went back to Perl, though. It just seems better thought out as a practical tool. In computer-science theory, Python and Ruby are "better". But I work in the real world.

Ruby and Python are more fashionable among kids fresh out of college. Most programmers who are on Facebook will follow the current fashion and go with Ruby or Python. The original post illustrates this: it conflates "Is it worthwhile" with "Is it still popular?"

I neither know nor care whether Perl is "popular" in a Facebook world. It is probably the most widely used scripting language among people who accomplish a lot, which is a very different thing. Some of the commenters who think that their favorite language has a comparable resource to CPAN have no idea about how broad and deep CPAN is.

ContentLicense: CC BY-SA 3.0


问:
Choose C++ or Java for applications requiring huge amounts of RAM?
I'm thinking of scientific applications that are mostly processor-bound and heavy on heap usage (at least several gigabytes). Any other time of the year I would happily go with C++, but in this case I wonder if the fragmentation natural to the C++ memory manager can be a serious issue versus the advantage of Java's compacting collectors.

Can anybody point to real-world examples related to this?

答:
The problem is not use C++ as it is Java and not use Java as it is C++.
A C++ container is normally implemented to avoid excess of fragmentation, just like the Java free store do.

But if you allocate yourself the memory directly, you can do also things Java does not permit you to do, that can result in fragmentation.

The proper solution (in C++) is use container and smart-pointers through allocator classes that manages allocation by means of fixed "plexes" (the key point, here, is writing a good allocator class). And this is a programming style that has nothing to do with Java, so any comparison is meaningless.

[EDIT]
This can be an outdated sample:
Fixed allocation


问:
How to resolve methods with the same name and parameter types?
In many cases, I want to write methods that have the same functionality for different types of inputs. This is easily accomplished by method overloading if the parameter types are different.

But what's the best (most robust) way to go about resolving the case when the parameter types are the same (i.e. two different representations of the data with the same type)?

An example of this would be an integer matrix which can naturally be stored as an int[][]. But what if you want to write a method which accepts the transpose of the matrix as well? The transpose is also an int[][] but a clearly different representation altogether.

I can see a couple ways of doing this:

Giving the methods different names

Adding a flag to the method

Wrapping each representations in different classes

I think the third method is the most clear way of doing this. Unfortunately I'm working on some high performance libraries where that's not a feasible solution.

答: Don't use the same data type for different representations. If you have a matrix and a "transposed-representation-of-a-matrix" version of your method, it might be a good idea to create two data types for these representations. This way, the compiler will also yell at you if you accidentally use the wrong one somewhere.</p>


答:
This is the perfect use-case for interfaces; Use a single base class to encapsulate the business logic, but implement different interfaces in subclasses that take varying parameters. This perfectly illustrates why you should code to an interface, rather than an implementation. So yes, you would use different classes, but you would do

```<code>public class MatrixOne implements ThisMatrix {
  //code
}

public class MatrixTwo implements TransposeMatrix {
  //code
}
</code>```

Obviously, this is a simplification. There are other options, but if you can pass a message indicating which version of the matrix is effective, you can tell the receiver how to process it, as well.

Title: How to resolve methods with the same name and parameter types?

Body:
In many cases, I want to write methods that have the same functionality for different types of inputs. This is easily accomplished by method overloading if the parameter types are different.

But what's the best (most robust) way to go about resolving the case when the parameter types are the same (i.e. two different representations of the data with the same type)?

An example of this would be an integer matrix which can naturally be stored as an int[][]. But what if you want to write a method which accepts the transpose of the matrix as well? The transpose is also an int[][] but a clearly different representation altogether.

I can see a couple ways of doing this:

Giving the methods different names

Adding a flag to the method

Wrapping each representations in different classes

I think the third method is the most clear way of doing this. Unfortunately I'm working on some high performance libraries where that's not a feasible solution.

Body:
This is the perfect use-case for interfaces; Use a single base class to encapsulate the business logic, but implement different interfaces in subclasses that take varying parameters. This perfectly illustrates why you should code to an interface, rather than an implementation. So yes, you would use different classes, but you would do

public class MatrixOne implements ThisMatrix {
  //code
}

public class MatrixTwo implements TransposeMatrix {
  //code
}

Obviously, this is a simplification. There are other options, but if you can pass a message indicating which version of the matrix is effective, you can tell the receiver how to process it, as well.


问:
Are there open source alternatives to Bitbucket, Github, Kiln, and similar DVCS browsing and management tools?
I am aware of several tools/services that provide DVCS browsing and management such as Bitbucket, Github, Kiln, SCM-Manager and Rhodecode.

However, the use case I am considering is one such that:

Any source code must reside on an employers internal servers.

The solution must be open source.

It should provide a Bitbucket or Github like experience, including a project wiki, repository browsing and management, and social coding aspects such as code review.

The solution should have mercurial support (if not support for other DVCSs).

Of these, only SCM-Manager and RhodeCode come close as they can be installed on your own servers and are open source. However they do not have the Bitbucket or Github experience. There is no issue tracker or wiki and the UI, while functional, is not up to par with Github or Bitbucket.

I can get close with Trac or Redmine with their repository browsers but unfortunately they do not have any repository management capabilities.

Are there other open source tools out there that would provide a similar experience to Bitbucket, Github or Kiln?

答:
Your constraints are pretty specific, but I think you can get the results you seek with ChiliProject + plugins.

ChiliProject is a fork of Redmine that uses updated versions of Ruby/Rails. It supports git and mercurial very well, and replicates the Github Issues functionality it looks like you're seeking by parsing commit messages (i.e., refs 291 in a commit would link a commit to issue #291).

There are also Redmine/ChiliProject plugins that provide facilities like code review, syntax highlighting, and other niceties that Github, etc. provide that might not be obviously or readily available in open-source competitors.

There are other options, JIRA, etc., but they (IMHO) don't provide the felxibility or wealth of functionality that the ChiliProject fork of Redmine + the multitude of available plugins provide. There's not much that Github and/or BitBucket do for you that ChiliProject (possibly with freely available plugins) can't do; and the beauty is, if it doesn't already exist, it's usually fairly trivial to implement it yourself.

If this sounds like more than you need... I haven't tried it yet, but GitLab also looks interesting... it doesn't seem to have the extensibility or plugin architecture of Redmine/Chili, but if you're looking for an open-source clone of Github with most of the core feature set (and you don't need to support multiple DVCSs), it looks pretty good.


问:
What is an untriaged bug?
I am an undergrad studying Computer Science. When I tried reporting bugs to several projects, I came across the classification untriaged a lot. A web search didn't really explain what this means.

Could you tell me what an untriaged bug is?

答:
Triage comes from medical jargon - it is the process of prioritizing patient care.

When used in the context of bugs it has a similar meaning - determining the priority of a fix.

So, untriaged bugs are those that have not been assigned a priority yet.

Title: What is an untriaged bug?


答:
Check out the "recent uploads to CPAN"-page. There are >20 new modules or updated modules being uploaded every day. I think the average number of daily uploads has been slowly but steadily increasing. Is this actvity a sign of a language that is dying? No!

It always impresses me how some important modules (for web programming for instance, or interfaces to RDBMS drivers) have been maintained and refined over many years. Often by the original author, or by new maintainers. Often this has created very mature code.

To get a module into CPAN authors are encouraged to go a very long way to maintain backward compatibility (with older perl 5 versions) as well as platform independence. See for instance http://matrix.cpantesters.org/?dist=DBI (DBI =  database interface, abstraction layer)

Also the language itself: I am a bit puzzled by all the new features that have been included into the language since 5.10, 5,12., 5.14. I have not learned to take advantage of the new features. Perl has been evolving too fast for me!

Title: Is Perl still a useful, viable language?

Body:
I know it may have been asked before, but here goes nothing...

Is Perl still something that would be considered useful? If someone was a new programmer (either completely new to programming or just a few month/years of experience) would Perl be something to be considered worthwhile to learn?

Is Perl still used with frequency? Is it still popular?

Or is Perl dying out compared to languages like Python, Ruby, PHP, ASP.NET, etc.?

Basically it boils down to this:

Is it still used/is it still used frequently? If yes, is it dying? If no, will it make a come back?

Is it something that would be worth learning?

How does it compare in demand to languages like Python in both popularity and usability/viability? Could languages like Python or Ruby be considered replacements for Perl?

Also, will newer versions of Perl really bring a large improvement to the Perl community, and perhaps bring Perl back to centerstage compared to other languages?

EDIT:

Okay, I suppose here's a better, reworded question:

Is Perl still growing, or is it "dying"? Is it still a language worth learning and using? What projects does it really "shine" in compared to other languages? What makes Perl a language to choose? Essentially: is Perl growing obsolete compared to other languages, and if so, do you expect that to change, or to continue?

And thank you to everyone who has answered so far, the discussion has been really interesting!


问:
How can I motivate myself to start learning more?
I've been interested in programming for a while now, and have been slowly, slowly, slowly working on things over the years. However, I don't feel like I've learned much.

I've only really stuck with familiar languages (Java, C# and I've tried a little bit of PHP). The problem is that in those languages, I've only brushed upon the surface of them and have restricted myself to doing fairly simple things.

For example, as a Java project, I've downloaded the source code for some game and changed a few things to my liking, but nothing terribly difficult. In C#, I've made a few WinForm and console projects to do some repetitious or routine tasks for me, which is nice, but again nothing too complicated.

I've just barely begun to grasp the concept of classes, multithreading and some basic but essential tools that are required in modern object-oriented programming. ("Why can't I just shove everything into one monster-sized class?" "Why can't I just run everything in one thread?" are questions I used to wonder about)

I've never made a large project by myself. Ultimately, my kind of "dream" hobby project is that I would like to create a game using DirectX technology. I say that because I've used XNA but it requires the user to install a framework to get it running, and I also feel that if I use the framework, that a lot of the back-end work is being obscured from me. (DirectX or OpenGL seem to be about as close to the machine as I can get without going overboard in complexity. DirectX is also installed on most [if not all] Windows machines that plan on running games.)

But I haven't even begun to even think about starting that. The amount of things I need to know to undertake a task is absolutely overwhelming. I wouldn't know where to begin. Likewise, I also feel inadequate because I've restricted myself to [what I see as] easy languages. I feel like I should start learning some scripting language or learn this or learn that, which is quite daunting.

--

tl;dr: I've been slowly teaching myself to program for a while now, but have been restricting my knowledge to limited languages and only scratching the surface of what I can do. I want to learn more and possibly start a decent-sized project (I can only make so many text-based RPGs and calculators), but the massive amount of knowledge I'll need is very intimidating.

One of my concerns is that I know so little about programming languages in general. Is it better to learn several languages or to be able to delve deep into one single language?

How can I motivate myself to learn more?

Am I thinking about this the wrong way?

答:
I think you are overwhelming yourself with the Big Picture.  Don't try to learn everything at once.

Could you read War and Peace at the same time you were learning Marvin K. Mooney?

Pick a small task, and learn how to do it in the language of your choice.  Then enhance it.  Then enhance that.

Despite the perception that all programming is either 1.) game programming or 2.) hacking into your favorite government agency (the main questions that I get when I speak at a Career Day in any high school), most of programming is not necessarily so glamorous.

Grow into it.

ContentLicense: CC BY-SA 2.5


问:
What is the difference between these senior software engineer titles?
I'm currently a senior research software engineer at a large company and am being offered a "senior staff engineer" position somewhere else. I am not sure if the new position's title conveys a sideways move or an advancement.

So, all other things being roughly equal (salary, domain of expertise, etc.), what is the external difference between these software engineer titles (in general and regardless of any particular company, if possible):

senior engineer

senior research engineer

senior staff engineer

member of technical staff

principal engineer

Edit:
Let me elaborate on "member of technical staff" since it's kind of uncommon. I think it's a high title, commonly associated with research. I know that Oracle, VMWare, and the old Bell Labs have these titles. See: Member of Technical Staff . I know what it means, but I don't know how it stacks up against the other titles, which is why I asked.

答:
The weird "member of technical staff" title actually has ranks in it as well (depending on company). It used to have only two ranks (mts, dmts - distinguished) and both implied you have a Ph.D (or masters with equivalent experience). There actually is a technical title committee (at least in AT&T Labs) that one has to go through to get approved to hold these titles.

The sub ranks are:

MTS - entry level (needs masters)

SMTS(S for Senior) - entry level for Ph.D researchers, or MTS after about 2 years

PMTS(P for Principal) - experienced researcher

LMTS(L for Lead) - director level, MTS with at least 12 years of experience.

DMTS(D for Distinguished) - executive director level - very few of these are given.

The highest you can get hired into is PMTS, the other two require promotions and both are rare. Engineer titles are given to non research, or people without masters/phd.

ContentLicense: CC BY-SA 4.0


问:
What is a good IDE for client side JavaScript development?
I recently started learning JavaScript and am looking for a good JavaScript Editor/IDE. I found dozens of them in a Google search but I would appreciate if users who have experience with using such an IDE could recommend one.

I want an IDE with syntax highlighting, possibly IntelliSense and debugging support for JavaScipt code. I'm a Windows 7 user and do just client-side JavaScript development.

Any suggestions??

答:
My personal favourite is Aptana Studio. It's Eclipse with Plugins for web development preinstalled and will get you going without any problems. Aptana is very comfortable and has all the features you want.

However almost all common IDEs will have either builtin support for Javascript or offer plugins for the language. Netbeans and IntelliJ are good,too.

Since you said IntelliSense I guess you're using VisualStudio. You'll easily find support for Javascript in it and maybe it will be most convenient to stick with it.


答:
There are no good JavaScript IDEs. There are only Type 3 IDEs for JavaScript. The "best" IDE currently would be WebStorm 3.0.

Use a text editor of your choice instead. Good choices include:

vim

sublime text 2

vim and sublime text support syntax highlighting and allow you to run command line or build scripts through the editor.

As for debugging JavaScript, for client-side, use the browser to debug it. For node, use node-inspector (the browser) to debug it.

As for intellisense, you don't need it and it will be wrong 10% of the time. Personally the fact that it gets it wrong 10% of the time is enough of a productivity hit to just not use it all. Again, WebStorm 3 is the only IDE that gets it 90% right here. VS2011 might also make for a good contender but I have not tried it personally. VS2010 is horrible for JavaScript.

Title: What is a good IDE for client side JavaScript development?

Body:
I recently started learning JavaScript and am looking for a good JavaScript Editor/IDE. I found dozens of them in a Google search but I would appreciate if users who have experience with using such an IDE could recommend one.

I want an IDE with syntax highlighting, possibly IntelliSense and debugging support for JavaScipt code. I'm a Windows 7 user and do just client-side JavaScript development.

Any suggestions??


答:
My project was an Atlassian JIRA plugin: Java, SQL, some Velocity templates in the back-end and few dashboard gadgets (JavaScript/HTML/CSS) in the frond-end. Atlassian also have their own frameworks for the plugins, so it is helpful if an IDE has support for nonstandard external libraries.

I've had quite unpleasant experience with Eclipse's JavaScript support, it has numerous glitches with completion and automatic code formatting, especially with complex code (modular sources, few frameworks used, etc.). Refactoring is not always works as intended (or at all) and almost useless. I've not tried Aptana Studio though.

NetBeans is somewhat better in this regard but its support for complex mixed source projects (like Java/JavaScript/web/templates etc.) is lacking (maybe I've not tried hard enough).

Finally I've ended up using IntelliJ IDEA. It is commercial (there is 30 day trial) but unbeatable feature-wise. Code analysis, semantic coloring, refactoring which works across various source files (like js, css, html). Just try it and you would never look back.

P.S. I'm not affiliated with JetBrains in any way, it's just my personal view.


问:
Is Agile applicable in product development companies as well?
The following principles of Agile development makes it look like Agile is mostly suited for services companies:

Customer satisfaction by rapid delivery of useful software

Welcome changing requirements, even late in development

Working software is delivered frequently (weeks rather than months)

Working closely with the client. Often this involves a client representative to be a part of the development team.

Face-to-face conversation is the best form of communication (co-location)

My question is: Is Agile exclusively suited for service oriented companies or do even product development companies (including web based companies) benefit from Agile techniques?

答:
Define who you believe your customers to be.  Are they the people who buy your company's products, are they the people within your company who might use and test your code, or are they perhaps both? When you write your code and submit it for testing, do you complete the entire product first, or do you deliver it in stages to be tested and signed off?

Whether Agile works in any company all comes down to the mind-set of the the people working with it, how the team thinks about it, and how committed they are towards making an Agile methodology work for them.

Ultimately, Agile is suited to the team that wants to make it work for them, and yes this means it can be successfully implemented in even some of the more "scary" development situations provided the methodology is adapted to suit. It doesn't matter if you feel your company is service or product focused.

The thing to remember is that going Agile isn't about copying someone else's methodology verbatim, which would be fine if the methodology can gel with your particular company's needs.  In the end, when changing the way you go about writing software, something has to give.  It's about achieving a compromise between your vision of an agile workflow, and the existing business processes that may need to be modified to accommodate agile processes. This is not something you can easily change overnight, but which changes gradually, and in stages as you fine tune both the agile and business process so that they will gel well with each other. It may also require a shift in your thinking, so that you apply all of the agile concepts that your developers need, and ignore the ones that might create problems for your team, and your "agile customer" becomes a "customer representative" within the company who takes responsibility for being the product champion, acting as the customer's "voice" in the team just to keep everyone firmly grounded.

In the company where I work, we probably only do about half of the things that all of the standard methodologies recommend we should do, and for the rest, we've fine-tuned things to suit ourselves.  Whenever we run into something that is inefficient, we implement changes to the method to deal with problem. This can happen from project to project on rare occasions, depending on who we are working with, and who we end up working for. So in the end, how you specifically go about implementing agile in your workplace is really down to you to ultimately decide. The key to it all is to simply keep an open mind, and to regularly re-evaluate your team's performance, removing practices that make things worse, and introducing the practices that make things better.

Good luck.


问:
Dark themes in IDE with multiple monitors
There has been numerous posts about developers that prefer a dark color scheme in their IDE. Most of the themes at studiostyl.es are dark themes.

Back when I had a single monitor, I did enjoy using a dark theme since it was easier on the eyes.  But now that I utilize multiple monitors, I find dark themes actually hurt my eyes.  Most of the time I have my IDE open on one monitor and a browser/email/documentation open on my other monitors.  Only my IDE has a dark theme and most of websites/documentation have a white background.  This forces my eyes to constantly adjust between my dark IDE and the white website, which puts strain on my eyes.

I'm sure I'm not the only person who tries to use a dark theme for the IDE and have multiple monitors.  How do other people deal with this issue?

答: I have two color schemes one for high light environments and one for low light environments. I switch between the two when the need arises.


答: Solarized is a theme made with just what you have in mind. I don't know just whether they made a Visual Studio port just yet, but I wouldn't be suprised. Vim and Emacs are supported.

Title: Dark themes in IDE with multiple monitors

Body:
There has been numerous posts about developers that prefer a dark color scheme in their IDE. Most of the themes at studiostyl.es are dark themes.

Back when I had a single monitor, I did enjoy using a dark theme since it was easier on the eyes.  But now that I utilize multiple monitors, I find dark themes actually hurt my eyes.  Most of the time I have my IDE open on one monitor and a browser/email/documentation open on my other monitors.  Only my IDE has a dark theme and most of websites/documentation have a white background.  This forces my eyes to constantly adjust between my dark IDE and the white website, which puts strain on my eyes.

I'm sure I'm not the only person who tries to use a dark theme for the IDE and have multiple monitors.  How do other people deal with this issue?


答:
If you are talking about an application which is bound to stress the limits of the machine, such that you expect you will be doing programming tricks to avoid exceeding those limits, then C++ is the way to go. Not only C++ gives you room for optimization where Java does not, (as Emilio pointed out,) but also, Garbage-Collectors are very memory hungry contraptions which need plenty of extra free memory in order to work efficiently.

The answers to this question: StackOverflow: How much extra memory does garbage collection require? paint a rather grim picture, but even if garbage collectors need the free memory to be only about as much as the allocated memory, (which is what I had heard,) this still means that with Java you will still need a lot of free memory for it to run efficiently.

On the other hand, nowadays we generally prefer to buy more expensive hardware rather than to have to perform programming tricks to avoid exceeding the limits of the hardware. In your case, your RAM problems would typically be solved by using a 64-bit machine and throwing as many RAM modules on it as necessary. You see, the cost of hardware is nowhere near the cost of development time in the developed world nowadays.

I think that you should seriously consider this option, and if possible, go with this option and with Java instead of C++, because it is a lot easier to develop something in Java than in C++, and to keep maintaining it afterwards.

Title: Choose C++ or Java for applications requiring huge amounts of RAM?

Body:
I'm thinking of scientific applications that are mostly processor-bound and heavy on heap usage (at least several gigabytes). Any other time of the year I would happily go with C++, but in this case I wonder if the fragmentation natural to the C++ memory manager can be a serious issue versus the advantage of Java's compacting collectors.

Can anybody point to real-world examples related to this?


答:
Customer satisfaction by rapid delivery of useful software product

Welcome changing product or engineering requirements, even late in development

Working software product is delivered frequently earlier (weeks rather than months) and product cycle time is reduced.

Working closely with the client product owner. Often this involves a client representative the product owner to be
a part of the development team.

Face-to-face conversation is the best form of communication (co-location)

In short, how can Agile not apply to product development?

Title: Is Agile applicable in product development companies as well?

Body:
The following principles of Agile development makes it look like Agile is mostly suited for services companies:

Customer satisfaction by rapid delivery of useful software

Welcome changing requirements, even late in development

Working software is delivered frequently (weeks rather than months)

Working closely with the client. Often this involves a client representative to be a part of the development team.

Face-to-face conversation is the best form of communication (co-location)

My question is: Is Agile exclusively suited for service oriented companies or do even product development companies (including web based companies) benefit from Agile techniques?


问:
Give a more formal definition for the term "pythonic" than PEP8?
For me as python programmer having a formal definition for the term "pythonic" would be much more important and less subjective compared to asking more rhetoric (non-formal) questions. This may lead to better communication by argumentation being less subjective (as discussed in here).

PEP8 by Guido is assumed as a starting point despite of some religious dogmatism (e.g. PEP20 is more axiomatic, shorter and simpler, but has no code). Having identified minimalism, readability (human comprehension) and unambiguity (explicit code) is actually the same as paraphrasing PEP20. But is it possible to rewrite zen of python in python? Obviously print('Beautiful is better than ugly') does not capture python in python ;-) Any thoughts on this?

Ultimately I would like to get closer to more logical or mathematical interpretation of the matter. Argument in form of the code answering why family of snippets A is pythonic compared to family of snippets B is also acceptable.

EDIT If possible try to reduce your answer to the following outline.
Let us consider all possible syntactically correct program texts generated by some procedure (e.g.). Please note that we a considering only programs written in python (which is a formal language with respective grammar). Also being syntactically correct does not mean semantical correctness (programs may be buggy or without any obvious purpose). Further we observe (assume) that ultimate family POmega of all syntactically correct programs in python must contain a subset of programs which are called Pythonic. Now in order to argue about what does it mean to be pythonic we will use a formal method - another language called Reason which would be less ambiguous (consistent, complete) than natural language. We will define a mapping from programs in Omega into Reason. Such mapping we will call interpretation. We will also produce more mappings in similar manner (e.g. as in) for all individual symbols in Python and their combinations (statements). Now if we would argue about images of such mappings, we would do so in form of proofs in Reason language. The question would be if subset Pythonic indeed exists can we follow that up from aximos in Reason built/reformulated from "Zen of python" or other motivating set of concepts? In fact, the whole deductive core of the language Reason would be built from "Zen" or PEP8. We will have to proof that each program from Pythonic will consist only from statements for images of which in  Reason can be shown to satisfy initial axioms of the model language. Different outcomes are plausible:

Subset of Pythonic programs could be empty. We have not found any programs that would satisfy our axioms in Reason.

It could happen that this set of axioms would turn out to be ambiguous (inconsistent or incomplete). Then our original assumption about existence of Pythonic programs would be wrong.

Alternatively axiomatic "Zen" could be simple enough and so well-chosen that Pythonic set is non-empty. Now the question is will such (consistent, complete) set be of practical value, i.e. can we say that such set of axioms is indeed a formal definition of "pythonic"?

This is a draft of how one can try to approach answering the question in formal manner. I would appreciate recommendations on a more elegant approach for solution to the problem (everything except ignoring it). But at the end it matters to me to see how such set of axioms looks like. Hence it will allow in precise (quantitative) way to ask and try to explain questions like why programs have "pythonic" qualities once written according to following python "dogmas"?

BTW One can built a more sophisticated model of Reason by introducing an equivalent of "human factor" - a software developer of the programs. Then the question would be - can human formally claim the program he rights belongs to "Pythonic" subset?

答:
To produce a test for '"pythonicity"' as pointed out in this Guido quote is obviously a non-trivial enterprise, but the test itself is very much nice to have. Now the current procedure is well known:

Use automated quality control tools as pep8.py or pylint (as pointed by Demian)

Perform codereview, where code is tested for pythonicity by human-based revision.

Finally you can ask community or Guido for the opinion, if code review is not resolved.

All of this can be semi-automated to a certain extend. In fact, communities like Q&A Stack Exchange projects are facilitating to test code for "pythonicity" right now.

Is there a better way to formalize such a test? As difficult as it seems a non-supervised test for pythonicity would be able to formalize "beauty" of the code making human interpretation superfluous. Most importantly it will fully include the human judgment. Topics like this are becoming less philosophical and much more practical if they are studied in theoretical AI or similar computer science.

Now I would not recommend you to answer this question any further unless you think you have a solution.


答:
One previous employer used both agile and delivered "shrinkwrap software". Some of the products have been shipped annually for 2 decades. Sprints were generally 2 weeks long, and pair programming was common, especially when deadlines were tight.

Welcome changing requirements, even late in development

Some of their products were used by customers to fill out government forms. Generally, the IRS has annual forms updated by the October/November time-frame for things that need to be filed in January (and April). Some years, Congress spends too much time goofing off to get the tax law changes done in time, so there have been a few years where forms that have a filing date of Jan 31 (such as W-2) are not finished by the IRS before Jan 15.

The goal was to have several scheduled releases during a year, but there were some years when we had a lot of updates due to changing regulations (and bug fixes).


问:
Do programmers keep error reporting on or off?
I was wondering if php programmers keep error_reporting in php.ini on or off after delivering the website?</p>

答:
You should always keep on error reporting, logging of most important events and audit. Otherwise, the day your application will fail for some reason, you'll have a hard time to figure out what happened.

This being said, error reporting must be done internally, and never shown to the end user, since it would be a security issue to show sensitive information. You can use display_errors and log_errors settings for this: in php.ini-production, the first is set to off, while the second is on.

By the way, php.ini-production already answers your question:

```<code>; error_reporting
;   Default Value: E_ALL & ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL & ~E_DEPRECATED
</code>```

Another comment also tells you that:

By default, PHP is set to take action on all errors, notices and warnings EXCEPT
  those related to E_NOTICE and E_STRICT, which together cover best practices and
  recommended coding standards in PHP. For performance reasons, this is the
  recommend error reporting setting. Your production server shouldn't be wasting
  resources complaining about best practices and coding standards.

Body:
You should always keep on error reporting, logging of most important events and audit. Otherwise, the day your application will fail for some reason, you'll have a hard time to figure out what happened.

This being said, error reporting must be done internally, and never shown to the end user, since it would be a security issue to show sensitive information. You can use display_errors and log_errors settings for this: in php.ini-production, the first is set to off, while the second is on.

By the way, php.ini-production already answers your question:

; error_reporting
;   Default Value: E_ALL & ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL & ~E_DEPRECATED

Another comment also tells you that:

By default, PHP is set to take action on all errors, notices and warnings EXCEPT
  those related to E_NOTICE and E_STRICT, which together cover best practices and
  recommended coding standards in PHP. For performance reasons, this is the
  recommend error reporting setting. Your production server shouldn't be wasting
  resources complaining about best practices and coding standards.


答:
One of my concerns is that I know so
  little about programming languages in
  general. Is it better to learn several
  languages or to be able to delve deep
  into one single language?

I don't know that I can expound on much of your question, but this particular line struck me as one that I have something to offer...

While there's some merit in experimenting in a handful of different languages, what I've found (and it took me about 6 years to really see this) is that at its core, programming is programming, and languages are just syntax. The fundamentals are going to be the same across languages, and the longer you've programmed, the more you'll find that you can pick up a new language (at least to the point of basic proficiency) in almost no time. For that reason, I would say you'd be better served by diving deeper into one language and learning the craft than by trying to get a shallow understanding of several.

As to how to motivate yourself to get deeper, your comment about "another text-based RPG or calculator" reminds me of this: the way I typically learn best is to have a project in mind. When I start out, I know that it's beyond my present capabilities, and I know that there are components in it that I have never done before and know that I don't even begin to know where to start on them. Because they are a defined part of the project, though, I have to do the research to learn. That way I'm not boxed into, "Here are the tools I've already got. What new thing can I make with them?", but rather, "Here's what I want to make. How do I get there?"

Title: How can I motivate myself to start learning more?

Body:
I've been interested in programming for a while now, and have been slowly, slowly, slowly working on things over the years. However, I don't feel like I've learned much.

I've only really stuck with familiar languages (Java, C# and I've tried a little bit of PHP). The problem is that in those languages, I've only brushed upon the surface of them and have restricted myself to doing fairly simple things.

For example, as a Java project, I've downloaded the source code for some game and changed a few things to my liking, but nothing terribly difficult. In C#, I've made a few WinForm and console projects to do some repetitious or routine tasks for me, which is nice, but again nothing too complicated.

I've just barely begun to grasp the concept of classes, multithreading and some basic but essential tools that are required in modern object-oriented programming. ("Why can't I just shove everything into one monster-sized class?" "Why can't I just run everything in one thread?" are questions I used to wonder about)

I've never made a large project by myself. Ultimately, my kind of "dream" hobby project is that I would like to create a game using DirectX technology. I say that because I've used XNA but it requires the user to install a framework to get it running, and I also feel that if I use the framework, that a lot of the back-end work is being obscured from me. (DirectX or OpenGL seem to be about as close to the machine as I can get without going overboard in complexity. DirectX is also installed on most [if not all] Windows machines that plan on running games.)

But I haven't even begun to even think about starting that. The amount of things I need to know to undertake a task is absolutely overwhelming. I wouldn't know where to begin. Likewise, I also feel inadequate because I've restricted myself to [what I see as] easy languages. I feel like I should start learning some scripting language or learn this or learn that, which is quite daunting.

--

tl;dr: I've been slowly teaching myself to program for a while now, but have been restricting my knowledge to limited languages and only scratching the surface of what I can do. I want to learn more and possibly start a decent-sized project (I can only make so many text-based RPGs and calculators), but the massive amount of knowledge I'll need is very intimidating.

One of my concerns is that I know so little about programming languages in general. Is it better to learn several languages or to be able to delve deep into one single language?

How can I motivate myself to learn more?

Am I thinking about this the wrong way?


答:
The advantage of garbage collection is that it simulates a machine with an infinite amount of memory. The mechanism or implementation of that abstraction is intended to be completely transparent to you as the programmer. We all know that the mechanism is reclaiming memory that is no longer used by the program, but that's not actually guaranteed. If you run the program on a machine with more RAM than the program ever actually uses, then garbage collection may never happen. Again, irrelevant, because you can just write the program without regard to how it uses memory. The memory manager will just allocate more RAM whenever the program requests it, and you're allowed to assume that such allocations will always succeed. Java is a garbage-collected language, and C++ isn't.1

The disadvantage of garbage collection is that, like all abstractions, it tends to be leaky. It doesn't always work perfectly all of the time, particularly in edge cases, and you're likely to run into bugs. The people who wrote the garbage collection algorithm (the one that's supposed to be transparent to you as a programmer) optimized for the most common cases, and the trouble with common cases is that they're never all that common. In general, you can't do any better than the garbage collector can at managing memory. But in specific circumstances (and given a sufficient amount of time, energy, and understanding), it might be possible. C++ gives you this flexibility; Java doesn't.

All of that said, I think the standard advice for choosing a language applies here, perhaps even more so in this case given the constraints. Pick the language that is the most familiar to the primary developers for the project. In addition to the obvious reasons (like you'll be able to develop the app faster and more efficiently), this is particularly important in the case that you describe because programming C++ like you're programming Java is going to result in terribly ineffective memory management practices, and therefore leaks and crashes. Analogously, programming in Java like you're programming in C++ isn't going to do you much good, and may end up producing a less-than-optimized program, given that the garbage collection algorithms are tweaked and tuned for the most common cases.

Programmers that are used to working in garbage-collected languages learn to trust the garbage collector, rather than fighting against it. If you're working in a garbage-collected language, these are the programmers that you want on your project. Programmers who are not used to working in a garbage-collected language are inherently skeptical of such an "infinite memory" abstraction, and frequently with lots of good reasons. Good as these programmers may be, these are not the ones you want working in a garbage-collected language because they'll be fighting against the GC every step of the way, constantly second-guessing it and often producing slower, less memory-efficient code than the other type of programmer. At best, they'll just spend a lot of time reinventing the wheel, costing you a lot of money and even more in long-term maintenance costs.

And then you also need to ask yourself whether it really matters. There's more than a hint of truth to Bo's snide comment: memory is so cheap now, it's hardly worth too much hand-wringing. Even if you need massive amounts, those amounts aren't nearly as massive now as they were 10 years ago. Programmers and application development are far more expensive than just buying gobs of RAM and processing power. That doesn't mean that you should eschew economy where possible, but it does mean that you shouldn't waste too much time doing it, either.

1 Of course, this assumption highlights a deeper flaw in the question. As it turns out, "Java or C++" is a bit of a red herring. The standard Java implementation provides garbage collection and C++ doesn't per the language standard, but there's absolutely no reason that you couldn't use a third-party garbage collector for C++. Lots of companies have made a living selling these things, and some have probably made a living giving them away for free.


问:
What is important when optimising for the CPU cache (in C)?
Reading these two questions, I see that understanding CPU caching behaviour can be important when dealing with large amounts of data in memory. I would like to understand the way the caching works to add another tool to my optimisation toolbox.

What are the core points about the way the CPU cache works so I can write code that uses it sensibly? Relatedly, is there a way to profile code to see if poor cache use is slowing things down?

答:
It is quite possible to understand and optimize for caches. It starts with understanding the hardware and continues with being in control of the system.  The less control you have over the system the less likely you will be to succeed.  Linux or Windows running a bunch of applications/threads that are not idling.

Most caches are somewhat similar in their properties, use some part of the address field to look for hits, have a depth (ways), and a width (cache line).  Some have write buffers, some can be configured to write through or bypass the cache on writes, etc.

You need to be acutely aware of all the memory transactions going on that are hitting that cache (some systems have independent instruction and data caches making the task easier).

You can easily make a cache useless by not carefully managing your memory. For example, if you have multiple data blocks you are processing, hoping to keep them in cache, but they are in memory at addresses that are even multiples relative to the caches hit/miss checking, say 0x10000 0x20000 0x30000, and you have more of these than ways in the cache, you may very quickly end up making something that runs quite slow with the cache on, slower than it would with the cache off. But change that to perhaps 0x10000, 0x21000, 0x32000 and that might be enough to take full advantage of the cache, reducing the evictions.

Bottom line, the key to optimizing for a cache (well, other than knowing the system quite well) is to keep all of the things you need performance for in the cache at the same time, organizing that data such that it is possible to have it all in the cache at once. And preventing things like code execution, interrupts and other regular or random events from evicting significant portions of this data you are using.

The same goes for code. It is a little harder though as you need to control the locations where the code lives to avoid collisions with other code you want to keep in the cache. While testing/profiling any code that goes through a cache that adding a single line of code here and there or even a single nop, anything that shifts or changes the addresses where the code lives from one compile to another for the same code, changes where the cache lines fall within that code and changes what gets evicted and what doesn't for critical sections.


问:
Are there any advantages of using separate RDBMS for reports?
My production database is SQL Server 2008 R2 Express. It has limited features and I am testing it in a production environment. To better handle reporting queries in a highly concurrent environment, I want to use any open-source RDBMS with tables that will be acting as temporary tables to frequently fill recent records and delete them after use.

The only problem is that I need to keep two connections for each RDBMS, but I feel, Firebird or PostgreSQL can give me better performance of reports in a highly concurrent environment.

What are your suggestions? Is this approach used in any commercial scenario?

答:
Beware of the programmer's solution. We are too willing to take on the challenges brought on by the current restrictions. Why have two different databases when you can buy the recommended version of SQL Server for a production environment or just switch completely to an open source rdbms if costs are an issue?

Eventually, you may have to off-load reporting to another server or datamart, but you're not there yet just because you've pushed the boundaries of the Express version.


问:
Do you write bad code when under pressure?
When you are under pressure, the deadline is approaching, and a manager is breathing down your neck do you find yourself starting to write bad code? Do TDD and best practices slip by the wayside in order to get things done? What do you do in situations like that? What were your experiences?</p>

答:
In a word, yes.  Anyone that tells you otherwise is probably, at best, mistaken.

However, the key is to build on your experience to write code that is less bad.  Resist the temptation to put in something to make it "just work" if at all possible, because it won't.  You still need to follow some sort of process (be it your own, or your company's, or some mix thereof).

Experience tells me that its much better to (gasp) slip the schedule a couple of days to prevent a week's worth of fixes, especially when "under pressure" means an expedited release to production.  If you are hurrying to release code, the testers are probably going to be in a hurry to rubberstamp it as well.


答:
Agile traces its origins to the Toyota Production System, which eventually influenced the entire auto manufacturing industry, which in turn influenced the entire manufacturing industry.

Software engineering is product design.  Our code is the equivalent of the tool & die design and industrial process design required to manufacture physical products.  Compilers are the workers.


问:
Mobile (Client) to Amazon S3 (Server) - Architecture
let's start off with the problem statement:

My iOS application has a login form. When the user logs in, a call is made to my API and access granted or denied. If access was granted, I want the user to be able to upload pictures to his account and/or manage them.

As storage I've picked Amazon S3, and I figured it'd be a good idea to have one bucket called "myappphotos" for instance, which contains lots of folders. The folder names are hashes of a user's email and a secret key. So, every user has his own, unique folder in my Amazon S3 bucket.

Since I've just recently started working with AWS, here's my question:

What are the best practices for setting up a system like this? I want the user to be able to upload pictures directly to Amazon S3, but of course I cannot hard-code the access key. So I need my API to somehow talk to Amazon and request an access token of sorts - only for the particular folder that belongs to the user I'm making the request for.

Can anyone help me out and/or guide me to some sources where a similar problem was addressed? Don't think I'm the first one and the amazon documentation is so extensive that I don't really know where to start looking.

答:
I would likely start with storing the S3 folders information on a DB and have the API handle the storage information according to the user's login information.

The iOS device shouldn't really care what the S3 is as the API should act as the proxy to Amazon.

If you're using .Net, here is a helpful link. It's basically saying, you need to create a zero byte object to create a folder.


问:
How could I implement multitouch gestures without a start event?
While working on multitouch, one of the problems I've run into is the fact that nobody seems to do gesture recognition without some kind of init event, whether it's a mouseclick or contact with a capacitive touchscreen.

Is it possible to do an "always listening" gesture handler? If so, how to do it without mirroring input in realtime and thereby imposing gloomy processor overheads? Is there some kind of downsampling (ie take every nth input from the cursor)?

答:
How about starting to listening at application start?

As for the processor usage, it depends on your particular implementation and the framework you are using.

If talking in general, independently of any framework, I would imagine several techniques to reduce the processor usage:

Have a solution already embedded into the framework. For example MultiTouchScreen would have an Touched or WokeUp event, which will be raised each time the user touches the panel for the first time (or every time, in which case it would be useful to unsubscribe from the event after it's raised, to avoid impacting performance negatively).

Tactile screens consume less power than multitouch. Maybe you can use your multitouch panel as a tactile screen until touched, and then enable the multitouch.

Monitor the touch panel at regular intervals, the interval being longer when idle. This technique is used for example in cordless laser mice. To waste less power, the mouse monitors the desk surface beneath every, say, 0.5 s. if the mouse wasn't moving for the last one minute, then 1 s. if the mouse was idle for five minutes, then 2 s. after ten minutes.

A few points to note:

You can inspire yourself by what is used by some security cameras. No motion: no need to record the scene at several FPS; but when the previous frame appears to be different from the current one, the camera wakes up and records at higher FPS rate.

Some kiosks and ATMs seem to use that. For example in France, ticket kiosks at railway stations (tactile screens, not multitouch) spend usually a few seconds waking up when not touched for a while, but are much more responsive when a person used it just before you do.

The drawback is that the user will have to wait for the application to "wake up". Depending on circumstances, this may either give a feel of a non-responsive app or be really frustrating. For example, at railway stations, it's rather a bad idea to have kiosks that spend a few seconds before responding when a customer may be late for her train.

You must profile the application in order to have an idea of how this will impact the performance and to choose a good user responsiveness/CPU usage ratio. For example for a security camera, slowing to one frame per second has no real negative impact, and allows to waste much less disk space. For wireless laser mice, there is a huge gain in terms of power consumption, but a non-negligible user responsiveness drawback too. Maybe for your particular app, you'll not gain too much power usage, but it will be very frustrating using your application.

Monitor the touch panel at lower resolution. Like it's possible to grab an image from a webcam at different resolutions, there is probably the same possibility for touch surfaces in the framework you use.

You can even imagine some more original solutions. For example, what about an inexpensive motion detector (the little box in public buildings which trigger an alarm or switch the light on when you enter in a room) which will wake up the touch surface every time a customer is near the touch panel?


问:
Resources on Writing Efficient C Code for Micro-controllers?
Serious help needed here. I love programming. I've been reading bunch of books(such as K&R) and articles/forums online for C language lately. Even tried looking into Linux code(although, i was lost where to start but peeking into small libraries helped?).

I started as a Java programmer and in Java it's pretty cut and dry; If programs gets too big, slice it in classes then further into functions. Guidelines like, keep the code readable and add comments. Use information hiding and OOP techniques. Some of which still applies for C.

I've been coding in C now and so far i get programs to work one way or the other. A lot of people talk about performance/efficiency, algorithm/design, optimization, and maintainability. Some people stress one more then the other but for non-professional software engineers you often hear something like e.g: Linux kernel dev won't just take any code.

My question is this: I plan on writing a code for 8-bit microcontroller without wasting any resources. Know that i'm coming from java background so things are not the same anymore... resources/books/links/tips will be much appreciated. Performance and size now matters. Resources/Tricks on efficient(within best practices) C code for 8-bit micro-controllers?

Also, inline assembly plays a vital role as well sticking close to micro-controllers standard. But are there general rule of thumb to efficiency that applies to all?

For example:
register unsigned int variable_name; is preferred over char anytime. Or using  uint8_t  if you don't need big numbers.

EDIT: Thank you so much for all the answers and suggestions. I appreciate everyone's effort for sharing knowledge.

答:
You have a few issues.  first do you want this project/code to be portable?  Portability costs you performance and size, can your platform of choice and task you are implementing tolerate the excess size and lower performance?

Yes, absolutely on an 8 bit machine returning unsigned chars instead of unsigned ints or shorts, is one way to improve performance and size.  Likewise on a 16 bit machine use unsigned shorts and a 32 bit machine unsigned ints.  You can quite easily see though that if you for example just used unsigned ints everywhere for portability across the system that are taking over (ARM for example pushing its way down into the lowest power, smallest device markets) that code is a huge rom hog on an 8 bit micro.  You could of course just use unsigned without int or short or char and let the compiler pick the optimal size.

Not just inline assembly, but assembly language in general. Inline assembly is very non-portable and harder to write well than just calling an asm function.  yes you burn the call setup and return but at a cost of easier development, better maintenance, and control.  The rule still applies, only write it in asm if you really need to, have you done the work to conclude that the compiler output is your problem in this area and how much of a performance gain you can get by doing it by hand.  Then back to portability and maintenance, as soon as you start to mix C and asm, and every time you mix C and asm you might harm your portability, and might make the project less maintainable depending on who else is working on it or if this is a product you are developing now and someone else has to maintain down the road.  Once you have done that analysis you automatically know whether or not you have to go inline or go with straight assembly.  I have 25+ years in the field, write C and asm mixtures every day, live on/at the hardware/software layer and, well, never use inline asm.  It is rarely worth the effort, too compiler specific, I write compiler non-specific code wherever possible (almost everywhere).

The key to your whole question is to disassemble your C code.  Learn what the compiler does with your code, and with time, if you so desire, you can learn to manipulate the compiler into generating the code you want without having to resort to asm as much.  With more time you can learn to manipulate the compiler to produce efficient code across multiple targets making the code more portable without having to resort to asm.  You should have no problem seeing why the unsigned char works better as a status return from a function than an unsigned in on an 8-bit micro, likewise the unsigned char gets to be more costly on 16 and 32 bit systems (some architectures help you out, some dont).  The llvm compiler system makes this education happen faster as you can compile one program and then examine the backend output for several targets without having to have several different cross compilers (like you would with gcc).

Some 8 bit microcontrollers, all?, are very compiler unfriendly and no compiler produces good code.  There is not enough demand to create a compiler market for those devices to create a great compiler for those targets so the compilers that are there are there to attract more business, non-asm programmers, and not because the compiler is better than hand written asm.  arm and mips getting into this world are changing that model as you have targets that do have compilers that have had a lot of work done on them, compilers that produce pretty good code, etc.  For micros with processors like that you of course still have the case where you have to drop down to asm, but it is not as often, it is a lot easier to just tell the compiler what you want it to do than to not use it.  Note that  manipulating a compiler is not some ugly, unreadable code, in fact it is the opposite, nice clean, straightforward code, perhaps re-arranging a few items.  Controlling the size of your functions and number of parameters, that kind of thing make a huge difference in compiler output.  Avoid ghee-whiz features of the compiler or language, KISS, keep it simple stupid, often produces much better and faster code.


问:
Parallel computing and mobile computing
I have been working as software developer for past 4 years on a variety of software products (Financial ERP system, Online Web development, Trading software and now a Supply Chain mgmt software). Most of the work has been in Core Java. Lately, I do feel that I should start looking into specific technical "principles" and/or domain such as Parallel Computing and Mobile Computing and not be working for long just on a software solution for the sake of working as a software developer. In short, I want to give a direction to my existing skill set so that I know more than just the programming language. </p>

<p>Can anyone please guide me on how I should go about learning these domains? I am really interested in parallel computing, but I am not much aware of other such domains I can look into. </p>

答:
Mobile Development:

You'll want to wrap your head around android. A few years back java has been supported on almost all mobile phones but now that the market is dominated by "smartphones" things have changed. The three most important infrastructures are: IOs, Android and Windows Phone 7. Note that I've excluded Symbian for Nokia has already announced that it's going to stop active development by I think it was 2015. Windows Phone 7 has still not been established and struggles for its share of the market. IOs development is driven by Objective-C and Android Apps rely on Java. THe Android SDK will let you be productive in a language you already now and you'll probably won't have any problems to get going.

Parallel Development:

Of course Java supports parallel computing but Java's threading system is arguably not very comfortable. I would recommend Scala as it has builtin support for message driven multithreading via actors. Scala compiles to .class files and runs on the JVM. That means you can reuse your existing knowledge of Java libraries. Naturally there are many other choices and depending on what you want to do one of them might be more appropriate. I've recently tried google go and it's very innovative.

Title: Parallel computing and mobile computing


答:
If the team is in a crunch then something was done wrong.

Missing deadlines is a sign of poor planning and estimation. Acknowledge that the deadline will be missed and solve the issue. Sometimes you don't have control over the planning or estimation. Identify who does and ensure that they know this was done in error.

In a situation were the deadline cannot be moved you break out the highly caffeinated beverages and put a rush on it. Identify anything you can sacrifice and cut it out. Take what's left and implement it as fast as possible. This will cause issues such as instability, odd errors, inefficient coding practices, band-aid fixes, and all sorts of other horrors. It's not necessarily bad code, but it's is not ideal.

A 50%-good solution that people
  actually have solves more problems and
  survives longer than a 99% solution
  that nobody has because it’s in your
  lab where you’re endlessly polishing
  the damn thing. Shipping is a
  feature.

From Joel on Software The Duct Tape Programmer.

Not ideal code can be dealt with if it's dealt with. Code that hasn't been dealt with will pile up and in turn make additional changes harder, if not impossible. It can get to the point where the application is so inter-dependently taped together that additions can only be done by the most careful programmers at an exorbitant time cost. While shipping is a feature, so it maintainability.

Title: Do you write bad code when under pressure?

Body: When you are under pressure, the deadline is approaching, and a manager is breathing down your neck do you find yourself starting to write bad code? Do TDD and best practices slip by the wayside in order to get things done? What do you do in situations like that? What were your experiences?</p>


问:
How can I gauge a candidate's ability to learn in an interview?
We are hiring for a small development department within a medium sized company for which software is not the main line of business.  As such, we are attempting to recruit what we have labeled a Senior Programmer.  The goal is to find someone that can design, implement and maintain entire new and existing systems from the database through to the front-end.

Regardless of a candidates claim to experience (read: massively spun CVs), or the results of the technical test, what I really care about is their ability to learn and the speed at which they will pick up technologies or concepts they are not familiar with to fill any gaps they might have in their knowledge.

How can I go about getting an idea as to a candidates ability to (or speed of) learning?

答:
References, references, references.

You can't test for ability to learn in an interview, but it should be implied or explicit in a resume/CV.  A good hiring manager will always contact references, supplied or otherwise, to confirm the points that are important to them, and to offer an open-ended discussion opportunity.  If learning is important to you, request references that can speak about that.  And don't forget to ask yourself if the reference has a good reason to be able to answer.

Lastly, if you think a candidate and/or their references are lying, shred their resume, burn the shreds, put the ashes in a box, lock it with a strong chain, put an anchor on it, and heave it into the deepest body of water you can find.  Life is too short to have liars working for you, and anyone whose references are lying is tarred by association (and rightly so).


答:
Agile (and any iterative) method is even more helpful for product development companies as opposed to service industry.

In one of my first assignment in a product development start-up, we went with the management a very detailed (including fine print) scope and my boss threw out most of it and trimmed down the requirement to almost all bare basic; the product won't have any gizmo's not even bells and whistles.

After the conclusion the crux is need to experiment with the market, as he said

... look, we are not a services company. Many typical service
  contracts (he gave examples of companies) starts out with unnecessary
  stuff; later on when people realize gaps, it's essentially more
  money to the services company. In a product development, we cann't
  afford to waste resources like that.

he continued ...

... when you build a product, you really have to go out and experiment
  with the market to understand what is really needed, that's when you
  go and build this (extra) things on top of the core product.

So from the product development point of view any methodology that begins with focus on minimum and essential requirements first is most important. Agile fits in perfect.

Second, there is another key things that product development companies face far more fiercely, time to market.

While you are developing, invariably, you will realize that some competitor will pop-up, and you do tend to either try to minimize scope as much as possible to get to market fast, or you may learn that need of the market needs to adapt.

Agile is even more important for product development environment than services companies.

One Caveat:

May be one place where i can think of Agile being misfit is where there is quite a bit of research work involved. Even research based work requires planning for individual task; however, suddenly one realizes some huge problems or a fresh new idea arrives, and the planning goes for a toss. Probably here, any structured approach finds somewhat limitation. Any one has tried Agile in research oriented work?


答:
The term 'reporting' is a bit loose. Some people use it to reference the result of basic queries. If this is the case, then as Jeff O says 2 different databases is not good if you need to update both databases with each transaction.

If you mean serious reporting, your options are to:

1 - Use the non-express version (as suggested by Jeff O) or

2 - Use a Data Mart type of solution (with its own database) with Star Schema and ETL jobs to periodically refresh the 2nd database. This is not as trivial as some may think, also it is not easy to maintain specially with new applications where schema changes are possible. However, this is a common way to perform reporting. It provides very fast response for queries because of the the Star Schema and batch aggregations. If you have large data, you may consider a dedicated server for this solution.

I don't know how your schema looks like or what kind of reports you are after, or how much data is there, but strive for having 1 database whenever feasible its much less troublesome.

Title: Are there any advantages of using separate RDBMS for reports?

Body:
My production database is SQL Server 2008 R2 Express. It has limited features and I am testing it in a production environment. To better handle reporting queries in a highly concurrent environment, I want to use any open-source RDBMS with tables that will be acting as temporary tables to frequently fill recent records and delete them after use.

The only problem is that I need to keep two connections for each RDBMS, but I feel, Firebird or PostgreSQL can give me better performance of reports in a highly concurrent environment.

What are your suggestions? Is this approach used in any commercial scenario?


答:
If i am interpreting your words right

so that I know more than just the programming language

You want to move away from vertical (application/business specific) domain work because you feel it is not quite technical!

My first advice for you is -if you don't think it is not too late - apply for a post graduation in computer science from a repute institute.

Alternatively, if that sounds difficult or not possible, try to get yourself employed in companies whom you think are in the forefront of such technologies. You can find great companies in this area (or similar domain you may like).

While you may be searching for such an opportunity - you might begin to gain knowledge by actively participating a more appropriate Open source project that excites you. If you are an identified contributor, your chances of getting in above profiles/companies might just improve.

Title: Parallel computing and mobile computing

Body:
I have been working as software developer for past 4 years on a variety of software products (Financial ERP system, Online Web development, Trading software and now a Supply Chain mgmt software). Most of the work has been in Core Java. Lately, I do feel that I should start looking into specific technical "principles" and/or domain such as Parallel Computing and Mobile Computing and not be working for long just on a software solution for the sake of working as a software developer. In short, I want to give a direction to my existing skill set so that I know more than just the programming language. </p>

<p>Can anyone please guide me on how I should go about learning these domains? I am really interested in parallel computing, but I am not much aware of other such domains I can look into. </p>


问:
Does an unexperienced programmer need an IDE?
Reading this other question makes me wonder if I (as an absolute beginner PHP programmer) should stick with WAMP and Notepad++ or to switch to some IDE like Eclipse.

It's understandable that skilled developers will benefit from a big shiny IDE. But why should an absolute beginner use an IDE? Do the benefits outweigh the extra challenge of learning the IDE on top of learning to develop?

Update for clarification:

My goal is to get some basic programming experience. By choosing PHP and WAMP (and FogBugz and Kiln) I hope to avoid having to navigate the tricky / messy OS specifics and compiling etc. and just focus on basic functionality like an online user registration form.

I've got lots of theoretical understanding from university a decade ago but no practical experience. I want to remedy that with a hobby project that would be similar to a real-world sellable web app.

There are so many questions to ask. So many pitfalls I probably have to blunder into. This question is just one piece (my first!) of that puzzle.

答:
Depending on what kind of program you are trying to create, a IDE can make the whole process, especially building and deploying, much easier. This is especially the case when you are using relatively complex frameworks.

On the other hand, doing it all by hand greatly improves understanding what happens under the hood. For that reason, creating a few small programs "the hard way" is a good exercise for a noob.


答:
Should a n00b use an IDE?  This depends on what your goal is as a n00b.  Here are some possible immediate goals:

1) Just start learning some programming language/something about programming (lightweight introduction)

2) Become a master and understand how everything works (heavyweight introduction)

For 1), use an IDE.  Using a good IDE will make your life EASIER.  Not harder.  Learning how to use an IDE is rarely all that hard after you get it installed.  Then to compile and run your program, you'll just click a "run" button or something like that.  Debugging will also be easier...just click some debug button.

For 2), don't use an IDE (at first).  If you want to understand everything perfectly, then using a command line debugger and compiler will give you more insight into how everything works.  This will be harder and might be discouraging at first.

Title: Does an unexperienced programmer need an IDE?

Body:
Reading this other question makes me wonder if I (as an absolute beginner PHP programmer) should stick with WAMP and Notepad++ or to switch to some IDE like Eclipse.

It's understandable that skilled developers will benefit from a big shiny IDE. But why should an absolute beginner use an IDE? Do the benefits outweigh the extra challenge of learning the IDE on top of learning to develop?

Update for clarification:

My goal is to get some basic programming experience. By choosing PHP and WAMP (and FogBugz and Kiln) I hope to avoid having to navigate the tricky / messy OS specifics and compiling etc. and just focus on basic functionality like an online user registration form.

I've got lots of theoretical understanding from university a decade ago but no practical experience. I want to remedy that with a hobby project that would be similar to a real-world sellable web app.

There are so many questions to ask. So many pitfalls I probably have to blunder into. This question is just one piece (my first!) of that puzzle.


答:
WebStorm fits your requirements like no other. I'm an old timer IntelliJ user and believe me, those folks know how to make an IDE.

And they are offering a special pricing before February 1.


答:
the extra challenge of learning the IDE

You mean, the part where the IDE does most of the work for you?

Now, I've never used any PHP IDEs, but presuming that they function similarly to other kinds of IDE, they save you massive amounts of work. The work involved in learning the IDE will be trivial compared to the functionality that the IDE saves you from having to do yourself. Things like code completion and syntax highlighting are incredibly useful tools and completely irreplacable.

Everybody who codes professionally does it with the help of tools such as IDEs and for good reason.


答:
I think an inexperienced PHP developer would be a lot more productive with an IDE.

The question should be, should experienced PHP developers need an IDE?


问:
Are there open source alternatives to Bitbucket, Github, Kiln, and similar DVCS browsing and management tools?
I am aware of several tools/services that provide DVCS browsing and management such as Bitbucket, Github, Kiln, SCM-Manager and Rhodecode.

However, the use case I am considering is one such that:

Any source code must reside on an employers internal servers.

The solution must be open source.

It should provide a Bitbucket or Github like experience, including a project wiki, repository browsing and management, and social coding aspects such as code review.

The solution should have mercurial support (if not support for other DVCSs).

Of these, only SCM-Manager and RhodeCode come close as they can be installed on your own servers and are open source. However they do not have the Bitbucket or Github experience. There is no issue tracker or wiki and the UI, while functional, is not up to par with Github or Bitbucket.

I can get close with Trac or Redmine with their repository browsers but unfortunately they do not have any repository management capabilities.

Are there other open source tools out there that would provide a similar experience to Bitbucket, Github or Kiln?

答:
I would take a look at Fossil.  It is the system the developers of sqlite use, internally, apparently.  It also uses sqlite, which is a good solid technology... that is nice and portable - as well as simple and reliable.

It has a good, if austere user-interface (which i think behooves the nature of a productivity-oriented goal such as you describe).  ((Be sure to check out the "grey" theme.  It is way less "router-admin" than the default "theme", if you could call it that.))  I was drawn to it because of its roots as a CGI based system, cause I'm a sucker for CGI.  The results of that heritage are actually very interesting, as this system has a very unique, JSON-ONLY mode which has all sorts of interesting implementation-possibilities..

They mention it - but it's worth repeating that it has 0 dependencies.  No php, no mySQL, no python.  Nada.  It's its own binary executable - and it works on many platforms.  I wish more projects "thought" the same way.

I am not affiliated with them, so will simply quote their opening page extolations, which generally, I agree with.. also take a look at questions & criticisms..

Bug Tracking And Wiki - In addition to doing distributed version control like Git and Mercurial, Fossil also supports distributed bug tracking, distributed wiki, and a distributed blog mechanism all in a single integrated package.

Web Interface - Fossil has a built-in and easy-to-use web interface that simplifies project tracking and promotes situational awareness. Simply type "fossil ui" from within any check-out and Fossil automatically opens your web browser in a page that gives detailed graphical history and status information on that project.

Autosync - Fossil supports "autosync" mode which helps to keep projects moving forward by reducing the amount of needless forking and merging often associated with distributed projects.

Self-Contained - Fossil is a single stand-alone executable that contains everything needed to do configuration management. Installation is trivial: simply download a precompiled binary for Linux, Mac, or Windows and put it on your $PATH. Easy-to-compile source code is available for users on other platforms. Fossil sources are also mostly self-contained, requiring only the "zlib" library and the standard C library to build.

Simple Networking - Fossil uses plain old HTTP (with proxy support) for all network communications, meaning that it works fine from behind restrictive firewalls. The protocol is bandwidth efficient to the point that Fossil can be used comfortably over a dial-up internet connection.

CGI Enabled - No server is required to use fossil. But a server does make collaboration easier. Fossil supports three different yet simple server configurations. The most popular is a 2-line CGI script. This is the approach used by the self-hosting fossil repositories.

Robust & Reliable - Fossil stores content using an enduring file format in an SQLite database so that transactions are atomic even if interrupted by a power loss or system crash. Furthermore, automatic self-checks verify that all aspects of the repository are consistent prior to each commit. In over three years of operation, no work has ever been lost after having been committed to a Fossil repository.

Update: Instead of alluding to the interface, here's a quick shot of it…  As you can see, it's definitely simple..  But that also means a clean slate for customization..  Just a single stylesheet and a header/footer/body-type templating system.  Better to write a short story than rewrite someone else's book, IMO.


问:
Should a PHP beginner use a framework?

Possible Duplicate:

  When should I start learning a PHP Framework

I am an absolute beginner programmer. I've got lots of theoretical understanding from university a decade ago but no practical experience. I want to remedy that with a hobby project that would be similar to a real-world sellable web app. I've chosen PHP in order to avoid OS specifics, build process, etc.

Should I start out using a framework, or coding everything by hand? What would the benefits of using a framework be?

I have briefly looked at PHP Code Ignition and it does a good job of praising its own benefits. I am sure that is true for an experienced developer, but does it also apply to a beginner?

答: You need to buy a good book on web application programming and code and run the examples contained within. There is no better way of learning PHP.</p>

Title: Should a PHP beginner use a framework?


问:
Managers X Motivation
As a programmer what do you think that is the thing that your manager does that mostly decreases your motivation?

My manager insists in blocking web content (this week was msdn content and Microsoft domain sites) This is so stupid, make me think I am not a reliable professional or that I am stealing his internet. And not, it is not a small business. It is a huge enterprise where such dinossaurs should not exist anymore.

答:
I have a few questions about this problem:

Have you brought your concern to management?

Is one person abusing privileges to where others are having to pay their consequences?

According to a recent Gallup Poll, the question was asked "what followers want from leadership". They found 4 common themes:

Trust

Compassion

Stability

Hope

I find it interesting that none of these include empowerment. Self-Determination Theory claims that there are 3 key elements to foster intrinsic motivation, one being autonomy. Similar to McGregor's X Y Theory on management styles, empowering employees is key to productive and creative solutions. If trust is present in leadership (both ways) then empowerment should flow naturally.

Title: Managers X Motivation


答:
there are a few things that will help any programmer in any language no matter what the skill level:

syntax highlighting plus brace matching

syntax checking as you type (very handy to avoid the dozen errors all coming from a single forgotten ; or mismatched braces)

easy documentation browsing (however this does not need to be in the IDE itself),

the main libraries of any language will have online documentation that you can access in your browser,

but the internal documentation (from the project you are working on) will not be unless you explicitly make it available

auto format to the one true brace style and correct spacing (so you spend less time enforcing those rules) (again this can be done with an outside tool)

only 1 and 2 need to be in the IDE/editor


答:
As a rule of thumb I choose like this:

If it's a small application with not many files, stick with the command line.

If it's a large application with many files use an IDE, as you'll constantly be switching between files and can benefit from the quick browsing and overview features (especially object oriented languages).

Learn to use both when appropriate. Start off with the command line.


答:
I'd strongly suggest using (and learning from) a framework. Try to choose one that has a decent community behind it. When I was using PHP, I found that CodeIgniter and Yii were both fairly strong. The good thing about using a framework, in anyone's situation (whether yours or a seasoned vet), is that you can learn from people with more experience than you. If they don't have more experience, then you can gain insight into someone else's thinking and different methods of solving a specific task.

If you start writing your own framework, not only do you have to worry about running the risk of having incorrect solutions, but about teaching yourself (and buying into) incorrect or inefficient ways of doing things.

Of course, using someone else's framework, you could also learn someone else's mistakes and bad practices ;) Upside is, you won't have to worry about implementing the plumbing yourself.

Title: Should a PHP beginner use a framework?

Body:
Possible Duplicate:

  When should I start learning a PHP Framework

I am an absolute beginner programmer. I've got lots of theoretical understanding from university a decade ago but no practical experience. I want to remedy that with a hobby project that would be similar to a real-world sellable web app. I've chosen PHP in order to avoid OS specifics, build process, etc.

Should I start out using a framework, or coding everything by hand? What would the benefits of using a framework be?

I have briefly looked at PHP Code Ignition and it does a good job of praising its own benefits. I am sure that is true for an experienced developer, but does it also apply to a beginner?


答:
The other, un-asked question: does an experienced PHP programmer need an IDE?

An IDE helps you to automate the build process - but with PHP, there is no build process. Syntax highlighting is a very nice feature, but you don't need a full IDE for that, a lot of lightweight text editors provide highlighting.

I do my PHP work in NetBeans, but that's only because I'm used to NetBeans. I bet I could do it just as well in any number of text editors.


答:
I'd strongly recommend getting started with a framework, once you're comfortable with the basics. This means that you should probably work a few examples from a book first, and get a good grounding in object oriented practices and relational databases. Once you've hacked about a bit, move on to frameworks as soon as possible.

All frameworks I can think of in the PHP world are strongly object oriented, so provided you're comfortable with that, you should be in a good place to make a start. The advantage with using a framework is that you can learn best practices, which is especially important in the PHP ecosystem - as a PHP programmer myself I can tell you that there are a number of poor practices that are passed around on blogs etc, and it will pay to learn from the correct sources.

I'd suggest learning from a micro framework like Silex to begin with - this is placed somewhere between the middle of straight PHP and full blown frameworks like Symfony, and you'll be introduced to the MVC paradigm as well as great other constructs such as the use of ORMs and lambda functions.

And to answer the second part of your question, the main benefits are that:

the code is highly tested,

it introduces best practices,

most frameworks encourage test driven development, which helps you output reliable code, 4. many frameworks emphasise separation of concerns, making applications scalable and easier to debug,

most frameworks have drop in plugins or libraries for doing all sorts of wonderful things, which can really speed up development, and

many frameworks will generate code for you - you give them a database definition and they will generate all access code (CRUD)

Title: Should a PHP beginner use a framework?


问:
What is the "architecture" that provides functionality to application-level URI interfaces, like chrome:// and Firefox's about:config, etc?
According to Wikipedia,

about is an internal URI scheme (also known as a "URL scheme" or, erroneously, "protocol") in various web browsers to display certain built-in functions. It is not an officially registered scheme, and has no standard syntax.

my question is...  what "powers" these "interfaces"? there doesn't seem to be any kind of "application server" running - that would conventionally support such a front-end - were it to be running remotely.. i'm sure the reason for the dearth of information out there - is that these all break the psuedo-promise that anything "you do" in the browser - won't "effect" your system.  these interfaces clearly have access to system level resources and permissions, etc..  are they all simply custom, c-coded hooks to the internal code of the parent applications - or are they a more abstract, ui--layer?

i admit to little knowledge of plug-in authoring, but can this type of functionality be achieved via the typical plug-in API's, or are they too limited? i have spent some time in the webkit source code poking around - but it is so massive and convoluted that its hard to deduct much...

it would seem that however these vendors are implementing these features might be an appealing alternative to say, the various language-specific bridges that webkit implements on various platforms.  i personally find the bridges frustrating, which is probably what led me down this train of thought...

any insights appreciated.

答:
Firefox's about:config appears to be a UI for editing the prefs.js file.

There are three methods: pref(), user_pref(), and lock_pref() that can be used in JavaScript. Probably not from JavaScript in web pages, for obvious security reasons, but instead in XUL / .XPI packages.

At the first link above it says:

Distributors can add default preference files via .XPI packages.

and it gives sample install.js code.


答:
I'm a big fan of software craftsmanship - writing clean code as best I can, etc, but at times I've had to rush during moments where time is short and a deadline is approaching. I really try not do this as best I can, but sometimes you can't get away from it.

Some people will say "Well that's life, you gotta ship" but I really disagree with this attitude.

When writing hurried code, you may end up getting the software out of the door on time, but what happens when, during the next few days, you end up getting support calls relating to bugs in the software (these bugs living in the same piece of code you rushed to get finished). Or you get an angry client calling you asking why their reporting module is no longer working, even though you promised it would be fine on the day of release?

It's all very well saying "You gotta ship", but there is a difference between looking efficient and looking like a sloppy worker.


答:
If you are trying to learn PHP sufficiently on its own, a framework can actually make things more difficult.  Yes, a framework will get you use to using certain patterns, but as a beginner, it can be difficult to separate learning PHP from learning the particular framework.  </p>

<p>I would suggest learning PHP itself, even just on a trivial app, before diving right into a framework.  After having a solid feel for PHP, then it will be easier to choose a framework that makes since for you.  Without ever doing things the manual way, many of the benefits a framework provides may obfuscate what you are trying to accomplish.  </p>

Title: Should a PHP beginner use a framework?

Body:
If you are trying to learn PHP sufficiently on its own, a framework can actually make things more difficult.  Yes, a framework will get you use to using certain patterns, but as a beginner, it can be difficult to separate learning PHP from learning the particular framework.

I would suggest learning PHP itself, even just on a trivial app, before diving right into a framework.  After having a solid feel for PHP, then it will be easier to choose a framework that makes since for you.  Without ever doing things the manual way, many of the benefits a framework provides may obfuscate what you are trying to accomplish.


答:
Using an IDE will make life a lot easier.  PHP especially has a lot of inconsistent functions that autocomplete in IDEs can help a lot with.  Plus, having a debugger in your IDE is truly invaluable...

There is something nice about the simplicity of working with raw files in a text editor, but if you are looking to learn what its like to produce a real web application, the learning to use the features of an IDE will be a huge assistance in the long run.


答:
about: is really nothing more than an if statement somewhere in the browser code -- a special case that does whatever the browser programmers want it to do. There's nothing special about it.

Even though a browser's main task is to render web pages, it's still just an application that can do other things as well.

Title: What is the "architecture" that provides functionality to application-level URI interfaces, like chrome:// and Firefox's about:config, etc?

Body:
According to Wikipedia,

about is an internal URI scheme (also known as a "URL scheme" or, erroneously, "protocol") in various web browsers to display certain built-in functions. It is not an officially registered scheme, and has no standard syntax.

my question is...  what "powers" these "interfaces"? there doesn't seem to be any kind of "application server" running - that would conventionally support such a front-end - were it to be running remotely.. i'm sure the reason for the dearth of information out there - is that these all break the psuedo-promise that anything "you do" in the browser - won't "effect" your system.  these interfaces clearly have access to system level resources and permissions, etc..  are they all simply custom, c-coded hooks to the internal code of the parent applications - or are they a more abstract, ui--layer?

i admit to little knowledge of plug-in authoring, but can this type of functionality be achieved via the typical plug-in API's, or are they too limited? i have spent some time in the webkit source code poking around - but it is so massive and convoluted that its hard to deduct much...

it would seem that however these vendors are implementing these features might be an appealing alternative to say, the various language-specific bridges that webkit implements on various platforms.  i personally find the bridges frustrating, which is probably what led me down this train of thought...

any insights appreciated.