答: I agree with the author, mostly.  If there is any behavior peculiar to a field, like validation of an order id, then I would create a class to represent that type.  His second point is even more important: if you have a set of fields that represent some concept like an address, then create a class for that concept.  If you are programming in Java, you are paying a high price for static typing.  You may as well get all the value you can.

Title: Never use Strings in Java?


问:
How can I defend Ruby on Rails against customers' not technical opinion?
My customer, a translations business owner, just told me that he has been reading about Ruby on Rails and told me that "there are more PHP guys around there" and "it seems the community prefers it".
What would you, as software engineer and freelancer, say to the customer to achieve these goals:

Sell

Make him see that the technology is my expert decision and Rails
is as good or better than PHP (+ whatever framework) for this
particular project.

UPDATE:
Thank you all for the suggestions! Tomorrow I've got another meeting with him, let's see how it goes, I will update again :)

UPDATE 2:
Finally I told him to read this thread and the result has been fantastic: He gave me the project and we are going to start right now. Thank you all for the help, you have free beer in my charge if we see someday :)

BTW: I learned the lesson: be as transparent as possible, because if you believe in yourself and your work, there is no question compromising enough to beat you.

regards

答:
I think you make a mistake in assuming that the choice of technology is a purely technical decision.

The customer seems to be concerned about the business implications of picking a particular technology.  Given that, you need to present a case that addresses his business concerns at least as heavily as your technology opinions.

Employers have to recruit from a particular geographic area and certain areas have particularly active communities around particular technology stacks.  If you're starting a business in the Pacific Northwest of the US, for example, there would be a strong bias towards a Microsoft stack simply because Microsoft is very influential in the area so most of the developers you'd be looking to hire would have experience with that stack.  Other geographical regions have very different profiles.

Talk with your customer and understand why and how he formed his opinion.  Perhaps he read that the local PHP community is particularly active or that the local college teaches a lot of PHP and no Ruby.  Perhaps he's got a trusted developer that he can call in for the occasional emergency that is a PHP pro and a Ruby neophyte.  Of course, it's also possible that he's using poor metrics like the number of job ads or resumes that mention various keywords.

Employers have to be concerned with the long-term sustainability of technology stacks.  Years ago, for example, lots of companies invested a great deal of time and effort building PowerBuilder apps (and other languages of that genre).  PowerBuilder often made it very easy to build line of business apps and developers at the time were often quite enamored with it.    Unfortunately, the PowerBuilder community more or less collapsed leaving companies in a situation where they had a lot of existing code in a language no one really wanted to use where they had difficulty getting competent developers to maintain the existing code and expensive, time-consuming projects to migrate those apps to other technology stacks.  The relative technical merits of PowerBuilder were vs. Java or C++ or C# or whatever they migrated to at that point; it was a death spiral since developers didn't want to get stuck working in a language that companies wanted to migrate away from and companies saw the lack of developers as a sign they should redouble their migration efforts to ensure they had the capacity to do the development the business needed.

Relatively niche languages like Ruby absolutely have the potential to create these sorts of legacy problems for companies who can't predict whether the language is going to fizzle out in a few years when people move on to the next fad or if it has real staying power.  You can certainly mitigate this by pointing out that Ruby isn't dependent on one company or organization so no one can decide it is no longer a strategic product for the company.  If your customer has been burned in the past by having applications developed in languages that became business headaches, you'll need to make a case that Ruby is more like Linux and other open source technologies that flourished without a company backing them than languages that have died out over the years.

Employers want consistency in the environment so choosing a language for one project forces a choice for many others.  Even if Ruby is technically ideal for the project you're pitching, you have to explain why it's appropriate for every other application this customer is going to need developed or explain what mix of technologies you believe are appropriate (i.e. Ruby for X, something else for Y).  Dealing with heterogeneous technologies, however, inevitably translates into extra cost for the business.

OwnerDisplayName: okeen

ContentLicense: CC BY-SA 3.0


答:
Your boss has a point.  PHP is much more popular than RoR accoding to several sites that endeavor to keep track of such things. For example, see http://lang-index.sourceforge.net and http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html>.  I think it would be foolish to ignore the facts.

I suggest you acknowledge he has a point and then remind him that RoR is has a strong following too.  It wouldn't hurt to have a few links to popular sites built with RoR that you can show him.

After all, he is really looking for your assurance that he is making the right business decision and wants the evidence to back it up.  As the old saying goes "No one ever had arrows shot at them for recommending Microsoft."  Same goes for PHP in web development.  Give him solid facts and eschew opinions.  You'll do fine.

Title: How can I defend Ruby on Rails against customers' not technical opinion?

Body:
My customer, a translations business owner, just told me that he has been reading about Ruby on Rails and told me that "there are more PHP guys around there" and "it seems the community prefers it".
What would you, as software engineer and freelancer, say to the customer to achieve these goals:

Sell

Make him see that the technology is my expert decision and Rails
is as good or better than PHP (+ whatever framework) for this
particular project.

UPDATE:
Thank you all for the suggestions! Tomorrow I've got another meeting with him, let's see how it goes, I will update again :)

UPDATE 2:
Finally I told him to read this thread and the result has been fantastic: He gave me the project and we are going to start right now. Thank you all for the help, you have free beer in my charge if we see someday :)

BTW: I learned the lesson: be as transparent as possible, because if you believe in yourself and your work, there is no question compromising enough to beat you.

regards


问:
Has anyone used functional testing tools to grade student lab exercises?
I'm working on classes that cover software tools and languages.  Obviously the classes are going to be more valuable if the students actually do some of what they're supposed to be learning, so I'm planning to incorporate lab work.

Has anyone used automated functional testing tools to grade lab assignments?  Lab 1 is to install Apache, so the testing server looks to see that your lab machine is listening on port 80, and responds with the default index page.  Lab 2 is to create a page that takes ?name=MyName and responds "Hello, MyName!", so the testing server GETs ?name=random and expects "Hello, random!".

If you haven't used them this way yourself, what tools might be a good candidate?

答:
What tools might be a good candidate?

curl is always a good place to start.

pyCurl might be easier to script and automate.

Selenium can do almost anything browser-related, but it's probably overkill for such simple assignments.

Yes, I actually wrote this kind of homework-runner a long, long time ago.  So long ago, it's hard to imagine.  It run on an OS called TOPS-10.


问:
Never use Strings in Java?
I stumbled upon a blog entry discouraging the use of Strings in Java for making your code lack semantics, suggesting that you should use thin wrapper classes instead. This is the before and after examples the said entry provides to illustrate the matter:

```<code>public void bookTicket(
  String name,
  String firstName,
  String film,
  int count,
  String cinema);

public void bookTicket(
  Name name,
  FirstName firstName,
  Film film,
  Count count,
  Cinema cinema);
</code>```

In my experience reading programming blogs I've come to the conclusion that 90% is nonsense, but I'm left wondering whether this is a valid point. Somehow it doesn't feel right to me, but I couldn't exactly pinpoint what is amiss with the style of programming.

答:
Although it is kind of overkill, I often think most stuff I've seen is under-engineered instead.

It's not just "Safety", One of the really nice things about Java is that it helps you a lot with remembering/figuring out just what any given library method call needs/expects.

The WORST (by far) Java library I've worked with was written by someone who was very fond of Smalltalk and modeled the GUI library after it to make it act more like smalltalk--the problem being every method took the same base object, but couldn't actually USE everything that the base object could be cast to, so you were back to guessing what to pass into methods and not knowing if you had failed until runtime (Something I used to have to deal with every single time when I was working in C).

Another issue--If you pass around strings, ints, collections and arrays without objects, all you have is balls of data with no meaning.  This seems natural when you think in terms of libraries that "some app" will use, but when designing an entire app it's much more helpful to assign meaning (code) to all your data in the place where the data is defined and only think in terms of how these high-level objects interact.  If you are passing around primitives instead of objects then you are--by definition--altering data in a place different from where it's defined (This is also why I really don't like Setters and Getters--same concept,  you are operating on data that isn't yours).

Finally, if you define separate objects for everything you always have a great place to validate everything--for instance if you create an object for zip code and later find that you have to ensure that the zipcode always includes the 4 digit extension you have a perfect place to put it.

It's not actually a bad idea.  Thinking about it I'm not even sure I'd say it was over-engineered at all, it's just easier to work with in nearly every way--the one exception being the proliferation of tiny classes but Java classes are so lightweight and easy to write that this is hardly even a cost (they can even be generated).

I'd be really interested to see a well-written java project that actually had too many classes defined (Where that made it harder to program), I'm beginning to think it's not possible to have too many classes.

Title: Never use Strings in Java?


问:
How to name a private method in a language which doesn't support privacy?
What's the coding standard for naming a private method in a language which does not have the private modifier? Specifically, I am talking about Javascript. Below I've placed an underscore at the end of my private method's name, but a colleague told me that underscore is usually for class fields.</p>

```<code>var MyClass = Class.create({
    initialize: function() {
        alert('constructor');
    },
    publicMethod: function() {
        alert('i am public');
    },
    privateMethod_: function() {
        alert('i am private');
    }
});
</code>```

答: As everyone told you in a comments, most people(and some languages) use single underscore.</p>


问:
How should I deal with nested compositions?
I came across the following question on a website for interviews:

Here are 3 products: table, chair and bench. Product can be of material: wood, metal, and plastic. Design class structures for this.

My first thought was to have an abstract class Product with a protected Material class member as shown below. My actual question is after the code block below

```<code>#include <stdio.h>
#include <string>
using namespace std;

class Type {
    public:
    // Commented out virtual below. Was a typo !
    /*virtual*/void SetType(string s) {
        m_typeName = s;
    }
    virtual void PrintType() {
        printf("Type = %s\n",m_typeName.c_str());
    }
    virtual ~Type()=0;
    Type& operator=(const Type& rhs) {
        if ( &rhs != this ) {
            m_typeName = rhs.m_typeName;
        }
        return *this;
    }
    private:
    string m_typeName;
};
Type::~Type() {}

class Wood: public Type {
};

class Plastic: public Type {
};

class Product {
    public:
    Product():m_type(NULL) {
    }
    virtual void SetType(Type* t){
        m_type = t;
    }
    virtual void PrintInfo() {
        printf("I am %s product\n",m_productName.c_str());
        m_type->PrintType();
    }
    virtual ~Product()=0;
    protected:
    string m_productName;
    Type* m_type;
};
Product::~Product() {}

class Table: public Product {
    public:
    Table() {
        m_productName = "table";
    }
};

class Chair: public Product {
    public:
    Chair() {
        m_productName = "chair";
    }
};

int main()
{
    Plastic *p = new Plastic();
    p->SetType("plastic");

    Table *t = new Table();
    t->SetType(p);

    t->PrintInfo();

    delete t;
    delete p;

    return 0;
}
</code>```

However, I have a feeling it could be designed better.

In general, if your compositions (Product in the example) contain compositions (Material in the example), what is a good design pattern?

答:
The drawback of your approach is that you must explicitly make a new "Product" class for each product type.  Since this is c++, you then need to know your products at compile time.  Every time you add or remove a product, you must recompile.

A different design may be to have products be defined by data.

Look into a "Component Based" approach to facilitate "Data-driven" programming.

This way, the program wouldn't need to know the type of products it was dealing with.  More importantly: The programmer wouldn't need to know about the products themselves.  The data can be populated by someone at the company more familiar with the products, leaving the programmer to program!

OwnerDisplayName: curryage

OwnerDisplayName: Jon G.


答:
Well, I see a few problems(or at least thinks I would do differently) with your code/design:

It doesn't conform to the rule of three, since you have written your own operator= for Type, but use the compiler generated copy constructor. Sincy you don't do any manual resource management I would suggest ditching the manually written operator=, the compiler generated one should suffice nicely.

Why do you have avirtual methods to set a private variable? Since the variable can't be accessed from derived classes it doesn't really make sense to make the setter virtual.

I would suggest writing apropriate operator<< for streamout instead of having print methods which call printf.

You do have an implementation for your purely virtual destructors, right? since they still need to be called from the derived classes destructors

I would generally call APIs which require the user to call a specific method after initialising an object badly designed (of course there might be exceptions). So the type should really be a constructor parameter (and shouldn't an object of type Plastic know that it is a Plastic (so the default constructor should set the Type).

Using using namespace std; in what appears to be a header isn't really a good idea, since it pollutes the current namespace.

Using a raw pointer which is passed from outside of the object (your m_type) is kind of dangerous unless you can guarantee that the pointed to object isn't deleted before the lifetime of your object ends (which you can't in this case). One way to solve that is using managed pointers (std::shared_ptr, std::tr1::shared_ptr or boost::shared_ptr) and make a deep copy of the pointed to object if it is passed as a raw pointer (which would need you to add a virtual deep copy method to each baseobject and override it for every derived one). Another way is to have a design where you don't need the pointers, meaning you don't use any kind of hierarchy for Type.

Personally I would probably ditch most of the inheritance and have only a Type and a Product class, which have members expressing what they are (strings or enums (or whatever) depending on what seems best in that case), unless the question explicitely they should be seperate classes (or specifies functionality which mandates they should be). Unnecessarily convoluted designs are rarely helpful afterall.

I should also add that I do not think that this is a good interview question (at least unless the original question has more details then you passed on), since it lacks any details on how the classes should be used. This means that any design decisions are basically guesswork (which is why I would go the way of KISS and don't use much of a class hierarchy). So if that came up in an interview I would ask to clarify the requirements.

Title: How should I deal with nested compositions?

Body:
I came across the following question on a website for interviews:

Here are 3 products: table, chair and bench. Product can be of material: wood, metal, and plastic. Design class structures for this.

My first thought was to have an abstract class Product with a protected Material class member as shown below. My actual question is after the code block below

```<code>#include <stdio.h>
#include <string>
using namespace std;

class Type {
    public:
    // Commented out virtual below. Was a typo !
    /*virtual*/void SetType(string s) {
        m_typeName = s;
    }
    virtual void PrintType() {
        printf("Type = %s\n",m_typeName.c_str());
    }
    virtual ~Type()=0;
    Type& operator=(const Type& rhs) {
        if ( &rhs != this ) {
            m_typeName = rhs.m_typeName;
        }
        return *this;
    }
    private:
    string m_typeName;
};
Type::~Type() {}

class Wood: public Type {
};

class Plastic: public Type {
};

class Product {
    public:
    Product():m_type(NULL) {
    }
    virtual void SetType(Type* t){
        m_type = t;
    }
    virtual void PrintInfo() {
        printf("I am %s product\n",m_productName.c_str());
        m_type->PrintType();
    }
    virtual ~Product()=0;
    protected:
    string m_productName;
    Type* m_type;
};
Product::~Product() {}

class Table: public Product {
    public:
    Table() {
        m_productName = "table";
    }
};

class Chair: public Product {
    public:
    Chair() {
        m_productName = "chair";
    }
};

int main()
{
    Plastic *p = new Plastic();
    p->SetType("plastic");

    Table *t = new Table();
    t->SetType(p);

    t->PrintInfo();

    delete t;
    delete p;

    return 0;
}
</code>```

However, I have a feeling it could be designed better.

In general, if your compositions (Product in the example) contain compositions (Material in the example), what is a good design pattern?

OwnerDisplayName: Grizzly


答:
EDIT: Per the comment below by @Raynor, the approach below is not a good way to achieve privacy in JavaScript.  See:
http://blog.jcoglan.com/2012/01/19/the-cost-of-privacy/

I use this convention:

```<code>var MyObject = (function() {
  var initFunction = function() { /* init some stuff */ };
  var privateFunction = function() { /* state secrets */ };

  return {
    init: initFunction
  };
})();
</code>```

Only the public functions are returned.  As you may guess I also tend to use only methods when using this style, no public properties.

Title: How to name a private method in a language which doesn't support privacy?

Body:
What's the coding standard for naming a private method in a language which does not have the private modifier? Specifically, I am talking about Javascript. Below I've placed an underscore at the end of my private method's name, but a colleague told me that underscore is usually for class fields.</p>

```<code>var MyClass = Class.create({
    initialize: function() {
        alert('constructor');
    },
    publicMethod: function() {
        alert('i am public');
    },
    privateMethod_: function() {
        alert('i am private');
    }
});
</code>```

Body:
EDIT: Per the comment below by @Raynor, the approach below is not a good way to achieve privacy in JavaScript.  See:
http://blog.jcoglan.com/2012/01/19/the-cost-of-privacy/

I use this convention:

var MyObject = (function() {
  var initFunction = function() { /* init some stuff */ };
  var privateFunction = function() { /* state secrets */ };

  return {
    init: initFunction
  };
})();

Only the public functions are returned.  As you may guess I also tend to use only methods when using this style, no public properties.


答: When I have a client who is wanting to use a particular tool because it's "industry standard," has a "consensus," or is "what everybody's using," I point out to them that all those terms are code for "industry average."  That is, what most of the other people in the area are doing.  The "average" business fails.  Pick your tools based on the job requirements, not on what everyone else is doing.  There being fewer RoR programmers doesn't matter if the system doesn't need as much tinkering with when it's done.</p>


答:
Without delving too deeply into architectures this can be seen as a good place for dependency injection, a variant on components.  The basic solution to your problem would be to create an interface (aka pure virtual class) for the "material" and embed a pointer to one in your furniture class.  When that furniture is constructed you pass in a material for it to use.  Extend that with a Design interface for what kind of furniture it is and you're golden.  Alternately your Design class holds the Material pointer which gets injected when it is created, which all then gets injected into the Furniture.

In this way your furniture can easily be extended to be made from concrete, styrofoam, or whatever else comes to mind and all without writing any new Furniture code but only new Materials.  And should a sudden need for brick BBQ grills arise, you're ready with just a little work.

Here's a link to a really simple explanation of what dependency injection is, since it's a simple idea: Without delving into gaming architectures this can be seen as a good place for dependency injection, a variant on components.  Here's a link to a really simple explanation of what dependency injection is, since it's a simple idea: http://jamesshore.com/Blog/Dependency-Injection-Demystified.html


答:
Your customer hired you, so presumably he trusts your expertise. Explain that different professionals may prefer different tools, and your preferred tool happens to be RoR. Point out the presence of the community and the community acceptance that exists for RoR and successful companies like 37signals using it, to remove his concern that you are recommending some arcane technology that nobody but you knows about. Point out that you will be more productive using the tools you prefer (thus lowering his costs and improving his changes on success) and that if you or him ever need to find more RoR experts it won't be hard to do. If he's more technical you may point out how RoR can be successful in the tasks he needs compared no less than his preferred solution.

Avoid repeating FUD and generally disparaging PHP - if you're not an expert in PHP, there's a high probability you'll say something that is not accurate, wrong or highly controversial, and if your customer learns you were wrong on that it may hurt your credibility with him in other aspects.


答: The best real world analogy I can come up with is "Would buy a Ford rather than a BMW just because BMW's market share is smaller?".</p>


答: Your customer could have a valid point.  Supply and demand affects prices.  If the supply of developers with a particular skill in the customers geographic area is low, the price for maintaining software requiring that rarer skill set could increase more over time than if the software were developed using a more popular language for which there was a significantly larger local pool of skilled developers.  So the issue could also be one of long term cost risk management.</p>


问:
What was your most difficult bug hunt and how did you find it and kill it?
This is a "Share the Knowledge" question. I am interested in learning from your successes and/or failures.

Information that might be helpful...

Background:

Context: Language, Application,
Environment, etc.

How was the bug identified ?

Who or what identified the bug ?

How complex was reproducing the bug ?

The Hunting.

What was your plan  ?

What difficulties did you encounter ?

How was the offending code finally found ?

The Killing.

How complex was the fix ?

How did you determine the scope of the fix ?

How much code was involved in the fix ?

Postmortem.

What was the root cause technically ? buffer overrun, etc.

What was the root cause from 30,000 ft ?

How long did the process ultimately take ?

Were there any features adversely effected by the fix ?

What methods, tools, motivations did you find particularly helpful ? ...horribly useless ?

If you could do it all again
?............

These examples are general, not applicable in every situation and possibly useless. Please season as needed.

答:
The Background

In a mission critical WCF application driving a website and providing backend trasactional processing..

Large Volume application(hundreds of calls per second)

Multiple server multiple instances

hundreds of passed unit test and countless QA attacks

The Bug

When moved to production the server would run fine for a random amount of time then begin to rapidly degrade and take the box CPU to 100%.

How I found it

At first I was sure this was a normal performance problem so I create elaborate logging. Checked performance on every call talked to the database people about utilization watched the servers for issues. 1 week

Then I was sure I had a thread contention issue.  I checked my deadlocks attempted to create the situation create tools to attempt to create the situation in debug. With growing management frustration I turned to my peers how suggested things from restarting the project from scratch to limiting the server to one thread. 1.5 weeks

Then I looked at  Tess Ferrandez blog created a user dump file and annalized it with windebug the next time the server took a dump.  Found that all my threads were stuck int the dictionary.add function.

The long the short one small dictionary that just kept track of which log to write x threads errors to was not synchronized.

ContentLicense: CC BY-SA 2.5


问:
Software licensing for reusable chunks of code
On a fairly regular basis, I run into problems that have already been solved by open source projects.

Let’s say, purely for the sake of example, that I’m adding functionality to a piece of open source software which lets it line wrap some information in your terminal. It needs to know the width of the user’s terminal to do so.

libuv (Node.JS’s platform layer) has already solved the problem (under *nix and Windows!) (so have a number of other projects, FWIW). It turns out that libuv is licensed under something which looks suspiciously like the MIT license:

```Copyright Joyent, Inc. and other Node contributors. All rights
reserved. Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.```

Is there a right (legal and respectful) way to use the window-sizing logic from libuv in another project? Here are the options that I can think of:

Nothing is required, since this doesn’t constitute a “substantial portion of the Software” (but including attribution in the source code would be nice).

A full copy of the license should be included in the source code.

A full copy of the license should be included in the source code and distributed with binaries.

Bonuses:

What if the destination project is closed-source?

What if the borrowed code gets modified heavily (now or in the future)?

What’s the best way for authors of open source code to encourage reuse of bits of it by other programmers, with reasonable restrictions (e.g. require attribution in the source code, but don’t require the license to be distributed with binaries which include it)?

答:
Difficult to give any one true answer.

If you break a lump of code down into small enough parts, pretty much all of it is not special at all.

Taking this to the logical extreme, are you going to worry about a license for:

thing = thing + 1;

IANAL - but I don't think you can take any answer given as being completely right because there will be cases where it will be wrong. (In the above, define "substantial". Its a subjective term).

What you do will come down to your judgement.


问:
Is it possible to learn maths via programming, or you should learn maths for programming?
I am not the best in maths, not very horrid either, but lower than the average, I've always been thinking to improve my maths, but schools and books didn't do the job because I get bored too fast. The only thing I don't get bored with is coding and gaming, so I thought what if coding a program that solves mathematical problems will help me understand maths better, most of these problems are limits (calculus), functions, Differential calculus, and some other subjects (I already said am not that good) similar to the previous noted.

My question is: Am I able to achieve a better knowledge in maths if I do some specific program coding, and if possible, is physics possible that way too? Or am I wrong and Maths should be learned before programming to help improve my coding?

P.S : C++ is the preferred language.

答:
You don't need much math for "programming".

You need math for "computer science".

If you plan to use pre-existing library solutions for everything, then you probably don't care how they work. But if you plan to make your own algorithms and data structures, you will need to know math, as CS is heavily math based.


问:
Database GUI Programming - .Net vs MS Access
MS Access gets pooped on a lot because A) many newbies use it B) people use it as a database backend which is not a good idea.

I'd like to see some reasonable discussion on why you might choose VB.Net over MS Access or vice versa for programming a Database GUI (forms and reports) to be used with MS SQL Server.

答:
Dot Net advantages:

It can use MS-Access as a database as well as other databases. This makes the solution cost less if you care about the cost and also about solution scalability.

Dot net works with many fine 3rd party tools that allows you to build a better GUI than MS-Access does. 3rd party components are available for many regular and special use

It offers better editor

It uses OO languages (C#, VB, etc.) with very powerful .NET classes - It provides for better exception management.

Data and code are separate

MS-Access Advantages

Has built in report generator (found only on VS Professional Edition)

Easy to deploy. Does not required .NET framework (In .Net you need to be careful how you do this)

Has many solutions already built for it

Easy to code it to do emails and printing of labels (not as easy with .NET)

Does a good job for simple applications where the user can manage data directly even without coding

Provides OLAP reporting out-of-the-box

MS Access Disadvantages:

Costs money

MS-Access security is not all that powerful (as I hear - Not sure aobut that).

Ms-Access forces you to work with VBA - Not a full OO language

Has basic Data Grid control as well as other simple controls only. It is not possible to build advanced custom controls.

Code and data exist together in one file

May not be easy to provide code sharing amongst developers

Not a good choice for web sites of many users

Does not provide full text search (as in SQL Server for example)

COM based


问:
Managing lots of little (sometimes contradictory) changes
I work in a large company and most coding projects are fairly structured with a project plan and review process.

However, for existing support there are occasional periods where a department will need lots of tiny changes made to an existing app or site such the accounting department at the end of a fiscal year.

The problem is that they get incredibly busy and my team gets a slew of tiny emergency changes thrown at us.  We need to be flexible enough to support their needs as they are real and provide a great deal of value to the company.  On the other hand, given how crazy their environment is, they sometimes give us contradictory changes (change the text to 10pt, then the next day change it to 12pt).

Again, the changes are trivially tiny but they can suck up a developer's day given how frequent they are.  I'd like to push back and set some fair limits for how we'll handle these requests going forward.  Is there a best practice for handling these types of small changes?  The department in question is far to busy to commit a lot more time to working with us.  We also don't charge back so it's hard to communicate the problem to them.  What's a good approach to resolving this?

答:
I've found that if you sit down and agree with users on a fixed cycle (one or two weeks), explaining it as necessary so that fewer bugs are introduced because there is more testing, users usually agree and start prioritizing their requests better.

Two weeks are better because it would give you one week of coding and one week of testing (users actually seeing all the features they asked exactly how they asked). Another advantage is that users themselves get less distracted by just sitting down once or every other week to see all the requests done.


答: How big/complicated is the code? If it's not that complicated, I think it's fair to learn the logic and write your own implementation.</p>

Title: Software licensing for reusable chunks of code

Body:
On a fairly regular basis, I run into problems that have already been solved by open source projects.

Let’s say, purely for the sake of example, that I’m adding functionality to a piece of open source software which lets it line wrap some information in your terminal. It needs to know the width of the user’s terminal to do so.

libuv (Node.JS’s platform layer) has already solved the problem (under *nix and Windows!) (so have a number of other projects, FWIW). It turns out that libuv is licensed under something which looks suspiciously like the MIT license:

```Copyright Joyent, Inc. and other Node contributors. All rights
reserved. Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.```

Is there a right (legal and respectful) way to use the window-sizing logic from libuv in another project? Here are the options that I can think of:

Nothing is required, since this doesn’t constitute a “substantial portion of the Software” (but including attribution in the source code would be nice).

A full copy of the license should be included in the source code.

A full copy of the license should be included in the source code and distributed with binaries.

Bonuses:

What if the destination project is closed-source?

What if the borrowed code gets modified heavily (now or in the future)?

What’s the best way for authors of open source code to encourage reuse of bits of it by other programmers, with reasonable restrictions (e.g. require attribution in the source code, but don’t require the license to be distributed with binaries which include it)?


答:
Looking at source code and writing something similar to do the same thing in much the same way is not a breach of copyright. The copyright applies strictly to the text of the source code.

So I am not allowed to cut and paste Agatha Christie's text and publish it as my own, but, I am quite free to write a murder mystery where the victims are all traveling on a sleeper train, and a clever foreigner solves the mystery.


问:
Platform design Issues
Suppose I design a platform over a platform (say Java or Win32 or .NET), which consists of various layers like Database, User Interface, Cloud etc.

Now every team would be working to make their product, say database best and less focused on their relationship with other teams, hence resulting in various issues when doing an integration of it.

Now, these are my questions in order to achieve a stable and bug-free platform:

How could one ensure that while integrating all the layers, there is less overhead involved and also is there any other way to automate this process ?

Also, if one particular team is using the API calls provided by other team and if the other team is still not ready with the API calls, there comes a DEADLOCK . How to step over such situations ?

Say, I want to monitor and get feedback from various teams regarding their progress. Is there any automation available for such activities ?

答:
1) How could one ensure that while integrating all the layers, there is less overhead involved and also is there any other way to automate this process ?

You should have an architect group for the overall system. But make sure they don't just design some interface. They should facilitate discussion between the teams and the interface should be only settled on if both sides agree it's reasonably easy to work with/implement. The design also needs to be flexible, so that if any team asks for changes, they need to be promptly discussed with all concerned teams and agreed upon or rejected.

2) Also, if one particular team is using the API calls provided by other team and if the other team is still not ready with the API calls, there comes a DEADLOCK . How to step over such situations ?

If you agree on how the interface should work in advance (see previous point), than you can create mock version for unit tests or at worst program to specification for a while.

3) Say, I want to monitor and get feedback from various teams regarding their progress. Is there any automation available for such activities ?

As S.Lott already said, you have to talk to the people, every day. Have a daily scrum meeting in each team and daily scrum meeting of the team leaders (with the overall project leader). I'd say the architects should be at least on the team leaders meeting, perhaps even on all the meetings, so they are always aware of issues that may affect the interfaces.

Title: Platform design Issues


问:
Will giving new recruits a separate subproject from experienced developers help the newbies ramp up more quickly?
We have 7 developers in a team and need to double our development pace in a short period of time (around one month). I know there is a common sense rule that "if you hire more developers, you only lose in productivity for the first few months". The project is an e-commerce web service and has around 270K lines of code.

My idea for now is to divide the project in two more or less independent sub-projects and let the new team work on the smaller of the two sub-projects, while the current team works on the main project. Namely, the new team will work on checkout functionality, which will eventually become an independent web service in order to decrease coupling. This way, the new team works on a projects with only 100K lines of code.

My question is: will this approach help newbie developers to adapt easily to the new project? What are other ways to extend the development team rapidly without waiting two months until newbies start producing more software then bugs?

=======

UPDATE

This enterprise failed completely, but not for the reasons you guys mentioned. First of all, I was misinformed about the size and capability of the new team. I should have evaluated them myself. Second, hiring turned out to be a hard job at that site. At the site of the main office hiring was much more easy, but in the city of the second team there was apparently shortage of developers with the required qualification. As a result, instead of projected 1.5 months the job extended to about 4.5 months, and was cancelled in the middle of it by the top management.

Another mistake I made (and was warned about it by Alex D) is that I was trying to sell refactoring to the top management. You never sell refactoring, only features.

The startup turned out to be successful anyway. The refactoring that never happened turned into technical debt: the system became more monolithic and less maintainable, developer productivity gradually decreased. I am not in the team now, but I do hope they complete it in the nearest future. Otherwise, I wouldn't give a penny for the project's survival.

答:
My question is will this approach help newbie developers to adapt
  easily to the new project?

"Newbie" might mean new to you, or it might mean new to working as software developers at all. If you're going to hire a group of developers to work on an important project on a schedule, make sure that at least most of the new hires are experienced developers, and preferably ones who've written projects similar to what you're trying to build.

What are other ways to extend the development team rapidly without
  waiting two months until they start producing more software then bugs?

Buy or license an existing product instead of trying to build your own. Do you really need to reinvent the checkout wheel?

As I said above, hire people who have experience building the kind of system you want.

Even before you hire this new team, you should be thinking about what they'll need to know about your existing stuff. Make sure that you reserve enough time for training sessions to help bring them up to speed.

Have you created a written set of requirements? If not, do that now. If you expect to be designing the project instead of letting the new team do that, you should prepare a clear design document as well, but be open to changes in response to input from the new team members.

Do you have a well-defined development process? Bug database? Version control? Code review process? Style guide? Get those things in place.

Don't expect miracles. You want to hire a seven person team and have them working productively in a matter of weeks, but wanting it doesn't mean that you can have that. Depending on where you're located, it may take a lot longer than a month just to find seven suitable people. Trying to rush things now will only cause pain and expense later.


问:
How to structure unit tests for a GUI app using C# and NUnit
I've been asked to do a small side-project to supply a simple application to one of our customers. Normally I would be working on back-end code where I have all of my testing needs figured out, and I've not yet had the dubious pleasure of writing tests for the GUI, so it's a little unclear to me how I should set up the testing code and tools for an EXE.

My first instinct was to simply include the tests with the application code, however that would require supplying a number of test-specific dependencies, which I have been instructed to specifically not ship to the customer. I am also unable to squeeze out any cash for a purpose built test tool, so I need to use the tools I have at hand (StoryQ, RhinoMocks, and NUnit), which really should be more than enough to test the behavior of a simple GUI app. So as far as I can see, this leaves me with trying to strike a good balance between keeping the design really simple, or purposefully over-engineering for the sake of the tests. It seems I'm either building the app with the business logic in a separate library and testing against the library as I usually would, or finding some other mechanism to allow me to the executable without breaking out additional modules that the application design doesn't really need.

Edit:

Please note that this question is about how to structure the relationship between NUnit and my executable - as opposed to a DLL - and not about how to separate presentation and business logic.

/Edit

So my question is:

Is there a specific/recommended method for configuring a simple GUI application with unit tests to allow me to adequately check state and behavior, using the tools I have at hand, and without resorting to over-engineering?

Have I missed something fundamental about the way NUnit should be invoked/configured when testing an EXE (as opposed to a DLL)?

Can you provide or point me in the direction of examples of how achieve all of this?

I realize that there may be more than one way to do this so I'm looking for specific implementation guidelines based on your experience.

答:
I think that:

Your business test code should be in a separate project, testing your business code library.

Your GUI test code should be in a separate project, testing your GUI library. Now, how to build a GUI library instead of an executable, I attempt to answer that later.

If you have a my.namespace.biz.MyClass, your test class should be my.namespace.biz.MyClassTest (or MyClassTestCase).

If you want to test the code found in your executable target, then you should have a setup that builds an EXE, and another setup that builds a library (DLL) which is the one that you will launch your tests against.

These are the rules that I like to follow, whether it's Java or C# (except there is no EXE problem with Java of course :-) )

As for how to configure your test environment, it seems to me that you have at least these two choices:

Using MSBuild

Create a clone of your .proj file (say myproject-as-dll.proj). Change the OutputType in the cloned file from "EXE" to "Library". Using the MSBuild command you are now able to produce a library you can set as reference into your project containing NUnit test cases.

It seems to be possible to me, but I've never used it that much honestly, so I'm not sure. Plus, you may not have MSBuild on your integration test server, and I don't know if it can be separated from Visual Studio...

Using NAnt

If you are not familiar with NAnt, you will have to google up how to configure your project builds with it. Maybe check out this, it is a bit old but the author has commented the NAnt files and If find it self explanatory.(Edit: examining his file more in detail, I find his configuration file extremely reusable). He also does much more than just build, since he executes test cases and launches code coverage tools. Now, I admit I've never used NAnt, contrary to its Java counterpart and father "Ant" that I've used a lot but I see it's quite the same thing and I don't think it's that difficult to learn.

With that tool you can come up with a configuration that will allow you to:

build all your projects (business logic, GUI, etc.) into separate libraries

build your test projects

launch the tests (that specific part is done with the NUnit2 task).

examine your code coverage with the NCover task.

With a bit of more code, you could even:

perform nightly deployments in your integration server

if NAnt is available in your integration server, launch nightly integration tests with the help of scheduled tasks

All is done without changing anything in your Visual Studio files. And, really, it does not look like over-engineering to me, it's just one file. It might take you one, maybe two days to make it all work but you'll have in my opinion a good setup.

Lastly, I would give to the client all that is necessary to build, test and run the projects. I tend to think it shows your professionalism and the fact that you write code with quality in your mind (which it seems to me you do since you're looking for elegant solutions)


答:
I'd say it is a really good idea in a language with a strongly typed typedef like feature.

In Java you don't have this so creating whole new class for these things means the cost probably outweighs the benefit. You can also get 80% of the benefit by being careful about your variable/parameter naming.

Title: Never use Strings in Java?

Body:
I stumbled upon a blog entry discouraging the use of Strings in Java for making your code lack semantics, suggesting that you should use thin wrapper classes instead. This is the before and after examples the said entry provides to illustrate the matter:

```<code>public void bookTicket(
  String name,
  String firstName,
  String film,
  int count,
  String cinema);

public void bookTicket(
  Name name,
  FirstName firstName,
  Film film,
  Count count,
  Cinema cinema);
</code>```

In my experience reading programming blogs I've come to the conclusion that 90% is nonsense, but I'm left wondering whether this is a valid point. Somehow it doesn't feel right to me, but I couldn't exactly pinpoint what is amiss with the style of programming.


问:
Can JavaScript be used as a general scripting language?
I've used JavaScript and some frameworks (jQuery, Prototype, some node.js) for client-side web programming, but never on the desktop, where I do most of my scripting work in either Python or Bash.

But IMHO, JavaScript would make a great scripting language if used outside of the browser. Has anyone tried this? Can JavaScript be an adequate replacement for Python/Perl/Bash for quick and dirty scripting tasks?

答:
Yes! You definitely can do that with Node.js or Rhino. For example the coffeescript compiler is nothing but a node.js script. </p>

<p>I will admit that it is not generally my first choice for desktop scripting but I see no reason why it would not work quite well for a number of tasks. </p>

Body:
Yes! You definitely can do that with Node.js or Rhino. For example the coffeescript compiler is nothing but a node.js script.

I will admit that it is not generally my first choice for desktop scripting but I see no reason why it would not work quite well for a number of tasks.


答:
Windows has a component called Windows Scripting Host that allows you to automate administration and even mimic user activity to some extent through JScript. </p>

<p>Update in 2017: OSX now allows you to automate desktop tasks with Javascript. What was previously possible through AppleScript is now possible through Javascript. </p>

Title: Can JavaScript be used as a general scripting language?

Body:
I've used JavaScript and some frameworks (jQuery, Prototype, some node.js) for client-side web programming, but never on the desktop, where I do most of my scripting work in either Python or Bash.

But IMHO, JavaScript would make a great scripting language if used outside of the browser. Has anyone tried this? Can JavaScript be an adequate replacement for Python/Perl/Bash for quick and dirty scripting tasks?

Body:
Windows has a component called Windows Scripting Host that allows you to automate administration and even mimic user activity to some extent through JScript.

Update in 2017: OSX now allows you to automate desktop tasks with Javascript. What was previously possible through AppleScript is now possible through Javascript.


问:
How to market yourself as a software developer?
I have noticed that this is a frequent issue among younglings from technical areas such as ours.

In the beginning of our careers we simply don't know how to sell ourselves to our employers, and random guy #57 (who is a programmer, but not as good as you - technically) ends up getting a raise or a promotion because he knows how to communicate and market himself better than you. Many have probably seen this happen in the past, and most certainly many more will in the future.

What kind of skill/ability (either technical, or of other nature) do you think is relevant to point out when doing a job interview or asking for a raise, besides listing all the programming languages and libraries you know?

答:
I actually just wrote a marketing plan for myself, this alone is a good exercise as it make you think it all out and figure out what things you want to do and what you don't.

The Major points I came up with were the following:

Keep publishing Books and work with my publisher to promote myself

Give talks at local user groups around TA

Attend Conferences if possible, give talks

Appear on various Podcasts about development

Start up a Podcast on Web Development with a friend

Of course your list will look different but that is what I came up with. And of course you want to spend some time on it every day.


答:
I had written Nunit WinForms few years back (6 yrs I guess).
One thing that I remember specifically is that although its a unit test case, it also acts as end to end test case.
Sometimes there isn't much to test on a front end (a simple form). So even though you are trying to test for a message box popping up on a button click, you are unintentionally testing various other methods from other layers.
There are some things which you cannot automate as well. The look, feel and usability cannot be automated using automated unit testing. You will have to run some manual tests before you release.</p>

Title: How to structure unit tests for a GUI app using C# and NUnit

Body:
I've been asked to do a small side-project to supply a simple application to one of our customers. Normally I would be working on back-end code where I have all of my testing needs figured out, and I've not yet had the dubious pleasure of writing tests for the GUI, so it's a little unclear to me how I should set up the testing code and tools for an EXE.

My first instinct was to simply include the tests with the application code, however that would require supplying a number of test-specific dependencies, which I have been instructed to specifically not ship to the customer. I am also unable to squeeze out any cash for a purpose built test tool, so I need to use the tools I have at hand (StoryQ, RhinoMocks, and NUnit), which really should be more than enough to test the behavior of a simple GUI app. So as far as I can see, this leaves me with trying to strike a good balance between keeping the design really simple, or purposefully over-engineering for the sake of the tests. It seems I'm either building the app with the business logic in a separate library and testing against the library as I usually would, or finding some other mechanism to allow me to the executable without breaking out additional modules that the application design doesn't really need.

Edit:

Please note that this question is about how to structure the relationship between NUnit and my executable - as opposed to a DLL - and not about how to separate presentation and business logic.

/Edit

So my question is:

Is there a specific/recommended method for configuring a simple GUI application with unit tests to allow me to adequately check state and behavior, using the tools I have at hand, and without resorting to over-engineering?

Have I missed something fundamental about the way NUnit should be invoked/configured when testing an EXE (as opposed to a DLL)?

Can you provide or point me in the direction of examples of how achieve all of this?

I realize that there may be more than one way to do this so I'm looking for specific implementation guidelines based on your experience.


问:
Is it possible to work with distrusting clients
One of our junior developers has been assigned a new client (we don't have the client yet, we're still working with him to see if we can meet his needs) and the junior developer said the client will hire us if we can do the work on his project without getting access to his server.

I've had a direct conversation with the client who turned out to have had his code stolen before by some offshore company that he outsourced. This made me more sympathetic but I still have mixed feelings about this.

On one hand I want to prove to the client that we're not all bad apples. Also if we do a good job with him, we get a loyal client who'll hire us for all his projects. I haven't heard of this happen before but I guess it happens more often than we'd all like to admit.

On the other hand I'm hesitant to accept working with him because deployment time is going to be a nightmare and no where in my career or education has anyone taught me how to work with clients like him. I (or the junior developer) would have to write a detailed description of exactly what to do with the source to deploy it and that is an annoying burden when I could deploy and test the whole thing in an hour myself.

As I said, I've never had to deal with this before (we're signing a non-disclosure but apparently so did the offshore company before us). We're not fully fully booked so it's not like I have an immediate replacement, but we're not begging for work either and I wonder if working under such restricted environment is worth the trouble.

Another side is that the experience itself could be rewarding for us, but is it experience worth having, as in what's even the likelihood of getting a similar client anytime soon. Are we even expected to comply with such clients?

So since I don't have any first hand experience with this and it definitely wasn't covered in school, how would those with longer experience working with clients deal with a distrusting client like this? Would you even accept the job?

答:
You start working with the client. If there is no need of any other resources for completing your project, then you are through that restricted environment.

And if you feel a need to have something which is restricted to you, then talk to client about this issue. Do the critical stuff in front of him.

And last option but better, since you are not begging for any work, Kick it off! ;)

By critical stuff, I meant access to the clients code.


问:
How to stop the development spec from changing in mid development?
Problem: It seems with almost every development effort I'm involved in, no matter how much time is spent planning prior to starting development, there is always a large amount of changes required either midway or towards the end of the project. These are sometimes big changes which require alot of re-development.

I don't work for clients who pay money, this is an in-house development team on in-house development websites. So, it's not like I can charge for it or anything. And at the end of the day, we have to try to hit deadlines.

Questions: What are some of the best ways you guys have found to minimize and prevent spec changes from cropping up midway or after development?

答:
Active user involvement throughout the development cycle, and use of as much Agile methodology as possible really helps us with our products.

Spec changes are inevitable, but by being transparent with users and above all, frequently consulting them means most changes are captured as early as possible.


答:
Deliver something (I hesitate to use the word anything) early and deliver often. That is - use some sort of iterative development methodology.

This is the basis of Agile development, but can be used with (almost) any methodology.

By breaking the project down into a series of mini projects you get more control as you can put something in front of the client early, you're not locked into a long development schedule that becomes out of date when the client changes their mind (as they will).

When they see the system evolve, some requirements will change, some will become redundant and others will increase in priority. However, by having a short project life-cycle you will be able to cope with these changes.

Title: How to stop the development spec from changing in mid development?

Body:
Problem: It seems with almost every development effort I'm involved in, no matter how much time is spent planning prior to starting development, there is always a large amount of changes required either midway or towards the end of the project. These are sometimes big changes which require alot of re-development.

I don't work for clients who pay money, this is an in-house development team on in-house development websites. So, it's not like I can charge for it or anything. And at the end of the day, we have to try to hit deadlines.

Questions: What are some of the best ways you guys have found to minimize and prevent spec changes from cropping up midway or after development?


问:
How much Code Coverage is "enough"?
We are starting a push for code coverage here at my work, and it has got me to thinking.... How much code coverage is enough?

When do you get to the point of diminishing returns on code coverage?  What is the sweet spot between good coverage and not enough?  Does it vary by the type of project your are making (ie WPF, WCF, Mobile, ASP.NET)  (These are C# classes we are writing.)

答:
Use coverage as a guide to indicate areas not tested. Rather than having a mandate for coverage it is wiser to understand the reason for code not covered. Recording a reason for the shortfall is good discipline that allows the risks to be balanced.

Sometimes the reason is less than desirable 'e.g. ran out of time' but might be OK for an early release. It is better to flag areas to return to for a boost in coverage later.

I work on critical flight software where 100% statement coverage is considered suitable for non-critical systems. For the more critical systems we check branch/decision coverage and use a technique call MC/DC which is sometimes not stringent enough.

We also have to ensure that we have also covered the object code.

It is a balance between risk, in our case very high, against value/cost.
An informed choice is needed based upon the risk of missing a bug.

Title: How much Code Coverage is "enough"?


答:
There's a famous military saying, attributed to Helmut von Moltke: "No battle plan survives contact with the enemy". In the same vein, I do not think it's possible to make a spec that will not have to be changed - not unless you can predict the future and read minds of the stakeholders (even then they may not have yet made their minds, even if they claim they did).
I would suggest instead approach it in a number of ways:

Make a clear distinction what can be changed and what can not. Communicate it clearly to the stakeholders, make them explicitly sign off on unchangeable things as soon as possible.

Prepare for the change in advance. Use code methodologies that allow to change the changeable parts easier, invest in configurability, encapsulation and clear protocols that would allow parts to be changed and replaced independently.

Talk to the stakeholders frequently, solicit feedback and approval. This would both keep you in sync and avoid them claiming "oh, that's not what we wanted" when it's too late. As noted in other answers, agile methodologies and frequent mini-releases would help you with that.

Put into the schedule the time to accomodate the inevitable changes. Don't be afraid to say "we will need more time" early if you think you would - if the schedule you're given is unrealistic it's better to know it (and have you on the record saying that) at the start than at the end.

If the changes are too extensive and threaten the deadline - push back and say something like "this change is possible, but will push the deadline by X time, make your choice".

Make a formal process of requesting changes, prioritizing changes and assigning changes to versions or releases. If you could tell people "I can not do it in this release, but will be happy to put it on schedule for the next one", it's much better than saying them "you're too late, your change can't go in, goodbye" and would make them your friend - they'd be happy for you to release in time so you could be free sooner to get to the next release which will have their change - and not your enemy.


答:
What are some of the best ways you guys have found to minimize and prevent spec changes from cropping up midway or after development?

There are no best ways. It is up to the management to limit the changes to spec in the certain phase of the development.

However, you should design your software in such a way to expect the changes. Then the impact of changes would be much less. Iterative and incremental development is a good start.


答:
The proper solution is cleanroom reverse engineering. Copyright applies to lines of code, not ideas. If you therefore have one person extract the idea from the original code and write it down, and another person re-implement the idea from paper, then you have a paper trail showing that you did not break the copyright.

This method has been tested and accepted in court.


答:
IMHO putting all the new developers on the new project, separated from your existing team is bound to bring problems. Yes, this (may) let your old team keep working more or less at its current pace. However, the new guys won't have a clue about the overall architecture and the big picture, so they will take a lot of time getting up to speed... and even then they may be heading the wrong direction.

I suggest dividing your existing team into two and hiring new members into both teams. This way there are people in both teams who can mentor the newcomers and ensure that a common, coherent architectural vision is kept up.

Otherwise, I agree with Caleb regarding documenting clear requirements, defining the development process and tools, and reserving time for training... and also on that expecting a team of 7 to get hired and get up to speed within a month is irrealistic.

Title: Will giving new recruits a separate subproject from experienced developers help the newbies ramp up more quickly?

Body:
We have 7 developers in a team and need to double our development pace in a short period of time (around one month). I know there is a common sense rule that "if you hire more developers, you only lose in productivity for the first few months". The project is an e-commerce web service and has around 270K lines of code.

My idea for now is to divide the project in two more or less independent sub-projects and let the new team work on the smaller of the two sub-projects, while the current team works on the main project. Namely, the new team will work on checkout functionality, which will eventually become an independent web service in order to decrease coupling. This way, the new team works on a projects with only 100K lines of code.

My question is: will this approach help newbie developers to adapt easily to the new project? What are other ways to extend the development team rapidly without waiting two months until newbies start producing more software then bugs?

=======

UPDATE

This enterprise failed completely, but not for the reasons you guys mentioned. First of all, I was misinformed about the size and capability of the new team. I should have evaluated them myself. Second, hiring turned out to be a hard job at that site. At the site of the main office hiring was much more easy, but in the city of the second team there was apparently shortage of developers with the required qualification. As a result, instead of projected 1.5 months the job extended to about 4.5 months, and was cancelled in the middle of it by the top management.

Another mistake I made (and was warned about it by Alex D) is that I was trying to sell refactoring to the top management. You never sell refactoring, only features.

The startup turned out to be successful anyway. The refactoring that never happened turned into technical debt: the system became more monolithic and less maintainable, developer productivity gradually decreased. I am not in the team now, but I do hope they complete it in the nearest future. Otherwise, I wouldn't give a penny for the project's survival.


答:
Ask Google and Oracle how do the think about copying some snippets for Android.

Ask Karl-Theodor zu Guttenberg (German ex Minister of Defence) how big a snippet must be until you have to mark it as an citation.

Really this is much to complicated to answer it in general. And to my understanding to be really correct, it depends at least on the local laws of your country.


答:
Dmitry, doubling your development pace in a short time is an incredibly ambitious goal. Some good suggestions have been posted here; but, no matter what you try, be aware that it may not happen. if your pace of development does not double, what would the consequences be, from a business perspective? Are you trying to push to meet a deadline?

If you are trying to meet a deadline, could you do it more reliably by cutting features? I have found a great way to make "missed deadlines" acceptable to a customer is to do incremental releases; release a version which has a subset of the required features, and then as more features are ready, release them incrementally, up to the final release.


答:
You're asking the wrong question. Spec changes will always happen in software development projects of any size.

Often it's because business requirements change but I've also seen it happen because customers (internal or external) can find it hard to visualise what is possible without seeing something to iterate from, so they have a vision which slowly changes as they engage with the developing solution.

The question you should be asking is not "how can I lock the spec down", it's "how can I structure my code and processes to respond to a changing environment without throwing away everything I've already written?"

This then leads you into the buzzword bingo arena: agile methodologies, iterative development and technical solutions such as component based / modular coding, continuous integration... the list goes on.

I'm not saying these are a silver bullet to all your problems but they all came about because of a desire to manage the very situation you're describing so at the very least they're worth some investigation.

Sorry if that's not offering concrete solutions but I tend to think a mindset shift into accepting and managing change will pay bigger dividends than trying to avoid it.


问:
Can a small team enter .NET world while most of them are working on OpenSource languages?
We are a team of about 15 employees, in a non-IT enterprise. Today, we mainly develop websites, using PHP, MySQL, etc. We run a bit less than 100 linux servers on ourselves.

But today, we are confronted with a too-big-for-us-to-code project. We selected a great provider (yes, outsourcing), and now they ask us to choose between C++/Qt and .NET/WPF.

The app is highly graphical, and meant to be distributed on Windows systems. .NET is recommanded to us as easier to design and more lightweight.

But what about our team ? Can we handle, with our small number, both universes at the same time ?

responsibilites :

during the dev : design the app, review the code

after the dev : host servers, do maintenance and answer user calls

in the case we need a v2, we intend to call back the same provider

What do you think ?

EDIT

We finally chose C++/Qt. The reasons are :

the dev time has been tested to be somewhat equal

it suits us better from a management point of view

and it increases cross-platform portability

答:
If you are an open source focused shop I'd strongly recommend avoiding Microsoft stacks, especially through outsourced deals. I've seen this happen and it isn't pretty.....

Reasons:

You'll get stuck supporting two platforms (Linux and Windows). Or even worse, you will decide at some future date to standardise on Windows and get locked in forever......

There is a fundamental culture clash between the two worlds. Mindsets are different, approaches are different, team dynamics are different.

Microsoft products don't play well with non-Microsoft products in general. They make it relatively easy for you to go all-Microsoft, but not very easy to interface with the rest of the world.

If there is a new outsourced relationship being put in place, that is hard enough to manage already. You don't want technology and cultural differences on top of that!!

If you want .Net-style platform capabilities but an open source approach, you are much better off by going the Java platform route. Advantages:

Java itself is open source (OpenJDK), as are most of the major IDEs and tools

Java works excellently on Linux and Windows alike.

You can deploy client applications easily to either Windows or Linux machines with Java Web Start.

The open source ecosystem of libraries for Java is the best of any language, particularly on the server side but for networked client side applications it is also very good.

If you don't like Java-the-language, there are many great open source languages that run on the Java platform (Clojure, Scala, Groovy, JRuby, etc....)

If you want to leverage your PHP expertise, you can even run PHP on the Java platform with tools like Quercus (disclaimer: I haven't tried these myself)


问:
How do you perform modeling in an Extreme Programming environment?
I know methodologies, like Extreme Programming (XP), which specifies its own specific practices for developing software. However, unlike Scrum where it focuses more on management aspects, XP specifies software practices that are required to be followed. From reading this article, these steps eliminate the explicit modeling phase using tools such as BPMN and UML. In another article from Martin Fowler, he further explains such discouragement.

Personally, I prefer the model-driven methodologies I guess it's up to the preference of companies and people. One of Agile goal is to "free developers from document works". Methodology like XP seems to easily lead to under documentation. I think to achieve that goal, the solution is to implement the tool to help developer reduce the workload on writing document, not by writing less documents, by gathering information from existing diagrams and automatically generate reports (in RTF, PDF, HTML in the case of Enterprise Architect of Sparx System).

Some software engineers also complain about drawing diagrams consuming their time. In my opinion, the solution is not to draw diagram, but using the tool. Modeling tools today support round-trip engineering, where you can synchronize between your code and your diagrams, thus eliminates the extra effort to manually correct the diagrams if the code base changes (specifically, class diagram).

How does modeling fit into a team that is using Extreme Programming?

答:
XP doesn't explicitly call for the creation of a model, but it doesn't say that one should never be produced. If developing a model helps you to build and then document your system, it should absolutely be done. The difference is that Agile Modeling has a different focus than system modeling in a plan-driven environment. In fact, the Agile Modeling site even addresses specifically how you model in an Extreme environment.

Agile environments take a more Lean (in the same sense of Lean engineering or Lean manufacturing) approach. Some of the key tenants include reducing waste, deciding late, and delivering fast. In order to eliminate waste, only the required documentation is delivered at the appropriate granularity. If you produce a work product, that work product is expected to ultimately add value to the customer - waste is considered anything that doesn't help add value to the person paying for it.

In fact, the XProgramming blog article you linked to supports this:

You may well need some nicely formatted UML for your project...If and when you really need these things, then by all means you should do them. But inside your collocated Whole Team, you most probably will not need them, because the information you need will be communicated through the more effective medium of conversation.

The Martin Fowler article that you linked to also supports this:

Certainly XP de-emphasizes diagrams to a great extent. Although the official position is along the lines of "use them if they are useful", there is a strong subtext of "real XPers don't do diagrams".

A central idea of the agile methods is "individuals and interactions over processes and tools". You don't follow a process or use a tool for the sake of following the process or using a tool. If the task that you are working on does not add value or if it doesn't produce something that is useful to someone (either the customer or another engineer), then you don't do it.

Martin Fowler goes on to say:

The primary value is communication. Effective communication means selecting important things and neglecting the less important. This selectivity is the key to using the UML well. ... A common problem with the common use of diagrams is that people try to make them comprehensive.

Again, same idea. The purpose of any documentation is communication. If you are producing things that don't help you communicate the system, why are you doing it? Don't focus on every little detail, but focus on communicating a message that provides useful, value-adding information to someone else.

Even later in the article, Fowler goes on to note that one of the problems with CASE tools is that they can fall out-of-sync. As soon as the code and the documentation fall out of sync, the document adds no value. I'd even take this a step further and say that it adds negative value, as it provides false and misleading information to anyone who tries to use it to make a decision. If you have a process to maintain synchronization, that's good. However, if you don't and you do let your documents fall out of sync, this brings up another question: why do you have them? They clearly aren't being used, or else they would be maintained.

Rather than some other model-driven methodologies requiring the models, even if they don't necessarily add any value, XP calls for spending time and resources on things that actually help you deliver value to the customer/client. If you can justify that certain models actually do add value to your project, then by all means you should produce them. However, you shouldn't be producing models that duplicate other information or don't add value.


答:
The theory that it is possible to completely spec out a software project of any significant size is a complete fantasy. This theory has been found not to work in organizations from large to small for pretty much the entire history of software development.

You MUST find some way to accommodate changes as you go! They ARE going to happen, because most of the stakeholders, even if they say 'yea, that's what I want' actually have no idea what they want until it's in front of them. That's why we have so many folks adopting iterative methods.

Whether you iterate the product or whatever, you MUST find some way to accommodate these changes, because trying to find ways to not have changes is just short of  asking gravity to turn itself off for a few minutes so you can go flying.


答: Don't try to prevent change, embrace it. The more you plan ahead, the more likely your plan will change. So, plan less, not more. Adopt an agile development methodology where you deliver small chunks of working code frequently, giving the customer the chance to change the specifications every couple of weeks.


问:
JavaScript for a non-programmer
2 years ago I starded learning AS3 in order to get hired at a web design company. A few months later, I ditched it, because I discovered that I'm better at design; so now I'm a web designer.

Recently, I decided that knowing JavaScript would be nice and helpful, so i started with Essential JavaScript Training from Lynda.com. Untill today, I was under the impression that my knowledge of programming was somewhat basic. What happened today...?
I learned (through trial and error) that variables are only valid in the functions that they're defined in. This turned my world upside down. I was like: "that makes sense now..." thinkin of the all the headaches that the lack of this specific piece of knowledge gave me.
How could I have missed such a fundamental thing while learning AS3 (and now JS)? I didn't. And I remember reading a at least three books on AS3, but none of them taught me about programming.

So what I want to ask you, is if you could recommend me a good JavaScript book from which i can learn programming, too, besides syntax.

Thanks! And sorry for my bad english :)

答:
As the author of Lynda.com's JavaScript Essential Training, I feel like I kind of have to jump in here…

IIRC, I covered variables and global versus local scope in Example 4 of Lesson 4 ("Creating prompts for users") when I first talked about var. If I wasn't clear enough, I apologize!

If you're looking for a solid beginner-level JavaScript book, may I suggest JavaScript & Ajax for the Web: Visual QuickStart Guide, 7th edition? Yes, I'm the co-author (with Tom Negrino), but I've received a lot of compliments on it from people who had never previously written code—they said that other books just confused them, and ours was the first that didn't assume they were already programmers.

Here's what it says on page 36:

Using var does two things:

It tells JavaScript to create a variable (that is, to set aside some space in memory for this new object).

It defines the scope of the variable, that is, where JavaScript needs to know about this particular object (see the What Is Scope? sidebar). If a variable is created inside a function, other functions don’t have access to it, as it’s local to that function. If it’s created outside any function, it’s global, and everything has access to it. In this script, we’re creating the ans global variable.

You said your previous books were on AS, so hopefully JS&A:VQS wasn't one of the books you had trouble with…

And if you have any further questions about particular bits of JavaScript code, StackOverflow is probably the place for them.

Edited to add…

Just my 2¢: I suggest that you—for now—ignore the Douglas Crockford recommendations. Yes, he does know his stuff (although I disagree with some of what he says, and I suspect he disagrees with 90% of how/what I teach) -- but I cannot honestly recommend his work for someone who doesn't have solid programming experience. His stuff is for intermediate/advanced-level scripters, not for someone at your current stage.

Title: JavaScript for a non-programmer


答:
Well thats a though call, clients always want more but here are a few point you should consider:

HTML Mock-ups: Always create HTML mock ups to define the UI part of an application, show them how will it look like and ask them for their opinions. If you find anything reasonable to change make it happen in the HTML prototype. Using this you will sort out lots of things like UI issues, basic flow and some add ons(like Sorting, Pagination, no. of records to be displayed etc.)

Active Participation from the other end: This is very important if you are developing for a business organisation, get in their business ask them to clarify your doubts and without fail ask them what changes do they want in their flow (if required).

Modular release: Release your code in a modular fashion, release, test, take feedback and release again.


问:
Drawing Ellipse from a bounding box?
Does anyone know a good algorithm for drawing an ellipse from a bounding box?

```<code>draw_ellipse(int s1, int s2, int s3, int s4, color c);
</code>```

I don't need something optimized to incomprehendable , unreadable efficiency. Just something good enough to use for a simple drawing api. You can provide the algorithm in your answer in all programming languages or even pseudocode, but I would prefer it if you use C++ or a C++-like syntax.

答:
Normally I have defined an ellipse with the center point, semi-major, semi-minor, and the angle of rotation.

What you have described is a ellipse that the center point needs to be determined, and is not rotated The most widely used algorithm in graphics for a circle is by Bresenham, Kennedy adapted it for an ellipse.

Title: Drawing Ellipse from a bounding box?


问:
Should my multi-server RDBMS or my Application handle database Referential Integrity?
Should items like Foreign Keys, Constraints, Default Values, and so on be handled by the database management system (in this case, MS SQL 2005) or the application? I have heard opinions from both sides and I'm honestly not sure which way to go.

There is a chance we will be spanning multiple servers/databases and I don't think Foreign Keys can be used across linked servers. In addition to that, there are some circular references in the database design which prevents me from using ON UPDATE CASCADE on everything.

The database is MS SQL 2005 (possibly 2008) and all interactions with it should go through the application.

答:
Both is definitely the way to go. You'll want validation logic in your code to prevent bad updates and inserts as well as to tell users what was wrong and how to fix it. And having the database there to back-stop things so if something came in and did not run through the validation it would not break things down the line is a good thing.

You should keep the database stuff higher-level. EG, enforce referential integrety and perhaps some not null. But don't worry about constraining lengths or formats as that is best rendered unto the application wholly.


答:
So you are trying to be the team that doesn't fall victim to the Mythical Man Month. You will have several problems, somebody on the team will have to do the technical interviews, then you will have to wait a few weeks after they accept the position before they can start. It may be two months before the new developers are in front of their keyboards.

Every new employee has a negative productivity in the first few months. It is made worse because the current developers will need to mentor them, further decreasing the tems productivity.

The other part of the MMM was that as the team grows so does the communications problems. Meetings become larger, email chains become longer...

I would bring them on in smaller groups and know that for a long time the productivity will not be proportional to the increased size of the team. Also realize the the drain on cash flow during the first few months can be significant, due to on boarding costs, and equipment.

In your comment to Alex D you mentioned "Its not the deadlines we are after, its demonstratable ability to deliver new features." So switch to a development style that roles out the features in smaller chunks, and more often. Have the new members of the team test the new features, that will help them understand the code base.


问:
Software licensing for reusable chunks of code
On a fairly regular basis, I run into problems that have already been solved by open source projects.

Let’s say, purely for the sake of example, that I’m adding functionality to a piece of open source software which lets it line wrap some information in your terminal. It needs to know the width of the user’s terminal to do so.

libuv (Node.JS’s platform layer) has already solved the problem (under *nix and Windows!) (so have a number of other projects, FWIW). It turns out that libuv is licensed under something which looks suspiciously like the MIT license:

```Copyright Joyent, Inc. and other Node contributors. All rights
reserved. Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.```

Is there a right (legal and respectful) way to use the window-sizing logic from libuv in another project? Here are the options that I can think of:

Nothing is required, since this doesn’t constitute a “substantial portion of the Software” (but including attribution in the source code would be nice).

A full copy of the license should be included in the source code.

A full copy of the license should be included in the source code and distributed with binaries.

Bonuses:

What if the destination project is closed-source?

What if the borrowed code gets modified heavily (now or in the future)?

What’s the best way for authors of open source code to encourage reuse of bits of it by other programmers, with reasonable restrictions (e.g. require attribution in the source code, but don’t require the license to be distributed with binaries which include it)?

答:
There are two questions:

When is the copyiright affected?

What to do, if it is?

The easy question is No. 2, what to do, if it is: You have to stick to the rules of the copyrighted software. There is no "for a small piece, I only stick partly to the license". It is either/or. If your action does not affect the copyright, you have nothing to do. Of course you're free to write an email to the author of a software, and ask for permission to use a short piece of code. If this is to much work and to slow for some few lines of code, rewrite them from scratch.

What constitutes a copyright infringement is much harder to decide. It may differ from jurisdiction to jurisdiction and even from judge to judge and case to case. When in doubt, rewrite it from scratch. If you can't write it from scratch, it is a copyright violation, that's for sure.


答:
A change is only a surprise ... if it's a surprise!

I'd suggest thinking about:

where on earth do these changes come from anyway?

why aren't you aware of them earlier?

why aren't you contributing to these changes (and potentially making even more of them)?

Change is nature of what we do. Since when did you code an algorithm exactly as envisioned on day 1?

But if you want to avoid perpetually being the frustrated developer "surprised" by changes, I think you need to find you way closer to the action of where decisions are made. After all, I'm sure you have a bucket load of ideas of how you could make the product better. Get a seat at the table, or forever accept that you will just have to deal with those "surprise changes".


答:
You would be better off hiring no one new and looking at your processes to see where you can make changes to make things go faster. The sooner bugs are found, the less time it takes to fix them, so how are you testing? Are you doing code reviews? Are you paying attention to the quality of the requirement? Do you have autiomated builds and deplotyment processes? Do you have automated tests? Are you having daily standup meetings (Amazing how much faster development can go when someone will ask you for your prgress every day!)? Are you using agile processes? Do you have some basic design flaws that should be addressed to make the rest of the development go faster (bad design can slow a development project down incredibly).

Please read the Mythical Man-month. You clearly are going to need to in order to be able to tell senior management why they are making the worng choices to speed up a project. .


答: So you want to throw them off a cliff and see if they can fly? I think when you discover things on your own, they tend to stick with you in the long run as opposed to just having solutions given to you. However, that assumes you actually do discover better solutions. I don't see why you can't allow this team to have a qualified leader who will balance letting them make some mistakes on their own along with giving them guidance and instruction by learning from quality examples.


问:
Never use Strings in Java?
I stumbled upon a blog entry discouraging the use of Strings in Java for making your code lack semantics, suggesting that you should use thin wrapper classes instead. This is the before and after examples the said entry provides to illustrate the matter:

```<code>public void bookTicket(
  String name,
  String firstName,
  String film,
  int count,
  String cinema);

public void bookTicket(
  Name name,
  FirstName firstName,
  Film film,
  Count count,
  Cinema cinema);
</code>```

In my experience reading programming blogs I've come to the conclusion that 90% is nonsense, but I'm left wondering whether this is a valid point. Somehow it doesn't feel right to me, but I couldn't exactly pinpoint what is amiss with the style of programming.

答:
It would be good, IF String (end Integer, and ... speaking only about String) was not final, so these classes could BE some (restricted) String with meaning and still could be send to some independednt object that knows how to handle the base type (without conversing back and forth).

And "goodnes" of it increase when there are eg. restrictions on all names.

But when creating some app (not library), its always possible to refactor it. So I prefare to start without it.

Title: Never use Strings in Java?


答:
This is why it is nearly impossible to plan too far in advance, but not an excuse to not plan at all. Don't fall too deep in love with your plans and you won't have to worry about them breaking your heart.

Inside your company there is a cost to using the IT resources whether anyone admits it, tracks it, or has to budget for it or not. The reality is, your team can only create so much code in a certain amount of time. All departments and projects are sharing in this budget.

You can't prevent anyone from wanting to change the requirements, but they cannot escape the consequences. Changes can significantly increase development times. That is a fact they have to deal with or decide not to make the change. Does a request from one department affect another? You may have to completely move their project behind another departments because the change request will encroach on another group's time schedule.


问:
In a legacy codebase, how do I quickly find out what is being used and what isn't?
I've been asked to evaluate what appears to be a substantial legacy codebase, as a precursor to taking a contract maintaining that codebase.

This isn't the first time I've been in this situation. In the present instance, the code is for a reasonably high-profile and fairly high-load multiplayer gaming site, supporting at least several thousand players online at once. As many such sites are, this one is a mix of front- and back-end technologies.

The site structure as seen from the inside out, is a mess. There are folders suffixed "_OLD" and "_DELETE" lying all over the place. Many of the folders appear to serve no purpose, or have very cryptic names. There could be any number of old, unused scripts lying around even in legitimate-looking folders. Not only that, but there are undoubtedly many defunct code sections even in otherwise-operational scripts (a far less pressing concern).

This is a handover from the incumbent maintainers, back to the original developers/maintainers of the site. As is understandably typical in these sorts of scenarios, the incumbent wants nothing to do with the handover other than what is contractually and legally required of them to push it off to the newly-elected maintainer. So extracting information on the existing site structure out of the incumbent is simply out of the question.

The only approach that comes to mind to get into the codebase is to start at the site root and slowly but surely navigate through linked scripts... and there are likely hundreds in use, and hundreds more that are not. Given that a substantial portion of the site is in Flash, this is even less straightforward since, particularly in older Flash applications, links to other scripts may be embedded in binaries (.FLAs) rather than in text files (.AS/ActionScript).

So I am wondering if anyone has better suggestions as to how to approach evaluating the codebase as a whole for maintainability. It would be wonderful if there were some way to look at a graph of access frequency to files on the webserver's OS (to which I have access), as this might offer some insight into which files are most critical, even though it wouldn't be able to eliminate those files that are never used (since some files could be used just once a year).

答:
From your description it seems that this code has hit the unmaintainable state, which means the the best approach is likely a complete rewrite. Developers would have a lot smaller paychecks if there were quality tools that worked to keep a messy code-base maintainable. It is possible to go through and clean up the old unneeded code from folders, but its a manual task and you likely won't get everything anyway without unreasonable amounts of time.  I'm just guessing here, but I bet the working code itself is just as much of a mess as the file structure which means even when you manage to get the code-base trimmed to the actively working code its still going to be a nightmare to update or fix anything.

I would stress that the effort required to get the existing code in a maintainable state would be equal or greater than the effort to start over on a rewrite. part of maintaining anything is knowing when to "take it behind the shed and shoot it".