问:
How to convince a teammate, who sees oneself as senior, to learn SVN conceptual basics?
To start with some background, I took up a new developer position this summer and ended up being the newest member on the team, yet with most experience under the belt.

So far I have managed to push sanity initiatives through easily enough because of low adoption costs (in terms of time and effort). However things have leveled up a bit.

One of my teammates, although experienced, does not really understand SVN. Naturally, blank areas on his mental map depicting oceans of SVN cause him to adopt rather strange usage patterns.

For example, he had declared a policy of "1 SVN commit per day per developer" because otherwise "the server would soon run out of disk space". When I explained him that SVN commits are deltas, not full copies, he responded with doubt and even today I'm not entirely sure if he understands what it means.

We also had a heated argument about whether to include Eclipse .project configuration in SVN. My teammate insisted we should, although it has caused numerous pointless conflicts. I was against keeping individual developer configuration files in SVN. Finally, it turned out that my teammate had a practice of re-checkouting the entire source tree after every commit to just make sure "code committed into repository works". That was the reason he was so adamant in keeping the project configuration in SVN - so it would be easy to re-import the project. When I explained that commit synchronizes working copy to remote byte-by-byte which makes re-checkout unnecessary, my teammate responded with doubt again and eventually waved the whole issue off as insignificant.

In my opinion, our team wastes time by resolving SVN conflicts in project configuration files which contain only developer-specific settings that need not be shared to SCM at all. All this mess because someone tailored the process around incorrect assumptions.

How can I convince a teammate, who sees oneself as senior, to get a better understanding of SVN basics?

答:
1. Let Subversion solve the problem for you. The way you tell it, your coworker is relatively unsophisticated when it comes to Subversion. In that case, a technical solution could be a good option. If the rest of the team agrees and you can get your manager's blessing, add a global-ignores field to the repository config file so that you can exclude the .project files and others that you don't want under version control.

2. Help him out. Instead of imposing your way of doing things on him, try to help the guy do things his way without causing problems for everyone else. If your coworker is working in his own branch, you really shouldn't care what he commits. If he wants to commit his .project file so that he can checkout a fresh copy of the whole directory, that's no problem for you. The only thing you should care about is that he doesn't merge his .project file back to the common development branch. That should be easy to manage, again, by setting the ignore property on the development branch to exclude the .project file.

3. Seek support from above. Don't get into a "you're not the boss of me" argument with the guy, but if his behavior is causing a problem for you then make sure that your manager is aware of the situation. If you're not sure how to approach your manager, try asking for advice: "Mike, I've been trying to talk to Larry, but I'm just not getting through. He insists on X, Y, and Z, and the rest of us spend a lot of unnecessary time working around the problems that creates. Can you give me any pointers on how to deal with the guy?"

4. Ignore him. Why does anyone on the team listen to this guy? Does he have any actual authority over the project? Who cares if he declares a one-commit-per-developer policy if he doesn't have the power to enforce it? Let him think he's Yertle the Turtle if it makes him feel better, just don't let him create real problems for you.


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

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

答:
Let's say we have a table of users which stores:

Id,

First name,

Last name,

Email,

Address,

City,

Phone, and

Mobile

And let's assume that our client needs the following information, at separate points:

User name,

User name and email,

User postal address, and

User phone number

We can obviously develop a set of functions (in the service layer) like:

getUserName(id), which would return first and last names,

getUserNameAndEmail(id), which would return first and last names, plus
email,

getUserPostalAddress(id) ..., and

getUserPhone(id) ...

or we could develop just one function:

getUserInformation(id), which would return all user information regardless of what is needed where.

There isn't any obvious technical reason to choose one method over the other as both have clear merits: The first way, we only transfer the data we need from server to client, but the second way we only build one function and reuse it every time we need any user information.

It's a question of data volume and bandwidth. If the client and the server are connected via the internet, and our data are large then we should probably choose the first method, as we don't want the customer to experience any unnecessary lag. But if the client and the server are on a local network, or any high speed network then the second method is probably the best way to go, as we gain some development time.

Of course our data may be extremely large, and the first method be preferred even on a local network, so to clearly understand why your development team chose their practices you must first understand the data you are dealing with. Finding (asking for) some concrete metrics would be a good first step. You will most probably discover that your fat data solve more problems than create.

ContentLicense: CC BY-SA 3.0


问:
Which GOF design patterns work well with TDD, and which do not?
The GOF Design Patterns book rarely mentions the test-ability of each pattern. I'm aware that there are patterns such as Singleton that would lead to code for which it is difficult to write unit tests, and some such as Strategy that help with TDD.

Which patterns promote TDD, and which hinder TDD?

答:
Any pattern that promotes a functional approach (i.e. you pass it some value(s), it returns a value, and doesn't cause side effects) is going to be straightforward to test.  Any pattern that causes side effects or persists state is going to be difficult to test, unless you can catch all of the side-effects and prove them.  That's why user interfaces are difficult to test; you need a human being to eyeball the screen to see the side effects.

Singleton is not easy to test because it persists state, i.e. any functions you perform on it are not idempotent (your results may change each time).  Databases are the same way; to unit test them properly, you have to wrap your tests in transactions so that you can roll them back after the test.

So go down the list of patterns, and evaluate each one on this basis.  For example, the Abstract Factory pattern is testable, because you can test which type it returns.  RAII should be testable because you can check the lifetime of an object by seeing if it is null.  Garbage collection is not necessarily testable in the same way, since you don't always know when the garbage collector will decide to do a collection.


问:
What exactly is distributed computing?
What exactly constitutes distributed computing, and how does it differ from parallelized / concurrent computing?

Does the use of mutexes and semaphores in multiple parallel threads trying to synchronize for access to a resource constitute a problem in the domain of distributed computing?

答:
Do multiple parallel threads trying to synchronize for access to a
  resource constitute a problem in the domain of distributed computing?

They do if those threads could be running on different machines, or even if they're running on the same machine but in different processes.

ContentLicense: CC BY-SA 4.0

Title: What exactly is distributed computing?


问:
Is developing games the best way to learn programming?
I heard recently an instructor mentinon that developing games was the best way to learn programming. Besides the fact that everything had to be created in code, he said you really get to fully experience and implement OOP into your programs. In other words everything you make in a game is a literal object both technically and in concept. Is it safe to make this assumption? Or are there always exceptions when learning programming?

note it was geared towards .net / xna / c# development.

答:
In my own experience, by writing a game (assuming you're doing this on your own/small team of developers), you're forced not only to think about the algorithmic/analytical part of programming but also the user experience and design.

In addition to that, if it's a reasonably complex game, you'll be working on this over a couple of months, and you'll realize the importance of documenting everything you do - which will later make you a better member of a team.


问:
What kind of metrics should I collect for a website/web app
I have a website that allows users to register for accounts, login, and renew an annual membership fee. They can also update their personal profile, their personal profile, look at a list of their employees, make bulk payments for their employees, view receipts and invoices, etc.

For non-members it's a regular website with a lot of pages, but for members, it has quite a few member only areas, with more to come (Such as forums). It also has a job listings page, course registrations, etc.

What are some useful "metrics" I can collect to give me meaningful information about the site, that I can share with my clients. I really don't know a lot about collecting data about this kind of thing, and would like to learn.

I already have a dashboard where the admins can view/export registrations this week and registrations by week for the past 30 weeks. I've been able to show them that registrations spiked after sending out an email about the new system.

I'm think I'll also be adding stats about how often users update their profiles and how many users have updated their profile that day/week.

Thanks

答:
What do your clients want to know?  Collect data on that.

That said, at a minimum I would collect (per web page):

Number of first-page views.

Number of pages viewed until abandonment (user leaves site).  This can be graphed to give an idea of how long people stay on the site.

Number of view per page.  Which pages are attracting more interest than others?

Stats will differ depending on whether it is a web app or web page.  Most sites are a combination of both; Amazon is a web page until you want to buy something, then it is a web app.

It wouldn't surprise me if it turned out that most websites have certain "hot spots," i.e. pages that are overwhelmingly viewed more than others.  Your clients want to know things like that, so they can attempt to reproduce the attraction effect for other pages/products.


答:
Robert has a good set of metrics for site use.

For performance metrics I collect (for all page):

number of visits to the page.

total time spend serving the page.

average time spent serving the page.

maximum time spent serving the page.

For application pages it can useful to record separate statistics for gets and posts.  This information can be extremely useful in finding bottlenecks and selecting pages to optimize.

Title: What kind of metrics should I collect for a website/web app

Body:
I have a website that allows users to register for accounts, login, and renew an annual membership fee. They can also update their personal profile, their personal profile, look at a list of their employees, make bulk payments for their employees, view receipts and invoices, etc.

For non-members it's a regular website with a lot of pages, but for members, it has quite a few member only areas, with more to come (Such as forums). It also has a job listings page, course registrations, etc.

What are some useful "metrics" I can collect to give me meaningful information about the site, that I can share with my clients. I really don't know a lot about collecting data about this kind of thing, and would like to learn.

I already have a dashboard where the admins can view/export registrations this week and registrations by week for the past 30 weeks. I've been able to show them that registrations spiked after sending out an email about the new system.

I'm think I'll also be adding stats about how often users update their profiles and how many users have updated their profile that day/week.

Thanks


答:
Strictly speaking "distributed computing" is any solution that involves processing a single transaction/request/calculation on more than one computer.

You will also come across the term "Distributed Systems" which is a catch all term for windows, unix and other small systems servers which would have originally deployed outside the central data center. Although its more normal for these systems to be deployed inside the data center these days the term has stuck.

Title: What exactly is distributed computing?

Body:
What exactly constitutes distributed computing, and how does it differ from parallelized / concurrent computing?

Does the use of mutexes and semaphores in multiple parallel threads trying to synchronize for access to a resource constitute a problem in the domain of distributed computing?


问:
What is the best book to prepare for a Java interview?

Possible Duplicate:

  How to prepare yourself for programming interview questions?

I found older questions but I was wondering if newer, better books/guides have been published in the last two years.

I am interviewing for a technology analyst position in finance and I expect to have a lot of technical questions based on running time/data structures etc. This is for an entry-level position so I have not had previous experience programming for work, only experience through my coursework.

答: This isn't specifically related to java, but "Cracking the Coding Interview" by Career Cup people might be a good option as far as the interview is concerned... :)</p>

OwnerDisplayName: flapjackery


问:
How to present asynchronous state change in chart or diagram?
I started to study about state transition chart. As I see, it assumes all state transition is done instantly with no time consuming. But in most of my case, I'm heavily depending on asynchronous I/O, so it seems to be less efficient modeling them with the chart.

How do you think about how to represent asynchronous state change? Please recommend something to me :)

答: As far as my knowledge goes for (UML) State diagrams it can't happen. If the state change isn't instantly there is obvious a in between state. In your example a state where your waiting for the IO to complete.</p>


答:
The word says it all. You have to do some computing operation and if you could distribute parts of this computing such that each computing works irrespective of the other computing and  then when all are done you combine the result of each computing to get the answer of main computing.
Example would be : Map-Reduce</p>

Title: What exactly is distributed computing?


问:
How do I convince some one that test should do assertion (not assertions) and not the helper methods
Joined a new employer and came across a new style of writing tests.

```<code>@Test()
public testMethodWhichDoesNotDoAnyAssertion() {
    LoginPage loginPage = signUpPage.doLogin("username","password");
    oneMoreCommonMethodCalledHere()
    anotherCommonMethodCalledHere()
}

public void doLogin(String userName, String password) {
     //login here
     Assert.assertTrue("Login Successful")
}

public void oneMoreCommonMethodCalledHere() {
     //Some more operations here.
     Assert.assertTrue("This also succeeded")
}

public void anotherCommonMethodCalledHere() {
     //Some more operations here.
     Assert.assertTrue("Even this succeeded!!! Your code is awesome!!!")
</code>```

So far I have been doing assertions in tests and not in the methods which are invoked from
test method. The problems I have with approach are multiple -

There are two many assertions happening in one method, though indirectly and it
defeats the idea of one responsibility per test

There are times when I want to do one assertion in my test method while testing for a work flow. And many of the helper methods which would be called would assert things and might even fail which
would hamper work flow test.

Now thing I have heard in favour of this approach -
It is easy for any one to just plug in helper method in a test while not worrying about
the assertions which should be carried out for a scenario, as helper method takes care of it.

Comments?

答:
The problem with that approach is that contrary to real "asserts" (I suppose we're talking Java here), the code is not removed by the compiler when compiling for a production release. It stays there. Sure, it's just an "if" that takes 0.0001 second to complete and performance will not be impacted much, but it seems to me that it pollutes the code.

I understand that your test case code is smaller, but what I always read everywhere is that test code should not be mixed up with business code. Moreover, your production code has most probably a dependency on a testing framework. However, your fellow colleague may perhaps start a new trend ? ;-)

Also, at first, I thought your colleague was using Spring Framework's Assert which is used to check your method parameters primarily. If he likes the "assert" keyword maybe you could convince him to use that instead, though it has nothing to do with testing :-)


答:
This would very subjective but below are some points to consider.

Data has a particular structure. In typical RDBMS this structure is relational.

A data structure should be chosen based on what sort of operations/procession that your application logic needs to do on the data.

If there is difference between the data structure the processing engine of your application and data structure that your persistence layer uses, then you will need some intermediate layer (service or whatever you want to call it) that will act as the data structure transformation layer. This layer should not do anything else other than this mapping between data structure.

In your particular case you need to ask the question, does the 2 data structures differs significantly, if yes, the you need that service layer, if not then you don't.

Title: What are the pros and cons of directly exposing a Table/View entity class to the client?

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

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


答:
Ask the question : "What is the responsibility of these helper methods?"
Is it that the helper method should do some operation and return some value indicating that the operation was success, or is it that the helper method does some operation and if it not successful the should out loud in a speaker (rather than whispering the result back to the caller) about the failure of the operation and hence making them dependent on the speaker to which they can shout.

Title: How do I convince some one that test should do assertion (not assertions) and not the helper methods

Body:
Joined a new employer and came across a new style of writing tests.

```<code>@Test()
public testMethodWhichDoesNotDoAnyAssertion() {
    LoginPage loginPage = signUpPage.doLogin("username","password");
    oneMoreCommonMethodCalledHere()
    anotherCommonMethodCalledHere()
}

public void doLogin(String userName, String password) {
     //login here
     Assert.assertTrue("Login Successful")
}

public void oneMoreCommonMethodCalledHere() {
     //Some more operations here.
     Assert.assertTrue("This also succeeded")
}

public void anotherCommonMethodCalledHere() {
     //Some more operations here.
     Assert.assertTrue("Even this succeeded!!! Your code is awesome!!!")
</code>```

So far I have been doing assertions in tests and not in the methods which are invoked from
test method. The problems I have with approach are multiple -

There are two many assertions happening in one method, though indirectly and it
defeats the idea of one responsibility per test

There are times when I want to do one assertion in my test method while testing for a work flow. And many of the helper methods which would be called would assert things and might even fail which
would hamper work flow test.

Now thing I have heard in favour of this approach -
It is easy for any one to just plug in helper method in a test while not worrying about
the assertions which should be carried out for a scenario, as helper method takes care of it.

Comments?


答:
Not sure if you intentionally used the term state chart. State diagrams are more known ( see discussion for comparison )

In the comparison there also is a nice overview of different ways of modelling parallel states in a state chart. I don't know of a real notation of asynchronous state transitions in a state chart but when you model the events and possible states the can happen in parallel you might also show the information that you want. Or you might combine the state chart and state transition diagram.

If you did mean state transition diagram here is a nice overview of different ways of modelling asynchronous state transitions in a state transition diagram

Hope this helps.

Title: How to present asynchronous state change in chart or diagram?

Body:
I started to study about state transition chart. As I see, it assumes all state transition is done instantly with no time consuming. But in most of my case, I'm heavily depending on asynchronous I/O, so it seems to be less efficient modeling them with the chart.

How do you think about how to represent asynchronous state change? Please recommend something to me :)


答:
Distributed computing is a computing system that has processing occurring on different computers (i.e. on a distributed system). The individual programs communicate with each other through a series of communication channels. These channels are usually network connections (TCP sockets, for example), but often use other communication protocols and devices (such as DeviceNET, BACNet, SECS-2, Modbus, etc.) or even protocols that are custom made for a specific device.

Distributed systems are usually much more complicated than systems that are designed to run on a single computer. In addition to concurrency and resource locking issues that multi-threaded applications need to contend with, distributed systems need to handle communication failures, and processing node failures. Transactions (and rollback) that require multiple processors to conduct can also be tricky.

Distributed systems take on many forms and are currently used in many applications. Web applications are distributed systems. An N-Tiered system usually has at least N different processors (with different applications). Distributed systems are also used in many factory automation systems as well.

The write-up on distributed computing in Wikipedia is worth a read.

In answer to you question about whether a multi-threaded application constitutes a distributed application -- if the threads are running on a single computer, the system is not distributed. It does have to solve some of the problems inherent in distributed systems, but not all of them.

Title: What exactly is distributed computing?


答:
Below I assume the helper methods you show are test helpers, not part of the production code (this is not clear from your post, as @Martin already noted).

There are two many assertions happening in one method, though indirectly and it defeats the idea of one responsibility per test

I personally don't take the "one assertion per test" rule (or might I call it dogma). I prefer to be pragmatic, and in my experience such a rule would hinder development. My rule is "one scenario per test" - and that single scenario may well require multiple assertions to verify the results.

However, I agree that having assertions intermixed with calls to the code under test is somewhat confusing. I prefer the Arrange-Act-Assert style as it makes my tests clearer - not only for others, but for the future myself too. Nevertheless, I do often put one or more assertions into dedicated helper methods - just in this case, those helper methods are meant only to assert results, not to act, and their name reflects this.

Now, at any rate, being the new guy in the team, you better understand and get used to the already established practices and conventions of the team, in order to become a useful team member (or start looking for a better workplace if you really really really feel you can't take this). After that, you can gradually start infusing your own ideas and thoughts, even criticism, into the thought process of the team. But trying to change team conventions up front, without proving your worth and gaining respect of your colleagues first, is going to be a futile and frustrating experience for you.

There are times when I want to do one assertion in my test method while testing for a work flow. And many of the helper methods which would be called would assert things and might even fail which would hamper work flow test.

Two notes:

Why do the assertions fail? My first instinct is that in a good test they shouldn't, and removing the failing assertions may actually hide a real problem.

What stops you from refactoring the helper methods? E.g.

```<code>public void doLoginWithoutAssert(String userName, String password) {
     //login here
}

public void doLogin(String userName, String password) {
     doLoginWithoutAssert(userName, password);
     AssertTrue("Login Successful");
}
</code>```

This way you can call the assertion-free helper while your colleagues keep calling their original helpers, and everyone's happy.

Body:
Below I assume the helper methods you show are test helpers, not part of the production code (this is not clear from your post, as @Martin already noted).

There are two many assertions happening in one method, though indirectly and it defeats the idea of one responsibility per test

I personally don't take the "one assertion per test" rule (or might I call it dogma). I prefer to be pragmatic, and in my experience such a rule would hinder development. My rule is "one scenario per test" - and that single scenario may well require multiple assertions to verify the results.

However, I agree that having assertions intermixed with calls to the code under test is somewhat confusing. I prefer the Arrange-Act-Assert style as it makes my tests clearer - not only for others, but for the future myself too. Nevertheless, I do often put one or more assertions into dedicated helper methods - just in this case, those helper methods are meant only to assert results, not to act, and their name reflects this.

Now, at any rate, being the new guy in the team, you better understand and get used to the already established practices and conventions of the team, in order to become a useful team member (or start looking for a better workplace if you really really really feel you can't take this). After that, you can gradually start infusing your own ideas and thoughts, even criticism, into the thought process of the team. But trying to change team conventions up front, without proving your worth and gaining respect of your colleagues first, is going to be a futile and frustrating experience for you.

There are times when I want to do one assertion in my test method while testing for a work flow. And many of the helper methods which would be called would assert things and might even fail which would hamper work flow test.

Two notes:

Why do the assertions fail? My first instinct is that in a good test they shouldn't, and removing the failing assertions may actually hide a real problem.

What stops you from refactoring the helper methods? E.g.

public void doLoginWithoutAssert(String userName, String password) {
     //login here
}

public void doLogin(String userName, String password) {
     doLoginWithoutAssert(userName, password);
     AssertTrue("Login Successful");
}

This way you can call the assertion-free helper while your colleagues keep calling their original helpers, and everyone's happy.


答:
Seems that the tests' assertions become a bit convoluted as the common methods are called several times during test, the assertions will be done several times at once. Usually you want  one assertion per test.

From a maintainability point of view I guess the test code is okay, though I personally prefer refactor tests so that common setup code (that are not in the @Before method) are extracted to their own methods. These extracted methods I usually prefix with when as method is named whenLoginIsPerformed(…) (terminology taken from the Mockito mocking framework). What you name it doesn't really matter if you want to go by the AAA as a mnemonic, you could prefix it with arrange such as method is named arrangeLoginIsPerformed(…).


问:
What responsibilities does a Management Information Systems job entail?
At my school there is apparently a Computer Science degree, which is located under the "department of natural sciences", while Management Information Systems is considered "business".

Besides the usual descriptions that can be found about both jobs, I was wondering how the job of MIS actually differs from say, that of a software engineer or programmer. Just curious, thanks

答:
From the single MIS class I took at UTD, it seems to be a general business degree with a focus exploiting computer systems to reduce tedium. we focused heavily on the supply chains and system inputs and outputs, talked about things such as processes from an extremely high-level overview, "learned what a database was for", and had a bunch of different documents (requisition request, product order form, etc) we had to memorize.

The emphasis was on automating real world processes using pre-existing systems

I assume (and the key word there is ass-u-me), that most people that get an MIS degree will go into management or finance, and work closely with managing data on a computer, and won't end up doing much system analysis / design / development.

I've since changed my major to Computer Science, and I'm getting a lot more training in systems design and development, rather than systems exploitation.


问:
Are 70% of programs/business applications/something based in COBOL?
I heard this number and a quick google search reveals a whole lot of touting this number and absolutely zero data (honestly most articles promoting COBOL read like 95% propoganda). Perhaps it's true in an extremely limited context of banking software or something, but with millions of applications coded in dozens of languages and near-zero new COBOL projects I don't see how this is possible.

Is this a myth from the 70s (when it would have seemed entirely plausible) or is there some limited definition where this is actually true? I know there is a great deal still being maintained and I'm sure a large % of businesses have at least one COBOL program around, but this invisible 70% seems absurd.

答:
The COBOL wiki page cites the Gartner quote, but there isn't a source from Gartner provided. It is all over the Net. 80% of businesses, 200 billion lines of code, 5 billion new lines of code each year. Some places, the numbers vary a bit. However, one number is almost always missing from that Gartner quote on the COBOL wiki page, and missing number is the year. 1997. Let's assume the quote was true, in 1997.

I have worked in COBOL for 20 years, and for the last 13 years I have witnessed COBOL development disappear.

ERP solutions? The last one I know of that had at least some COBOL in the product was PeopleSoft, when I talked to PeopleSoft reps at an IT conference in 2004. I was working for the UW at that time, and I talked to literally dozens of people, maybe upwards of 100, from universities all over the country. A very common story was repeated. "We replaced our homegrown ERP solution, written in COBOL, with " PeopleSoft, Oracle, SAP, SunGard. Delve into the careers links of those companies, and look at IT positions. See if there is any mention of COBOL, DB2, CICS, etc.

Healthcare? Well, I worked for GE Healthcare for 3 years, and they were among the last hospital clinical software vendors writing in COBOL. 3 big layoffs in 3+ years, an office that dwindled from 600 employees to under 300 employees, clients converting to Epic or Cerner. Not a very bright future for COBOL there. Neither Epic nor Cerner writes in COBOL. Check out their career pages. McKesson appears to still be written in COBOL, but I see a number of hospitals converting away from them as well.

State and federal government might end up the last bastion of COBOL, but some of those projects have gone away. Completely replaced with .NET or Java.

At 44, I'm one of the youngest COBOLers I know. Oh, there are 5 or 6 I know who are younger than me, but the 100 or more others I know are probably on average 10-15 years my senior.

IBM 390 and zSeries, HP NonStop, Unisys 2200, and Unisys MCP are the big iron boxes out there running COBOL. Every one of them supports Java development. From what I have read and know Java on big iron, which is mostly limited to the HP NonStop, if it is done right then Java can replace COBOL over time.

There have been efforts, that I know of or worked on, since 1994 to replace clunky mainframe green screens with GUI front ends written in VB, .NET or Java.

A lot of COBOLers I talk to who are certain of COBOL's future are out of work, like me, and aren't finding work. Best shot I have is a state gig where there are likely more than a couple of people within a few years of retirement. Assuming I get in, I expect over the next couple of years my role will evolve into how to clean, efficiently, and without interrupting the business administer a lethal injection, figuratively speaking, to COBOL through step by step replacement.

Finally, back to Gartner. They charge for everything they publish, and it ain't cheap. But venture over to Gartner.com, set up a free account, go to the Research tab, and search on the keyword COBOL. You won't get the whole article, but you will get a summary and a snippet. Reading and analyzing Gartner's work, I think it's very clear they are signalling the death of COBOL.


问:
Is there any circumstance in which a strict waterfall project can succeed when requirements are not clearly defined?
I can not see how a software project can make any meaningful progress under a waterfall methodology if the requirements cannot be clearly stated from the outset. Am I missing anything?</p>

答: Allow me to recommend that you read "Death March" by Ed Yourdon. Once you realize that you aren't the ONLY one working under less than ideal conditions, it really is helpful and motivating. That said, it also has not dissuaded me from asking uncomfortable questions--like why are we coding without clearly defined requirements?</p>


答:
What exactly constitutes distributed computing?

Distributed computing is an inherently parallel collection of processing elements that communicate with one another to tackle one or more problems. Those processing elements are sufficiently separated from each other that it is not practical to build a reliable and timely messaging fabric between them, and so it becomes impossible for there to be a global knowledge of the state of the system. Particular features of messaging with distributed systems are that messages will get lost, will get garbled, will get delayed — solutions in this space have to take account of this.  Thus, distributed programming is about dealing with networks and messages, parallelism and a lack of global information.

The easiest method of working around the problems is to make a single processing element be special, i.e., authoritative for a particular piece of information. Then the other elements can either refer back to it every time, or cache the information and hope that it doesn't go out of date (since they can't count on being told of changes). This is the classic client/server architecture.

Internet computing is distributed computing, but without the ability to control what most of the distributed nodes really do.

Do multiple parallel threads trying to synchronize for access to a resource constitute a problem in the domain of distributed computing?

They constitute a possible solution that is useful when building the client/server model, but at a cost of a potentially dramatic increase in resource contention. For reads, that's not a very big deal (providing there's enough hardware) but for writes it's a big problem indeed.

What you try to avoid though is distributed locks. The lack of reliable timely messaging absolutely slays distributed decision protocols, unless you use something like the Paxos protocol, but that's got a lot of caveats. The fundamental problem with distributed computing is that "bad stuff happens to messages". Relatively-low level protocols, like TCP, lessen the problems, but you can still come badly unstuck.

Title: What exactly is distributed computing?


问:
Would it be useful for a programmer to get qualified in Prince2
Even if the programmer wasn't going to perform the function of project manager, would there be any benefit on a small team of one of the devs being Prince2 qualified?</p>

答: The Prince2 qualification itself is only really of use to those who want to be professional project managers, but understanding the content of it and its meaning is quite reasonable for the more senior members of dev team. (It would probably help junior members too, but they're busy learning other important things too. Don't overload!)


答:
It depends on how good the coders are.

If the coders have a good understanding of the business they are working on and if they are clever enough to write the code in a loosely coupled way, then towards the end of the waterfall when the customers see the product they should :

a) not have too much to complain about

and

b) what they complain about can be easily altered and fixed

You have to be good to make it work though!

Title: Is there any circumstance in which a strict waterfall project can succeed when requirements are not clearly defined?

Body: I can not see how a software project can make any meaningful progress under a waterfall methodology if the requirements cannot be clearly stated from the outset. Am I missing anything?</p>


答: Yes. Managing dev projects is still project managment so the Prince skills will still be usefull. It dosent cover all aspects of software project managment so I recomend you pick up a book on agile after.</p>

Title: Would it be useful for a programmer to get qualified in Prince2

Body: Even if the programmer wasn't going to perform the function of project manager, would there be any benefit on a small team of one of the devs being Prince2 qualified?</p>


问:
Forgetting basic language functions due to use of IDE, over reliance?

Possible Duplicate:

  Should newbies use IDE autocomplete (Intellisense)?

  Is it wrong or bad to use autocomplete?

Having used an IDE for the last 3-4 years, the other day a few of my coworkers and I came to a fairly sad realization that we had forgotten some basic Java methods/functions because we always relied on our IDE (Eclipse/STS/IntelliJ) to complete them for us (such as what a function takes in terms of parameters), is this a sign that our skills are deteriorating, that we're over relying on IDEs? (This whole discussion came about us talking about taking the Oracle Java 7 EE certification test and looking over a few practice questions, questions such as, what parameters does function X take, etc)

If so, how do you guys fight off this sort of thing? Just re-read books and stuff? I myself can't imagine not coding with an IDE because in all honesty, it does make me code a lot faster with things such as auto complete, etc while some of my co-workers suggested we code sans IDE for a few months.

I do realize that sometimes one doesn't need to know everything about a function, but I do remember a college professor telling us that IDEs are terrible because when the time comes that you need some sort of function, you'll have to waste time looking it up instead of just banging out the code from rote memory.

答:
I've been COBOLing for 20 years, and using a PC text editor for the last 12 years while most everyone around me slogged along with clunky mainframe editors. Oh, there were a couple of other radicals who saw the value of syntax highlighting, macros, and other heathen practices. Always thought an IDE would make me more productive, but never really pursued it much.

About 4-5 years ago, I was part of a group tasked to research and recommend a text editor. We looked at options, and quickly all of us saw the merits in an IDE over a text editor. We only were able to come up with one solution that met the needs we laid out, and one could get into a semantic discussion over whether it was a true IDE or still just a text editor with extremely advanced macro capabilities giving it IDE-like functionality.

In terms of productivity, having been on the farm before going to Paris, I don't think there can be any question that IDEs are the way to go.


答:
MIS is taught in many universities. I advise you to look at the program description of the major institutions to see what possible careers are.

My personal opinion is that MIS may be a good study as an MBA specialization or a post-graduate degree rather than an undergraduate degree.

MIS graduates, as far as I know, are not intended to be programmers. So they either be part of management or analysis activities. Management and/or analysis require real-life and business specific expertise. This kind of expertise is usually absent from the graduate's background. As a result it is hard to find a position that the graduate would fit in without re-training.

I suggest you check with other students in that major, your advisory and friends as well as job boards to try to measure the real demand for this degree.

Title: What responsibilities does a Management Information Systems job entail?

Body:
At my school there is apparently a Computer Science degree, which is located under the "department of natural sciences", while Management Information Systems is considered "business".

Besides the usual descriptions that can be found about both jobs, I was wondering how the job of MIS actually differs from say, that of a software engineer or programmer. Just curious, thanks


答:
Speaking as someone who works as a developer, as is fully prince2 qualified, I have found it somewhat useful in assisting managing projects.

Prince2 is I would say, like the abstract class that other methodlogies such as agile/scrum/waterfall can implement.  That's not to say that Prince2 is better or was first, just that is more of a conceptual framework that can be implemented in different ways. I would say it does cover all areas of project management and it is applied to other domains than software.

It is especially useful if you are working in prince2 organisation, but if you are not and have no plans to its usefulness is somewhat restricted.

My employer paid for my course, if it was my money or if I could back I would think twice before doing it.  A scrum master qualification may be more useful ... as it is "hotter" and focussed on software development.


答:
We did have a course on "distributed systems" and while I don't remember the definition exactly, it was along the lines of:

can run on multiple separate nodes that communicate via messages (can't share memory)

objects can be migrated between nodes

objects keep their identity when migrated and can be addressed transparently when migrated

objects don't depend on the node that created them

the system can handle adding and removing nodes

(I believe there were some more and I am not certain about the last point)

Now in the course we did learn how to implement distributed transaction and distributed lock. The lesson is that distributed lock is basically implemented using distributed transaction, which is the other way around compared to what you do locally, and that it's inherently not fault tolerant, which rather defeats the purpose of having distributed system in the first place.

Edit: That definition is for "distributed system" in the narrow sense of operating system or database system and as opposed to merely client-server system. Anything satisfying the first condition may be called distributed in some contexts.

Coincidentally the definition matches the difference between distributed and traditional version control systems, all of which are at least client-server and often also replicated.

Title: What exactly is distributed computing?


问:
Is it Ok to change estimates in the middle of an iteration?
We have started using Agile/Scrum in a team of 4 developers. We did our story estimations and ordered the stories Primed stories in the product backlog.

We started with the point based estimation on the complexity from 1 to 5, instead of usual 1,2,3,5,8,13.... and so on

After working on a couple of the stories we felt that some of the stories that was estimated at 4 point should only be 2 while the other which were estimated at 2 are a lot more complex and should have been estimated as 5. I would like to know:

Is it Ok to change our story estimates in the middle of the iteration?

Is it Ok to use the current estimation points from 1 to 5, instead of usual 1,2,3,5,8,13.... and so on

Although I personally feel that it should be no for both the cases but I need to back myself up as my own understanding is not very clear.(Any good ref material would be good though!)

答:
Is it Ok to change our story estimates in the middle of the iteration?

Absolutely not. We expect that to happen. And we expect the errors to balance themselves out over time. We only really adjust estimates where it is clear that a certain category (e.g. new web pages) is always going to be more complex than we had thought when we estimated them all.

As an Epic story is broken down into smaller stories (which should happen long before the sprint), we might appear to adjust the original estimate, but I would call it refining rather than reestimating. That's because we have a clearer view at that time.

Mike Cohn's Agile Estimating and Planning is a good book on the subject. I would warn against using it (or any "Agile" book) as a bible, but it's a good start point from which to refine your process.

He talks about the way erroneous estimates balance out as "magic", but stresses that he has seen it work over and over and over.

Is it Ok to use the current estimation points from 1 to 5, instead of usual 1,2,3,5,8,13.... and so on

The use of the Fibonacci series of points estimation is an acceptance that the bigger a story is, the less accurate our estimate is (see my earlier comment about Epics).

But, if it doesn't work for you, particularly if you keep all your jobs small, then don't use it. It's a guideline, not a rule.

T-shirt sizing (S M L XL XXL) is also popular and that is essentially no different from (1 2 3 4 5).

OwnerDisplayName: tintin


问:
Why aren't more desktop apps written with Qt?
As far as I know and have understood in my experience with Qt, it's a very good and easy to learn library. It has a very well designed API and is cross-platform, and these are just two of the many features that make it attractive. I'm interested to know why more programmers don't use Qt. Is there a deficiency which speaks against it? Which feature makes other libraries better than Qt? Is the issue related to licensing?</p>

答:
The actual reason is not technical.

People happen to be different. So are their choices. Uniformity is not a human feature.


问:
What are the pros and cons of Coffeescript?
Of course one big pro is the amount of syntactic sugar leading to shorter code in a lot of cases. On http://jashkenas.github.com/coffee-script/ there are impressive examples. On the other hand I have doubts that these examples represent code of complex real world applications. In my code for instance I never add functions to bare objects but rather to their prototypes. Moreover the prototype feature is hidden from the user, suggesting classical OOP rather than idiomatic Javascript.

The array comprehension example would look in my code probably like this:

```<code>cubes = $.map(list, math.cube); // which is 8 characters less using jQuery...
</code>```

答:
pros

CoffeeScript has helped me learn more about JavaScript

is fairly easy to read, even for complex nested callbacks

provides safety around some of javascript's difficult to track down language issues

The above working example of Andrew I found to be enlightening. I believe readability of their existing object literal returns would be enhanced by simply manually identify the return

return

// object literal here

The IDE tools have been enhanced, TextMate and Cloud9 support CoffeeScript. Admittedly windows support has been lagging (isn't that true for web development in general though?)

cons

Browser interpreted CoffeeScript can be challenging to debug.

It's an additional layer on top of JavaScript requiring some understanding and consideration from developers.


答:
To answer your general question about what constitutes distributed computing, I would recommend the paper A Note on Distributed Computing by Ann Wollrath, Geoff Wyant, Jim Waldo and Samuel C. Kendall. It covers the recent history of distributed systems and its failures, and it proposes that distributed computing requires thinking differently about the problems involved.

Though neither mutexes nor semaphores are mentioned in the paper, it provides valuable insight into the proper engineering of a distributed software system.

As to why your interviewer asked about mutexes and semaphores, I would agree with @Caleb:

They do if those threads could be running on different machines, or even if they're
  running on the same machine but in different processes.

The only thing I would add is that mutexes and semaphores are low level locking primitives that allow you to distribute work across multiple computing devices, and their operation is (usually) vital to the success of the application. Obviously, it depends on the language and technology used. If you're using Erlang or Scala, you'll probably use Actor model-based concurrency rather than traditional, lock-based concurrency.

Title: What exactly is distributed computing?


问:
How to keep settings for C++ Unit Test modules in sync with the production code modules?

Note: I'm coming from a Windows / Visual-C++ background.

Note: I have already read Michael Feathers' Working Effectively with Legacy Code.

Note: Broad question, asking for narrow answers, i.e. while I don't want to narrow this question down to a specific compiler/platform/make system, useful answers will likely only contain one combination.

The C++ development model

Even ideally, you have your, well organized, source files:

Klass1.h/cpp

Klass2.h/cpp

CustomAlgorithms.h (header only)

main.cpp (may not be needed for a dyn/static lib module)

Then, your application consists of n modules (even if they are just static libraries all linked together to an executable module in the end.

To get from the source to the binary module(s), you need project files / make files / whatever. These files "tell" the compiler (and the linker) how to generate the binary modules from your sourcecode.

Adding in Unit Tests

Regardless of which Testing Framework you use and regardless of where you actually put your test code, you need to produce different/additional binary modules for your test code than for your production code. (At least for any executable or dynamic library, static libs should be a tad easier.)

If you need to produce different binary modules for your test code, then you need to maintain a separate/additional set of (compiler) settings for this test code.

With Visual Studio you can try to minimize the amount of work by using vsprops files, but you still are left with a separate project file for your tests and your production modules. This can become problematic to maintain.

With a make system, I'm not sure how this is done, but I explicitly want this question to encompass both, as techniques from one may translate into the other.

So, TL;DR, how do you prevent yourself from having to manually edit two different "project files" (one for test, one for production), every time you add or change something in the production settings.(*)

(*) You might think you don't change things that often, but think of a real world scale project with dozens (hundreds) of modules and dozens of developers. Each tiny amount of manual work you save for the test scaffolding will multiply.

答: Use CMake or another sane (meta-)build system which takes care of the build settings automatically, or allows you to share them across projects. </p>


答: Frameworks like Qt are appropriate when you're more concerned with your product looking the same on all platforms than with your product looking right on all platforms. More and more often these days, those kinds of applications are moving to web-based technologies.

Title: Why aren't more desktop apps written with Qt?

Body: As far as I know and have understood in my experience with Qt, it's a very good and easy to learn library. It has a very well designed API and is cross-platform, and these are just two of the many features that make it attractive. I'm interested to know why more programmers don't use Qt. Is there a deficiency which speaks against it? Which feature makes other libraries better than Qt? Is the issue related to licensing?</p>


问:
How can I get my startup working with Agile development?
In our startup, we've worked until now using the traditional waterfall model, but we want to try our next project using Agile Methodology.

We are pretty much alien to the entire Agile process, so considering this, what is the best way to understand Agile (resources and a practical handbook can be of help), decide on a specific methodology (Scrum, etc), and start it in our next project?

答:
I like the approach outlined in Jim Shores book.

He recommends that the organization spend one hour per day, for a week or two, learning the values  and practices of XP. He calls it études, and the idea is to read about an agile subject and then discuss it in pairs while being time boxed to a certain time answering certain questions (how is this new to us? what might be a problem with it? etc). Eventually people should begin to grokk it and be able to make an informed decision if agile seems like a good idea or not.

I've personally used this approach and it worked very well. I like that it introduces people to agile practices (time boxing, pairing, collaboration) which might might be just the kick-start your organization need.

OwnerDisplayName: andy


问:
How to test the tests?
We test our code to make it more correct (actually, less likely to be incorrect). However, the tests are also code -- they can also contain errors. And if your tests are buggy, they hardly make your code better.

I can think of three possible types of errors in tests:

Logical errors, when the programmer misunderstood the task at hand, and the tests do what he thought they should do, which is wrong;

Errors in the underlying testing framework (eg. a leaky mocking abstraction);

Bugs in the tests: the test is doing slightly different than what the programmer thinks it is.

Type (1) errors seem to be impossible to prevent (unless the programmer just... gets smarter). However, (2) and (3) may be tractable. How do you deal with these types of errors? Do you have any special strategies to avoid them? For example, do you write some special "empty" tests, that only check the test author's presuppositions? Also, how do you approach debugging a broken test case?

答:
The tests are already tested. Tests are by design protected from the bugs, because the testing only detects differences between code and our expectations. If there are problems we have an error. The error could be in the code or in tests.

There are some techniques that prevents you from adding the same bug in both your code and tests:

The client should be different person than the implementer.

First write the tests and then the code (like in Test Driven Development).

You don't need to test the underlying platform. The tests not only exercise the code written by you, but they run the code from the platform too. While you don't necessary want to catch bugs in the testing platform, is very hard to write code and tests that always hides a bug in the platform, in other words is very hard to have a systematic bug in both your tests/code and in the platform, and the probability is lowered with each test that you create. Even if you would try to do this you would have a very hard task.

You could have bugs in tests but usually they are caught easily because the tests are tested by the code developed. Between the code and the tests you have a self enforcement feedback. Both make prediction about how a specific call of an interface should behave. If the response is different you don't necessary have a bug in the code. You could have a bug in the test as well.

ContentLicense: CC BY-SA 2.5

Title: How to test the tests?


问:
Would I be in violation of these icons free license on my Android application?
Since there isn't yet a Q&A site for legal issues and since this is related to an Android app, I'm posting it here, instead of Stack Overflow cause this is not code related.

I want to separate this question into 3 sub-questions which are all related though. These questions are about the Free, Commercial and Extended licenses of DryIcons.

1) Generally speaking, would I be in violation of the free license if I used some icons in my paid version of an Android app? I'm a bit confused... The free license has the following in the "Grant of Rights" section:

b. You may use the Licensed Material in any personal or commercial
  project unlimited number of times according to the DryIcons Free
  License Terms and Conditions;

From this I take that yes, I can use their icons in my paid Android app. But then I read this in the commercial license under "Restrictions":

e. Licensee may not use Licensed Material in electronic items for
  resale, such as website templates, electronic devices (i.e. computer,
  iPhone, phones, etc.) software applications, document templates,
  wallpapers, screensavers, e-cards or similar products that Licensee
  intend to sell or distribute;

Which one assumes the extended license is the one we need for a paid app. But isn't this a little bit contradictory? Doesn't that point in the free license allows me to simply use their work in paid apps?

2) Now, let's assume I really need to buy a commercial/extended license to use their work on my paid/commercial Android app, something I'll be in fact selling to an unlimited number of users.

Would I fall under the commercial/extended or the free license if I used In-app Billing in my Android app? With In-app billing I wouldn't be selling their work at all. My app would be free with a bunch of features and I would be also using their work. But since my app is free I'm also free to use their work as long as I give proper credits with a link to their website as they state in the free license (no problem doing that, I'm all for it). Then, with In-app Billing I would actually be selling extra features to my app (by providing an upgrade to a "Pro" version), not their work.

Do you think I would be in violation of the free license like this?

3) And now a similar situation as the previous point. What if, instead of In-app Billing, I would have 2 apps. One completely free using their work as the free license allows me. And another which is nothing more than an "unlock app", something that would unlock extra features on the free app. The "unlock app" is the real paid app and this app does not use their work at all.

Do you think this is exactly the same situation as in the previous point and that I'm just playing with semantics? What's your opinion on that?

Do you think I would be in violation of the free license like this?

答:
IANAL, but ...

From what you say it appears the free license can be used as long as the project is not commercially distributed (e.g. website for your own business is allowed, but website for someone else's business is not allowed).

Regarding your third question, if their license says "project", they mean "project", not "application". So if you have two apps, one free and one paid, then those would both form a commercial project.

You should consider paying for the extended license anyway, regardless of whether you need it or not, just to show the appreciation for the icon set.


答:
Is it Ok to change our story estimates in the middle of the iteration?

Absolutely yes - if it will affect current or future spring planning. The point of agile is to base your actions on information that is as current and correct as possible.

If an estimate turns out to be so wrong that the current sprint can't be finished in its timebox, you need to act on the revised estimate, so you'll probably want to change it. If you base new estimates on old ones (and actually look at those rather than relying on memory/experience) you need them to be correct.

On the other hand, there isn't really any value per se in an estimate being correct. Don't waste time on prettying up some meaningless statistic.

Title: Is it Ok to change estimates in the middle of an iteration?

Body:
We have started using Agile/Scrum in a team of 4 developers. We did our story estimations and ordered the stories Primed stories in the product backlog.

We started with the point based estimation on the complexity from 1 to 5, instead of usual 1,2,3,5,8,13.... and so on

After working on a couple of the stories we felt that some of the stories that was estimated at 4 point should only be 2 while the other which were estimated at 2 are a lot more complex and should have been estimated as 5. I would like to know:

Is it Ok to change our story estimates in the middle of the iteration?

Is it Ok to use the current estimation points from 1 to 5, instead of usual 1,2,3,5,8,13.... and so on

Although I personally feel that it should be no for both the cases but I need to back myself up as my own understanding is not very clear.(Any good ref material would be good though!)


答:
The exact quote from free licence is that

You may use the Licensed Material in any personal or commercial project unlimited number of times according to the DryIcons Free License Terms and Conditions

so you look back to the section titled "Terms and Conditions" and it says:

You may use the Licensed Material in a publicly accessible web site, web application or any form of presentation publicly accessible through the World Wide Web [...]

so it does not apply to application you put on android market.

The commercial also explicitly states what it does apply to and software is not in that, so the commercial does not apply either.

The extended explicitly says:

Permitted Uses include the following:

Electronic devices (i.e. computer, iPhone, phones, etc.) software applications

so you need to obtain extended license.

Title: Would I be in violation of these icons free license on my Android application?

Body:
Since there isn't yet a Q&A site for legal issues and since this is related to an Android app, I'm posting it here, instead of Stack Overflow cause this is not code related.

I want to separate this question into 3 sub-questions which are all related though. These questions are about the Free, Commercial and Extended licenses of DryIcons.

1) Generally speaking, would I be in violation of the free license if I used some icons in my paid version of an Android app? I'm a bit confused... The free license has the following in the "Grant of Rights" section:

b. You may use the Licensed Material in any personal or commercial
  project unlimited number of times according to the DryIcons Free
  License Terms and Conditions;

From this I take that yes, I can use their icons in my paid Android app. But then I read this in the commercial license under "Restrictions":

e. Licensee may not use Licensed Material in electronic items for
  resale, such as website templates, electronic devices (i.e. computer,
  iPhone, phones, etc.) software applications, document templates,
  wallpapers, screensavers, e-cards or similar products that Licensee
  intend to sell or distribute;

Which one assumes the extended license is the one we need for a paid app. But isn't this a little bit contradictory? Doesn't that point in the free license allows me to simply use their work in paid apps?

2) Now, let's assume I really need to buy a commercial/extended license to use their work on my paid/commercial Android app, something I'll be in fact selling to an unlimited number of users.

Would I fall under the commercial/extended or the free license if I used In-app Billing in my Android app? With In-app billing I wouldn't be selling their work at all. My app would be free with a bunch of features and I would be also using their work. But since my app is free I'm also free to use their work as long as I give proper credits with a link to their website as they state in the free license (no problem doing that, I'm all for it). Then, with In-app Billing I would actually be selling extra features to my app (by providing an upgrade to a "Pro" version), not their work.

Do you think I would be in violation of the free license like this?

3) And now a similar situation as the previous point. What if, instead of In-app Billing, I would have 2 apps. One completely free using their work as the free license allows me. And another which is nothing more than an "unlock app", something that would unlock extra features on the free app. The "unlock app" is the real paid app and this app does not use their work at all.

Do you think this is exactly the same situation as in the previous point and that I'm just playing with semantics? What's your opinion on that?

Do you think I would be in violation of the free license like this?


答:
As a UNIX guy (primarily) the first thing I'd do is write a script to manage these things for me. Never do anything even slightly complex manually if you can easily script it.

The script could accept a file to add or remove from the project, and update all the relevant projects. The script could even accept a project name and infer its test project, if you're into using conventions.

The bottom line is this: if you know how to do it manually, and it's tedious -- script it.

Title: How to keep settings for C++ Unit Test modules in sync with the production code modules?

Body:
Note: I'm coming from a Windows / Visual-C++ background.

Note: I have already read Michael Feathers' Working Effectively with Legacy Code.

Note: Broad question, asking for narrow answers, i.e. while I don't want to narrow this question down to a specific compiler/platform/make system, useful answers will likely only contain one combination.

The C++ development model

Even ideally, you have your, well organized, source files:

Klass1.h/cpp

Klass2.h/cpp

CustomAlgorithms.h (header only)

main.cpp (may not be needed for a dyn/static lib module)

Then, your application consists of n modules (even if they are just static libraries all linked together to an executable module in the end.

To get from the source to the binary module(s), you need project files / make files / whatever. These files "tell" the compiler (and the linker) how to generate the binary modules from your sourcecode.

Adding in Unit Tests

Regardless of which Testing Framework you use and regardless of where you actually put your test code, you need to produce different/additional binary modules for your test code than for your production code. (At least for any executable or dynamic library, static libs should be a tad easier.)

If you need to produce different binary modules for your test code, then you need to maintain a separate/additional set of (compiler) settings for this test code.

With Visual Studio you can try to minimize the amount of work by using vsprops files, but you still are left with a separate project file for your tests and your production modules. This can become problematic to maintain.

With a make system, I'm not sure how this is done, but I explicitly want this question to encompass both, as techniques from one may translate into the other.

So, TL;DR, how do you prevent yourself from having to manually edit two different "project files" (one for test, one for production), every time you add or change something in the production settings.(*)

(*) You might think you don't change things that often, but think of a real world scale project with dozens (hundreds) of modules and dozens of developers. Each tiny amount of manual work you save for the test scaffolding will multiply.


答:
MIS typically means using database, reporting & business intelligence platforms as well as their specific business knowledge to analyze and answer questions about a business unit or function. Typically this is not much overlapped with software development or with quantitative analysis. Often MIS teams are part of finance or process design teams, or they  may be part of a specific product segment or function. They may develop business process scorecards, financial reports and they spend a lot of time doing ad-hoc reporting/research requests for managers.

They often need a range of skills; it is not unheard of to develop a new database and ETL jobs to populate it just to create a specific set of new reports, at least in the MIS teams I have worked with. This work provides a quick and dirty answer to the business, and then the development teams will get involved in incorporating this information into a more robust business intelligence or data provisioning system.


问:
What procedures or audits should be used to assess the security of a software system?
Are there any standardised security procedures or auditing techniques that can be used to assess the security of a piece of software?  I'm specifically interested in auditing software written in Java, but other tips for other languages as well as general practices would be useful to know about as. A list of frequent identified security vulnerabilities would be helpful, as well.

I'm looking for things that are specific to software engineering practices, rather than, for example system administrators.

答:
If you are looking for general software security information, I would recommend looking at the US Department of Homeland Security National Cyber Security Division's Build Security In website. Among other things, they provide a number of articles broken down by various best practices for different phases or activities, knowledge areas, and tools. They also provide a number of links to external resources that are relevant.

The MITRE Corporation provides the Common Weakness Enumeration. This is a tool to identify and discuss potential vunerabilities and tools to identify and correct these problems in your software. Coming out of this is a list of the Top 25 Most Dangerous Software Errors. Not all of these apply to every piece of software, but it can be used to analyze your software systems and determine the most riskiest for you.

CERT at the Software Engineering Institute at Carnegie-Mellon University provides resources for secure coding in Java, C, and C++. You can purchase books, or you can view some information online (Java, C, C++). CERT also enumerates 10, fairly straightforward, secure coding standards.

I would also recommend reading the work of Gary McGraw. He was (is?) the editor of a series of articles in IEEE Security & Privacy, which are provided through the Build Security In site. McGraw also wrote or co-wrote three books that are highly relevant - Building Secure Software: How to Avoid Security Problems the Right Way (the White Hat Book), Exploiting Software: How to Break Code (the Black Hat Book), and Software Security: Building Security In (the Ying-Yang Book).

As far as things that you can do now, realize that security is something that needs to be considered throughout the SDLC, from requirements through maintenance tasks. Keeping security in mind throughout the entire process is necessary. Although some of the resources I've linked to discuss general security concerns, it's important to identify the most likely and highest impact security issues for a project and focus on those. Once identified, the use of checklists during reviews, an emphasis on these characteristics during development, and the use of tools that integrate well into your process are essential. There's no one-size-fits-all technique - you need to balance time, cost, and effort to reduce risks.


问:
What should you test with unit tests?
I'm freshly out of college, and starting university somewhere next week. We've seen unit tests, but we kinda not used them much; and everyone talks about them, so I figured maybe I should do some.

The problem is, I don't know what to test. Should I test the common case? The edge case? How do I know that a function is adequately covered?

I always have the terrible feeling that while a test will prove that a function works for a certain case, it's utterly useless to prove that the function works, period.

答:
If you start following Test Driven Development practices, they will sort guide you through the process and knowing what to test will come naturally. Some places to start:

Tests come first

Never, ever write code before writing the tests. See Red-Green-Refactor-Repeat for an explanation.

Write regression tests

Whenever you encounter a bug, write a testcase, and make sure it fails. Unless you can reproduce a bug through a failing testcase, you haven't really found it.

Red-Green-Refactor-Repeat

Red: Start by writing a most basic test for the behavior that you are trying to implement. Think of this step as of writing some example code that uses the class or function that you are working on. Make sure it compiles/has no syntax errors and that it fails. This should be obvious: you haven't written any code, so it must fail, right? The important thing to learn here is that unless you see the test fail at least once, you can never be sure that if it passes, it does it because of something that you've done of because of some bogus reason.

Green: Write the most simple and stupid code that actually makes the test pass. Don't try to be smart. Even if you see that there's an obvious edge case but the test take in account, don't write code to handle it (but don't forget about the edge case: you'll need it later). The idea is that every piece of code yo write, every if, every try: ... except: ... should be justified by a test case. The code doesn't have to be elegant, fast or optimized. You just want the test to pass.

Refactor: Clean up your code, get the method names right. See if the test is still passing. Optimize. Run the test again.

Repeat: You remember the edge case that the test didn't cover, right? So, now it's its big moment. Write a testcase that covers that situation, watch it fail, write some code, see it pass, refactor.

Test your code

You are working on some specific piece of code, and this is exactly what you want to test. This means that you should not be testing library functions, the standard library or your compiler. Also, try to avoid testing the "world". This includes: calling external web APIs, some database intensive stuff, etc. Whenever you can try to mock it up (make an object that follows the same interface, but returns static, predefined data).

Title: What should you test with unit tests?


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

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

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

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

答:
I'd be very wary about requiring users to use their PayPal account. This would imply that you were going to be taking money from users at some point. This would put even more off.

The best solution is probably the simplest. Do what Stack Exchange does. Allow the user to sign up with OpenID (or even just e-mail and password) and then track the IP addresses the user logs in from and who the user gives reputation to and who they get it from. There are probably other things you can track such as the time of day they usually log in etc.

Then have tools for your site moderators (you'll need moderators) to show users that share IP addresses and have interacted with each other a little too much (for example). Depending on what you track you can show different data.

Obviously one drawback with the IP address is that it's not unique. People at the same workplace will share one as will people using the site from internet cafes or libraries.

Now on Stack Exchange where the post is more important that the person colleagues shouldn't be voting for each other more than they would for any random person on the site. However, if on your site the person is more important then the reverse could well be true.

What ever system you implement people will try to circumvent it, so this will be an ongoing process of changing sign-in rules etc.

OwnerDisplayName: Alek Storm

OwnerDisplayName: ChrisF


答:
I really like Qt, but it's a bit heavyweight for a lot of applications. Sometimes you just don't need that level of complexity. Sometimes you just need something simple without all the overhead of Qt. Not every application needs to be event driven and C++ provides a reasonable set of templates. Boost provides another very good set and includes a lot of the low-level functionality (file, socket, managed pointers, etc) that QT does.

Other applications have licensing requirements that don't play nice with GPL, LGPL or Qt's commercial license. The GPL is inappropriate for commercial software. The LGPL is inappropriate for statically linked software and the commercial license costs money - something that many are unwilling to pay.

Some have security or stability considerations that don't allow complex libraries like Qt.

You need to run moc to pre-process your sources. That's not a huge issue, but it can be daunting for the new user. A lot of programmers think you need to use qmake with Qt, but that's a misnomer. It is possible to plug Qt into other build systems pretty easily.

Some targets are very memory or CPU constrained.

There some platform-specific gotchas in it. Most of those gotchas are undocumented. Build a sufficiently large application and you will run into them and wonder what's going on (disclaimer, the last time I used Qt in anger was over 18 months ago, so it may have improved).

It's C++ only. Other language bindings exist, but they tend to hide or poorly expose a lot of the functionality that you'd want Qt for.

There's a lot of reasons to not use Qt, that's why there are alternatives. If all you have is a hammer then every problem will look like a nail.


答: The circumstance for success when answering the question of how long it will take to build something neither you nor the client understand is to say it will take way way longer than you think it will. Put in months, or years of slack if you have to.</p>


问:
Ramping Up On Legacy Code
When starting to work on a project with an existing code base, the first thing that needs to be done is usually to understand the application & existing code.  Let's assume that the existing code is legacy code; referring to Michael Feathers' definition of "code with no tests".

I am sure that there are many different ways to handle this ramp-up phase. The most straightforward way is to go through the UI of the application (if there is one) and simultaneously debug the application to understand what is happening at the code level. This is a very time-consuming approach and also it is very easy to forget what you learn in a debugging session. Furthermore, there is no real way to share (among the team) what you learn during debugging.

Understanding the down-sides of this approach, I have tried another approach for my most recent project. What I did was to write a kind of API layer that sits on top of the existing code base. This API contained the functionality of pretty much what a user would do in the UI.

To be more specific, let's assume that the existing application is a typical transactional application with orders, items and shopping carts. My API turned  out to something like this:

```<code>public class OrderAPI{
    public Order createOrder(customerName);
    public boolean deleteOrder(orderID);
    public List<Order> getOrdersForCustomer(customerName);
}

public class OrderItemAPI{
    public OrderItem createOrderItem(order);
    public boolean deleteOrder(orderID);
    public List<OrderItem> getItemInOrder(order);
}

public class ShoppingCartAPI {
    public ShoppingCart createCart(customer,order);
    public boolean addItemToCart(cart, item);
    public boolean removeItemFromCart(cart, item);
}
</code>```

The methods in the API correspond to the actions that the user would perform at the UI level. Within these methods, the calls to the existing codebase are made.

Writing this API by itself, of course, doesn't mean much. So, I have written tests (I guess they automatically become integration tests) to ensure that the API works well; proving that I got an understanding of how the legacy code works.

After all this introduction, comes my question: Can you define (possibly in software engineering terms) what I have done? When taking this approach, I have gone completely with my intuition. At some point, I remember being extremely confused; working on the API, then working on my tests, fixing my API, then my tests. I wasn't sure anymore if my main objective was to learn the existing code base or come up with a stable API layer.

I would greatly appreciate any kind of explanation; I am sure that this must be a practice that other people have already experimented with. I just need the right guidance to point me to the appropriate discussions/resources.

答:
I like the idea of writing unit tests to familiarize yourself with the code, but I'm not sure about the API layer. Was the legacy code too difficult to write tests against without the wrappers? Do you plan to develop something that uses this API (other than the tests)?

I would not generally advocate writing much code that you did not expect to run in production. The person coming after you may be even more confused by this. If this is just part of your test suite, I'd just make sure that is very clear from the folder/project structure.

Title: Ramping Up On Legacy Code


问:
How can I thoroughly evaluate a prospective employer?
We hear much about code smells, test smells, and even project smells, but I have heard no discussion about employer "smells" outside of the Joel Test.  After much frustration working for employers with a bouquet of unpleasant corporate-culture odors, I believe it's time for me to actively seek a more mature development environment.

I've started assembling a list of questions to help vet employers by identifying issues during a job interview, and am looking for additional ideas.   I suppose this list could easily be modified by an employer to vet an employee as well, but please answer from the interviewee's perspective.

I think it would be important to ask many of these questions of multiple people to find out if consistent answers are given.  For the most part, I tried to put the questions in each section in the order they could be asked.  An undesired answer to an early question will often make follow-ups moot.

Values

What constitutes "well-written" software?

What attributes does a good developer have?  Same question for manager.  Who are your most valued employees/managers, and why?

Process

Do you have a development process?

How rigorously do you follow it?

How do you decide how much process to apply to each project?

Describe a typical project lifecycle. Ask the following if they don't come up otherwise:

Waterfall/iterative: How much time is spent in upfront requirements gathering? upfront design?

Testing

Who develops tests (developers or separate test engineers?)

When are they developed?

When are the tests executed?

How long do they take to execute?

What makes a good test?

How do you know you've tested enough?

What percentage of code is tested?

Review

What is the review process like?

What percentage of code is reviewed?  Design?

How frequently can I expect to participate as code/design reviewer/reviewee?

What are the criteria applied to review and where do the criteria come from?

Improvement

What new tools and techniques have you evaluated or deployed in the past year?

What training courses have your employees been given in the past year?  What will I be doing for the first six months in your company (hinting at what kind of organized mentorship/training has been thought through, if any)

What changes to your development process have been made in the past year?

How do you improve and learn from your mistakes as an organization?  What was your organizations biggest mistake in the past year, and how was it addressed?

What feedback have you given to management lately?  Was it implemented? If not, why?

How does your company use "best practices?"  How do you seek them out from the outside or within, and how do you share them with each other?

Ethics

Tell me about an ethical problem you or your employees experienced recently and how was it resolved?

Do you use open-source software?  What open-source contributions have you made?

Follow-Ups

I liked what @jim-leonardo said on this Stack Overflow question:

Really a thing to ask yourself: "Does this person seem like they are trying to recruit me and make me interested?" I think this is one of the most important bits. If they seem to be taking the attitude that the only one being interviewed is you, then they probably will treat you poorly. Good interviewers understand they have to sell the position as much as the candidate needs to sell themselves.

@SethP added:

Glassdoor.com is a good web site for researching potential employers. It contains information about how specific companies conduct interviews...

答: I would always recommend trying to find out what a company is like before deciding whether to work there. There are places where you can find it – websites like http://www.whataretheyreallylike.com – where employees review their own employers. They can’t tell you everything, but they’re worth a shot, eh?</p>


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

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

答:
There are some possibilities. Two that come to mind are working with embedded systems or interfacing with hardware or some type of field support job.

If you work with embedded systems or software that relies on hardware systems, you might get the opportunity to work in a laboratory, perhaps alongside mechanical, electrical, and computer engineers. However, the time spent in the lab, if any, depends on the project and the organizational structure.

A field support job would probably be at a desk, but it would be working with customers to analyze requirements, troubleshoot deployments, and develop new functionality or patches in the field. It would probably be a desk job, but it might entail traveling or working in facilities other than your company's office.

The exact specifics depend, of course, on the company that you are working for and what they expect from a software engineer. Because of the nature of the work, it's probably difficult to find a job that doesn't have a large amount of time spent at a desk in front of a computer.


答:
You can't Prevent it, you have to provide incentives against it.

You problem is that your system has a built in incentive to create multiple accounts. Remove that incentive or give a better one for sticking with one account.

Title: How can I prevent users from creating multiple accounts on a web site?

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

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

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

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


答:
One way a lot of websites use is adding a SMS verification code to their signup process. It delegates the uniqueness problem to some mobile phones company.

It's still not bullet proof, it will diminish your user signup numbers a lot. But rare are those who have access to multiple mobile phone numbers. It may cost you some money if you're operating in an area where SMS have to be paid by the sender.

But couple this with some IP and behavior tracking and -as mentioned by other people- incentives to having only one account and you should be set.


答:
User reputation (assuming you have some upvote-feature like the Stack Exchange sites) will never be a truly accurate score. Even if you really make sure that no natural person can create two accounts by whatever means (I doubt that this will be possible), you still have these problems:

People can upvote their friends more often than other people (or gang together to downvote someone else).

If high reputation is really valuable for some people and sockpuppeting is a way to get it, people will sell (or lease) verified accounts for sockpuppeting.

So, don't rely on such a feature.


答:
IF you want a programming job, you are going to be on a desk (sitting, standing or walking) most of your time. There is no way around that.

But if what you are looking for is a programming-related job, there are alternatives, BUT you won't be the one actually programming.

EDIT:

I didn't want to list job names, cause they tend to change from company to company, but I'll list responsibilities:

Being in charge of getting requirements from your customers, where you need to be on site to learn the client's business.

Coordinating development teams, where you need to hop around and be available for solving problems all around.

Coordinating between the customer and the development team to build the right product for a particular client.

Basically several jobs related to software development, but that don't actually require coding, which was really the point I was trying to make.

Title: Are there any jobs in the programming field that don't require you to sit at a desk all day?

Body:
I'm new in the field of programming. I really enjoy it as a career, but I'm not sure I can handle sitting at a desk for eight hours a day. I don't mind it for short stretches of time of course, but I can't do it day in and day out.

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


答:
There are environments where you won't be sat at a desk all day. Many research or engineering environments will have you working both at your desk and in the laboratory or on the engineering floor.

For instance, where I work I have an ordinary desk where I do administration and intensive or off-line programming tasks, but I also have two experimental stations that I support. Whenever I need to test code on 'the machine' I have the option of using Remote Desktop Connection or going down and working in the experimental 'hutch'.

In my previous three jobs I similarly had a desk, but much of the work was done down in the workshop or on the shop floor, testing, optimising or coding on the machines we were developing. I've even been sent out to the US, Germany, Taiwan and China to support and develop software further on machines in the field after they have been delivered to customers.

Even in my first job after university, which was more desk-bound than anything since, I was sent out to customer sites to deploy software and help with troubleshooting.

Incidentally, while much of my career could be described as embedded systems, as Thomas Owens suggests, don't assume that embedded means microcontrollers, in-house designed circuit boards or hard core operating systems like QNX or OS-9.

Much of industry runs on PLCs as Wolfger suggests and industrial PCs running operating systems like Linux, Windows Embedded or even just plain old Windows. These systems integrate 'hard real-time' subsystems with 'soft real-time' control systems. Where the top-most layer can be the most complex and challenging, especially when trying to represent a complex machine with a simple, easy to use user-interface.


答:
Look into PLC programming. Typically lots of travel involved, and lots of standing/walking on a factory floor.

A Programmable Logic Controller, PLC or Programmable Controller is a digital computer used for automation of electromechanical processes, such as control of machinery on factory assembly lines, amusement rides, or light fixtures...


答:
Agree with Thomas Owens in so far as support positions involve plenty of moving about.  I used to work on Cisco routers.  Working with advanced routing systems is somewhat similar to programming in terms of complexity.  The setup process is pretty involved and can be quite complex. Especially if you go for advanced certification like CCDP.

Networking professionals often make a good income.  Several of my friends are in the industry and enjoy the work.


答: You could go into teaching programming. Most of your time would be at the front of the room lecturing. I am not sure how much actual programming would still be involved. Probably as much as you wanted, depending the style you choose to teach with. More hands-on demonstration rather than just lecturing in theory.</p>