答:
The biggest problem with Manager Classes is that they only represent this vague idea of what the class is supposed to do. If you call something a Manager then it can do anything and everything possible relating to whatever it is managing. I suppose in some contexts that might be ok, but I would say in almost all cases that is not what you want.  You want someone to be able to look at the class name and not only have a darned good idea of what the class does do but also what it doesn't do.

Another problem with manager classes is that it makes it very difficult to decide where functionality should go. When there are a lot of manager classes then there is frequently a lot of overlap in functionality between manager classes. You then have to figure out which class should implement that overlapping functionality and of course someone else would have chosen differently. So when they look for the functionality and don't see it where they expect then they go ahead and re-implement it where they think it belongs because they aren't aware of the other implementation's existence. In other words, manager classes lead to hard to understand and frequently convoluted designs.

Title: Tips/advice on how to reduce the use of "manager" classes?

Body:
I sometimes hear that having too many "manager" classes in your program's design is code smell and add an unnecessary layer of complexity. To me it makes sense that people want to use manager classes for manipulating and controlling objects from a context that makes sense to them, but figuring out how to make a solution work without them can be confusing.

Should one really avoid manager classes as much as possible? Also, what articles/papers should I read on how to implement an alternative work around for general/common cases where these managers can be removed?


问:
Where to start learning to use the Boost libraries?
Boost has recently become available on the project on which I'm working, and I don't have much experience with it. The library has so many parts and features that it's hard to know where to get started in learning it - especially since I'll be trying to learn it while making production code (so it can't slow me down too much).

I would greatly appreciate it if someone could list around 3 to 5 features which are very useful in general, every-day programming and state why they're useful.  Then I can start to learn those and use them - it'll at least give me a foothold in the library and a friendly place to start learning it/applying it :)

Thanks in advance!

答: Boost isn't a framework, nor a library. It is a quality-controlled, peer-reviewed library collection. You don't learn Boost. The libraries are individual- when you need something, you check to see if it's in Boost, if it is, then you learn that library. That's it. You can't get a grasp on boost::optional from getting a grasp on boost::variant. </p>

ContentLicense: CC BY-SA 3.0


问:
What are some patterns and anti-patterns of application logging?
I recently had to investigate a field issue for our large enterprise application. I was horrified by the logs that I had to comb through in an attempt to find the problem and at the end of the day the logs did not help at all identifying/isolating the bug.

Note: I understand not all bugs are discoverable through logs. This does not change the fact that the logs are horrible.

There are some obvious problems with our logging that we can already attempt to fix. I do not want to list those here and I cannot simply show you our log files so you can give advice on what to do.

Instead, in order to assess how bad we are doing on the logging front, I would like to know:

What are some guidelines, if any, when it comes to logging for an application, especially large application.

Are there any patterns we should follow or anti-patterns we should be aware of?

Is this an important thing to fix or can it even be fixed or all log files are simply huge and you need supplemental scripts to analyze them?

Side note: we use log4j.

答:
My experience with logs is the bigger the better, but be consistent enough to make it filterable by machine, and be able to configure a severity level for every component of your application individually.

Also, it's very difficult to predict what logging you will need to find a future bug.  Most of the obvious places to log for bugs are fixed before the product goes out the door.  It's not uncommon for the result of a bug report to be that you just added logging to help diagnose it if it happens again.


答:
A few points that my practice proved useful:

Keep all logging code in your production code. Have an ability to enable more/less detailed logging in production, preferably per subsystem and without restarting your program.

Make logs easy to parse by grep and by eye. Stick to several common fields at the beginning of each line. Identify time, severity, and subsystem in every line. Clearly formulate the message. Make every log message easy to map to its source code line.

If an error happens, try to collect and log as much information as possible. It may take long but it's OK because normal processing has failed anyway. Not having to wait when the same condition happens in production with a debugger attached is priceless.

Logs are mostly needed for monitoring and troubleshooting. Put yourself in a troubleshooter's shoes and think what kind of logs you'd like to have when something wrong is happening or has happened in the dead of night.

Title: What are some patterns and anti-patterns of application logging?

Body:
I recently had to investigate a field issue for our large enterprise application. I was horrified by the logs that I had to comb through in an attempt to find the problem and at the end of the day the logs did not help at all identifying/isolating the bug.

Note: I understand not all bugs are discoverable through logs. This does not change the fact that the logs are horrible.

There are some obvious problems with our logging that we can already attempt to fix. I do not want to list those here and I cannot simply show you our log files so you can give advice on what to do.

Instead, in order to assess how bad we are doing on the logging front, I would like to know:

What are some guidelines, if any, when it comes to logging for an application, especially large application.

Are there any patterns we should follow or anti-patterns we should be aware of?

Is this an important thing to fix or can it even be fixed or all log files are simply huge and you need supplemental scripts to analyze them?

Side note: we use log4j.


问:
Should a developer argue against unnecessary or harmful features?
What is a good attitude from developers when discussing new features, and namely, non critical/questionable features?

Say you are developing some sort of Java like language, and the boss says: "We need pointers so that developers could fiddle with object memory directly!"

Should the developer shoot down the idea because it adds unimaginable complexity and security vulnerabilities, or should he do what's asked?

This may not be a good example, but what about things that are more in a gray area, like adding buttons that break workflow, or goes against internal structure of the program, etc.?

What is the optimal "can do" vs. "can't do" distribution for a regular programmer?

EDIT: The question is not about a bad boss :D

I was more interested how do people approach new problems that add a noticeable amount of problems while maybe being marginally useful.

Should the general attitude be:

yes we'll do it, screw the complexity

maybe

no, the general rework, and implications don't justify the change

What should be the reaction of a good developer?

答:
Excuse me, but this question sounds like a minor asking for fatherly advice. If this is the case, the good developer will need to embrace these commandments:

Remain faithful to yourself. If your gut feels uneasy about a feature, voice your concerns audibly. Chances are good that the team is just awaiting an opening.

Do not try to substitute experience with the rules of thumb of the experienced. To you, every situation is different, every feature is new. This is a plus your seniors don't have.

Software development isn't exact science, it will never be. Therefore, accumulate wisdom, not behaviour.

Accept defeat. If the team agrees otherwise, do not repeat your concerns ad nauseam.

Think positive. If the idea is really begging for 'shooting it down', try to find and name positive aspects to it before you list its deficiencies.

Learn how to interact with people. We developers often place technical knowledge over social competence. The technical abilities peak early in life, but the social competence can keep growing until retirement.


答:
Realize that you do not know everything and cannot do everything.

If you are sure that it is a bad idea then, say what's bad.

If they try to push it on you, say either - Need more time to analyze, if you need more time or say that we haven't found a good solution to this problem.

If they still insist on implementing the bad idea, get an acknowledgment from them that you have advised against it including your reasons. You may even send out an email summarizing the discussion with a copy to your manager. This might save your a** later.

Title: Should a developer argue against unnecessary or harmful features?

Body:
What is a good attitude from developers when discussing new features, and namely, non critical/questionable features?

Say you are developing some sort of Java like language, and the boss says: "We need pointers so that developers could fiddle with object memory directly!"

Should the developer shoot down the idea because it adds unimaginable complexity and security vulnerabilities, or should he do what's asked?

This may not be a good example, but what about things that are more in a gray area, like adding buttons that break workflow, or goes against internal structure of the program, etc.?

What is the optimal "can do" vs. "can't do" distribution for a regular programmer?

EDIT: The question is not about a bad boss :D

I was more interested how do people approach new problems that add a noticeable amount of problems while maybe being marginally useful.

Should the general attitude be:

yes we'll do it, screw the complexity

maybe

no, the general rework, and implications don't justify the change

What should be the reaction of a good developer?


答:
If you are using a pre TR1 compiler then smart pointers

```<code>boost::shared_ptr
boost::weak_ptr
boost::scoped_ptr

boost::scoped_array
boost::shared_array
</code>```

If your compiler already has smart pointers use them.

The reason is obvious C++ without smart pointers is basically not C++

The boost ptr_contaier libraries.

All the STL containers re-implemented specifically to hold pointers. Not only do the containers take ownership of the pointers so that when the container is destroyed it automatically destroys all the pointers. BUT it also provides accesses to elements as normal object references (not pointers) this makes it easy to use the objects in standard algorithms without wrapper functors.

The boost lambda libraries. (see comment below)

The STL functors and binders are OK for simple things. But boost::lambda took it the next step and makes things a lot simpler when using the standard algorithms.

boost::any and boost::variant

When you need to hold objects without wanting to know their exact type.

multi Index Containers

Containers that allow multiple different ways to access the elements.

Gone are the days when you have a vector of objects and a separate map for quick searching vector. This cuts down on the boilerplate you need to write to maintain the two containers when inserting/deleting elements into the containers.

boost::lexical_cast

Probably the least useful in real life but a lot of fun to play with is boost::lexical_cast. It converts any object to/from a string (as long as that type has the appropriate << and >> operators defined). Very useful for dumping error messages when de-bugging.

Title: Where to start learning to use the Boost libraries?

Body:
Boost has recently become available on the project on which I'm working, and I don't have much experience with it. The library has so many parts and features that it's hard to know where to get started in learning it - especially since I'll be trying to learn it while making production code (so it can't slow me down too much).

I would greatly appreciate it if someone could list around 3 to 5 features which are very useful in general, every-day programming and state why they're useful.  Then I can start to learn those and use them - it'll at least give me a foothold in the library and a friendly place to start learning it/applying it :)

Thanks in advance!

Body:
If you are using a pre TR1 compiler then smart pointers

boost::shared_ptr
boost::weak_ptr
boost::scoped_ptr

boost::scoped_array
boost::shared_array

If your compiler already has smart pointers use them.

The reason is obvious C++ without smart pointers is basically not C++

The boost ptr_contaier libraries.

All the STL containers re-implemented specifically to hold pointers. Not only do the containers take ownership of the pointers so that when the container is destroyed it automatically destroys all the pointers. BUT it also provides accesses to elements as normal object references (not pointers) this makes it easy to use the objects in standard algorithms without wrapper functors.

The boost lambda libraries. (see comment below)

The STL functors and binders are OK for simple things. But boost::lambda took it the next step and makes things a lot simpler when using the standard algorithms.

boost::any and boost::variant

When you need to hold objects without wanting to know their exact type.

multi Index Containers

Containers that allow multiple different ways to access the elements.

Gone are the days when you have a vector of objects and a separate map for quick searching vector. This cuts down on the boilerplate you need to write to maintain the two containers when inserting/deleting elements into the containers.

boost::lexical_cast

Probably the least useful in real life but a lot of fun to play with is boost::lexical_cast. It converts any object to/from a string (as long as that type has the appropriate << and >> operators defined). Very useful for dumping error messages when de-bugging.


问:
What does "Human Readable" mean? Is it a misnomer?
Two examples spring to mind:

One of the reasons that .Net programmers are encouraged to use .config files instead of the Windows Registry is that .config files are XML and therefore human-readable.

Similarly, JSON is sometimes considered human-readable compared with a proprietary format.

Are human-readable formats actually readable by humans? In the example of configuration data:

The format doesn't change the underlying meaning of the information - in both cases, the data represents the same thing.

Both registry and .config file are stored internally as a series 0s and 1s. To that extent, the underlying representaion is equally unreadable by humans.

Both registry and .config file require a tool to read, format and display those 0s and 1s and convert them into a format that humans can read. In the case of configuration stored in the Windows Registry, this is a Registry Editor. In the case of XML it could be a text editor or XML reader. Either way, the tool makes the data readable, not the data format.

So, what is the difference between human-readable data formats and non-human-readable formats?

答: It also applies to code - you structure your program in a logical and thoughtful manner such that the job of anyone looking at it for the first time is made a bit easier.</p>

ContentLicense: CC BY-SA 2.5


问:
Forking an open source project nicely
It's time.

You've worked long and hard to add your vision to the open source project you love, on which you've worked, debated, and to which you've contributed inestimable amounts of code and insight.

But it's not going to work out with the existing developers.

You finally need to fork the code.

How do you do this and remain on the best terms possible with the existing project?  How do you not say, "Oh yeah?  Fork you!"

Aside from the mechanics of cross-polination and assuming that the reasoning for forking is sound, logical, and acceptable, what issues come up?

Competition?
Resource sapping?
User poaching?

How do you go through this arguably difficult and long process until you've diversified enough that these are no longer seen as problems?

Rather than discussing the reasoning behind the decision, please assume that you have already been convinced that forking the code is the best overall solution, and now the point is to move forward in the best way possible.

-Adam

答:
First say you just want to do some experimental refactoring.  You know, just some ideas you want to play with.  But these changes may necessitate breaking backward compatibility with the main branch of the project, so you don't want to commit the changes there.

Then create your fork.  Of course you are a responsible developer, so you put all code under revision control.  Use Launchpad or SourceForge or Google Code or whatever.

Lie low for a while and just work on it yourself.  Then get someone you trust to "take a look" at what you've created.  Then another someone.  Some time after that, make a simple project web site wherever you're keeping your source.

By that time, the folks you thought weren't working out on the original project will probably have moved on too, so there'll be nobody left to offend.  The original project will decline in activity as your new project gains followers.

Re codelogic's comment:

Right; I was assuming that the people the OP wants to leave behind are not capable of sustaining the project on their own.

I've heard it said, "organizations survive, people don't."  That is, no single person is so critical to a project that the remaining team cannot compensate for a vacuum left by that person's departure.

However, in open source, sometimes it's true that no one has the will, the talent, and the time to run a project without the founder.

OwnerDisplayName: Adam Davis

Title: Forking an open source project nicely

OwnerDisplayName: Bill Karwin


答:
You want to work on your own fork of the code or do you want to fragment the community?

We've internally forked a couple of projects. We'd make a change, ship it up to the owners, they'd say "no thanks", and we'd shrug our shoulders and bring it internally and maintain it ourselves.

Mind, these weren't enormous projects, but that just the way it goes. We haven't published anything, hosted a site, or whatever. We just push the source downstream to our clients with rest of the code base.

There was simply no call for us to "promote" our changes in any more public fashion than the dev mailing list.

If you want to maintain parity with the original, then you're going to have to be aggressive on patch management, and merging, and whatever.

If you don't want to bother, then...don't. No reason to make a public thing about it unless that's the general intent, rather than simply needing a forked version for your own projects.

The source is there to be used, so use it.

Title: Forking an open source project nicely

Body:
It's time.

You've worked long and hard to add your vision to the open source project you love, on which you've worked, debated, and to which you've contributed inestimable amounts of code and insight.

But it's not going to work out with the existing developers.

You finally need to fork the code.

How do you do this and remain on the best terms possible with the existing project?  How do you not say, "Oh yeah?  Fork you!"

Aside from the mechanics of cross-polination and assuming that the reasoning for forking is sound, logical, and acceptable, what issues come up?

Competition?
Resource sapping?
User poaching?

How do you go through this arguably difficult and long process until you've diversified enough that these are no longer seen as problems?

Rather than discussing the reasoning behind the decision, please assume that you have already been convinced that forking the code is the best overall solution, and now the point is to move forward in the best way possible.

-Adam

OwnerDisplayName: Will Hartung


答:
In most open source projects, the word "fork" isn't often that warmly perceived, I have personally made the experience that asking to work on a "topic branch" in order to develop a specific set of features is much more welcomed.

And this only makes sense: "forks" are by nature potential competitors, while "topic branches" are -at least by design- meant to be eventually merged/contributed back to the project.

Title: Forking an open source project nicely


问:
Why do iterators in Python raise an exception?
Here's the syntax for iterators in Java (somewhat similar syntax in C#):

Iterator it = sequence.iterator();

while (it.hasNext()) {
    System.out.println(it.next());
}
```

<p>Which makes sense. Here's the equivalent syntax in Python:</p>

```it = iter(sequence)
while True:
    try:
        value = it.next()
    except StopIteration:
        break
    print(value)
```

I thought Exceptions were supposed to be used only in, well, exceptional circumstances.

Why does Python use exceptions to stop iteration?

答:
It's a difference in philosophy. The Pythonic design philosophy is EAFP:

Easier to ask for forgiveness than permission. This common Python coding style assumes the existence of valid keys or attributes and catches exceptions if the assumption proves false. This clean and fast style is characterized by the presence of many try and except statements. The technique contrasts with the LBYL style common to many other languages such as C...


问:
Is it unusual for a small company (15 developers) not to use managed source/version control?
It's not really a technical question, but there are several other questions here about source control and best practice.

The company I work for (which will remain anonymous) uses a network share to host its source code and released code.  It's the responsibility of the developer or manager to manually move source code to the correct folder depending on whether it's been released and what version it is and stuff.  We have various spreadsheets dotted around where we record file names and versions and what's changed, and some teams also put details of different versions at the top of each file.  Each team (2-3 teams) seems to do this differently within the company.  As you can imagine, it's an organised mess - organised, because the "right people" know where their stuff is, but a mess because it's all different and it relies on people remembering what to do at any one time.  One good thing is that everything is backed up on a nightly basis and kept indefinitely, so if mistakes are made, snapshots can be recovered.

I've been trying to push for some kind of managed source control for a while, but I can't seem to get enough support for it within the company.  My main arguments are:

We're currently vulnerable; at any point someone could forget to do
one of the many release actions we have to do, which could mean whole
versions are not stored correctly.  It could take hours or even days
to piece a version back together if necessary

We're developing new features along with bug fixes, and often have to delay the release
of one or the other because some work has not been completed yet.  We also have to force
customers to take versions that include new features even if they just want a bug fix,
because there's only really one version we're all working on

We're experiencing problems with Visual Studio because multiple
developers are using the same projects at the same time (not the same
files, but it's still causing problems)

There are only 15 developers, but we all do stuff differently; wouldn't
it be better to have a standard company-wide approach we all have to
follow?

My questions are:

Is it normal for a group of this size not to have source control?

I have so far been given only vague reasons for not having source control - what
reasons would you suggest could be valid for not
implementing source control, given the information above?

Are there any more reasons for source control that I could add to my
arsenal?

I'm asking mainly to get a feel for why I have had so much resistance, so please answer honestly.

I'll give the answer to the person I believe has taken the most balanced approach and has answered all three questions.

Thanks in advance

答:
Wow, just wow. While I don't think it's the best way to handle code control, it's not entirely unusual I worked at a company with 6 developers and no source control was used, they kind of had their own internal way of managing files, a release manager and whatnot would oversee all changes. In-fact the mantra was that new functionality could be added in to projects as long as some kind of switch was wrapped around the functionality.

For example we were working on a b grade social network written in PHP and the client wanted functionality to be able to subscribe to a users profile. Basically the functionality was wrapped in a check like this if ( ENABLE_SUBSCRIBE_FUNCTIONALITY == true ) { then execute the code }

The place I worked at as well never had more than one developer at a time working on a particular file, mostly everything was modular so in that instance there was no need for source control. However, I believe the advantages of source control far outweigh the disadvantages of not having it in most cases.

The very fact your company is resorting to spreadsheets documenting file changes and what was changed when something like Git or Subversion can handle that for you is just absolutely ridiculous.

OwnerDisplayName: LordScree


答:
There's a very Pythonic way to write that expression without explicitly writing a try-except block for a StopIteration:

```<code># some_iterable is some collection that can be iterated over
# e.g., a list, sequence, dict, set, itertools.combination(...)

for value in some_iterable:
    print(value)
</code>```

You can read up on the relevant PEPs 234 255 if you want to know more behind why StopIteration was introduced and the logic behind iterators.

A general principle in python is to have one way to do something (see import this), and preferably its beautiful, explicit, readable, and simple, which the pythonic method satisfies.  Your equivalent code is only necessary as python doesn't give iterators a hasNext member function; preferring people to just loop through the iterators directly (and if you need to do something else to just try reading it and catch an exception).

This automatic catching of an StopIteration exception at the end of an iterator makes sense and is an analogue of the EOFError raised if you read past an end of file.

Title: Why do iterators in Python raise an exception?

Body:
Here's the syntax for iterators in Java (somewhat similar syntax in C#):

Iterator it = sequence.iterator();

while (it.hasNext()) {
    System.out.println(it.next());
}
```

<p>Which makes sense. Here's the equivalent syntax in Python:</p>

```it = iter(sequence)
while True:
    try:
        value = it.next()
    except StopIteration:
        break
    print(value)
```

I thought Exceptions were supposed to be used only in, well, exceptional circumstances.

Why does Python use exceptions to stop iteration?

Body:
There's a very Pythonic way to write that expression without explicitly writing a try-except block for a StopIteration:

# some_iterable is some collection that can be iterated over
# e.g., a list, sequence, dict, set, itertools.combination(...)

for value in some_iterable:
    print(value)

You can read up on the relevant PEPs 234 255 if you want to know more behind why StopIteration was introduced and the logic behind iterators.

A general principle in python is to have one way to do something (see import this), and preferably its beautiful, explicit, readable, and simple, which the pythonic method satisfies.  Your equivalent code is only necessary as python doesn't give iterators a hasNext member function; preferring people to just loop through the iterators directly (and if you need to do something else to just try reading it and catch an exception).

This automatic catching of an StopIteration exception at the end of an iterator makes sense and is an analogue of the EOFError raised if you read past an end of file.

ContentLicense: CC BY-SA 4.0


答:
It's just that the Java implementation has a hasNext() method so that you can check for an empty iterator before you perform a next(). When you do call next() on a Java iterator with no elements left, a NoSuchElementException is thrown .

So effectively, you can do a try..catch in Java like the try..except in Python. And yes, as per a previous answer, philosophy is very important in the Pythonic world.


问:
I'm a contract developer and I think I'm about to get screwed
I do contract development on the side. You could say that I'm a contract developer? Considering I've only ever had one client I'd say that's not exactly the truth - more like I took a side job and needed some extra cash. It started out as a "rebuild our website and we'll pay you $10k" type project. Once that was complete (a bit over schedule, but certainly not over budget), the company hired me on as a "long term support" contractor. The contract is to go from March of this year, expiring on December 31st of this year - 10 months. Over which a payment is to be paid on the 30th of each month for a set amount.

I've been fulfilling my end of the contract on all points - doing server maintenence, application and database changes, doing huge rush changes and pretty much just going above and beyond. Currently I'm in the middle of development of an iPhone mobile application (PhoneGap based) which is nearing completion (probably 3-4 weeks from submission).

It has not been all peaches and flowers though. Each and every month when my paycheck comes due, there always seems to be an issue of sorts. These issues did not occur during the initial project, only during the support contract. The actual contract states that my check should be mailed out on the 30th of the month. I have received my check on time approximately once (on time being about 2-3 days within the 30th). I've received my paycheck as late as the 15th of the next month - over two weeks late. I've put up with it because I need the paycheck. There have been promises and promises of "we'll send it out on time next time! I promise" - only to receive it just as late the next month. When I ask about payment they give me a vibe like "why are you only worried about money?" - unfortunately I don't have the luxury of not worrying about money. The last straw was with my August payment, which should have been mailed on August 30th. I received it on September 12th. The reason for the delay? "USPS is delaying it man! we sent it out on the 1st!" is the reason I got. When I finally got the check in the mail, the postage on the envelope was marked September 10th - the date it was run through the postage machine. I've been outright lied to, at this point.

I carry on working, because again - I need a paycheck. I orchestrated the move of our application to a new server, developed a bunch of new changes and continued work on the iPhone app. All told I probably went over my hourly allotment (I'm paid for 40 hours a month, I probably put in at least 50). On Saturday, the 1st, I gave the main contact at the company (a company of 3, by the way - this is not some big corporation) a ring and filled him in on the status of my work for the past two weeks. Unusually I hadn't heard from him since the middle of September. His response was "oh... well, that is nice and uh.. good job. well, we've been talking within the company about things and we've certainly got some decisions ahead of us..." - not verbatim but you get the idea (I hope?). I got out of this conversation that the site is not doing very well (which it's not) and they're considering pulling the plug.

Crap, this contract is going to end early - there goes Christmas! Fine, that's alright, no problem. I'll get paid for the last months work and call it a day. Unfortunately I still haven't gotten last months check, and I'm getting dicked around now. "Oh.. we had problems transferring funds, we'll try and mail it out tomorrow" and "I left a VM with the finance guy, but I can't get ahold of him". So I'm getting the feeling I'm not getting paid for all the work I put in for September. This is obviously breach of contract, and I am pissed.

Thinking irrationally, I considered changing all their passwords and holding their stuff hostage. Before I think it through (by the way, I am NOT going to do this, realized it would probably get me in trouble), I go and try some passwords for our various accounts.

Google Apps? Oh, I'm no longer administrator here.
Godaddy? Whoops, invalid password.
Disqus? Nope, invalid password here too.
Google Adsense / Analytics? Invalid password.
Dedicated server account manager? Invalid password.

Now, I have the servers root password - I just built the box last week and haven't had a chance to send the guy the root password. Wasn't in a rush, I manage the server and they never touch it. Now all of a sudden all the passwords except this one are changed; the writing is on the wall - I am out. Here's the conundrum.

I have the root password, they do not. If I give them this password all the leverage I have is gone, out the door and out of my hands. During this argument of why am I not getting paid the guy sends me an email saying "oh by the way, what's the root username and password to the server?". Considering he knows absolutely nothing, I gave him an "admin" account which really has almost no rights. I still have exclusive access to the server, I just don't know where to go.

I can hold their data hostage, but I'm almost positive this is the wrong thing to do. I'd consider it blackmail, regardless of whether or not I have gotten paid yet.

I can "break" something on the server and give them the whole "well, if you were paying me I could fix it!" spiel. This works from a "well he's not holding their stuff hostage" point of view, but what stops them from hiring some one else to just fix the issue at hand? For all I know the guys nephew is a "l33t hax0r" and can figure it out for free.

I can give in, document as much as I can and take him to small claims court. This is breach of contract, I'm not getting paid. I have a case, right?

????

Does anyone have any experience in this? What can I do? What are my options? I'm broke, I can't afford a lawyer and I can barely afford not getting this paycheck. My wife doesn't work (I work two jobs so she doesn't have to work - we have a 1 year old) and is already looking at getting a part time job to cover the bills. Long term we'll be fine, but this has pissed me off beyond belief!

Help me out, I'm about to get screwed.

答:
Find a lawyer. Go with his advice over ours.

If the amount you're out isn't worth hiring a lawyer, let it go and chalk it up to experience.  Do NOT do anything from your side that would make you look bad in court or open you up to a countersuit. Hold up your end of the agreement completely.  You may want to contact them and ask them why you're suddenly unable to do the work you've been contracted for.  Keep all correspondence and try to get them to put things in writing so you have it for the lawyer.

OwnerDisplayName: kagaku


答: If they are breaking a contract isn't that a legal issue? Holding out on a root password would then not be your ammo, contract law would be your ammo.</p>

Title: I'm a contract developer and I think I'm about to get screwed

Body:
I do contract development on the side. You could say that I'm a contract developer? Considering I've only ever had one client I'd say that's not exactly the truth - more like I took a side job and needed some extra cash. It started out as a "rebuild our website and we'll pay you $10k" type project. Once that was complete (a bit over schedule, but certainly not over budget), the company hired me on as a "long term support" contractor. The contract is to go from March of this year, expiring on December 31st of this year - 10 months. Over which a payment is to be paid on the 30th of each month for a set amount.

I've been fulfilling my end of the contract on all points - doing server maintenence, application and database changes, doing huge rush changes and pretty much just going above and beyond. Currently I'm in the middle of development of an iPhone mobile application (PhoneGap based) which is nearing completion (probably 3-4 weeks from submission).

It has not been all peaches and flowers though. Each and every month when my paycheck comes due, there always seems to be an issue of sorts. These issues did not occur during the initial project, only during the support contract. The actual contract states that my check should be mailed out on the 30th of the month. I have received my check on time approximately once (on time being about 2-3 days within the 30th). I've received my paycheck as late as the 15th of the next month - over two weeks late. I've put up with it because I need the paycheck. There have been promises and promises of "we'll send it out on time next time! I promise" - only to receive it just as late the next month. When I ask about payment they give me a vibe like "why are you only worried about money?" - unfortunately I don't have the luxury of not worrying about money. The last straw was with my August payment, which should have been mailed on August 30th. I received it on September 12th. The reason for the delay? "USPS is delaying it man! we sent it out on the 1st!" is the reason I got. When I finally got the check in the mail, the postage on the envelope was marked September 10th - the date it was run through the postage machine. I've been outright lied to, at this point.

I carry on working, because again - I need a paycheck. I orchestrated the move of our application to a new server, developed a bunch of new changes and continued work on the iPhone app. All told I probably went over my hourly allotment (I'm paid for 40 hours a month, I probably put in at least 50). On Saturday, the 1st, I gave the main contact at the company (a company of 3, by the way - this is not some big corporation) a ring and filled him in on the status of my work for the past two weeks. Unusually I hadn't heard from him since the middle of September. His response was "oh... well, that is nice and uh.. good job. well, we've been talking within the company about things and we've certainly got some decisions ahead of us..." - not verbatim but you get the idea (I hope?). I got out of this conversation that the site is not doing very well (which it's not) and they're considering pulling the plug.

Crap, this contract is going to end early - there goes Christmas! Fine, that's alright, no problem. I'll get paid for the last months work and call it a day. Unfortunately I still haven't gotten last months check, and I'm getting dicked around now. "Oh.. we had problems transferring funds, we'll try and mail it out tomorrow" and "I left a VM with the finance guy, but I can't get ahold of him". So I'm getting the feeling I'm not getting paid for all the work I put in for September. This is obviously breach of contract, and I am pissed.

Thinking irrationally, I considered changing all their passwords and holding their stuff hostage. Before I think it through (by the way, I am NOT going to do this, realized it would probably get me in trouble), I go and try some passwords for our various accounts.

Google Apps? Oh, I'm no longer administrator here.
Godaddy? Whoops, invalid password.
Disqus? Nope, invalid password here too.
Google Adsense / Analytics? Invalid password.
Dedicated server account manager? Invalid password.

Now, I have the servers root password - I just built the box last week and haven't had a chance to send the guy the root password. Wasn't in a rush, I manage the server and they never touch it. Now all of a sudden all the passwords except this one are changed; the writing is on the wall - I am out. Here's the conundrum.

I have the root password, they do not. If I give them this password all the leverage I have is gone, out the door and out of my hands. During this argument of why am I not getting paid the guy sends me an email saying "oh by the way, what's the root username and password to the server?". Considering he knows absolutely nothing, I gave him an "admin" account which really has almost no rights. I still have exclusive access to the server, I just don't know where to go.

I can hold their data hostage, but I'm almost positive this is the wrong thing to do. I'd consider it blackmail, regardless of whether or not I have gotten paid yet.

I can "break" something on the server and give them the whole "well, if you were paying me I could fix it!" spiel. This works from a "well he's not holding their stuff hostage" point of view, but what stops them from hiring some one else to just fix the issue at hand? For all I know the guys nephew is a "l33t hax0r" and can figure it out for free.

I can give in, document as much as I can and take him to small claims court. This is breach of contract, I'm not getting paid. I have a case, right?

????

Does anyone have any experience in this? What can I do? What are my options? I'm broke, I can't afford a lawyer and I can barely afford not getting this paycheck. My wife doesn't work (I work two jobs so she doesn't have to work - we have a 1 year old) and is already looking at getting a part time job to cover the bills. Long term we'll be fine, but this has pissed me off beyond belief!

Help me out, I'm about to get screwed.


答:
Hey look I've found myself on the internet.

In my opinion and in situations like this - the key point is keep integrity.

Give them the root password when they request it, keep mailing or emailing at least once a week about any overdue accounts or termination fees - they'll either give up and pay, or simply ignore it.

It's not good to let things like this get in the way with moving forward - so when it comes to legal action (if the amount is less than say, something you "can" be without (not that you want to be without it)) leave it alone - move on - profit.

Stress from people not paying, or not paying on time is probably one of the biggest gripes about self-contracting.  I know it is for me, and as such, I now charge in advance before I commence work.  I do miss out on work because of this, but at least I have my sanity.

I'm a developer - as are you - not an accounts collector.  Do what you do best and find another client (or two or three).


答: I suspect this question will probably be closed soon. But I suggest that you walk away and find yourself another contract job. Really it sounds like the relationship is irreparable. If they ask for the password just give it to them, and act professionally. More than likely they will have some issues going forward and will need to contact you, if they haven't paid you the money they owe, then you can decline to help them. If they want to use your services again, you can mention the problems with late payment and ask them for a bond or similar upfront. Repeated late payments implies cash flow problems.</p>


答:
Why is everyone suggesting you give them the login? I'd consider that work. Which isn't being paid anymore.
If you can prove what work you did since you last got paid, remove it, and never speak to them about anything other than money. When/if that's resolved, you can resume working for them, if you wish, including giving them the password.</p>


答:
Right now you SUSPECT you are not being paid. You might be, you might not be.

The best thing is to go see them face to face and ask what's going on.

Tell them up front, if they want you to stop, you will do so immediately but you expect to be paid for work done until now.

If they want you to continue, get it in writing.

Keeping the root password (holding it hostage) is probably not a good idea.

Bear in mind also that many people (me included) get put into accounts systems on 14 to 30 day payment cycles, and waiting up 60 days for your money is fairly common. Frustrating. But common.


答:
Reach out to local Web developers in your area for support, this might help you find some good advice on dealing with this problem locally. None of the answers here can help you as much as people in your area. Look in the usual places such as user groups in your town (or near-by towns) dealing with the types of technology your are using.

What you have written does sound pretty bad, but look on the positive side. You have been working on some very good and solid skills; server maintenance, application and database maintenance, and iPhone mobile development. I sure there are many more hard skills, plus some soft skills of dealing with a failing company that will in the long run help you develop a good business for your family.

You need to put all the disappointments aside for a moment, collect your thoughts, and then approach the company with the plain facts! not emotions!! "I need payment for my services more timely because I have a family that depends on my support.  If you are not planning on finishing the work we planned then please let me know ASAP so I can use my talents elsewhere."

One final note, you have suggested several ideas in your post about what you could do to get some form of relief from this problem. These will probably hurt You and Your family in the end more than help. Good contracting works because your former clients spread the word about what a good job you did for them. Even clients from failing businesses can let others know how well you handled a difficult situation.

You never know maybe this company might have a rebound someday and will need your help even more.

Best wishes, keep coding and doing good work!


问:
Suggestions for Programs to develop for learning
i wonder apart from those very simple hello world apps, what other programs should i try developing for learning. i am entering uni next year and wonder what kind of programs will be developed in that environment.

this is not really a language specific thing, but if you want to know what i use currently mainly

windows: C#/WPF - i studied java/vb etc in poly but i think C# is the way to go, maybe even F#

web: PHP/MySQL, Zend Framework/Doctrine, + HTML/CSS/JS(jQuery) of course. looking to try google app engine with python too.

for now, i am thinking of

todo lists

apps that integrate with api eg. twitter/tumblr which i use

text editor - i am currently trying to develop a text editor that uses markdown and generates html files for viewing (link to blog entry). not very pratical after i started developing it. cos when editing theres no formatting and in HTML format, i cannot edit directly

blog software (for web)

答:
You can also look at TopCoder. This site has great algorithms to learn and they conduct competition from time to time. The important advantage of this site is that you can see others source code for a particular problem and can learn more.

And even on the SE sites, you have to look at CodeGolf.


答:
The answer is clear, but you're going to have to grow a pair to do it.

Stop working until you get paid.

Charge them 10% extra for every n days late, where 5 <= n <= 10.

Look for other jobs.

If you can build all this stuff, I promise you there are other people out there that are willing to give you money for your skill.


问:
What is the benefit of studying bitwise operators?
What is the benefit of studying bitwise operators (Bitwise Not, Bitwise AND, Bitwise OR, Bitwise XOR, Left Shift, Signed Right Shift, Unsigned Right Shift etc.)?

Will we really use these operators in programming?

答:
It all depends on what your focus is really. Some programmers may go their entire career without using bitwise operations and may do quite well for themselves (although they will encounter frustration whenever dealing with code that contains them).

However, bitwise operations are a fundamental part of software engineering and questions pertaining to them are asked quite frequently in interviews (along with other fundamental CS questions such as how to convert between base-x and base-y).

You'll find that those who come from a CS background will use them when the need arises in many different ways (a common use case is a bit field). If you don't understand how bit operations work, you'll generally be at a loss trying to understand the sections containing them.

Now, having said all that, bitwise operations should be fairly easy to understand for anyone pursuing a career in programming and shouldn't really require a lot of studying.


答:
"Yes, we will."

Bitwise operations are everywhere. They are perfect for working with bitfields (a practice that is ubiquitous in C and C++), such as a 'flags' field in a data structure or function argument. Basically, | combines flags, ^ flips flags, & checks if a flag is set, and the x &= ~FLAG pattern clears a flag.

Bitwise operations are ubiquitous in all things low-level - hardware drivers, network protocols, binary file formats - as well as some higher-level fields like character encodings, cryptography, etc.

Bit-shifting can also sometimes double for integer division and multiplication by powers of 2, with a slightly different rounding behavior for negative numbers (sometimes, but not always, more desirable than what regular integer division does).

In tight loops, bitwise arithmetic can sometimes be used to avoid conditionals, which is beneficial because modern CPUs use branch prediction, and a misprediction (i.e., the condition in an if statement evaluates differently from the previous time) causes a significant delay. Using bitwise arithmetic, the same calculation can sometimes be expressed without any conditionals.

Even if you don't intend to work in any of the above scenarios, it is still a good idea to study and understand bitwise operations - all modern computers are binary, and you definitely need to know the basic principles by which they operate. Numbers in a computer don't behave like numbers in the real world, and studying binary operations will help you understand why.

Title: What is the benefit of studying bitwise operators?

Body:
What is the benefit of studying bitwise operators (Bitwise Not, Bitwise AND, Bitwise OR, Bitwise XOR, Left Shift, Signed Right Shift, Unsigned Right Shift etc.)?

Will we really use these operators in programming?


问:
Advantage of using Swing over AWT
Why is Swing preferred over AWT?

Which Swing component could be used for playing a video on it?

答:
AWT is older than Swing and supports only a limited set of components. Otherwise you have to write your own such as tables/data grids for example (typically, you will have to write your own video player, good luck !). Swing is more "modern" as Sun engineers learned from their AWT mistakes and made something better, albeit more complex. Both Swing and AWT are event-based so if you know event-driven programming you will be at home. The learning curve is a bit steeper with Swing because of the larger number of available classes, though by practicing a bit with tutorials you should quickly be fine.

Check out this IBM presentation on SWT, Swing & AWT, it really is a good read. Also AWT vs Swing.

As to how you can play video on Java: https://stackoverflow.com/questions/4569490/how-to-play-video-in-java-using-swing

Title: Advantage of using Swing over AWT


问:
What do you consider to be the prime cause of software defects (and how to minimize them)
I define defect as :

"something within the application design or code which prevents it functioning as per requirements."

I'm looking for ideas about the causes of defects, eg the human factor, lack of testing, lack of prototyping, and possible ideas to mitigate these.

答: The failure to understand software as a network of state machines, the principles underlying their operation (states, their determination and transitions), and the interactions of the state machines.</p>


答: I work in the embedded field and being completely at home with bitwise operations is a sine qua non for anyone that wants to work here.  It is one of the first interview questions that I ask.  All of our software has a very intimate relationship with the hardware most of which is controlled by modifying single bits in hardware registers.  Changing the wrong bit has disastrous consequences.</p>


问:
What to do if boss always postpones major decisions about requirements and overall design?
When starting a new project, my boss always avoids to make fixed decisions. He is usually saying: ok, just start to write something and be as generic as possible. When you're finished we look how we continue. His argument is basically that you never know and "agile development".

To keep the question as generic as possible: what do you do if your boss doesn't like to make decisions?

Just stick to it and write code that might undergo heavy refactoring and partial rewriting a few weeks later? Or keep on discussing until the boss does at least a few decisions? This is more or less my current strategy. Because it's like a law of physics, at some point something needs to be delivered. Either because the boss' boss wants to see results or because stuff is becoming ridiculous at some point.

I also observe that my boss is criticizing nearly everything. Even suggestions that are based on his own...

答:
I used to have a boss like that - in fact I would joke that his motto was "indecision is the key to flexibility".

Whatever development work you do, you're probably in a better position to solve the client's problem than your boss. If you don't know what the problem is the client is trying to solve (which is not the same thing as a spec), then someone is not doing their requirements gathering properly.

Sketch some page layouts, or build a non/semi-functional prototype. But do something. It's not clear from your post whether you're building full-client software or web-apps, but the beauty of the latter is you can release-early, release-often. Start with the bare-bones and work it up from there. A false start does no harm if it gets some dialogue flowing and some decisions made.

We have a saying around $WORK (internal web-apps) for our clients: "I'll give you something so you can tell me what you want." Be prepared to throw the first draft away, but you might be surprised how rarely you actually have to.


答:
Boost is a collections of libraries.  Next time you do a code kata, pick a library in Boost that you think may help you and use it.  The documentation is very good and you should not no problems picking up simple usages.  More complex ones will come when you try to do more clever things.

Example: a thread safe singleton with boost::thread call_once.

Example: read a configuration file of key:value using tokenizer.


答: Not much. They occasionally turn up in APIs (C/C++ particularly) that want a set of flags to be passed as a single number. But even there they're treated just like arithmetic operators (64+1 or 2<<6 | 2<<0, same diff) So if you're only working with more modern languages, they're very low priority in the pile of things you might want to learn.</p>


答:
Confrontation with a client is always a bad thing, but, I would suggest two course of action.

Don't deliver anything until your payments are up to date.

Start looking for another client/job now.


答:
It's your life, your situation, your ass on the line. But me, I would be quickly writing a series of increasingly firm letters demanding payment for work completed. If they're going under, their cash reserves are short - and you want every possible chance to get paid. I wouldn't give them the root password. Nor would I deliberately sabotage anything. The battle lines are where they are, and you negotiate from that point.

And for next time, you need to learn to quickly get on top of any late payments. Usually there is a reason - they're short on cash. After one late payment you're perfectly within your rights to insist on advance payment for the next month. In this case, you got yourself into a situation where you needed the money, but the client wasn't reliable enough to be your financial backbone. Live and learn, I guess.


答:
I have encontered this a lot...in small engineering/electronic companies where they do lot of embedded software/ hardware.

In these places SCM is not part of the electronics engineering culture. They usually have one engineer per project, who just needs to back up the latest release.

So branching/merging and even sharing code is considered irrelevent. Also, these companies are probably ISO9000, so the process, albiet weird, is probably documented.

In any case I/other developers have just started using SCM personally.

Title: Is it unusual for a small company (15 developers) not to use managed source/version control?

Body:
It's not really a technical question, but there are several other questions here about source control and best practice.

The company I work for (which will remain anonymous) uses a network share to host its source code and released code.  It's the responsibility of the developer or manager to manually move source code to the correct folder depending on whether it's been released and what version it is and stuff.  We have various spreadsheets dotted around where we record file names and versions and what's changed, and some teams also put details of different versions at the top of each file.  Each team (2-3 teams) seems to do this differently within the company.  As you can imagine, it's an organised mess - organised, because the "right people" know where their stuff is, but a mess because it's all different and it relies on people remembering what to do at any one time.  One good thing is that everything is backed up on a nightly basis and kept indefinitely, so if mistakes are made, snapshots can be recovered.

I've been trying to push for some kind of managed source control for a while, but I can't seem to get enough support for it within the company.  My main arguments are:

We're currently vulnerable; at any point someone could forget to do
one of the many release actions we have to do, which could mean whole
versions are not stored correctly.  It could take hours or even days
to piece a version back together if necessary

We're developing new features along with bug fixes, and often have to delay the release
of one or the other because some work has not been completed yet.  We also have to force
customers to take versions that include new features even if they just want a bug fix,
because there's only really one version we're all working on

We're experiencing problems with Visual Studio because multiple
developers are using the same projects at the same time (not the same
files, but it's still causing problems)

There are only 15 developers, but we all do stuff differently; wouldn't
it be better to have a standard company-wide approach we all have to
follow?

My questions are:

Is it normal for a group of this size not to have source control?

I have so far been given only vague reasons for not having source control - what
reasons would you suggest could be valid for not
implementing source control, given the information above?

Are there any more reasons for source control that I could add to my
arsenal?

I'm asking mainly to get a feel for why I have had so much resistance, so please answer honestly.

I'll give the answer to the person I believe has taken the most balanced approach and has answered all three questions.

Thanks in advance


答:
AWT components are essentially a thin layer on top of native OS GUI controls. To draw for example a checkbox, AWT components were calling underlying OS. Such approach caused two problems:

the same app had a bit different GUI behaviour under different OS

overcoming known differences caused AWT code to be bloated and IIRC a bit buggy

Because of this connection between AWT component and underlying OS control AWT controls were called "heavyweight". In contrast Swing offers, so called "lightweight" controls. They are purely Java, have no dependency on underlying OS and basically "draw themselves" using Java2D primitives (pixels, lines, brushes and so on). This approach has several advantages but what is most important -- it fixes AWT outstanding problems mentioned above.

As for Swing component for video playing, I don't think there is one, at least among standard Swing components. You may want to google for one, as it probably is already written. You can also look at JMF API, but I think you'd have to code a few bits yourself before you can display video.

Title: Advantage of using Swing over AWT

Body:
Why is Swing preferred over AWT?

Which Swing component could be used for playing a video on it?


问:
Have objects delivered in terms of code reuse?
I have often heard it said that objects have not delivered in terms of code reuse. Do you agree? If you believe that they haven't, why not?</p>

答:
I don't expect ALL objects to be reused but we do have a lot of object that we reuse on many different projects.  We also have objects that just get reused on one project.  We often will consume the same business objects (or data transfer objects) as well as business logic objects from a Click-Once desktop app, a web app and a phone app all for the same project.

Where have you heard that OO doesn't deliver on reuse?  And what was the reasoning?  Perhaps the design of their objects forced them into that situation...


答:
From my own experience working with web-applications:

(& considering storage is very cheap now-days)

Log as much available (at that very moment) info as you can.

I always include DateTime.Now in my log-strings.

I always (if it's possible) log time-duration of some specific "action".

Be consistent with your log-strings. Since always I use this kind of pattern:

"[Info X] [Info Y] [Info Z] [etc.]"


答:
I learned a lot working on this-kind of my hobby projects:

Simple games (Snake clone, Tic Tac Toe clone, etc.)

Screen-savers

Not to mention - those kind of projects are incredibly fun to work :-).

Title: Suggestions for Programs to develop for learning

Body:
i wonder apart from those very simple hello world apps, what other programs should i try developing for learning. i am entering uni next year and wonder what kind of programs will be developed in that environment.

this is not really a language specific thing, but if you want to know what i use currently mainly

windows: C#/WPF - i studied java/vb etc in poly but i think C# is the way to go, maybe even F#

web: PHP/MySQL, Zend Framework/Doctrine, + HTML/CSS/JS(jQuery) of course. looking to try google app engine with python too.

for now, i am thinking of

todo lists

apps that integrate with api eg. twitter/tumblr which i use

text editor - i am currently trying to develop a text editor that uses markdown and generates html files for viewing (link to blog entry). not very pratical after i started developing it. cos when editing theres no formatting and in HTML format, i cannot edit directly

blog software (for web)


答:
1) AWT is prehistorical FrameWork and is strong based on Windows OS

2) Swing is GUI FrameWork based on AWT, all JComponent inherits or implemetns part of usefull methods from ATW Components, sure if exist,

3) Swing implements a few of new JComponents, for example JTable, best from comparison table here

4) for video and multimedia are there lots of Custom API, (never use that) but I think that based on AWT Canvas

5) since as of the JDK 6 update 12 and JDK7 build 19 releases, promiss that you can mixing AWT and Swing Components, but don't suggest to do that, Components are painter in the Container correctly, but still there exist same difference betweens heavyweight and lightweight components as before, and you have to calculate with that

Title: Advantage of using Swing over AWT


答:
Engage in 'upward management' talk to your boss and clients, figure out some solutions, pick the best one for your team to implement, find flaws in the other ones, and 'manage' your manager into making the 'right' decision.

And of course make sure he thinks it was all his/her idea. (especially when it all goes wrong!)

Title: What to do if boss always postpones major decisions about requirements and overall design?

Body:
When starting a new project, my boss always avoids to make fixed decisions. He is usually saying: ok, just start to write something and be as generic as possible. When you're finished we look how we continue. His argument is basically that you never know and "agile development".

To keep the question as generic as possible: what do you do if your boss doesn't like to make decisions?

Just stick to it and write code that might undergo heavy refactoring and partial rewriting a few weeks later? Or keep on discussing until the boss does at least a few decisions? This is more or less my current strategy. Because it's like a law of physics, at some point something needs to be delivered. Either because the boss' boss wants to see results or because stuff is becoming ridiculous at some point.

I also observe that my boss is criticizing nearly everything. Even suggestions that are based on his own...


答:
Get a stopwatch,

Count the time you spend in the spreadsheet just for synching up versions

Count the time you spend repairing broken versions

count the number of times people shout in the hallway "i'm editing main.c!, just to make sure nobody else is right now!".

count the number of complaints you get from customers because their bugfix contained other changes

count the time delay of release just because you were unable to synch up the versions

Make a powerpoint with this data, compare with how vcs would work.

Show management


答:
Program a small game: it's fun and you learn a lot.

Some ideas:

Minesweeper

Tetris

A card game

Snake

And when it's done why not implement a highscore website...


答: Make decisions yourself and start coding. Of course, developing in a flexible way will help (read Robert C Martin's Agile Patterns, Principles and Practices if you haven't already) but all the flexibility in the world won't help if no decisions are ever made. You may find you have to just develop what you think is needed, and then modifying it as required. Often clients/bosses don't know what they want until they see it, or until they see something they don't want. This will probably take you outside the scope of being a developer, but that's life. I often find that I and my colleagues are effectively making business descisions. Sometimes these aren't questioned, and decisions I've made start driving the business, purely because no one else would make the decsision. Be sure to list ALL of you assumptions and decisions (no exceptions) and present these to your boss.


答: Sounds like they're going broke. Don't bother suing them. Just stop working and keep the root password until you get paid for the last time. If they have money they can pay you good-bye; if they have no money the root password won't do them any good anyway. IANAL.</p>


答:
Stop working.

Send them what you have done (they then have no recourse - i.e. there will be no angry telephone calls) (this goes against everything I stand for, but it will be the easiest way)

Find another job.

Put it down to experience.


答:
If you have a contract backing you up, the only correct solution is

"F*ck you. Pay me." 1

Time to get yourself a lawyer. This seems like an easy case.

[1] - http://vimeo.com/22053820


问:
What factors should be evaluated when determining a desktop software price?
What factors should be evaluated when determining a desktop software price?</p>

答:
Take it away, Mr. Spolsky: Camels and Rubber Duckies.

...One of the biggest questions you're going to be asking now is, "How much should I charge for my software?" When you ask the experts they don't seem to know. Pricing is a deep, dark mystery, they tell you. The biggest mistake software companies make is charging too little, so they don't get enough income, and they have to go out of business. An even bigger mistake, yes, even bigger than the biggest mistake, is charging too much, so they don't get enough customers, and they have to go out of business. Going out of business is not good because everybody loses their job, and you have to go work at Wal*Mart as a greeter, earning minimum wage and being forced to wear a polyester uniform all day long.

So if you like cotton uniforms you better get this right.

The answer is really complicated. I'm going to start with a little economic theory, then I'm going to tear the theory to bits, and when I'm finished, you'll know a lot more about pricing and you still won't know how much to charge for your software, but that's just the nature of pricing...


答:
Get a new job asap & Wait for your last cheque. Do your minimum notice period and walk out.
As for the root password, It is your professional responsibility to FORGET it as soon as you walk out the door. (Consequences of said professional behaviour is not your problem, & if they ask for it before you leave you give it to them.)

btw- IANAL etc....


问:
Tips/advice on how to reduce the use of "manager" classes?
I sometimes hear that having too many "manager" classes in your program's design is code smell and add an unnecessary layer of complexity. To me it makes sense that people want to use manager classes for manipulating and controlling objects from a context that makes sense to them, but figuring out how to make a solution work without them can be confusing.

Should one really avoid manager classes as much as possible? Also, what articles/papers should I read on how to implement an alternative work around for general/common cases where these managers can be removed?

答:
Having lots of "manager" classes is often a sympton of an anemic domain model, where the domain logic is hoisted out of the domain model and instead placed in manager classes, which more or less equate to transaction scripts. The danger here is that you're basically reverting to procedural programming - that in itself may or may not be a good thing depending on your project - but the fact that it wasn't considered or intended is the "code smell" imo.

Following the principle of the "information expert", a logical operation should reside as close to the data it requires as possible. This would mean moving domain logic back into the domain model, so that it's these logical operations which have an observable effect on the state of the domain model, rather than transaction scripts changing the state of the domain model from the outside.


问:
Is it possible for two DLLs to conflict , preventing solution to build
Though I have a specific case, but I was wondering about the general situation.

Can two DLLs, when added as Reference to a Visual C# project collide with each other to prevent the solution from building? If this is the case, what are the possible ways to mitigate this.

答:
This is very possible.

If you have defined an identical namespace and type name on different assemblies (or in your project and the added assembly), you will get a conflict with any code that tries to use one or another of these types.

If you ensure you have unique namespaces, as do your references you wouldn't have this problem.

Another possibility has to do with different versions of a dependency - if your project uses (for example) a logging library at version 1.2, but the added assembly has a dependency on the same assembly but a different version (say 1.3) and either your project or the added assembly has been configures/built to use a specific version, you will get a conflict and the build will fail.

Both these issues can be resolved using assembly aliases, as described here.


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

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

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

Values

What constitutes "well-written" software?

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

Process

Do you have a development process?

How rigorously do you follow it?

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

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

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

Testing

Who develops tests (developers or separate test engineers?)

When are they developed?

When are the tests executed?

How long do they take to execute?

What makes a good test?

How do you know you've tested enough?

What percentage of code is tested?

Review

What is the review process like?

What percentage of code is reviewed?  Design?

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

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

Improvement

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

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

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

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

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

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

Ethics

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

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

Follow-Ups

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

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

@SethP added:

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

答: Try to find some of the employees' Twitter accounts. If you see them mentioning overtime or long work hours a lot, it might be wise to investigate a bit more or even avoid the company.</p>


答: Sometimes its actualy customer request (comming from customer internall politics). Then its hopeless and must be done (but management should also consider whether continue such project or whether should they renegotiate price.)</p>


答:
You can put as many different versions of an assembly as you want in the Global Assembly Cache provided that they are strong-named. This may help you if you want different applications to use different versions of an assembly, machine-wise. However using different versions of an assembly in ONE application will still get you in trouble. </p>

<p>What is the reason for you to need both versions at the same time ? </p>

Title: Is it possible for two DLLs to conflict , preventing solution to build

Body:
Though I have a specific case, but I was wondering about the general situation.

Can two DLLs, when added as Reference to a Visual C# project collide with each other to prevent the solution from building? If this is the case, what are the possible ways to mitigate this.

Body:
You can put as many different versions of an assembly as you want in the Global Assembly Cache provided that they are strong-named. This may help you if you want different applications to use different versions of an assembly, machine-wise. However using different versions of an assembly in ONE application will still get you in trouble.

What is the reason for you to need both versions at the same time ?


答: WTF?! This may be the most ridiculous question I've ever seen. You need to find a new job. 15 developers?! You think that's a small team? This is insane. Manager should be immediately terminated. Honestly, I'm going to have  nightmares after reading this question. Please tell us the product you sell so we all know not to buy it! I don't know what's scarier, this question, or answers saying this is not unusual!</p>


问:
Why do people still say Java is slow?
For a long time in SO and in other places Java has the reputation of being slow. From jokes to many comments in questions and answers, people still believe Java is slow based solely on experience with it in the 90s.

This is my issue: we have disproved (most) of the reasons that people believe Java is slow. Outside of small things, Java is pretty fast.

So why is it that people still refuse to believe Java is fast now? Is it part of their mindset that anything thats not C/C++ is slow? Is it because people don't check over time? Is it because people are just biased?

答:
It depends what you means as being slow.

First of all, java as made many progress recently and is very fast in most cases. But :

Java is slow at startup, because you have to load the JVM before doing
anything.

Some security feature can kill performances in some cases. Bound check with random access is an exemple.

Make something really fast in java require to work against the JVM (to take advantage of cache line for exemple).

The lack of metaprogramming imply a penality at run time with each abstraction, thus performance come to the cost of design in many cases.

Java can hardly ensure real time constraint - by design - and this could be considered as « being slow » by some people.

By the way, java is, in some cases, faster than vanilla C/C++. But thoses languages gives you the tools to tweak them.

Java is a programming language aimed at productivity. Now it is fast enough for most applications, but isn't enough for some others.

In general, Java's slowness is an overused argument because it's irrevelant in most cases.

Title: Why do people still say Java is slow?


答:
Yes, this is very possible.

Let's say you added a reference to some DLL which uses the old version of Lucene.Net and you want to include the latest version.

You could solve that problem by using extern aliases: http://msdn.microsoft.com/en-us/library/ms173212.aspx


答:
The performance of Java is very subjective however, the perception of why Java is slow is largely for reasons that others have noted: most peoples perception of something is colored by their earlier experience with it and Java hasn't always been a well optimized language under the hood. Likewise, vanilla Eclipse isn't exactly a fast IDE to work with and pales in terms of responsiveness when compared to an IDE like Visual Studio.

That said though, outside of the UI issues that Java has at start-up, it is fast enough for most applications. If you search you can find articles that compare it with other languages and most of the results presented put it into the range where it will only be an issue when you are dealing with major data sets.

In the bioinformatics field it is used quite a bit because it is well supported and there is already an installation base for, one of the advantages that Java has is that you can do some fairly rapid development with it that you can't do with C. If you look at the languages used for bioinformatics (I personally use R, Python, and Java regularly) you will note that none of them is exactly the fastest and it isn't unusual for the data sets in bioinformatics to run into the 100's of gigabytes of information. At the end of the day, human time is still more valuable and while the speed differences are noticeable, the size of the data sets tend to be large enough that they run overnight anyway.

If it were easier to write a snappy UI in Java it is quite like that the speed perception would fall off the radar as most people do not push languages enough that speed is really an issue on a daily basis.

Title: Why do people still say Java is slow?

Body:
For a long time in SO and in other places Java has the reputation of being slow. From jokes to many comments in questions and answers, people still believe Java is slow based solely on experience with it in the 90s.

This is my issue: we have disproved (most) of the reasons that people believe Java is slow. Outside of small things, Java is pretty fast.

So why is it that people still refuse to believe Java is fast now? Is it part of their mindset that anything thats not C/C++ is slow? Is it because people don't check over time? Is it because people are just biased?


答:
Opinions are opinions, and facts are facts.

Here's a fact from the Google Code Jam, which arguably challenges programmers to solve tough computing problems in a short period of time, meaning that performance of the language they use play an important role:

During the past editions (2009, 2010, 2011), around 75% of the programmers who arrived at the final rounds were using C++, as opposed to around 15% using Java.

Source -> http://www.go-hero.net/jam/

Title: Why do people still say Java is slow?


问:
What imperative programming languages do not support recursion?
To my knowledge, all modern imperative programming languages support recursion in the sense that a procedure can call itself. This was not always the case, but I cannot find any hard facts with a quick Google search. So my question is:

Which languages did not support recursion right from the start and when was that support added?

答: Some c compilers for small microcontrollers don't support recursion, presumably because they have an extremely limited stack size.</p>


问:
Should we (still) consider a synced XMLHTTPRequest bad practice?
As you may know, XMLHTTPRequest can be used synchronously or asynchronously, but synchronized requests have always been considered bad practice, and I've always agreed with that.

Not only is the ideology of modern JS development heavily based on an event model, but there were also some more prosaic reasons to avoid synchronized requests. For example, old Internet Explorer versions could just freeze suddenly.

Today I saw a synchronized request in Liferay source code and thought "What a shame, how dare they. Don't they know that it is wrong?". But then I asked myself what is actually wrong with this approach in modern times, and I wasn't able to give an accurate, logical answer.

For example, on the server side it is common practice to use synchronized HTTP requests.
Of course all the data could be fetched asynchronously, and perhaps should be fetched that way, but we often need data that will be used to fetch another chunk of data, so in that case the request must be synchronized.

So, should this still be considered bad practice?

PS: I haven't used the term AJAX since the first A stands for asynchronous. :)

答:
In short, yes.

Synchronous HTTP requests halt execution of subsequent code while they are en route. While browsers may no longer block the UI during this time, we're relying on the user's available bandwidth, network reliability, and the server's current load for the performance of our code. This is generally not good practice.

On the MDN "Using XMLHttpRequest" page, there is also a vague warning about memory use and event leakage when using synchronous XMLHttpRequest. There is no detail given, but given that the UI is not blocked, and JavaScript is, it would make sense that we might miss UI events we would have caught had we been using Async.

Note: You shouldn't use synchronous XMLHttpRequests because, due to
  the inherently asynchronous nature of networking, there are various
  ways memory and events can leak when using synchronous requests.

Edit: Server Side

While I agree that synchronous requests are common, I don't know that they're best practice. They may, however, be better practice on the server than on the client. It is better to put faith in your own server and its network connections than it is to put faith in those of your user. The server is (theoretically) a constant, the client is a variable. There are also no UI issues to deal with, and no possibility of uncaptured events.


问:
What electronic user-story-mapping tools can you recommend?
Agile software development relies heavily on a work item type called user stories.  For example, you have a backlog full of user stories and you can select a few of them to work on during the next sprint.

But where and how do you find user stories to put into the backlog?  There is a popular technique for doing that called story mapping.  Jeff Patton invented it and here is the definitive guide on how to do it.

The question is, what electronic tools are out there that support Patton's story-mapping technique?

I've done a bit of research, found Pivotal and Rally plug-ins (but I'm not a customer of either) and I'm currently experimenting with SilverStories.

What other tools are out there?  What have you used?  What do you (not) recommend?  Why?

UPDATE: Some people who wrote comments seem to lean towards an answer that applying this technique is simply impossible with an electronic tool and we should just accept that.  Can't someone write it up as an answer?

UPDATE (to clarify the question in light of Alex Feinman's comment): the question is about identifying options for story-mapping.  Since Jeff Patton's technique can obviously be done on a white-board with stickies, the question focuses on additional options that might be provided with electronic tools.  (Premature) commitment to any particular tool or class of tools is not the point of this question.

答:
Silver Stories made by Silver Stripe Software seems to fit the requirements of this question.  (They reached out to me after I complained online about my problems with their product and got the problem resolved.)

I've been able to use the story-mapping technique with this tool and create a small sample story map:

I've been also able to take stories identified my the mapping exercise into the backlog and start pulling them across a kanban board:

This tool is definitely an option if you want to start with story-mapping.  Of course, the real-world maps will be much larger and a large flat-screen monitor is recommended.


答:
For sure. You can get the "Ambiguous Reference" compiler error, when two objects cannot be distinguished. Typically, you can specify the full path in code and it will not cause an issue, but if the dlls were fully identical, then you would not be able to distinguish between two object in any way. Sya we have two dlls:

System.IO which contains the File class

and

MyProject.IO which contains a File class

If you were to have something like this...

```<code>using System.IO;
using MyProject.IO;

...
private void foo()
{
    File f = new File();
}
</code>```

... you would have an ambiguous reference, since there is no way to tell which file you are talking about. This would fix it:

```<code>using System.IO;
using MyProject.IO;

...
private void foo()
{
    MyProject.IO.File f = new MyProject.IO.File();
}
</code>```

The only way it would be difficult to fix would be if "File"'s path was identical in both assemblies, but that would require the unlikely situation where two dlls had an identical namespace structure. For example, my situation above would never happen, since no one is going to name there project "System" (with the exception of the actual developers of the .Net framework).

Body:
For sure. You can get the "Ambiguous Reference" compiler error, when two objects cannot be distinguished. Typically, you can specify the full path in code and it will not cause an issue, but if the dlls were fully identical, then you would not be able to distinguish between two object in any way. Sya we have two dlls:

System.IO which contains the File class

and

MyProject.IO which contains a File class

If you were to have something like this...

using System.IO;
using MyProject.IO;

...
private void foo()
{
    File f = new File();
}

... you would have an ambiguous reference, since there is no way to tell which file you are talking about. This would fix it:

using System.IO;
using MyProject.IO;

...
private void foo()
{
    MyProject.IO.File f = new MyProject.IO.File();
}

The only way it would be difficult to fix would be if "File"'s path was identical in both assemblies, but that would require the unlikely situation where two dlls had an identical namespace structure. For example, my situation above would never happen, since no one is going to name there project "System" (with the exception of the actual developers of the .Net framework).


问:
is it a reasonable practice to extend a class just to reuse a single function?
I am developing a range of post filters for a wordpress site, and I have built the first 4 with a single class.

The final two are different enough in scope to only share a single function (the function for producing the final links) in their classes.

Is it reasonable, either in this instance or in any number of similar hypothetical instances, to extend the original class in order to have that functionality, or is there a better way?

答: If a class description has the word "and" in it, it should be broken down into two (or more) classes.  By the looks of things, you could make that function a member of another class that is referenced by the ones you currently have.


答:
No, if the two classes are so different that they only share one function, the chances are they are not interchangable - and therefore they would break the liskov substition principle.

Only derive from a base class if it's logical to do so. Sharing a single piece of code is rarely a justification for inheritence :)

In this particular example it sounds like you want to re-use that function via composition instead...

Title: is it a reasonable practice to extend a class just to reuse a single function?

Body:
I am developing a range of post filters for a wordpress site, and I have built the first 4 with a single class.

The final two are different enough in scope to only share a single function (the function for producing the final links) in their classes.

Is it reasonable, either in this instance or in any number of similar hypothetical instances, to extend the original class in order to have that functionality, or is there a better way?


问:
Refactoring or upgrading databases to handle new features
Several responses to a database schema question, suggested an additional table to normalize a database for a feature that is not part of the current requirements (A UserDepartment table to allow for a many-to-many relationship between employees/users and different departments they may belong to.).

Not against normalization. Seems like when it comes to database design, there is a strong push to include features that they're 'sure' someone will want in the future. Is it so difficult to add tables/fields to the database to accomodate features that there is a tendancy to over-engineer? Wouldn't they be refactored or upgraded just like the rest of the app if needed? Redoing things is never fun, but moving data from one table to a new one can be done. Just not sure where this line of thinking will end.

Edit: There is so much of an aversion to this, I wonder how many projects end up not adding a feature that requires a drastic database change or are non-normalized approaches taken like adding a DepartmentID2 field instead of a new table. The need for multiple departments for an employee is a common domain problem. I just haven't noticed many database schemas that are littered with many-to-many relationships.

答:
There is an entire book written about database refactoring. Just like with code refactoring, there are standard ways to do database refactoring. The only difference is that when doing code refactoring, you don't have to consider the state of the object/code, while in databases you have to consider the data, because losing data is not good for the users (or for anyone, actually).

You can read more about database refactoring here.


答:
BASIC, in the days of line-numbers, tended to have poor recursion support. Many (all?) BASICs of that time supported nested gosub calls, but did not support an easy way of passing parameters or return values in a way that made it useful to self-call.

Many early computers had problems with recursion, because they used call instructions that wrote the return address into the beginning of the routine called (PDP8, the IAS family of machines, probably more architectures I am unfamiliar with), usually in such a way that it was the machine code for "Jump to the instruction after the one that called the routine".

Title: What imperative programming languages do not support recursion?

Body:
To my knowledge, all modern imperative programming languages support recursion in the sense that a procedure can call itself. This was not always the case, but I cannot find any hard facts with a quick Google search. So my question is:

Which languages did not support recursion right from the start and when was that support added?


问:
Is it unusual for a small company (15 developers) not to use managed source/version control?
It's not really a technical question, but there are several other questions here about source control and best practice.

The company I work for (which will remain anonymous) uses a network share to host its source code and released code.  It's the responsibility of the developer or manager to manually move source code to the correct folder depending on whether it's been released and what version it is and stuff.  We have various spreadsheets dotted around where we record file names and versions and what's changed, and some teams also put details of different versions at the top of each file.  Each team (2-3 teams) seems to do this differently within the company.  As you can imagine, it's an organised mess - organised, because the "right people" know where their stuff is, but a mess because it's all different and it relies on people remembering what to do at any one time.  One good thing is that everything is backed up on a nightly basis and kept indefinitely, so if mistakes are made, snapshots can be recovered.

I've been trying to push for some kind of managed source control for a while, but I can't seem to get enough support for it within the company.  My main arguments are:

We're currently vulnerable; at any point someone could forget to do
one of the many release actions we have to do, which could mean whole
versions are not stored correctly.  It could take hours or even days
to piece a version back together if necessary

We're developing new features along with bug fixes, and often have to delay the release
of one or the other because some work has not been completed yet.  We also have to force
customers to take versions that include new features even if they just want a bug fix,
because there's only really one version we're all working on

We're experiencing problems with Visual Studio because multiple
developers are using the same projects at the same time (not the same
files, but it's still causing problems)

There are only 15 developers, but we all do stuff differently; wouldn't
it be better to have a standard company-wide approach we all have to
follow?

My questions are:

Is it normal for a group of this size not to have source control?

I have so far been given only vague reasons for not having source control - what
reasons would you suggest could be valid for not
implementing source control, given the information above?

Are there any more reasons for source control that I could add to my
arsenal?

I'm asking mainly to get a feel for why I have had so much resistance, so please answer honestly.

I'll give the answer to the person I believe has taken the most balanced approach and has answered all three questions.

Thanks in advance

答:
It seems that you are some convinced, but someone in the organization is not empowering you to do it.  As you can read from the other comments, you should do it.

You can find some information here: http://www.internetcontact.be/scm/?page_id=358

The most important factor is that your customers are forced to the last 'instable' branch and if your contracts with your customers makes you responsible for deploying instable versions, your company is losing money.  You should really focus on release stability here.  This is the main reason for source control, and as it seems your main failure.  The others will not be improved that much by using source control as you already have alternative systems in place.


答:
Because it is, can we close this topic once and forever?

https://days2011.scala-lang.org/sites/days2011/files/ws3-1-Hundt.pdf [scroll down to tables, Java is 3.7-12.6 times slower than C++, research by Google employees]

P.S.: If it's not, name me at least one snappy Java app for a start, haven't seen one before.

Title: Why do people still say Java is slow?