问:
Manager keeps changing requirement specification after every demo

Background of my working environment

My manager has no background or understanding of computers or software whatsoever. It is highly likely he hasn't seen code in any form (not even from a physical distance of 10 feet or less) in his life.

There is no one who understands the complexity of what I am asked to implement. To the point that if I semi-hardcode no one would know.

On Joel's test we score an unbelievable score 0.

The problems

The manager and at times other "senior" keep changing the requirement specification. Changes which, if good engineering be done and not patchy "fixes", require change in the underlying design.

There is absolutely no one who looks at code (probably because no one knows how to, or even if it should be done) which means no one will ever be able to:

Appreciate the complexity of the problem or the elegance of the solution.

Suggest improvement to the approach.

Appreciate the quality of the code.

Point out where the code can be improved.

A lot of jargon is used which makes sense grammatically but fails to make any sense any other way.

Doesn't feel, behave or work like a software company.

The question

What should be done? Especially regarding there being no one who would point out improvements in my code.

Update

To answer HLGEM's (and possibly others) question about what I've done to try and fix it. I offered to set up Redmine and introduce source control to everyone. I said I would recommend distributed (git or mercurial) but will also talk about centralized ones and let the team decide. Response was that things are being done and will be done within weeks. Haven't seen that nor am I aware if other parts of the company use it.

答:
Talk to your manager and to the seniors about this. Explain your issues and suggest solutions. Prepare the talk a bit so you know the general message you want to convey.

After the talk, give it some time. See if things change or not. If they don't, try to implement changes yourself and show to the manager and seniors the positive results of your changes.

If the talk doesn't help and your changes are dismissed, you have to evaluate for yourself how much you like to work at that place. Yes, the work might be bad, but maybe the pay is good and you only have a commute of 5 minutes? Do the positive aspects of your job outweigh the negative? I they don't, I'd start looking for a new job.


问:
"It was working yesterday, I swear!" What can you do?
When you arrive in the morning, you find that your software does not work anymore, even though it did when you left yesterday evening.

What do you do? What do you check first? What do you do to stop being angry and start working on your problem? Do you blame your colleagues and go directly to them? What can be done to avoid being in such a situation?

答:
I have worked with code that appeared to change overnight and after a while I came to the conclusion this was due to malevolent pixies crawling into my codebase at night and changing things in such a way that in spite of the fact it worked yesterday, it now doesn't work at all. Indeed in classic Schroedinbug style, not only does it not work now, it is transparently clear that there is no way that it ever could have.

Over time I have realised that it's just possible that in fact pixies have nothing to do with it and that possibly my "time to go home, that will be good enough" last build doesn't get the detailed testing and attention that perhaps it deserves.

My first assumption when I encounter this in the morning is that it is probably my fault as I'm usually the one responsible for my own features or corners of software I'm working on. My second assumption is that I might as well get that coffee now. If it's not something blatantly obvious that a monkey could figure out ( which it sometimes is ) then the chances are good that I have managed to drag in an old version of a library, mistakenly rolled back a file that didn't need to be rolled back or have something cached somewhere that brought it into the build without checking it. Going through my recent Source Control activity tends to reveal things I have done, cleaning the build often removes errant cached versions.

Sometimes it really is nothing to do with me - someone updated a dependency without mentioning it, WindowsUpdate installed something that changed the environment so that my code didn't work; there are a lot of background possibilities, but usually it's a case of manning up and accepting that, like most people, I am basically an idiot.

ContentLicense: CC BY-SA 3.0


答:
If I were you, I would try to find another job. Why? I think you know that, unfortunately, your manager is, well, "not good". You should try to work some stuff out with your manager though.

If you do not want to leave, and/or you're not going to talk to anyone, then you're going to have to find something yourself. If nobody in the company knows about your code, how is your manager supposed to know you meet the requirements? Just saying.

Title: Manager keeps changing requirement specification after every demo

Body:
Background of my working environment

My manager has no background or understanding of computers or software whatsoever. It is highly likely he hasn't seen code in any form (not even from a physical distance of 10 feet or less) in his life.

There is no one who understands the complexity of what I am asked to implement. To the point that if I semi-hardcode no one would know.

On Joel's test we score an unbelievable score 0.

The problems

The manager and at times other "senior" keep changing the requirement specification. Changes which, if good engineering be done and not patchy "fixes", require change in the underlying design.

There is absolutely no one who looks at code (probably because no one knows how to, or even if it should be done) which means no one will ever be able to:

Appreciate the complexity of the problem or the elegance of the solution.

Suggest improvement to the approach.

Appreciate the quality of the code.

Point out where the code can be improved.

A lot of jargon is used which makes sense grammatically but fails to make any sense any other way.

Doesn't feel, behave or work like a software company.

The question

What should be done? Especially regarding there being no one who would point out improvements in my code.

Update

To answer HLGEM's (and possibly others) question about what I've done to try and fix it. I offered to set up Redmine and introduce source control to everyone. I said I would recommend distributed (git or mercurial) but will also talk about centralized ones and let the team decide. Response was that things are being done and will be done within weeks. Haven't seen that nor am I aware if other parts of the company use it.


答:
...keep changing the requirement specification. Changes which, if good engineering be done and not patchy "fixes", require change in the underlying design.

Sounds like the real world. This happens all the time, everywhere. Yes it sucks, but it's bearable with some sort of agile attitude. Besides, one measure of software goodness is its malleability. Take it as a challenge.

A lot of jargon is used which makes sense grammatically but fails to make any sense any other way.

Again, doesn't sound so unfamiliar ;-)

There is no one who understands the complexity of what I am asked to implement.

Not even you? If you do understand that, then there's one person in the mirror who does understand that. So your responsibility of your company's well-being is probably heavier than your formal title suggests. If you do understand the issues and your manager doesn't, then it's your responsibility to make things clear to the management so that they can properly direct the company. It might be reasonable to assume that your nearest managers should be technically competent (not necessarily as competent as you - while they're managers, you're the expert - but at least a tiny bit competent), but if they obviously aren't and you could help them, why don't you?

A simple escapist solution is to switch company. But as an another option, consider implementing Joel test's items. Although items from 5 on require more co-operation with the management, items 1-4 are such that you could just set them up without asking anyone.

That said, no one here at SE can know your exact situation. It's possible that you're in a company crowded by incompetent jerks, and making something good out of such a mess could be too much for anyone. You must assess the situation yourself.


问:
Best open source ASP.NET MVC e-commerce projects
I need to get a e-commerce site up and running, but I really don't want to program it from the bottom up if I don't need to. I want to program it using ASP.NET MVC.

I'm looking for a good open source alternative (or one for purchase if it's modular enough) that I can use as a base and enhance with the needed functions?

It has to have all "normal" e-commerce functions, and also the possibility to integrate with a credit card API of my choice.

If anyone have any recommendations for me here, I would appreciate it :)

答:
An other one you could give a go is Suteki Shop which is done with NHibernate.

Sutkei Shop on GitHub

an eCommerce application. The orginal aim is to write a site for a fashion retail business. It includes a product catalogue, shopping cart and order processing...

It's based on the following technologies:

.NET 4.0

ASP.NET MVC 3

MVC Contrib

NHibernate

Windsor IoC Container

Built using TDD with the following tools:

NUnit

Rhino Mocks...


答:
Well, here's a real life example of code that "worked yesterday" and not today... It is from earlier this month.

The application in question pulls information from a database by date, and the default behavior is to get data for the current day. This worked fine on August 8th, but failed on the 9th. It was not tested earlier than this. It would have also worked on 9th of September, and the 10th of October...

Another clue is that we are in the UK, the database in question was in the USA...

So, my answer to your question about what to check first is to double check how you format your dates, because if you mix up the day and the month fields it will work perfectly, but only on 1 day per month:-)

Title: "It was working yesterday, I swear!" What can you do?

Body:
When you arrive in the morning, you find that your software does not work anymore, even though it did when you left yesterday evening.

What do you do? What do you check first? What do you do to stop being angry and start working on your problem? Do you blame your colleagues and go directly to them? What can be done to avoid being in such a situation?


答:
The short version:

Run.

The somewhat longer version:

If the manager doesn't know how to run a project, and if the senior goes along with it, then you have next to no chance of fixing things.

In order to manage software projects, a manager does need to understand something about software. If managers don't, they need to learn first. What are your chances you could persuade your management and your senior(s) that they got it all wrong? What are the chances you will teach them something?

I have been in a similar situation once (only there was no senior). I quit after a terrible year, and never looked back (except in disgust).


答:
I think there are missing layers of responsibility in your team.
There should be a project manager, systems analyst, business analyst and developers.
The Project Manager role is responsible for defining and enforcing the customer-project communication strategy (among other tasks).

Managers are not required to understand code or complexities. The need to understand, resources, cost and risk.

Source code versions, code quality, complexity, etc. are either the PM responsibility or the Senior Developer's.

Solution is to:

1-Define the project team structure and their responsibilities

2-Educate the manager in cases of software failures caused to bad management - Stay away from technical details. You can find some examples by googling.


答:
You look in your mailbox after the mail sent by the Continuous Integration engine when the unit test(s) failed (or the log page if you didn't watch that specific problem), and see who did the check-in just before that build.

Then go talk to him or her.


问:
Over normalization in database
Currently I am working on creating a new database schema as part of a major new product.  Our previous customer address records (in a previous product)  look something like this in our current schema (not all columns shown):

```<code>AddressID, AddressLine1, AddressLine2, City, State. Zip, Country, Etc.
</code>```

I want to normalize this so that an address actually breaks down to:

1 address to many address lines

1 address to a zip/postal code

So I sent out a communication saying that zip code will now be in its own table and that each "address" corresponds to one zip/postal code.  In addition, addresses would be broken out so that we could support more than 2 address lines with a 1 to many relationship.

Some people in my group are now saying that I am over-normalizing the database.  Am I?

Note, I am not a DBA but I feel that this is more logical and more efficient than the previous schema.

Update

Thx to everyone for their input.  I'm not going to break out the address or zips to their own tables.  My original plan was to have a zip code lookup and re-use for the addresses so I would only have to have one set of zips, but I'll just drop everything on the record itself, and have a separate table for zip lookups.

答:
Jeez.

At the relational level, there's no such thing a "over normalization" or "under normalization". Instead, there are formal specifications for first normal form, second normal form, and so on.

Mailing labels have lines. Addresses don't.

On the one hand, factoring ZIP codes into their own table doesn't necessarily improve data integrity. It might limit users to choosing an existing ZIP code, but it might also allow users to associate an Alabama ZIP code with San Francisco, Calif.  On the other hand, a foreign key reference to a table of {city, state, ZIP} probably will improve data integrity in a table of US addresses.

Repeated data in a column doesn't violate any normal form. To be more specific, a table of addresses that has 3 million rows might have 400 addresses in ZIP code '90210'. Having 400 addresses that share the same ZIP code doesn't violate any normal form.

Substituting an ID number for a ZIP code doesn't change the normal form, and it doesn't improve data integrity. Ditto for cities and states.

Using ID numbers as surrogate keys requires joins. Setting a foreign key reference to a table of {city, state, zip} doesn't require a join. Queries are exactly the same after setting the foreign key reference; they don't need to change at all.

Each country has their own governing body that makes rules for addressing. Different governing bodies, different rules. Different rules, different constraints. Different contstraints, different domains. Different domains, different tables.

ContentLicense: CC BY-SA 4.0

Title: Over normalization in database


答:
Your problem is that ticketing systems and version control are TECHNICAL matters and you should be doing this regardless of the input of a non-technical manager.  This should be assumed as a best practice technically and if they don't have this set up then you should take it upon yourself to make this happen.

You can't expect a non-technical manager to understand the benefits of defect tracking, source control and continuous integration.  This is why they are non-technical, they are not supposed to know or care about that, they are domain and business knowledge experts.  The only thing they should be providing is high level direction and requirements.

I have a non-technical manager as well and was able to increase the Joel Test score from a 4 to an 8 just because I went and did them and didn't ask for permission.

Your group needs a strong technical leader and nobody has stepped up to the plate.

Check out http://community.rallydev.com/ they have a community edition that does an excellent job of Agile project management and Defect tracking.  That alone will bump up your Joel score and will cost you NO server space or time at all to set up.


问:
How do I handle refactoring that takes longer than one sprint?
I work with a code base that is over 500K lines of code. It is in serious need of refactoring. There have been refactoring efforts identified that will take longer than the normal two week sprint. These can't be broken up into smaller tasks as I have seen suggested in other answers on this site. The product needs to work at the end of the iteration, and partial refactoring will leave the system in an unusable state as the dependency between items is horrible. So what would be the best way to approach this hurdle? Again I mention, breaking it down into smaller pieces is is not an option, that has already been done.

Update:
People seem to need an explanation of why this can't be fit into a 2 week sprint. There is more involved in a sprint than just writing code. We have a policy of no code without tests. That policy did not always exist and a large portion of the codebase does not have them. Also some of our integration tests are still manual tests. The issue is not that the refactoring itself is so large. It is with the fact that small changes have an effect on many parts of the system, and we need to ensure that those parts still operate correctly.

We can't put off or extend a sprint because we have monthly hotfixes. So this change extending past a sprint cannot stop the other work being added to the hotfix.

Refactoring vs Redesign:
Just because our development process is not efficent enough to handle this refactoring in a two week cycle does not warrant renaming it to a redesign. I would like to believe that in the future we could accomplish the exact same task within a two week cycle as our process improves. The code in question here has not had to change in a very long time, and is quite stable. Now, as the direction of the company is becoming more adaptable to change, we want this portion of the code base to be as adaptable as the rest. Which requires refactoring it. Based on the answers here, it is becoming apparent that there is missing scaffolding necessary to make this refactoring work in the time frame of normal sprints.

Answer:

I am going to do the branch and merge approach that Corbin March suggested the first time so we can learn more about these problem areas and how to identify the missing tests. I think moving forward, we should take the approach that Buhb suggested of identifying the areas that are missing tests and implement those first, then do the refactoring. It will allow us to keep to our normal two week sprint cycle, just like many here have been saying should always be the case for refactoring.

答:
One suggestion that may help:  If you have untested code such that you don't have sufficient time to refactor and retest it within the two week sprint, consider first making some other unrelated small change(s) to the code so that you can focus on writing tests for the first sprint or two.  Perhaps you can identify several untested clients of the code you want to refactor; pick one client and make some other changes of some use to the business that will force you to write tests for that client.  Once you're more familiar with the code, from working with it, and you have more tests, and you've possibly accomplished a few minor contributing refactorings, you will be in a much better position to accomplish the refactoring and the (now easier) testing both in one iteration.

Another approach is to make a copy of the offending code, refactor it, and then move clients one at a time to the new code.  This work can be broken up across iterations.

And don't give up:  Don't just accept that a large refactoring cannot be broken down into smaller steps.  The easiest/fastest/best approach might take longer than an iteration.  But that doesn't mean that there is no way to do iteration-sized chunks.


问:
Daily Scrum Meeting (Burndown chart)
Here is an example: early in the morning of the second day of the Sprint (during the stand up) I go to the board and see that the story I worked the previous day (first day of Sprint) contains a big "1 IDEAL DAY" written on it (estimate). Right now (early in the second day of Sprint) the story is not completed and I guesstimate it will take half a "REAL DAY" to complete it.

Question: so to track progress and update the burndown right now, shouldn't I update that "1 IDEAL DAY" on the card with something else (recap.: original estimate in 1 ideal day, remaining work in 1/2 real day)? What would be that something else in this particular example?

答:
When I am talking personal finances with my wife as we go over the checking account I don't start respond to her questions with numbers in Ocatal or Hexadecimal format.  She started spouting figures in Decimal so I communicate Decimal back to her.

If you start your Scrum in IDEAL days then all discussions should revolve around IDEAL days.  Don't even talk REAL days, because nobody will ever really know how to relate to that in comparison to IDEAL days.

You THINK it will take you 1/2 REAL days to finish the story, but then about 10am your breakfast doesn't agree with you and you can't leave the bathroom for 6 hours.  Or some important client meeting comes up that you need to attend.  This is why you chose IDEAL days in the first place.

Title: Daily Scrum Meeting (Burndown chart)


答:
There are only two possible reasons why your code fails today, but worked yesterday.

Look at the data

There's something in the data you didn't test and or account for.  Either data isn't validated properly or an error in logic wasn't revealed until a logical condition you didn't anticipate occurs.  This means the bug was there yesterday, but it was hiding from you under valid data.

I once had some order entry code running fine for weeks.  I went home one day, and it died.    Investigation the next day revealed that I had a bug hidden in a chain of function calls.  In a weakly typed language, I declared an integer when I should have used a long int.  The language did the conversion between the two automatically until it couldn't because the number exceeded what would fit into an integer.  The system failed on order number 32768.

Look at What Changed

Look at what changed since it worked.  Did the IT section push out a OS update?  Did another coder modify code that your program uses?  Did the user's permission change?  Often, if you find what changed, you'll find the bug.


问:
What do you think of "Planning Poker"?
Planning Poker

Summary, in case you don't want to read the wiki article:

Get a list of tasks you want to do for the upcoming iteration

For each task:

2.1 Discuss with the group what it entails

2.2 Everyone writes down / selects an estimation of how much effort is required for the task

2.3 Everyone reveals their estimation

2.4 The highest and lowest outliers explain their reasoning

2.5 Repeat until a consensus is reached

Usually something similar to numbers from the Fibonacci sequence like 0, ½, 1, 2, 3, 5, 8, 13, 20, 40, 100 are the allowed values, so you don't get long arguments over close values like 23 vs 27.

Further, the numbers represent a unit-less value of effort, whose value is determined by a baseline task that everyone agrees equals about a 1, and all else is relative to that.

Ultimately, the goal is to get a good feel for a given team's "velocity", which is the number of these points that can be completed in a given iteration.  With that, it's possible to make reasonably accurate estimates of how long any given feature will take.

We did this at iteration planning meetings at one company I worked at, and I thought it was one of the few good things about that particular company.  So, what I'm wondering is, has anyone used this?  Do you think it's a useful tool for estimation?  Does it work in all situations, or does it lend itself to certain teams, projects, etc?

答:
There are many good answers here already -- I just wanted to point out one other feature.

When you use planning poker, you get an instant measure of how big disagreements are on size of work. If I think it's a 2, and you think it's a 3, we can just call it a 3 and move on. But if I think it's a 1 and you think it's a 5, we'd better discuss.

ContentLicense: CC BY-SA 2.5

Title: What do you think of "Planning Poker"?


答:
In addition to what maple_shaft suggested about consistency and always using the same units in your estimates and measurements, I would also suggest not revising estimates unless you are also preserving the original estimate along with the actual time-to-completion (store three data points for each estimate instead of two).

When you want to improve your ability to estimate, having that original estimate and your actual time is useful when you begin to ask questions about why your estimate was incorrect and how you can improve future estimates. If you don't know your initial estimate in the future, you can't compare actual time to estimated time.

Title: Daily Scrum Meeting (Burndown chart)

Body:
Here is an example: early in the morning of the second day of the Sprint (during the stand up) I go to the board and see that the story I worked the previous day (first day of Sprint) contains a big "1 IDEAL DAY" written on it (estimate). Right now (early in the second day of Sprint) the story is not completed and I guesstimate it will take half a "REAL DAY" to complete it.

Question: so to track progress and update the burndown right now, shouldn't I update that "1 IDEAL DAY" on the card with something else (recap.: original estimate in 1 ideal day, remaining work in 1/2 real day)? What would be that something else in this particular example?


问:
Which language and GUI toolkit would you use for a prototype program?
Suppose, I have an idea and I have to put it into code quickly. And then I am presenting it to someone who is not so computer savvy. Which language should I use for quick and dirty coding? And which GUI toolkit should I use so that the the computer semi-literate find it easy to use (read shiny-eye-candy). It is a desktop application.</p>

答:
Marco Dinacci's suggestion of using a tool to draw mockups is a good one.

However, if you do decide to implement a prototype, be sure to know if it's a throw-away prototype or an evolutionary prototype. If it's a throw-away, I would suggest using a language and toolkit that you won't be using to implement the final product. For example, if you are going to be implementing the final system in Java, string together some GUI screens using the Visual Studio GUI building tools and C# or VB.NET. This will prevent you from being able to use subpar prototype code in your final implementation. If it's evolutionary, spend the time to learn and develop the UI and evolve it with the entire application.


答:
That's what usually happens when I take holidays :-)

More seriously, I'd first tell them:

I will look into it to see what's wrong and what could be the root

I will touch base in 30-60 minutes once I had a chance to see what's happening

After that time, I can hazard an estimate of what might have happened and how long it will take the fix it if it's not already fixed and, if applicable, what data we may have lost (but I have good backups, so that never happens hopefully).

As for the blaming part:

if it's just a colleague typo, there is no need to mention it: shit happens and the fright from the bug most likely taught him a lesson and hopefully, he won't do it again.

if he intentionnally did something I told him not to (e.g. give the root password of the production server to the new guy and tell him to make a modification on it directly without supervision)(yes, that already happened...), then I have to mention it.


问:
How can my multinational transition from one development platform to another?
I am working in IT department of a big, international company. We are developing different Intranet applications for the business (Complaints, Rebates, Service Desk etc). Now we decided to migrate from PHP platform to .NET (integration with MS CRM Dynamics, Exchange and MS Office be among many reasons). As there are about 20 different applications the business is using on current, PHP platform, we will have to come up with the best way to move them all to the new platform. I don't want to go into details how to convert the code etc, as while we do migrate we want to improve all of these applications.

So we came up with 2 main ways of moving these apps:

Support just one platform. What would it mean? Create homepage and literally migrate all apps as they are to .NET (without improving them while we do that). After New intranet is running we would start rebuilding migrated applications and improving them. That would save us developing intranet in .NET while having to support PHP platform.

Support both platforms for some time. That would mean building just a homepage and 1 or 2 new applications (which do not exist on our PHP platform). Making these available to the users but not taking off the PHP platform (we would incorporate menus and links to make it easier for users to move between apps on PHP page and the new one). Then we would start rewriting the PHP applications while improving them.

Now I am not sure what would be better, on one hand (option 1) we will potentially make everything easier for users by not forcing them to use two different platforms at the same time. Although they won't see any improvement of having the new platform, apart from everything looking nicer, the functionality of applications on the new platform will be the same for some time. Also I think we would add ourselves (IT dep) more work as esentially we would write every app twice.

On the other hand in option two (2) users would have worse experience as two platforms look different, but they would realise the benefits of the new platform as new applications are beeing moved.

Has any of you came across something like that? What would you choose? Or maybe there is even different, better way to those I have presented? I would like to know what do you think and how would you approach that.

答:
Let's consider both scenario's:

Everything-at-once migration

While you are migrating your codebase your customers will keep using your existing apps. Since migration will take a non-trivial amount of time, this means you will need to have a maintenance team on the old codebase, for bugfixing and feature development. Every change you make in the old codebase needs to happen in the new codebase. You'll end up writing every line of code twice as long as the migration isn't done, making it more expensive the longer it takes to migrate. So, it all boils down to: what will the turnaround time for the full migration be? Your development costs will skyrocket for as long as the turnaround time lasts.

Piece-by-piece migration

In this scenario you'll have better control over double effort, but you're still going to have a lot of additional costs. Your deployment will involve two separate platforms, with twice the deployment issues and additional server resources required. Unless you have a very modularly organized app, you'll find that often a piece of code is present in the other platform than the one you need it on, causing additional porting and maintenance effort. As long as the migration isn't done, your development cost will be higher. At the same time, feature pressure will mean that it's going to take you a very long time to finish migrating.

Conclusion

From personal experience I can tell you two things:

Switching programming languages rarely pays off. From a cost-benefit analysis, it's very unlikely that it will be profitable to switch to .NET from PHP. So my main advice is: don't. Try to solve your problems with your existing codebase.

Piece-by-piece is the best approach, but you'll have a hard time doing it on the level of application modules. You'll find that you're going to have to develop and maintain features on both side of the architecture for as long as the migration isn't fully done. It can be a good idea to prioritize features not based on what customers need most but on what will limit the amount of double effort (thereby lowering cost).

OwnerDisplayName: Daniel Gruszczyk


问:
How can I practice implementing data structures and algorithms?
I just finished learning the basics on data structures and algorithms using Python and C, completing some of the exercises from the book I read. I feel that it is necessary to implement some of these data structures and algorithms to enhance my understanding about the material that I just learned, such as the red-black tree and priority queue.

Are there any good websites with material for me to use when practicing?

答:
Start with a search.

Search for the words "Code Kata"

Read those web sites for examples of things you can write that will require data structures and algorithms.

OwnerDisplayName: Alcott


问:
Should a developer accept a workload estimation done by a Excel macro?
In a new project, a friend had to write tests where the time required to write them was calculated by an Excel macro written by his non-developer manager.

In such circumstances, should a developer accept the responsibility to write and run the tests in the calculated time? Are the results of these test trustworthy?

For information, my friend refused to be responsible for estimations he didn't made, ask succeed to work on another project, and have been replaced by an inexperienced out-of-the-school yes-guy.

答:
It depends on how sensible they look to the developer, and what data/logic they are based on. (they might be based on statistical data collected over several years about how much time was required - by this developer himself, and/or by others - to solve similar tasks in the past... or they might be based entirely on his manager's - correct or incorrect - assumptions.)

Ideally, he should discuss with his manager that one can't be reasonably expected to commit to and take responsibility for a task estimated by someone else.

Plainly refusing to commit to the estimates may indeed result in his prompt replacement, so it is better to have a softer approach and avoid direct confrontation if possible.


答:
Presumably the macro is operating on some sort of input data, it's not just a random number generator? So, in order to answer your question we need to know what the input data is and what the macro does. Without this any answer is pretty meaningless.

Or, is your question really about accepting estimates produced by a manager who lacks relevant experience? In this case the answer is no, you (or your friend) should produce their own estimates and submit those to the manager. If the 2 figures do not match then they need to work together to figure out the best way forward - maybe agreeing to write fewer tests or maybe taking longer to write them all.

Point blank refusal isn't going to help anyone, and working to a timescale you can't meet is no fun either, the solution lies in taking a professional approach and coming to a compromise that allows work to proceed.

Title: Should a developer accept a workload estimation done by a Excel macro?

Body:
In a new project, a friend had to write tests where the time required to write them was calculated by an Excel macro written by his non-developer manager.

In such circumstances, should a developer accept the responsibility to write and run the tests in the calculated time? Are the results of these test trustworthy?

For information, my friend refused to be responsible for estimations he didn't made, ask succeed to work on another project, and have been replaced by an inexperienced out-of-the-school yes-guy.


答:
One of the most newest software development methodologies is agile, and one of the well-known agile frameworks is scrum. But in this methodology, developers (scrum team) is responsible for calculating the required time to do a task or implement a user story.

I definitely say NO. Because:

A non-developer manager can't estimate the required time for doing a job

Estimating the required time for doing any job needs some human intelligence, which Excel doesn't have

By accepting such working practices, manager progressively get used to replace developers in estimating times. This can result in catastrophe. Consider this scenario in which your manager says:

I want to start a new project for selling bicycles online and I know that it takes 3 weeks for you and John to accomplish it.


答:
Big bang approaches are rarely constructive as far as end-users are concerned. I'd advise against it and to be honest I can't believe anyone would seriously consider it as an option given the number of applications concerned.

I'd be inclined to go with option two and handle re-works on a case by case basis. Admittedly this may take longer than approach one on paper but in reality, you're opening up a significant amount of business risk by taking approach one and I really wouldn't like to be around for the support calls on day one if there is even just one little problem at the user end.

Additionally, if the overwhelming bulk of your web services based applications are already written in php, how is the available .Net expertise?

I think either way your users are going to have to experience change, either big bang (cue lots of support calls) or piecemeal (increasing familiarity). I'm inclined to think you haven't really sized out exactly how much work is going to have to be done to go from being near completely all php to completely .Net either.

Title: How can my multinational transition from one development platform to another?

Body:
I am working in IT department of a big, international company. We are developing different Intranet applications for the business (Complaints, Rebates, Service Desk etc). Now we decided to migrate from PHP platform to .NET (integration with MS CRM Dynamics, Exchange and MS Office be among many reasons). As there are about 20 different applications the business is using on current, PHP platform, we will have to come up with the best way to move them all to the new platform. I don't want to go into details how to convert the code etc, as while we do migrate we want to improve all of these applications.

So we came up with 2 main ways of moving these apps:

Support just one platform. What would it mean? Create homepage and literally migrate all apps as they are to .NET (without improving them while we do that). After New intranet is running we would start rebuilding migrated applications and improving them. That would save us developing intranet in .NET while having to support PHP platform.

Support both platforms for some time. That would mean building just a homepage and 1 or 2 new applications (which do not exist on our PHP platform). Making these available to the users but not taking off the PHP platform (we would incorporate menus and links to make it easier for users to move between apps on PHP page and the new one). Then we would start rewriting the PHP applications while improving them.

Now I am not sure what would be better, on one hand (option 1) we will potentially make everything easier for users by not forcing them to use two different platforms at the same time. Although they won't see any improvement of having the new platform, apart from everything looking nicer, the functionality of applications on the new platform will be the same for some time. Also I think we would add ourselves (IT dep) more work as esentially we would write every app twice.

On the other hand in option two (2) users would have worse experience as two platforms look different, but they would realise the benefits of the new platform as new applications are beeing moved.

Has any of you came across something like that? What would you choose? Or maybe there is even different, better way to those I have presented? I would like to know what do you think and how would you approach that.


问:
How to get better at testing your own code
I am a relatively new software developer, and one of the things I think I should improve is my ability to test my own code. Whenever I develop a new functionality, I find it really difficult to follow all the possible paths so I can find bugs. I tend to follow the path where everything works. I know this is a well known issue that programmers have, but we don't have testers at my current employer and my colleagues seem to be pretty good at this.

At my organization, we do neither test-driven development nor unit testing. It would help me a lot but it's not likely that this will change.

What do you guys think I could do in order to overcome this? What approach do you use when testing your own code?

答:
A tester and a programmer face the problem from different angles, but both roles should fully test functionality and find bugs. Where the roles differ is in focus. A classical tester sees the application from only the outside (i.e. black box). They are experts on the functional requirements of the app. A programmer is expected to be an expert on both the functional requirements and the code (but tends to focus more on the code).

(It depends on the organization whether programmers are explicitly expected to be an expert on requirements. Regardless, the implicit expectation is there -- if you design something wrong, you -- not the requirements person -- receive the blame.)

This dual expert role is taxing on the mind of the programmer and, excepting the most experienced, can decrease proficiency in requirements. I find that I must mentally shift gears to consider the users of the application. Here is what helps me:

Debugging; set breakpoints in the code and run the application. Once you hit a breakpoint, step through the lines as you interact with the application.

Automated testing; write code that tests your code. This only helps at tiers below the UI.

Get to know your testers; they may know the application better than you do, so learn from them. Ask them what the weaknesses of your application are, and what tactics they use to find bugs.

Get to know your users; learn to walk in your users' shoes. The functional requirements are the fingerprint of your users. There are often many things your users know about the application that may not come through clearly in the functional requirements. As you understand your users better -- the nature of their work in the real world and how your application is supposed to help them -- you'll understand better what the application is supposed to be.


答:
Binary chop

works especially well for difficult JavaScript errors. Basically comment half the code, see if you get the error, if you do it's in that half of the code. Half it again and carry on.

If your code is well encapsulated this is a fantastic, time saving, stress busting tool.

Once you've found the guilty code, it's often worthwhile isolating the error on it's own test page.


答:
Most definitely NO.

A small program, even a large, complicated program, cannot possibly estimate how long any programming job will take. See Mathematical Limits to Software Estimation for reasons why. A longer, peer-reviewed paper, Large Limits to Software Estimation is also available.

I would also reconsider my opinion of the manager in question: why does he or she believe that a spreadsheet macro hasn't been tried in the past, given that everything else has been tried to estimate software task duration in the past.


答:
If your usual bug tracing methods don't work and everything is a total mess, it can be wonderful to have a backup that you can restore easily.

This is what I run locally, automatically every hour from 8am to 6pm:

```<code>rdiff-backup /path/to/mystuff /path/to/mybackup
</code>```

Simple, eh ?

If you ever have to restore anything, use

```<code>rdiff-backup -r 24h /path/to/mybackup/specific/dir /tmp/restored
</code>```

rdiff-backup only stores files that differs.
You can use rdiff-backup on Linux, mac and win.

Of course, this shouldn't be your only backup.  But it's extremely easy and cheap way to have a local backup.

Now, I wouldn't recommend this as a normal bug fixing method, but if everything else fails, it's a fallback.

Body:
If your usual bug tracing methods don't work and everything is a total mess, it can be wonderful to have a backup that you can restore easily.

This is what I run locally, automatically every hour from 8am to 6pm:

rdiff-backup /path/to/mystuff /path/to/mybackup

Simple, eh ?

If you ever have to restore anything, use

rdiff-backup -r 24h /path/to/mybackup/specific/dir /tmp/restored

rdiff-backup only stores files that differs.
You can use rdiff-backup on Linux, mac and win.

Of course, this shouldn't be your only backup.  But it's extremely easy and cheap way to have a local backup.

Now, I wouldn't recommend this as a normal bug fixing method, but if everything else fails, it's a fallback.


答:
Absolutely NO.

I promise you that manager is not so deluded to think that his Excel macro can accurately predict estimations.  I am not even arguing what should be a well known fact that there are too many variables involved to accurately predict something like this in an algorithm.  If he invented such an algorithm he should patent it and make millions in my opinion.

What is really happening here is the manager is using this supposed Excel macro as a thinly veiled disguise to hide the fact that he is forcing unrealistic expectations and undue pressure on his developers.

He knows it is BS and doesn't care, it is an excuse to overbook resources and try to get things done faster by making all of his "worthless" developers perpetually "LATE".

This manager sounds like an exploitative jerk.


答:
Ugh!

This is a gigantic "job smell". That is incredible micro-management.

If they cannot trust their employees to give an estimate, what else don't they trust you with?


答:
I don't want to down-play writing tests, but the project has probably had several developers write them before. If estimates are based on these data, they may be more accurate than your friend has assumed. Since your friend left the project, made no attempt to create opposing estimates or see if they could be completed as predicted, we'll never know.

All he had to do was complete one or two tests to see how accurate the estimate was, and return to the manager with a legitimate arguement. There may be other team members who could have provided feedback on the reliability of the estimates or the consequences of falling behind. Sometimes one manager has to give 'something' to his boss to keep everyone happy. Developers see this as a false sense of security. Maybe if there was a movement for developers to provide estimates and show a willingness to get things done, management may develop more trust.

What I'm guessing is, if he were able to complete the tests in less time, he wouldn't say anything about it. Then again, excusing himself from a practice he does not believe in, may indicate a high-level of integrity.


答:
In a new project, a friend had to write tests where the time required to write them was calculated by an Excel macro written by his non-developer manager.

There are parametric estimation models for estimating completion time of projects, including software projects. Usually, the estimate is for production code, but I don't see why it can't be extrapolated to estimate how long it will take to write test code. These estimates are only as good as the data that is fed into them, though.

Assuming that the method used is a valid estimation model and the data is accurate and valid, there's no reason why a good estimate can't come from an Excel macro written by a non-developer manager.

In such circumstances, should a developer accept the responsibility to write and run the tests in the calculated time?

No estimate should ever be blindly accepted, under any circumstances. No estimate is ever perfect, regardless of how it is generated. It's up to the engineer to review any estimates, identify potential problems, assess their impact, and discuss and refine the estimate as needed.

Are the results of these test trustworthy?

Tests are only as good as the effort spent in designing and implementing them. If a tester produces low-quality tests, defects will slip through testing and make it to a later phase of the project. It stands to reason that schedule pressure will lead to low-quality tests, so if the time is insufficient to design the appropriate test cases and then implement those cases, then the tests would not be as useful.


问:
Web application development security best practices
I am looking for the current, state of the art, coding standards for web development (mostly PHP). Since I do not want to reinvent the wheel I would like to reuse libraries written by people much clever than I am.

I know about OWASP which is a wonderful source of best practices and brilliant information. Their web site is however quite unorganized when it comes to libraries.

On the one hand there is OWASP ESAPI with pointers to libraries.

On the other hand there is OWASP AntiSamy, which also has libraries. It in turn points to HTMLPurifier or the MS Anti-XSS library.

I did not find any links between these different solutions.

Is there currently a consensus on the most recommendable libraries to use in order to mitigate the major security risks?

Thank you

答: You will need to add static code analysis to your testing. Many Cross-site scripting (XSS) problems are very difficult for the human eye to pick out. Automated code analysis finds them easily.</p>


答:
Firstly, I agree with everything Joeri says.

Option one is truly horrible.  If you do this and don't continue support as Joeri describes, you shut down support for potentially a couple of years as far as your customer sees it.  After two years they get effectively the same site with all of the same issues they've grown to know & hate for the last few years.  Plus the risk that the market has changed in the interim and made the application obsolete & in need of a major revamp.  Also, if you do shut down support for two years what do you think is going to happen to all of the service requests?  They won't go away.  At least some of your users will "go rogue" and develop mission critical systems in (probably) Access to plug the gaps in the systems you are rewriting - then you still end up supporting two platforms...

Option two means that you will be supporting both technologies for an extended period of time.  This period of time will be longer than you think and you could end up with a permanently fragmented ecosystem - i.e. a significant amount of PHP code that is not economic to rewrite mixed with newer .NET code.

Push back hard against whoever is suggesting this.  It will be much cheaper to write code to integrate the PHP applications with the products you suggest than to rewrite everything in .NET then integrate the rewritten code with the products, don't forget, the integration will not magically happen if you use .NET.

One more thing, take the number of lines of PHP code and put it into a COCOMO 2 tool to get an idea of how long and how many developers you will need in order to complete the rewrite.


答:
You say in one of the comments that this is your first job. Managers often aren't technical anywhere except a dedicated software shop in my experience. This is part of life, just get used to that.

You cry and whine because there is no one to appreciate the elegance of your solutions. The real problem here isn't that there is no one to appreciate the elegance of your solutions, but that there is no one to teach you that your solutions aren't nearly as good as you think they are. Virtually all new programmers overestimate their actual skills. With no mentor, there is no one to help you to better practices. If there is no one there to mentor you, then join local user groups, actively participate, and get someone there to mentor you. Even better, that will help you find a better job eventually.

You score a zero on the Joel test? If you are the only coder (and it sounds from what you wrote that you are) they why aren't you using source control? What is preventing you? If you aren't the only coder, why is there no one who can do code reviews? All our devs do code review, it isn't a management function especially when the managers are non-technical.

Requirements change in pretty much all places. Business needs change continually and non-programmers often can't visualize what the program will do until they ee something. Then they realize it isn't what they need. That's why Agile came into being really because the older methods were not handling that change well.

Set up bug tracking even if the management doesn't want to enter the data themselves. Be responsible for entering new bug/features as someone mentions them to you. It really helps to be able to tell the manager when he wants a change that you have been assigned 27 other things and here is the list, which one do you want me to move down the priority list to accomodate this new change.  It will help at review time because you will be able to count up the number of bug fixes and features you implemented. If everyone isn't using it, then at least you can for your own work.  If they won't let you install any software then use an Excel spreadsheet. Take some initiative. Once you can show results, others will be more interested. If you think there is too much work for one person, the bug tracker will help you prove it.

Do not provde polished looking demos! Demos should look as if they are scribbled in pen on a piece of paper. The more polished the interface looks the more the non-technical person thinks it is finished.

Even though no one would know if you don't follow best practices and semi_hard code for instance, you will know and you will get into sloppy, bad habits. That will not serve you well in your next job. So do things as close to the right way that you possibly can under the circumstances. Make sure to write tests (just consider this as part of the development time and put the time to do it in any estimates you give managment even if you don't specifically say that is part of the estimate) and use those test to makes sure later changes don't break something else.

You need to view this as a priceless opportunity to grow and improve. You have more freedom in the actual coding than many people have at that stage of your career. So consider this an opportunity to create a portfolio of successful implemented projects. When you do go looking for that next job, being able to point out such accomplishments as institutited source control, instituted bug tracking, created X number of successful project implementations, etc, will make you stand out from the rest.

You also have a great opportunity here to learn how to manage expectations upward. This is askill that will come in handy the rest of your career. You have nothing to lose in trying to do this here, things are already not good. But you can learn the political skills that will help you in better places later. Learn to do a cost-benefit analysis. Learn to undersatnd the business domain so that you can be convincing when you talk to them. Learn to talk in terms of benfits to the company and profit. Do estimations for every task you are assigned and even if they don't match waht management is giving you, keep records of what you estimated and what it actually took to improve your own ability to estimate work. Once you can show that your estimates historically have been more accurate than managment's, they will be more likely to listen when you tell them the estimate is too low. But you have to build a track record first of both more acfcurate estimates and most importantly, ability to deliver the projects and make them work. Again this is a good skill to have as you move up in your career.

Above all don't be passive and expect improvement to come from above.


问:
What's the best way for me to get started using version control in an opensource project?
It was suggested that I take my project open source due to its size and my lack of skills, so I checked out Google Code, and started making a project and now it's asking me if I want the project to have Git, Mercurial, or Subversion code hosting.

I don't even know what code hosting is, and a search just confused me more with the debates between all these things, and this is made even worse as Google Code is asking me which type of license I want.

I think I'm not quite understanding what open source really means, can someone pretty much make a quick layman's cheat sheet on what all this is? Much appreciated.

Edit There have been a lot of great responses on these three versions of code hosting, but I think I failed to communicate the real question: Basically I've no idea how this open source stuff works, why would I host the code somewhere like this? And would that mean I have to take the site off of my current hosting, or is this an entirely different type of hosting? What happens when I make my site open source, what rights do I have, what rights do I give away. How does it work, do people just come and throw code at me for free? Perhaps these are stupid questions, and if that's the case then I guess I need stupid answers, I seriously have no idea what open source is, except for the concept of sharing code...

答:
Joel Spolsky's written a great tutorial about Hg (Mercurial) and I believe the introductory section covers Subversion, including the reasons why you're upgrading to Mercurial. Give that a read, it really helped me understand a lot about Mercurial and DVCS in general.

Oh, and when you're ready to host, you can use Google Code, BitBucket, Github (with the help of this excellent extension) or others.

OwnerDisplayName: Nathan

OwnerDisplayName: Jimmy Sawczuk


答:
Code hosting is exactly that - somewhere to host (or keep) your code.

Git, Mercurial and Subversion are all source control tools you use to manage your code history.  Git and Mercurial are distributed systems whereas Subversion is a more traditional server based setup.

Have a look on Wikipedia or some such and see which appeals to you most.  Personally we use Mercurial and it works very well for us.

Title: What's the best way for me to get started using version control in an opensource project?

Body:
It was suggested that I take my project open source due to its size and my lack of skills, so I checked out Google Code, and started making a project and now it's asking me if I want the project to have Git, Mercurial, or Subversion code hosting.

I don't even know what code hosting is, and a search just confused me more with the debates between all these things, and this is made even worse as Google Code is asking me which type of license I want.

I think I'm not quite understanding what open source really means, can someone pretty much make a quick layman's cheat sheet on what all this is? Much appreciated.

Edit There have been a lot of great responses on these three versions of code hosting, but I think I failed to communicate the real question: Basically I've no idea how this open source stuff works, why would I host the code somewhere like this? And would that mean I have to take the site off of my current hosting, or is this an entirely different type of hosting? What happens when I make my site open source, what rights do I have, what rights do I give away. How does it work, do people just come and throw code at me for free? Perhaps these are stupid questions, and if that's the case then I guess I need stupid answers, I seriously have no idea what open source is, except for the concept of sharing code...

OwnerDisplayName: Dave F


答:
Subversion would be the easiest option because it's a VCS. Git and Mercurial are DVCS systems. They're more modern and more powerful but trickier to understand. Using a front-end such as TortoiseSVN or TortoiseHG (for Mercurial aka HG) also really helps.

If your software is a stand-alone program you could use GPL or really open it up with a BSD license. If your project is a library that somebody else will link with use LGPL or again BSD; but don't use GPL.

[edit]

As for your original motivation for open sourcing the software: Unfortunately just making software open source doesn't mean you're going to get an influx of talented free labor. There are hundreds of thousands of open source projects. Only a small percentage of them have active contributing members. The reasons that make these projects successful or not are as varied as why businesses succeed and fail. If you want to become a good programmer and produce good software you'll have to spend a lot of time learning, writing code and communicating with other people on sites such as StackOverflow.

OwnerDisplayName: Sarel Botha


答:
I use git, which I find easier to manage due to distributed control. Hg is good also for this particular purpose, but I can't give you advice on it, having never used it. SVN is a centralized system and hence less practical, but might be slightly simpler.

Open source basically means you give anyone the ability to use your work and build on it. You can set the boundaries of that use: GPL means the user has to make his added work open source to, LGPL means he doesn't, for example.

OwnerDisplayName: Kheldar


答:
About the version control system, I would say that you should stick with the most-used and more recent alternative: That is: "Git". Mercurial is less popular, and SVN is old, slow, and centralized. With GIT you will benefit of a version control system that is modern and popular. There's practically nothing to lose.

Sources (reggarding popularity of DVCS):

https://stackoverflow.com/questions/tagged/git ~10k questions
https://stackoverflow.com/questions/tagged/mercurial ~3k questions

http://www.googlefight.com/index.php?lang=en_GB&word1=git&word2=mercurial

11700000 results vs

1580000 results

Regarding the license: Maybe you should look at the most common ones: GLP, MIT, LGPL, BSD, and pick the one that suits your project better.

OwnerDisplayName: pedrorolo


答:
Sounds like you are asking two different questions:

Are the results of these test trustworthy?

Excel is a tool like any other one that we work with and what the calculations was written in shouldn't really have an impact upon the results of the algorithm itself. The fact that the estimation is coming from an Excel macro is irrelevant to whether or not the results of the calculation (i.e. the validity of the estimate) is valid. If you have bad assumptions in the underlying model it doesn't matter what you use to do the calculation as the underlying assumptions are incorrect.

In such circumstances, should a developer accept the responsibility to
  write and run the tests in the calculated time?

If the requirement that the developer do the work in the indicated time is in their contact then there is not much they can do to argue with it as long as the estimates are reasonable. Which leads into the next point: if the calculations are giving a reasonable amount of time and they are similar to the estimates the developer would give themselves then there is no reason not to object to the timelines given. In fact, it might work to the developers advantage as they might be able to influence the assumptions used in the module as opposed to if they are given an arbitrary timeline.

If the timelines seem infeasible for the amount of work required then obviously they should raise this concern and try and work with the manager to get more realistic timelines, but if the timeline are feasible then they are going to have a hard time objecting to them.

In terms of project management and estimating timelines, yes, it can be done but it is highly dependent upon the nature of work being done. You are likely going to see more accurate estimates being given for the time required to write unit testing code (assuming the developer understands the framework and has written them before) than you will for writing new code against the use cases the testing code is being written for.


问:
Creating a Django development and production app
I just got started on some web development, and got my feet wet by creating a basic facebook app using Django. I am thinking of publishing the app, and consequently now need a development app that I could make subsequent changes to and roll them out to the production app. I'm completely new to this, and would be really thankful if someone could guide me on how I could go about this, and what the best practices are. (I also plan on letting my friend contribute to the app, so I would need to integrate git or some other vcs in the process right?)

Thanks!

答:
For developement Arnar has it, convention is to put your dev settings in a 'local_setttings.py' and import that in your settings.py.

Fabric is very popular for deployment.  One command deploys and can set up your production environment.

In addition python project management is made easy by pip/virtualenv. http://www.caktusgroup.com/blog/2010/04/22/basic-django-deployment-with-virtualenv-fabric-pip-and-rsync/
Shows the full processes using virtualenv/fabric/pip

This is a great tutorial that shows you how to go from nothing to production http://www.foxhop.net/django-virtualenv-apache-mod_wsgi


答:
Especially regarding there being no one who would point out
  improvements in my code.

Couldn't you try to set up code reviews so that there are people looking at the code?  Are there conventions and standards that would help give the code some structure?  This is presuming you aren't the only developer there of course.

While you are likely in a less than great place, does it look like it is working in the end?  Are projects getting done and things are moving forward?  Are things getting done?  The Duct Tape Programmer would be the Joel article that you may want to read.


答:
And of course, what can be done to avoid being in such a situation?

Addressing this question, you might want to look into Continuous Integration (CI).  Simply put: CI is a process where developers frequently (as many as several times a day) integrate and test all code.  The idea is that changes to one module that break another module are quickly found.

In practice, most teams that employ CI use a CI Server (see: Wikipedia's list).  The CI Server is usually setup to monitor the SCM repository and start a build when it sees changes.  When the build is complete, it will then run a series of automated tests and post the results via e-mail and/or webpage of the build and tests, along with what changes caused the build.  Hopefully, when something does break the build or tests, you have only a very small change set to look at, so it gets solved quicker.

There are other questions here about which CI Server to use, so I'll let you find them in interested.  Personally, I am a big fan of Jenkins.

[What should I do about things being broken.]

As others have already said, find out what broke and try to fix it.  Spending time trying to place blame is time spent not solving the problem.


答:
A language you feel comfortable in and the GUI toolkit you want to use in the end product.

That way you can reuse the GUI parts in your final version. The language doesnt really matter for the prototype - if you are comfortable in it, it'll be easier and faster to write.

Title: Which language and GUI toolkit would you use for a prototype program?

Body: Suppose, I have an idea and I have to put it into code quickly. And then I am presenting it to someone who is not so computer savvy. Which language should I use for quick and dirty coding? And which GUI toolkit should I use so that the the computer semi-literate find it easy to use (read shiny-eye-candy). It is a desktop application.</p>


答:
If this is a small shop where you and the other "senior" are basically the only people coding, then it actually might be your responsibility to indicate to the manager what needs to be done to satisfy the "Joel Test".

Changes in requirements will always be there, and your job is to embrace them, which is one of base principles of agile development:

Welcome changing requirements, even late in
  development. Agile processes harness change for
  the customer's competitive advantage.

But adapting to changing requirements means following other agile principles as well. At management level, this means manager must be able to transparently present to the customer that all such changes come with a cost: either the project's scope must be changed to satisfy deadlines, or deadlines must be shifted (the latter not being recommended).

If this is a sort of a project where your manager is the one who comes up with all the requirements, then you should act like he/she is your agile customer, and explain the same thing to them (scope <--> deadline compromises).

But at the developer's level in a small company, I would say that it is your responsibility is to ensure that coding part conforms to agile recommendations.

These are some steps you absolutely need to do, and probably you will need to do them yourself:

you must have a version control system (takes one day to set it up for a small team)

you must have build scripts to ensure that you can make releases often (pretty quick to set up also)

you must use automated unit tests (this is a way of coding, and it dictates your entire design radically, so it might be difficult to add them in the middle of a tightly coupled project)

you could also set up a continuous integration system to ensure automated builds and tests, as well as functional and GUI tests (which are a bit harder to write)

Remember that you can have a SVN repository locally on your own machine. A simple TODO list might serve as a poor-man's bug tracking system (a bit extreme, but hey). And there is no excuse for not having build scripts.

Also, before making any statements about scope/deadline compromises, someone also needs to make predictions about how much time a certain feature will take. This is usually done in "ideal days" in agile world, which means you should do your best to predict the relative effort of each feature, and then use your actual coding speed to see how well you predicted (and scale the "curve" accordingly).


问:
Database Application Design Best Practices
Once upon a time it was common practice for both the business logic and database logic to be written in the same language (eg PL/SQL, Transact SQL, etc), more recently the practice is to separate the application into layers/tiers such as database, business logic, and presentation, with each tier written in a different language. Typically an ORM is used to help facilitate communication between the business logic and the database.

From time to time however, especially when the application is relatively small, I still write applications with the business logic pushed down into the database layer, only the user interface is outside the database. I am aware of the various arguments for and against this, however I'm wondering as to whether there are any contemporary best practices if one was to write a database application in this manner? There are quite a few books on data models etc, but none really talk about how to structure the actual application code in terms of stored procedures, functions and so on. Also there are a number of books on database refactoring, or database anti-patterns, but again they broadly assume that the database is just being used to persist data.

I did find this one paper by Blaha, "Object-oriented design of database stored procedures". Are there any other books, papers, or sample databases that illustrate contemporary database application design best practices?

It actually seems relatively common to still build applications in this way, however it appears to be one of those things that people have accepted is not best practice so they want to avoid talking about it.

Is it OK for a business stored procedure to access a table directly ? Or should all table access be through CRUD methods? Are there any code generation tools people recommend? Thanks.

答:
I would say you could very easily justify putting the logic in the database layer.  It really is about encapsulation.  If you are calling stored procedures to access your data then you are encapsulating that business logic the same as if you had an ORM layer.

I think people sometimes get bent about scalability and portability when you really don't have any need for that.  If your applications do not have a requirement to run on different database systems (like an open source library might, or something you sell to clients), the I don't see a problem with that.

While there are a lot of tools for ORM and the sort, if you are comfortable with stored procedures and your client (whether that's the company you work for or a paying client) is comfortable with the support of that, then it's a good idea.  You can then put a very light UI web layer in place and for that matter could probably stand up a webservice or other API pretty easy too, since you have encapsulated that business logic.


答:
It seems to me that while most people here are answering the how, no-one has really answered the why in your question.

One of the first open source projects I experienced was the fabulous Fractint project, this was developed by the Stone Soup Group who were inspired by the old stone soup folk story.

For me, this encapsulates the spirit of open source better than any Stallman rant or even the original GNU Manifesto. It is a testament to the strength of that community that Fractint is still being developed 23 years after the fire was lit under that particular cooking pot of code.


问:
What do people in IT consulting firms do?
What do people in IT consulting firms do?

Ok I can guess they consult, provide answers to questions, but exactly what kind of questions do they answer that it is even possible people will pay enough for them to sustain their company expenses?

答:
A real word example:

I was working at a telecommunications company and they wanted to get Siebel up and running and didn't have any real in house experience (at least that's what they thought, we in IT probably knew more than the the consultants, but management wanted to blow a few million I guess).  Anyway they bring in Accenture (big name consulting firm).  They brought with them some experienced (and some not so as noted in other posts) developers and a pre-done configuration for Siebel.

These folks gathered requirements, designed the system, and did some of the implementation.  If we had wanted to spend more they would have done all the implementation, but the company wanted to train a bunch of us IT folks to keep things going once Accenture got it started.


问:
If I have two developer license accounts with Apple, can I easily switch between the two for app development and publishing?
I've been interested in iPhone development since the release of the iPhone, however, I am on a limited personal budget.  I've never been willing/able to fork out the money necessary for an iPhone and a Macbook.  I know, some may argue that it's not that expensive, but for a hobby it hasn't been worth the price.

By some twist of amazing fortune, the company that I work for is wanting me to develop an iPhone and iPod app.  This means I am getting pretty much all the hardware you would want to develop on-- an awesome Macbook, Thunderbolt display, an iPhone, an iPad, a few accessories.  In short, it's basically my "wish list" that I have dreamt of one day owning.

In my free time, I will be allowed to use the hardware to develop whatever software I desire but since my development laptop will primarily be used for my employing companies project I need assurance that any work I do under my own developer license will not affect my developer license associated with my work account.

Can I easily switch between two developer accounts when developing and publishing applications?  What if one account is a standard one and the other is an enterprise?

As of yet, I don't have any hardware or any developer licenses and I'm asking in complete ignorance.  Can I do this or will the accounts collide?

REQUESTING UPDATE/SECOND OPINION

Thanks to mouviciel for promptly answering this question with a straight-forward response.  However, I've been working with with XCode for quite a while and I've also had experience with downloading sample projects and modify them so that I can run them on my iOS device.

This lends me to believe that answering my initial question might involve tweaking PList files and other project settings, but should still be doable without having to create a separate account on my Macbook.

So I ask again, can I easily switch between two developer accounts when developing and publishing applications, strictly using one account on my Macbook?

If the answer is, yes, (which is what I assume is the case) how must I redefine my personal projects which may initially inherit user setting associated with my business account and credentials?

答: The simplest way is to get two user accounts on the Macbook and switch between user sessions whenever you want to switch between work project and hobby project.</p>


问:
Composition of a dev team
I'm in a team of fifteen people and the team is in transition after a few changes of management. The current line of management is pushing for an agile approach to developing software but without providing any lead. The team suffers from a big communication problem both inside and with other departments in the company who are our customers.

Management has recently created a sub-team composed by the technical specialists. They have great knowledge of the code base but have been in the company for up to ten years and are not so open to change. There goal is to provide technical direction.

I've joined the team in the last six months. I have a good six years experience developing different software but don't have the same knowledge of the code base as others. I have good communication and organisation skills and can relate to the customers easily.

The company's focus is to deliver innovative new products, but based on my observations we break down in project organisation (we seem to lose focus of the customer, get buried in the code base and misinterpret requirements).

I think I can provide direction in delivering projects with a good focus on the customer, however I don't hold the same technical expertise as the technical specialist team. I also think I'm the only one with previous agile experience in the team.

I've got two questions:

Is there room in a dev team for technical specialists and those that are good at delivering and making the customer happy, i.e the two working in tandem with each other?

Do you need to be a technical specialist to lead a dev project team?

答:
Sounds like you need to establish a customer advocate role.  This is an agile team term for the person that represents the customers interests to the team.  They sit in on all design meetings and make sure the engineers are building to the requirements the customer has laid out.  Also ensure that you are there to help answer questions they may have about requirements. Offer to take questions to the customer if necessary as well.

One thing you can apply your customer skills for is to act in this role.  Write up detailed requirements (in the form of user stories if you want to be agile about it) to detail what the customer wants.  This is very important if you customer is vague in what they want.  Nothing leads to over-bloated buggy systems more than vague requirements.

You should be as a team reviewing all the code done for a sprint (another agile term which is delivering buildable tested code every 1 to 2 weeks).  If you need to sneak up on this idea what I did with my team was to just have the in process review meeting where we brought in management (it was a small company) and customer advocates and demoed all the new features from that week (or 2 weeks work).  The developers need to all attend this meeting.  They will hate it, complain it's a waste of time etc., but they will hear directly from the customer what they like and don't like about what they are doing.

Be forward about keeping things lean.  If a feature starts to be discussed that is not in the requirements say so.  If you can get authority from management, make developers test the hell out of each feature too.  Nothing stops a lame unnecessary feature like having to spend 2 days writing tests from hell for it.

Title: Composition of a dev team


问:
How should C++ Unit Test code be organized for maximum Unit Test efficiency?

This question is not about Unit Testing Frameworks.

This question is not about writing  Unit Tests.

This question is about where to put the UT code written and how/when/where to compile and run it.

In Working Effectively with Legacy Code, Michael Feathers asserts that

good unit tests ... run fast

and that

A unit test that takes 1/10th of a second to run is a slow unit test.

I think these definitions do make sense. I also think that they imply that you have to keep a set of Unit Tests and a set of Those Code Tests That Take Longer separately, but I guess that's the price you pay for only calling something a Unit Test if it runs (very) fast.

Obviously the problem in C++ is that to "run" your Unit Test(s), you have to:

Edit your code  (production or Unit Test, depending on which "cycle" you're in)

Compile

Link

Start Unit Test Executable(s)

Edit (after weird close vote): Before going into the details, I'll try summarize the point here:

How can C++ Unit Test code be effectively organized, so that it's both efficient to edit the (test) code and to run the test code?

The first problem then is to decide where to put the Unit Test code so that:

it's "natural" to edit and view it in combination with the associated production code.

it's easy/quick to start the compilation cycle for the unit your currently changing

The second, related, problem then is what to compile so that the feedback is instantaneous.

Extreme options:

Each Unit-Test-Test-Unit lives in a separate cpp file and this cpp file is compiled+linked separately (together with the source code unit file it tests) to a single executable which then runs this one Unit Test.

(+) This minimizes startup (compile+link!) time for the single Test Unit.

(+) The test runs super fast, because it only tests one unit.

(-) Executing the whole suite will need to start a bazillion of processes. Can be a problem to manage.

(-) The overhead of process starts will become visible

The other side would be to have -- still -- one cpp file per test, but all the test cpp files (together with the code they test!) are linked into one executable (per module / per project / pick your choice).

(+) Compile time still would be OK, as only changed code will compile.

(+) Executing the whole suite is easy, as there's just one exe to run.

(-) The suite will take ages to link, as each recompilation of any object will trigger a re-link.

(-)(?) The suit will take longer to run, although if all Unit Tests are fast, the time should be OK.

So, how are real world C++ Unit Tests handled? If I only run that stuff nightly/hourly, the second part doesn't really matter, but the first part, namely how to "couple" the UT code to the production code, so that it's "natural" for developers to keep both in focus always matters I think. (And if developers have the UT code in focus, they'll want to run it, which brings us back to part two.)

Real world stories and experience appreciated!

Notes:

This question intentionally leaves unspecified platform and make/project system.

Questions Tagged UT & C++ is a great place to start, but unfortunately too many questions, and especially answers, are too heavily focused on the details or on specific frameworks.

A while ago, I answered a similar question on structure for boost unit tests. I find this structure to be lacking for "real", fast Unit Tests. And I find the other question too narrow, hence this new question.

答:
We have all unit tests (for a module) in one executable.
The tests are put into groups. I can execute a single test (or some tests) or a group of tests by specifying a (test/group) name on the command line of the test runner.
The build system can run group "Build", the test department can run "All". The developer can put some tests into a group like "BUG1234" with 1234 being the issue tracker number of the case he's working on.</p>

OwnerDisplayName: Martin

OwnerDisplayName: ur


答: Get an account on http://topcoder.com. They run competitions among programmers to tackle problems involving data structures and algorithms. You'll be competing on correctness, runtime, and speed of implementation. They also have some very good tutorials.</p>

Title: How can I practice implementing data structures and algorithms?

Body:
I just finished learning the basics on data structures and algorithms using Python and C, completing some of the exercises from the book I read. I feel that it is necessary to implement some of these data structures and algorithms to enhance my understanding about the material that I just learned, such as the red-black tree and priority queue.

Are there any good websites with material for me to use when practicing?


答:
The consulting firm does some of the customizations that the enterprise software requires for a company to use it as intended.  The software that is so flexible and scalable that it requires someone to properly configure it and get it rolling would be another way to describe it.

If you can imagine companies that are paying hundreds of thousands of dollars to buy the software, it isn't that hard to imagine other companies charging tens of thousands to customize it for a client.

Body:
What do people in IT consulting firms do?

Ok I can guess they consult, provide answers to questions, but exactly what kind of questions do they answer that it is even possible people will pay enough for them to sustain their company expenses?


问:
"It was working yesterday, I swear!" What can you do?
When you arrive in the morning, you find that your software does not work anymore, even though it did when you left yesterday evening.

What do you do? What do you check first? What do you do to stop being angry and start working on your problem? Do you blame your colleagues and go directly to them? What can be done to avoid being in such a situation?

答: My natural reaction is always to blame others but over time I have come to realise that it is usually me who is at fault. In addition to all the excellent comments above, it is important that you record for yourself what the final reason was. It doesn't matter whether you use a Wiki which is shared with other team members, a private Twiki, Evernote, a log book or a good memory. The important thing, at the moment you find the answer (and want to get back to work!) is to record the reason.


问:
Do private static methods in C# hurt anything?
I created a private validation method for a certain validation that happens multiple times in my class (I can't store the validated data for various reasons). Now, ReSharper suggests that the function could be made static. I'm a little reluctant to do so due known problems with static methods. It would be a private static method. My question is, can private static methods cause similar coupling and testing problems like public static methods? Is it a bad practice? I would guess not, but I'm not sure if there is a pitfall here.

答:
Private static methods are the easiest thing possible, from my point of view.

DataIn -> Method -> DataOut

There are no dependencies on external objects, no side effects. Why do you consider them bad?


答:
The first thing to do when something stops working is to ask yourself - What's different? What has changed?

When something worked last night but fails this morning, the one thing that obviously has changed is - the date and time :)

I'd try and think whether there's any part of the logic I'm working on that depends on dates and might be affected by the passing of time. It's surprising how many times that's the cause of such problems.

If that fails, you should definitely follow up on the other great advice supplied here.


答:
Testing classes that use public static methods can be hard, as it's not (particularly) easy to stub / fake / mock out the static methods. Instance methods, on the other hand, can be mocked easily, especially if they're virtual or satisfy an interface.

However, I can't see any reason to not use private static methods. Indeed, there's a slight performance benefit, as you don't need an instance of the class to occupy memory.

On the other hand anything static is a bit of a code smell. Is this actually a "helper class"? Could it be that the method could more usefully reside on one of the classes passed as a parameter? The answer to those questions is often "it's fine as a static" but it's worth remembering.

Title: Do private static methods in C# hurt anything?

Body: I created a private validation method for a certain validation that happens multiple times in my class (I can't store the validated data for various reasons). Now, ReSharper suggests that the function could be made static. I'm a little reluctant to do so due known problems with static methods. It would be a private static method. My question is, can private static methods cause similar coupling and testing problems like public static methods? Is it a bad practice? I would guess not, but I'm not sure if there is a pitfall here.


问:
How do you find your way in deeply nested, interfacey code?
I know most people hate flat and long functions, and hate when code is not full of ISomethings.

The problem is that I guess my mind works in different way, and I always have problems with that type of code in any non-trivial solution.

So, since most of people enjoy explosive number of functions, can you describe what is the preferred method when dealing with unknown code-bases written in this way?

So far, for me, it looks like:

I have a object with interface IFoo, great, I need to extend it with method Bar1. Reverse lookup, we land nowhere, global search on who implements IFoo, it's Baz1, Baz2, Baz3, Baz4, an they are created by 3 class factories.
So we start one by one, definition of Baz1, looks nice, but it's behaviour is completely dependent on parameters used when object was created through class factory. And what's worse, it's just a wrapper around some other functionality of yet another class with IFooBar. Which again uses some internal implementation of classes with ISomethingElse, which again turns into an explosive graph.

How do you navigate all that effectively?

答:
Sounds like some inappropriate coupling is going on.

There are some tools out there that make this a little easier. In C# I use CodeRush, which includes a handy navigation utility to "jump to implementors" for an interface definition, and similar.


答: It depends on your IDE.  With Visual Studio and ReSharper, finding the implementations and usages of an interface is extremely easy.  I guess I'm the opposite of you though, I find smaller functions to be easier to comprehend than large ones. </p>

Title: How do you find your way in deeply nested, interfacey code?

Body:
I know most people hate flat and long functions, and hate when code is not full of ISomethings.

The problem is that I guess my mind works in different way, and I always have problems with that type of code in any non-trivial solution.

So, since most of people enjoy explosive number of functions, can you describe what is the preferred method when dealing with unknown code-bases written in this way?

So far, for me, it looks like:

I have a object with interface IFoo, great, I need to extend it with method Bar1. Reverse lookup, we land nowhere, global search on who implements IFoo, it's Baz1, Baz2, Baz3, Baz4, an they are created by 3 class factories.
So we start one by one, definition of Baz1, looks nice, but it's behaviour is completely dependent on parameters used when object was created through class factory. And what's worse, it's just a wrapper around some other functionality of yet another class with IFooBar. Which again uses some internal implementation of classes with ISomethingElse, which again turns into an explosive graph.

How do you navigate all that effectively?


答:
You don't. This is the point in writing code that way.

You don't need to know about any of those implementations. You just have to know about what you're adding.

Now you say that you need to add a method to IFoo. Why do you? Is it some functionality you need to call in every class which implements IFoo?

```<code>IFoo foo = FooFactory.Create(info);
foo.Action1();

if (foo.Check == "Yay")
{
    foo.Action2();
}

foo.Action4(); // Maybe I'm adding this line

while (foo.StillActive)
{
    foo.Action3();
}
</code>```

If so then you need to know what it's going to do for each of those cases -- so you probably need to understand the factory class, to know what those cases are.

But if not then you probably shouldn't add your method to IFoo. If it's only going to be used in one of those classes, create another interface and do this:

```<code>IBlah fooBlah = foo as IBlah;
if (fooBlah != null) fooBlah.DoSomething();
</code>```

Body:
You don't. This is the point in writing code that way.

You don't need to know about any of those implementations. You just have to know about what you're adding.

Now you say that you need to add a method to IFoo. Why do you? Is it some functionality you need to call in every class which implements IFoo?

IFoo foo = FooFactory.Create(info);
foo.Action1();

if (foo.Check == "Yay")
{
    foo.Action2();
}

foo.Action4(); // Maybe I'm adding this line

while (foo.StillActive)
{
    foo.Action3();
}

If so then you need to know what it's going to do for each of those cases -- so you probably need to understand the factory class, to know what those cases are.

But if not then you probably shouldn't add your method to IFoo. If it's only going to be used in one of those classes, create another interface and do this:

IBlah fooBlah = foo as IBlah;
if (fooBlah != null) fooBlah.DoSomething();


答:
I would think: "Do I need to test this?"

If your method is private anyway, meaning you don't want to unit test the logic in the method itself, then as far as testability and maintainability are concerned your class is a black box either way, the inner workings of your class are its business and its alone. Refactoring will not be affected either, which is also something to consider.

So, in my opinion: No, making a "private" method "private static" will have no long term ramifications whatsoever.


问:
Why are HDL IDEs so user-unfriendly when compared to generic-purpose language (like Java/C) IDEs?
I've been programming for a while now, and I've covered a lot of languages. And this trend that I noticed is that all HDL languages have so painful IDEs!

In general, any development environment having some Hardware related development has very crappy UI.

I'm talking about uVision, ModelSim, VHDL Simili, Xilinx etc, compared with Netbeans, Eclipse, Visual Studio etc.

Why do hardware-guys hate their developers?

NOTE: There are exceptions (LABView is awsome!). Can you think of any more?

答:
It's not that hardware guys hate their developers. It's that they're hardware guys, so they're not really very good at designing or writing software. Most of them simply don't think enough like "normal" people to produce software that most people will find attractive or easy to use.

The other part of it is that most of these tools assume that anybody using them uses them  constantly; the emphasis is primarily on making them easy for an expert to use, as opposed to easy for a beginner to learn. Of course, it's possible to combine the two, but it takes even more of the UI design skills that (as I just pointed out above) they mostly lack. Worse, along with lacking the skills, many think in terms like: "only a [insert perjorative term here] would care about changing colors."


问:
Overused or abused programming techniques
Are there any techniques in programming that you find to be overused (I.E. used way more excessively than what they should be) or abused, or used a bit for everything, while not being a really good solution to many of the problems which people attempt to solve with it.

It could be regular expressions, some kind of design pattern or maybe an algorithm, or something completely different. Maybe you think people abuse multiple inheritance etc.

答: Mocking.  It introduces too many artificial requirements for excessive decoupling into your code, leads to overengineered ravioli code and forces OO-style design down your throat when a more procedural or functional design might be a simpler solution to your problem.</p>