答:
I worked for a company at one point that had a relatively stressed relationship with software companies that were developing systems for it, and I did hire a Business Analyst there to help out, they had a similar role to the Program Manager described in Joel's post. This person was more able to get answers to questions from difficult to pin down stakeholders, and served as a clearing house for answers. As well, since they did have a background in software development they were able to recognize when an answer would lead to more questions, and we successfully improved matters this way.

That said, this shouldn't be necessary in most cases. Assuming there is a good relationship between the client and the outsourcing services provider, the provider's staff Business Analysts should be able to extract the requirements.

Title: Is there a such thing as a Program Manager for Outsourcing Companies?

Body:
Accordingly to the first paragraph of Joel's post, a Program Manager is a very good thing to have in products. But what about having a Program Manager for a company that doesn't have a product, but have projects?

The only coincidence that I'd see if you ask me and ask me to answer right away is that a Program Manager for an outsourcing company would be someone that oversees all the projects that the company have, ensuring that the things are being done aligned to the company strategy, from a technical point of view.


问:
Should I develop a product with minimal use so I can say I developed it?
I appear to have done something wrong here, so let me try to rephrase this more simply so I stop giving the wrong impression.

I'm in the planning stages of a project right now, on my own time; I'm currently defining the scope of the project. I can see this application also releasing an Android app; furthermore, I've long wanted to get into Android development, and being able to list an actual project on my resume seems likely to be beneficial. However, the application itself is far more useful on a PC than a tablet and almost useless on a smartphone; odds are, very few (if any) people would want to use this on Android.

I want to develop it, but I anticipate almost no demand. Should I do so under the idea that the experience is useful, or should I either keep it private or not do it under the idea that an app nobody uses looks bad to future employers?

Original Question:

I'm planning out an open-source project, mostly to beef up my resume (ETA: Okay, I'm doin it mostly because I want to do it, but I'm releasing it as open-source rather than keeping it to myself so I can list it on my resume easier). I'm considering doing an Android version, intended to run on tablets. But it's not the most useful thing to have on a tablet; neither I nor my partner can really conceive of anyone wanting the product. However, adding "developed for Android" to my resume seems to be a good selling point, and I'd like to get into mobile development. Should I make an app nobody wants so I can say I made an app? Or should I hold off until I have a better idea?

Edit: I must have phrased things badly, some of the answers seem to have the wrong idea. I'm doing the entire project for the hell of it; if I don't do an Android version of this particular project, I'll complete it sooner and plan something else and do that. It's a given that I'm always going to be doing a project and that I want to do this project. The question is, should I instead do something more useful as a "let's play with Android" project? Will making something nobody wants hurt me in the long run?

答: You've already picked an answer, but I'll chime in here.  I run a little Android shop.  If you want to learn Android, I tell people to pick an idea and try to build it rather than doing tutorials or whatever.  When its your idea, you're far more invested, even if it won't be used.  Second, anybody up there who said it was worthless for your resume is TOTALLY WRONG!!!  If you apply to me for a job (and, of course, we're hiring), and you have code available, you're far more likely to get an interview and get the job (unless your code is terrible).  That leads me to say the "correct" answer guy is wrong in saying you shouldn't code an Android project if you have some experience already.  Most people who claim to know Android (or any platform) because they coded one little thing are totally wrong.  I would say you don't really know Android until you've had to finish and release an actual commercial product, or a very significant non-commercial one.  Having basic familiarity with a platform, and understanding how to debug multi-threaded apps in the field, with 500+ different combos of hardware/OS, are two totally different things.  We only do Android so we can have a deep focus and do a better job than general shops.  So, Android, iOS, Fortran, whatever.  If you know you want to work on a specific thing and find a job doing that, double down.  Go crazy.  Write apps.  Put them in github and ask the community for feedback.  It will only help.

ContentLicense: CC BY-SA 3.0


问:
How much AJAX is too much?
My current project is part of a highly linked architecture, with individual systems each owning certain pieces of data, and exposing them RESTfully. Both our web services and our user interface take advantage of this linkage, storing links to the resources in other systems rather than storing a copy of the data, and presenting composite views by fetching the current state of those resources.

For example, my system might be responsible for a yearbook of people (I'm not using our real data and relationships here, of course). People are owned by another system, and perhaps have contact information (email addresses, phone numbers, twitter handles, etc). That contact information might be stored in another system that has details about the phone number or email address.

In order to present a view in my user interface, I then have to fetch my own data and follow the links in order to present the appropriate details from these other systems. I could cache certain parts of this information but likely want to retrieve the newest details.

In some of my pages, I have a reasonably small number of lookups to do this kind of data enrichment. In other pages, I am presenting a lot more information and end up with an explosion of data as I get a list, expand each element, expand each of those, and so on. I have experimented with providing a service which does this aggregation and returns all the data needed by the view in a single response. However, I am not sure whether this is the cleanest way to provide this.

Can anyone suggest some strategies for determining when I should directly use AJAX requests to fetch this data? At what point should I switch from individual requests to providing aggregated services to build the data? Or is there some other technique I could apply?

答: Its too much when it becomes a hindrance to usability, performance, maintenance, or development. </p>

Title: How much AJAX is too much?


问:
How does office bureaucracy affect code quality
I'm interested in stories where office bureaucracy has had direct effect on the final code quality result.

For example, a friend just told me that at his previous work place the version control system was so bulky that programmers were not allowed to create new "modules" (root directories in the source tree) without asking permissions from the VCS gods. The result was that programmers were unwilling to go through the extra bureaucratic step and instead of properly componentizing their services they ended up piling unrelated functionality on top of existing modules even when functionality was just remotely related to the current definition of the module or the module's name was way in the past. (not to mention renaming a module...)

I'm interested in similar stories of office, operational or any other bureaucracy that eventually, perhaps unintentionally affected software quality

答:
I'm interested in stories where office
  bureaucracy has had direct effect on
  the final code quality result.

I don't think bureaucracy has so much effect on code quality as personal dynamics and office politics do. Bureaucracy has to do with process. When an existing process is done improperly (or exploited negatively... see further below), it has the potential to negatively affect the ability to delivery or react to sudden changes. A lack of process, however, will have a certain and significant impact on code quality. Or to be more precise, a process that does not govern code quality (also interpreted as a lack of code quality process) affect code quality.

That is, it is not bureaucracy itself but specific, QA-related holes in bureaucracy that affect code quality when exploited (either accidentally or nefariously.)

Personal dynamics and office politics, however, are much more of a culprit in bad code, however. Personal dynamics involves lack of professional ethics first and foremost. I don't really buy the argument that people write bad code because they don't know better or have not been properly trained. I've seen people w/o CS-related degrees writing decent code. It is a state of mind and a personal matter of being organized and meticulous.

Office politics play an even more terrible role. Bosses that push the don't think, just code mantra (though there are times when we must just code and ship and clean the bodies later); developers who insist on delivering what they think is the perfect code even though getting something out of the door now is of the essence; code reviewers that are a**holes; cubicle wars and such. These things exacerbate problematic personal dynamics. The combination of both seep through any crack in the process (the bureaucracy) or lack thereof, causing a breakdown in code quality assurance.

Hole in bureaucracy could be solved if there is a culture of post-morten reviews and continuous improvement. However, negative personal dynamics and destructive office politics prevent such corrections on the process to occur, thus perpetuating existing problems (including those related to code quality.)

Bureaucracy by itself is rarely ever the culprit in bad code quality. I would actually say that code quality and bureaucracy are both negatively affected by negative personal dynamics and office politics.

ContentLicense: CC BY-SA 2.5


问:
Migration strategies for deprecating in-house scripting language
We have a scripting language that we use internally for many things.  It began as a simple evaluation statements for dynamic labels to become a Turing complete language used pervasively throughout our system.

Problem is that it was never designed for this and it shows.  Development environment is anemic, scripts produced are not testable and still to this day there is not formal definition of the language.

A growing sentiment among the language's users feel that it has done it's job and it's time to let go but we are faced with a difficult challenge to migrate existing codebase to whatever new solution would be devised.  This very argument is used against the idea of migrating.

Have you ever faced a similar situation ? and if so what strategies did you use to stop usage of the old and promote the new ?

One last thing (thanks Morons) is that many of these scripts are not documented and their original purpose is lost though they are still in active use.  The scripts are also used at customer sites to customize the system so we have literally thousands of these scripts a large portion of which is not under source control or any versionning mechanism for that matter.

Accepted answer.

Difficult choice this is.  All answers were good and sound advice though I think the best lies somewhat of a hybrid of Moron's and Oliver's.

I ended-up accepting Oliver's because it is the answer that stands the best chance of getting accepted higher up (ha! politics!).  Packaging the old scripting environment in a callable statement that can be integrated in the new environment would provide a quick and easy upgrade path.

Once done we can control better creation of new scripts by displaying warnings or disallowing all-together  old scripts from being edited or created forcing to go with the new language.

Thanks all for your input !

答:
The fact that you are dealing with a custom scripting language is irrelevant. You are migrating a set of scripts from one language to another.

There are 2 basic strategies:

1) Take an on large effort to convert all the scripts upfront (as a project)

2) As you need to make changes to particular scripts, rewrite them in the new language. After some time, when there is only a few scripts left in the original language, go ahead an take on a project to finish those off. *

Either way you need to set a hard and fast rule: No New code is written in the legacy language.

*You may also set a rule on how much you are allowed to edit before having to re-write the whole thing, But this is likely to be abused as a loop hole.


问:
Measuring the state of progress in an agile project
Is there a way to measure the success of an agile project as it relates to a well defined outcome?

For example, I've pair coded Conway's game of life with 12 people using TDD, and each time it was different, but the goal of implementing a fully working version of the program was the same everytime.

Clearly that's an extreme example, and most projects will not be that small, or well defined in scope, but it's just an attempt to express the concept I'm
presenting, and which I'm looking to better understand.

答: Assuming the well defined outcome is a collection of user stories, measuring success could mean a steady progression of software that satisfies the user stories.</p>


答:
There is really only two measures of success for any project, really:

Is the customer happy with the results? This is the most important item.

How many project team casualties resulted from the project?  The fewer, the better

That's it.

Title: Measuring the state of progress in an agile project

Body:
Is there a way to measure the success of an agile project as it relates to a well defined outcome?

For example, I've pair coded Conway's game of life with 12 people using TDD, and each time it was different, but the goal of implementing a fully working version of the program was the same everytime.

Clearly that's an extreme example, and most projects will not be that small, or well defined in scope, but it's just an attempt to express the concept I'm
presenting, and which I'm looking to better understand.


答: Regardless of velocity or actual user stories completed or anything like that, isn't the true measure of success on an agile project (really, any project) that the user accepted the software?  Perhaps if you focus more on illustrating a scenario where your product owner approved some stories, did not approve others, maybe added or changed some along the way, and then reached a point of accepting the project as "done" that might be more illustrative than just saying some equivalent of "it's not done until all the requirements pass testing".</p>


问:
Where should I start on a large concurrent programming assignment?
My task is to implement a distributed semaphore system (links to description) and an application for it. I will be using Java sockets, and it will use watermark arrays and priority queues (not sure where), and so I am curious about how to tackle this project. Specifically, I'd like to know what is a good first-step goal, or a simple subsystem I can implement. At the moment, I just don't know where to focus my attention.

The application is a floating license system - like in a computer lab with only one copy of a software (maybe a CAD program), which allows only one PC at a time to use the software. When one machine is using the software, the access to the software is locked. When that machine is done using it, it gives it up and whomever was first in requesting should be next.

Here's  the pseudo-code algorithm referenced - http://i.imgur.com/q9kRm.png

答:
Consider starting with "handshake" sub-system - the one that will allow licensed application running at particular machine to register a session at your license server and obtain a token uniquely identifying it for further interactions.

I think it would be reasonable for this subsystem to also include some "negotiation" about further communication protocol ("heartbeat signals will be expected to exchange at a rate between 5 and 10 seconds" - stuff like that).

 Next logical step would probably be establishing kind of "heartbeat" module - the one that would allow registered machine and server to... oops sorry you asked about first-step goal that one doesn't fit.


问:
Is there any example or resource explaining/showing code from High-level to Low-level to deep down Machine code?
I have been searching for an example over the internet that shows any operation like saving a file or drawing anything in UI or any other sort that shows the implementation from High-leve language code to Low-level code to deep down machine level code.

The basic idea is to explain the computer working in a nutshell. Like, in high-level laguage we write int c= int a + int b which is compiled into low-level code IL_0001: ldarg.1
IL_0002: ldarg.2 IL_0003: add and then to machine level code.

Any example or code flowchart from high-leve language to deep down machine code will be helpful.

答:
DTrace is the only tool can do such deep inspection throughout software stack that I know of. You may find this example of tracing from PHP all the way to OS kernel useful.

It was originally developed at Sun Microsystems as one of key new features for Solaris 10. It has been ported to Mac OS X and FreeBSD since then. A breakthrough if you ask me.


答:
According to James Shore, the author of "The Art of Agile Development" Book, success has three aspects, Organizational, Technical and Personal Success. If it meets all, then it can be considered as success. The following is the excerpt from the book.

Success is usually defined as delivering on time, under budget, and
  as specified. That's a flawed definition. Many late projects are huge
  successes for their organizations, and many on-time projects don't
  deliver any value. Instead, think in terms of organizational,
  technical, and personal success.

Agile development is no silver bullet, but it is useful.
  Organizationally, agile delivers value and reduces costs; technically,
  it highlights excellence and minimal bugs; personally, many find it
  their preferred way to work.

You can see the more details here: http://jamesshore.com/Agile-Book/why_agile.html


问:
What's the best way to deal with large compressed files over FTP?
In my application, I'm getting product information files from an FTP server. They are text files that have been ZIP-compressed.

At first, I thought uncompressed the file on the server then reading the text over the web would work, but the uncompressed files are ~900 MB, making it slow and inefficient while causing out-of-memory exceptions.

How should I handle this type of problem? Should I download the compressed files, uncompress and process them locally, then re-upload them? Or is there another, more efficient way to do this?

答:
I assume you want to do so programmatically.

Yo don't need to uncompress first. E.g., in Java, you can read files in a zip archive directly, using java.util.zip.ZipFile:

ZipFile zipfile = new ZipFile(filename);
Enumeration e = zipfile.entries();
while(e.hasMoreElements()) {
    entry = (ZipEntry) e.nextElement();
    is = zipfile.getInputStream(entry));
    // now read from is and write to ftp outputstream
}
```

By doing so you avoid the overhead of uncompressing, which may save you from out-of-memory error.

Body:
I assume you want to do so programmatically.

Yo don't need to uncompress first. E.g., in Java, you can read files in a zip archive directly, using java.util.zip.ZipFile:

ZipFile zipfile = new ZipFile(filename);
Enumeration e = zipfile.entries();
while(e.hasMoreElements()) {
    entry = (ZipEntry) e.nextElement();
    is = zipfile.getInputStream(entry));
    // now read from is and write to ftp outputstream
}

By doing so you avoid the overhead of uncompressing, which may save you from out-of-memory error.


问:
ETL Software Research Question
Where I work, we use an in-house ETL solution that's homegrown and has been around for 5-10 years. I'm still new to my data analysis job, but I was wondering about the ETL tools that are out there. This is a new area for me.

My situation, and job, is basically

digging in a set of databases (DB2, SQL2005, Citrix, Ancient Cobol Database with a SQL Wrapper on top, MySQL, etc).

Gather the desired information.

combine the different datasets into one set.

output into a file of choice (CSV, Tab Separated, Pipe Separated, XLS, etc).

FTP to customer.

I guess what my real question is, given my job, what are some good ETL suites that I can look at and compare to my in-house tools? This is more to research some other options. Ultimately, I'd either suggest a new solution or get options/ideas to improve our current app.

答:
The three main commercial contenders are:-

Informatica PowerCenter -- probably the best of breed, very clean graphical interface and very consistent APIs.

IBMs InfoSphere DataStage -- the "granddaddy" of these tools. It has been around for a long time so its highly tuned and has lots of options. Conversely it suffers from inconsistent implementations and APIs as coding styles changed over the years. Also the excellent "parallel edition" is really another product bolted on.

AbIntio from the company of the same name -- Never worked with this personally and the company is incredibly secretive so its hard to get details until you are an actual customer. BUT I have it on good authority that this is the fastest of the tools and can move massive volumes of data in double quick time.

Be warned all of these are big ticket items.

Title: ETL Software Research Question


问:
What is the architectural pattern: data pollers collect push normalized data to a central server for monitoring
I am trying to find a name for this architectural pattern that I have seen in many places before:

Poller - (There are a number of these)

These are either plugins or services acting on there own

communicate with equipment of various sorts collecting data and pushing that data to a central service in a normalized form.

each poller knows how to communicate with a particular device,

collects the devices status but does not act on it, just passes it on.

Central Server

Receives normalized data, files it in key / value store.

Periodically (or by some trigger) evaluates conditions that refer to the data.
The conditions cause some action to occur (like an event to be logged, or message to be sent to an operator)

答:
I don't know that I've ever come across a technical term for this other than a monitoring system.  Maybe data collection network or a data acquisition system ( http://en.wikipedia.org/wiki/Data_acquisition ).  What you are referring to as pollers would seem to fall into the category of data loggers:  http://en.wikipedia.org/wiki/Data_logger

If that isn't exactly what you were looking for maybe it will be a useful starting point for you.


问:
Choosing a licence for open source projects
I've done some open source projects, and I plan to do more in the future. So far, I've released all my code under GPL, but I've read a few articles which claim GPL is too restrictive for any code to be used in corporate environment. This, supposedly, reduces contributions.

Here's what I wanted to accomplish:

For full applications:

no commercial use with the exception of selling support for the application (i.e. the app cannot be sold, but everything around it can)

For libraries (components, plugins, ...):

can be included into commercial projects without modifications

any modification the the library/component must be open sourced (contributed back) - the rest of the project, commercial or not, is not affected

For applications, GPL still seems the logical choice. For libraries, my primitive understanding of licences makes me think that LGPL is a good match, but, I'm not sure. I've looked at MIT licence, and that seems too permissive.

Most of the time, I want people to use my code anywhere they want to, as long as any improvements are contributed back.

This brings me to my question(s): is LGPL a logical choice for open source libraries, components, plugins etc? Is there a better alternative? Is GPL a good choice for my applications or is there something better?

Update:

For those who are interested in my final decision, I've decided to release my libraries under multi-license scheme, MPL, LGPL and GPL. This enables virtually everyone to use my code with no obligations, unless they modify it under MPL, in which case it would have to be contributed back.

This means the code can be used by both FSF and proprietary software, but "bad" commercial exploitation is prevented (or so I'd like to think).

答: It sounds to me like GPL and LGPL are what you want for your projects.</p>


答:
I think how many Ajax requests you should perform and when they should be done really depends on your UI. What I would think of first is what is the most important information related to the data I'm loading. For example, if it's a person, I'd say his first name, last name, birthday date are what I want to display (or the kind of information you can find in Wikipedia's right side frame for displaying personal information). I think you have to display critical information as fast as possible however it's up to you (or your client) to determine what is critical and what is not.

You can then use Ajax requests to load more detailed information (addresses ? phone numbers ? twitter handles) that at first is not available or/and hidden to the user, for example in a "tab" that is not selected. The selected tab by default being the one with the main information. You have two ways to do it then:

Load when the page is ready, that is when it has shown up to the user. It is loaded while the user looks at the main information.

Load when the user clicks on the tab. The user will have to wait a little bit (could be very fast and nearly unknown to the user).

Either way, adopt consistency and always make sure to show the famous "loading icon" when the data is not yet available. The second choice may not be great, but it could be useful for Ajax requests that take some time, return a lot of data and more than anything else need a complex widget to be displayed. You also avoid unnecessary Ajax calls.

How many Ajax requests you perform (service aggregation as you wrote means to me you aggregate data server-side) is less important in my opinion than the total time it takes to get the data you need. If you display the information faster with one huge request, go for it, if not, stay with several small requests/responses. You should set yourself a goal in terms of loading the page as fast as possible and try to attain it.

Anyway, you will have to experiment and see what gives the user the best experience. I know it's not a great advice, but that's what I'd try to do.

Title: How much AJAX is too much?

Body:
My current project is part of a highly linked architecture, with individual systems each owning certain pieces of data, and exposing them RESTfully. Both our web services and our user interface take advantage of this linkage, storing links to the resources in other systems rather than storing a copy of the data, and presenting composite views by fetching the current state of those resources.

For example, my system might be responsible for a yearbook of people (I'm not using our real data and relationships here, of course). People are owned by another system, and perhaps have contact information (email addresses, phone numbers, twitter handles, etc). That contact information might be stored in another system that has details about the phone number or email address.

In order to present a view in my user interface, I then have to fetch my own data and follow the links in order to present the appropriate details from these other systems. I could cache certain parts of this information but likely want to retrieve the newest details.

In some of my pages, I have a reasonably small number of lookups to do this kind of data enrichment. In other pages, I am presenting a lot more information and end up with an explosion of data as I get a list, expand each element, expand each of those, and so on. I have experimented with providing a service which does this aggregation and returns all the data needed by the view in a single response. However, I am not sure whether this is the cleanest way to provide this.

Can anyone suggest some strategies for determining when I should directly use AJAX requests to fetch this data? At what point should I switch from individual requests to providing aggregated services to build the data? Or is there some other technique I could apply?


问:
What is the difference between debugging and testing?
Introduction To Software Testing (Ammann & Offutt) mentions on p.32 a 5-level testing maturity model:

Level 0 There’s no difference between testing and debugging.

Level 1 The purpose of testing is to show that the software works.

Level 2 The purpose of testing is to show that the software doesn’t work.

Level 3 The purpose of testing is not to prove anything specific, but to reduce
the risk of using the software.

Level 4 Testing is a mental discipline that helps all IT professionals develop
higher quality software.

Although they don't go into much further detail. What are the differences between debugging and testing?

答: Bugs are visible errors.  Debugging is the process started after test case design.  It is a more difficult task than testing, because in the debugging process we need to find out the source of the error and remove it, so sometimes debugging frustrates the user.</p>


答:
The answer is "it depends".

Are your ajax requests handled concurrently, or are they serialized? Serialization can occur client-side (logic or browser connection limits), or server-side (e.g. PHP serializes requests if you use sessions, to prevent concurrency issues with session data).

What's your typical case and worst case for roundtrip time to the server?

I've known situations where the typical roundtrip time was one second. In that sort of situation you must aggregate requests if they would otherwise become serialized, because each request takes 1 second even if your server responds in 1 millisecond. On the other hand, if the requests are highly concurrent, who cares?

Title: How much AJAX is too much?


问:
Why should I use reflection?
I am new to Java; through my studies, I read that reflection is used to invoke classes and methods, and to know which methods are implemented or not.

When should I use reflection, and what is the difference between using reflection and instantiating objects and calling methods the traditional way?

答: Reflection can automatically keep parts of your program in sync, where previously, you would have had to manually update your program to use the new interfaces.</p>

Title: Why should I use reflection?


答:
Reflection is much slower than just calling methods by their name, because it has to inspect the metadata in the bytecode instead of just using precompiled addresses and constants.

Reflection is also more powerful: you can retrieve the definition of a protected or final member, remove the protection and manipulate it as if it had been declared mutable! Obviously this subverts many of the guarantees the language normally makes for your programs and can be very, very dangerous.

And this pretty much explains when to use it. Ordinarily, don't. If you want to call a method, just call it. If you want to mutate a member, just declare it mutable instead of going behind the compile's back.

One useful real-world use of reflection is when writing a framework that has to interoperate with user-defined classes, where the framework author doesn't know what the members (or even the classes) will be. Reflection allows them to deal with any class without knowing it in advance. For instance, I don't think it would be possible to write a complex aspect-oriented library without reflection.

As another example, JUnit used to use a trivial bit of reflection: it enumerates all methods in your class, assumes that all those called testXXX are test methods, and executes only those. But this can now be done better with annotations instead, and in fact JUnit 4 has largely moved to annotations instead.

Title: Why should I use reflection?

Body:
I am new to Java; through my studies, I read that reflection is used to invoke classes and methods, and to know which methods are implemented or not.

When should I use reflection, and what is the difference between using reflection and instantiating objects and calling methods the traditional way?

ContentLicense: CC BY-SA 4.0


答:
Another approach would be to port your scripting run time to the new scripting language of choice and provide ways for executing legacy scripts within the new language.

LegacyRuntime.execute(String script);

Being able to mix old and new code should ease the transition.

Title: Migration strategies for deprecating in-house scripting language

Body:
We have a scripting language that we use internally for many things.  It began as a simple evaluation statements for dynamic labels to become a Turing complete language used pervasively throughout our system.

Problem is that it was never designed for this and it shows.  Development environment is anemic, scripts produced are not testable and still to this day there is not formal definition of the language.

A growing sentiment among the language's users feel that it has done it's job and it's time to let go but we are faced with a difficult challenge to migrate existing codebase to whatever new solution would be devised.  This very argument is used against the idea of migrating.

Have you ever faced a similar situation ? and if so what strategies did you use to stop usage of the old and promote the new ?

One last thing (thanks Morons) is that many of these scripts are not documented and their original purpose is lost though they are still in active use.  The scripts are also used at customer sites to customize the system so we have literally thousands of these scripts a large portion of which is not under source control or any versionning mechanism for that matter.

Accepted answer.

Difficult choice this is.  All answers were good and sound advice though I think the best lies somewhat of a hybrid of Moron's and Oliver's.

I ended-up accepting Oliver's because it is the answer that stands the best chance of getting accepted higher up (ha! politics!).  Packaging the old scripting environment in a callable statement that can be integrated in the new environment would provide a quick and easy upgrade path.

Once done we can control better creation of new scripts by displaying warnings or disallowing all-together  old scripts from being edited or created forcing to go with the new language.

Thanks all for your input !


答:
The testing maturity model that you have listed are descriptions of the mentality of the development team.

What the list implies, without saying explicitly, is how the change in mentality affects the way testing is conducted.

As a development team advances to the next level, the scope of testing is broadened.

At Level 0, no testing is done, because the team thinks it is not necessary.

At Level 1, testing is done to provide a nominal coverage of basic functionalities.

At Level 2, testing is broadened to include everything in Level 1, and adds in destructive testing (a dedicated test team who have access to all information that developers have access to, including source code and binaries, and tries to find bugs that can be triggered from a user role)

At Level 3, in addition to everything in Levels 1-2, non-functional-based testing / non-correctness-based testing (such as performance characteristics) is added.

At Level 4, the goals of software testing is well-understood by every person, including the customer-facing IT staff. Thus, IT staff will be able to provide feedback about what scenarios to test for, improving the risk coverage of Level 4.

(Disclaimer: I do not have access to the textbook, therefore my terminology may be incorrect.)

Title: What is the difference between debugging and testing?

Body:
Introduction To Software Testing (Ammann & Offutt) mentions on p.32 a 5-level testing maturity model:

Level 0 There’s no difference between testing and debugging.

Level 1 The purpose of testing is to show that the software works.

Level 2 The purpose of testing is to show that the software doesn’t work.

Level 3 The purpose of testing is not to prove anything specific, but to reduce
the risk of using the software.

Level 4 Testing is a mental discipline that helps all IT professionals develop
higher quality software.

Although they don't go into much further detail. What are the differences between debugging and testing?


问:
Alternatives to Professional Version Control
We're teaming up with some non programmers (writers) who need to contribute to one of our projects.

Now they just don't like the idea of using Git (or anything for that matter) for version controlling their work. I think this is because they just don't find it worthwhile to wrap their heads around the twisted concepts of version control. (when I first introduced them to branching and merging -- they looked like I was offending them.)

Now, we're not in a position to educate them or convince them to use it. We're just trying to find alternatives so that we get all their work versioned (which is what we need) -- and they get easy workflow and concentrate on what they do.

I have come up with some ideas...

tell them to save their work as a separate file every time they make some non-trivial change, and then use a diff on our side to just track changes.

write a program (in Python) that implements the "milestones" in CSSEdit in some way.

About the project:

It is a natural language processing system (written in C + Python). We've hired some writers to prepare inputs for the system in different languages. And as we evolve the software, we'd need those writers to make changes to their inputs (articles). Sometimes the changes are very small (a word or two), and other times big.

The reason we need to version control those changes is because every small/big change in the input has the potential to change the system's output dramatically.

答:
A rather unorthodox approach would be just use Dropbox. Have the authors save the files in the dropbox directory and you get versioning and backup for free. Plus there is basically no learning curve for the authors.

For git, sounds like in the end you gonna end up providing the authors with the correct branch versions anyway, so just put the git repo in the dropbox and handle the branching and merging for the authors.


问:
Are there any best practices regarding the handover from architecture to development?
We are looking at improving the process for handing over tasks from architecture to development.

At one end of the scale it there is no architecture guidance you risk getting chaos, with each developer doing things his way.

At the other end of the scale where everything is specified, the specification takes longer than the development, and you risk having very boring development tasks.

Has anyone found an optimal middle ground between these extremes? Which artifacts do you deliver to development? For example: modules, class structure, or sequence diagrams?

答:
I would say that Class diagrams views creating a model as well as code is a solution. The class diagram represent the static view of your project architecture. I mean that you have packages > classes, intefaces, enum > attributes, mehtods etc... > etc..
If you look well the UML2 metamodel has exactly the same structure as a java or dotnet project.

What we use in our projects are simply class diagrams which are saved into a single model. We generate views of the model if the classifier already exists or create new one at graphical if it is new. Developers can see our diagrams and model because saved at the project folder root inside CVS. What I like is that also the developer can model because if something is changed at code level then the model is automatically updated on CVS for the entire team.

It works really well and no real need to know UML because class diagram is really simple and reverse engineering will do the job and create the graphical view of the code. Simple navigation, advanced and detailed views where plenty of comments could be added with diagrams always up to date and visible on CVS directly in the project. My UML class diagram is now Magic :-)


问:
Moving legacy application to a testable framework?
We have a web application which contains a web service with over 50 methods.

The application is currently installed at a number of sites and is currently being maintained by one developer.

The application is currently a single user system where all the data is stored in XML files.

One of our main tasks is to make it a multi user system whilst at the same time put in a database (RDBMS or NoSQL, not decided yet).

In addition to other new features we want to get a team of developers (around 5) working on other new features.

From what I have seen, the application is not testable. There are no test units and all the code is pretty much in the web service methods.

I need to put a framework in place so that the other developers can simply start working on their features using TDD and then finally when we have the database in place we can switch that in at a later date.

I was thinking of first moving all the code into libraries and then introducing UNITY and test/mocking frameworks to provide some of the services that the other developers will need. That way via inversion of control they at least have interfaces they can work with.

I am not sure if this is the right way to go or whether I should focus on some other area.

I was thinking about putting unit tests around the original code but then all the code will change later so this may be pointless in the long run.

We have a period of about 6 weeks before we get the other developers involved.

Any help would be appreciated.

答:
IMHO you're on the rigth way... (You're thinking about pros/cons)

So I'd suggest to

set up CI (jenkins?)

write tests for code that is subject to change right before it'll change

devide existing code into modules (if, and only if, you can test, that this operation is a succeess)

introduce new APIs where needed and wrap old APIs in the first step (remove them in the second)

Hmm. Should be enough as a raw plot.


答:
I had such an experience.

My approach was to reverse-engineer the language implementation, deriving a more or less formal specification for its syntax and semantics (imagine deconstructing a BNF out of a handwritten parser in Fortran77, with several thousands  of keywords). Then I've implemented a compiler for this language, translating it into an idiomatic Lua code (even preserving most of the comments).

You can choose any suitable popular scripting language or implement your own better designed DSL. Compiler could be used as a transparent translation layer (keeping the legacy scripts intact) or for rewriting the scripts for a better further maintenance.


问:
Does everyone need a framework to work better?
I have been working with a complex system written with Java. It is made by with many java programs and many shell scripts which call them and some cronjobs to schedule them.

The system is hard to maintain. Input/Output/Error/OK files were distributed in different place of the system by the hands of different programmers. In order to know what is going on, I need to check the config file to see where are the relevant files, and go there to check the status of the program by viewing some logs or ok files(a blank file with extension of .ok to indicate the success of a scheduled job).

Moreover, I am tired of wasting my time on the JDBC connection/object which need to open explicitly and close explicitly.

I've heard that people's compliment over the famous Struts Spring Hibernate (SSH) frameworks. I have never touch any of those, would they help me make a better project which is easy to maintain?

答:
The answer is No.  You do not need frameworks in order to work better.  Some frameworks embody design patterns that could perhaps be usefully applied to a particular application.

So I'd look at whether a design pattern can be applied to your problem and then assess whether a framework will assist you or whether implementing the pattern yourself would be the better option.

Don't re-invent the wheel just for the sake of it, but also don't blindly apply frameworks, they have consequences and trade-offs like anything else.


问:
Guidelines for using BOOST
I am planning to use boost libraries, as it is quiet rich, and will save lots of time. But my question is, what are the guidelines i have to follow, so that

I can replace some part of boost with standard C++ as and when they are supported, considering so many new features are coming in C++11.

Also, how to encapsulate them in a way so that i have to change least when i change platform/compiler/boost version.

Also is there a category which suggest, which portion of the library to use and avoid, considering stability and standard.

答:
For questions 1 and 2 the answer is relatively straightforward through boost itself - the boost::tr1 library wraps the original "TR1" (technical report 1 I think) parts of the C++11 standard in a way that you will get your native implementation if it's available or the boost implementation if it's not, in the std::tr1 namespace.

For 3: all libraries in boost are quite stable, though some are not ideal (boost::python has memory leaks when embedding python, for example), and some are very complex (spirit, MPL) and you may want to avoid them for those reasons.

Title: Guidelines for using BOOST


答:
All things considered, in most cases and especially for common types of applications, you're better off using frameworks than not using them.

Frameworks (good ones, anyway) offer the following benefits:

They provide well-designed APIs for common tasks, and efficient, well-tested implementations that are much better that what most developers would come up with themselves, especially when new to a field.

They impose some structure/patterns on your code that have been shown to work well and make your code easier to understand, especially (but not only) to people who have used the same framework.

Learning to use a framework can be daunting, and most developers' cowboy coder instincts scream "I could do this so much better". Usually they're wrong - you're seeing the result.

But frameworks will not magically make your code maintainable - any tool can be misused to the point where it does more harm than good.

Title: Does everyone need a framework to work better?

Body:
I have been working with a complex system written with Java. It is made by with many java programs and many shell scripts which call them and some cronjobs to schedule them.

The system is hard to maintain. Input/Output/Error/OK files were distributed in different place of the system by the hands of different programmers. In order to know what is going on, I need to check the config file to see where are the relevant files, and go there to check the status of the program by viewing some logs or ok files(a blank file with extension of .ok to indicate the success of a scheduled job).

Moreover, I am tired of wasting my time on the JDBC connection/object which need to open explicitly and close explicitly.

I've heard that people's compliment over the famous Struts Spring Hibernate (SSH) frameworks. I have never touch any of those, would they help me make a better project which is easy to maintain?


答:
I agree with @Martin in that you don't necessarily need frameworks to solve these problems. Although for greenfield development, it is indeed advisable to pick and use an established framework, in this specific case it seems to me that most of your problems stem from the general disorderliness and inconsistency of the system. Although a common, consistently used framework could indeed help consolidating your system and keeping it maintainable in the long run, the more important and urgent part is reorganizing your system to make it consistent and clean.

This can - and in fact, should - be done before migrating to a framework, because it involves a lot of decisions and preparations you would need to do before migrating to a framework anyway. However, this approach is much less obtrusive, thus less risky, than full scale migration. Altogether, it gives you the most return on your investment (effort spent).

Otherwise - by migrating to a framework directly - you risk expelling a tremendous effort and still having a system which may be slightly less disorderly and inconsistent - and in a different way than before -, but still hard to maintain.

So start by setting up common conventions for your project team ("this is where we put the output file for module X, and this is its expected format") and ensuring that everyone adheres to them, initially for new development. Once the conventions are discussed, shaken out, tried, tested and matured, you may gradually start to revise, rewrite and reconfigure existing scripts to adhere to them too. Once most of the system works according to the conventions, you may consider migrating to some framework.


答:
Truthfully the answer is in your edit: "We've hired some writers" - sometimes you just have to be bloody minded... they want your money they have to do what you want providing that what you want is not unreasonable.

The argument you make is the argument you've already advanced - we need to be able to do X, Y and Z to make the product work - and in order to do this we need you to do that. We will be as supportive as we can, but for this to work (and therefore for it to continue as an income stream for you, the writer) this has to happen.

I tend to agree that an appropriate Wiki based solution would seem to be a good match - but the challenge here is how to find a compromise between their workflow and your requirements.

I'll repeat the key point - in order for your project to be a success you need the articles to be versioned therefore those who work on the articles have to play by an agreed set of rules, if this doesn't happen you will get burned and by extension so will the writeres.

Title: Alternatives to Professional Version Control

Body:
We're teaming up with some non programmers (writers) who need to contribute to one of our projects.

Now they just don't like the idea of using Git (or anything for that matter) for version controlling their work. I think this is because they just don't find it worthwhile to wrap their heads around the twisted concepts of version control. (when I first introduced them to branching and merging -- they looked like I was offending them.)

Now, we're not in a position to educate them or convince them to use it. We're just trying to find alternatives so that we get all their work versioned (which is what we need) -- and they get easy workflow and concentrate on what they do.

I have come up with some ideas...

tell them to save their work as a separate file every time they make some non-trivial change, and then use a diff on our side to just track changes.

write a program (in Python) that implements the "milestones" in CSSEdit in some way.

About the project:

It is a natural language processing system (written in C + Python). We've hired some writers to prepare inputs for the system in different languages. And as we evolve the software, we'd need those writers to make changes to their inputs (articles). Sometimes the changes are very small (a word or two), and other times big.

The reason we need to version control those changes is because every small/big change in the input has the potential to change the system's output dramatically.


答: Noone seems to talk about them, but you might consider a Creative Commons licence. They have a range of licences (or one that you tailor to your needs, looked at a different way).</p>

Title: Choosing a licence for open source projects

Body:
I've done some open source projects, and I plan to do more in the future. So far, I've released all my code under GPL, but I've read a few articles which claim GPL is too restrictive for any code to be used in corporate environment. This, supposedly, reduces contributions.

Here's what I wanted to accomplish:

For full applications:

no commercial use with the exception of selling support for the application (i.e. the app cannot be sold, but everything around it can)

For libraries (components, plugins, ...):

can be included into commercial projects without modifications

any modification the the library/component must be open sourced (contributed back) - the rest of the project, commercial or not, is not affected

For applications, GPL still seems the logical choice. For libraries, my primitive understanding of licences makes me think that LGPL is a good match, but, I'm not sure. I've looked at MIT licence, and that seems too permissive.

Most of the time, I want people to use my code anywhere they want to, as long as any improvements are contributed back.

This brings me to my question(s): is LGPL a logical choice for open source libraries, components, plugins etc? Is there a better alternative? Is GPL a good choice for my applications or is there something better?

Update:

For those who are interested in my final decision, I've decided to release my libraries under multi-license scheme, MPL, LGPL and GPL. This enables virtually everyone to use my code with no obligations, unless they modify it under MPL, in which case it would have to be contributed back.

This means the code can be used by both FSF and proprietary software, but "bad" commercial exploitation is prevented (or so I'd like to think).


答:
If you can provide prepared workspace with transparent VCS-usage, they will use VCS. Don't teach non-programmers to use VCS in programmer's way

Just find editor with embedded VCS-support, configure it and show additional easy steps in their works.

Just an example - Editplus knows about Subversion, have ability to perform basic SVN operation inside editor window. Latest Editplus even can use TortoiseGIT for Git-integration

Edit: found some-way-alternative solution: EasySVN, which, being properly configured, monitor working copy and perform autocommit and automerge, allowing to use any authoring tool for end-user and any document's formats


答:
I've had to deal with a similar situation like this before. In the end we just designated one developer (me) as the version control point of contact for the 3rd party.

The 3rd party would email me a zip file of their project files every day and I would do the checkin for them. I setup a separate project workspace and svn account for them and would unzip the files into that workspace overwriting what was there and then do the checkin under that account.

It's wasn't the most fun to have to do every day but sometimes it's more important to just get the work done.

One plus was that it did help me review their work to make sure they were not checking in bad code and data that would break the build.


答:
Ah, the joys of non coders mucking about. I'd suggest getting a git/mercurial environment set up for them. Tell them to save everything in a format that the repo can handle. With tortoisegit or tortoisehg, they don't need to know how the repo works. They just check if they have an exclamation point in their project directory, right click the offending file, and click commit. Type up a synopsis of changes(they're writers, right?) and you are done!

An extra step in the work flow for them, but nothing about merging/branching/cool stuff. The pre built environment is already set up to be in the writers branch, so they don't see code. Have a script auto sync them every day. Later, after they are used to committing, you can show them extra features. The ability to see what changed when is so useful that they won't be able to do without it, once you sneak it into their workflow.


问:
What's the worst programming book you've ever read?
What's the worst programming-related or technical book you've ever read? This can be any book which one way or another can be connected to programming, as long as it's not fiction.</p>

答:
How to do everything with PHP and MySQL by Vikram Vaswani. That book set me back so much when learning programming at first. Horrible code, constant mixing and matching of code and markup, complete ignorance of OOP the barest nod to security throughout and just plain ignoring PHP5, which even then, wasn't exactly brand new.

I wrote a blog post on programming books in which I had this picture comparing the two first PHP books I got.

Compare the size http://blog.webicity.info/blog/wp-content/uploads/2010/08/books-small.jpg

Guess which has the more accurate title?


答:
Did you look at Plastic SCM.  They are trying to make it simpler to use

If you just want versioned backups you can use Dropbox or you can setup Windows backup service.  Or you can install Crashplan or another similar product.


答:
SparkleShare is a git-based dropbox-clone, I think it suits your needs.

SparkleShare creates a special folder on your computer. You can add remotely hosted folders (or "projects") to this folder. These projects will be automatically kept in sync with both the host and all of your peers when someone adds, removes or edits a file.

...here's a few examples of what it does well and less well with smiley faces:

Great

Frequently changing project files, like text, office documents, and images

Tracking and syncing files edited by multiple people

Reverting a file to any point in its history

Preventing spying on your files on the server using encryption

Not so great

Full computer backups

Storing your photo or music collection

Large binary files that change often, like video editing projects...

Update (November 2015): The project seems to be abandoned (last release from April 2014).


答:
What about Share Point? I know it isn't popular in the development worlds but if your writers are using Windows as an OS it will work well and they won't really know that they are using version control(A big plus for my work).

This solution also keeps them from dealing with anything that would scare them to much, as it seems they are skittish of new things.


答:
Could you setup a tool that monitors the file system where the writers are saving their files and have it do an automatic commit every time they make a save?  </p>

<p>If you put it on a network share you could do all the configuration without involving them at all; but every time they provided an updated version for your team to use it would be added to git for you.  </p>

Body:
Could you setup a tool that monitors the file system where the writers are saving their files and have it do an automatic commit every time they make a save?

If you put it on a network share you could do all the configuration without involving them at all; but every time they provided an updated version for your team to use it would be added to git for you.


答:
For the Mercurial DVCS, there is a user interface called EasyMercurial, whose stated goal is explicitly to provide a simple view of the basic version control operations.

EasyMercurial is intended to be:

simple to teach and to learn
  indicative of the actual repository state, using a history graph representation

recognisably close to normal command-line workflow for Mercurial
  consistent across platforms

We are not trying to produce "the best" Mercurial client for any one
  purpose. We actively encourage users to move on to other clients as
  their needs evolve. The aim is simply to provide something accessible
  for beginners in small project groups working with a shared remote
  repository.

I would recommend giving it a try.


答:
when I first introduced them to branching and merging -- they looked
  like I was offending them

This is probably because branching and merging are advanced concepts, and infinitely less useful than to simply keep track of the changes.

So why not explain just "commit" (save) and "update"? Two really simple concepts. I'm sure you can explain it in less than 10 minutes.

If you really want to use separate branches and stuff like that, you can do that part yourself without involving them with it.


问:
Clang warning flags for Objective-C development
As a C & Objective-C programmer, I'm a bit paranoid with the compiler warning flags.

I usually try to find a complete list of warning flags for the compiler I use, and turn most of them on, unless I have a really good reason not to turn it on.

I personally think this may actually improve coding skills, as well as potential code portability, prevent some issues, as it forces you to be aware of every little detail, potential implementation and architecture issues, and so on...

It's also in my opinion a good every day learning tool, even if you're an experienced programmer.

For the subjective part of this question, I'm interested in hearing other developers (mainly C, Objective-C and C++) about this topic.

Do you actually care about stuff like pedantic warnings, etc? And if yes or no, why?

Now about Objective-C, I recently completely switched to the LLVM toolchain (with Clang), instead of GCC.

On my production code, I usually set this warning flags (explicitly, even if some of them may be covered by -Wall):

-Wall

-Wbad-function-cast

-Wcast-align

-Wconversion

-Wdeclaration-after-statement

-Wdeprecated-implementations

-Wextra

-Wfloat-equal

-Wformat=2

-Wformat-nonliteral

-Wfour-char-constants

-Wimplicit-atomic-properties

-Wmissing-braces

-Wmissing-declarations

-Wmissing-field-initializers

-Wmissing-format-attribute

-Wmissing-noreturn

-Wmissing-prototypes

-Wnested-externs

-Wnewline-eof

-Wold-style-definition

-Woverlength-strings

-Wparentheses

-Wpointer-arith

-Wredundant-decls

-Wreturn-type

-Wsequence-point

-Wshadow

-Wshorten-64-to-32

-Wsign-compare

-Wsign-conversion

-Wstrict-prototypes

-Wstrict-selector-match

-Wswitch

-Wswitch-default

-Wswitch-enum

-Wundeclared-selector

-Wuninitialized

-Wunknown-pragmas

-Wunreachable-code

-Wunused-function

-Wunused-label

-Wunused-parameter

-Wunused-value

-Wunused-variable

-Wwrite-strings

I'm interested in hearing what other developers have to say about this.

For instance, do you think I missed a particular flag for Clang (Objective-C), and why?

Or do you think a particular flag is not useful (or not wanted at all), and why?

EDIT

To clarify the question, note that -Wall only provides a few basic warnings.

They are actually a lot more warning flags, not covered by -Wall, hence the question, and the list I provide.

答:
I think the best evidence that people care about warnings is the fact that they exist and are widely used.  I am strongly of the opinion that the more errors caught during compile time, the better.  If this wasn't a widely held belief, everyone would be using weak dynamically typed languages, because their compilers or interpreters give you a lot more leeway.  To the contrary, even on scripting languages the use of strict flags is popular.  On static strongly typed languages not only do people use -Wall -Werror frequently, but they often find warnings so valuable that they want even more, so they pay for static analysis tools like Coverity whose sole purpose is providing warnings.

That doesn't mean there aren't detractors.  A lot of developers see warnings as working against them in the short term rather than working for them in the long term, and don't try to fix the underlying problem.  Hence, you see lovely code like this snippet I came across yesterday:

```<code>node = node; // Shut up compiler warning
</code>```

OwnerDisplayName: Macmade

Body:
I think the best evidence that people care about warnings is the fact that they exist and are widely used.  I am strongly of the opinion that the more errors caught during compile time, the better.  If this wasn't a widely held belief, everyone would be using weak dynamically typed languages, because their compilers or interpreters give you a lot more leeway.  To the contrary, even on scripting languages the use of strict flags is popular.  On static strongly typed languages not only do people use -Wall -Werror frequently, but they often find warnings so valuable that they want even more, so they pay for static analysis tools like Coverity whose sole purpose is providing warnings.

That doesn't mean there aren't detractors.  A lot of developers see warnings as working against them in the short term rather than working for them in the long term, and don't try to fix the underlying problem.  Hence, you see lovely code like this snippet I came across yesterday:

node = node; // Shut up compiler warning


答:
I agree that your 1st duty is to consolidate/clean your code up to use a single place for files, common config files, consist status mechanisms.

Using a framework, without doing this 1st is not going to help.  So do the clean up 1st and then re-evaluate your needs.

PS clean up is hard and slow.  I spent 6-8 weeks clean up a system that had just been completed because the previous developers had not followed consistency etc rules.


答: If what you care about is making sure your code stays free, getting improvements back, and being sure anyone can use it, then MPL is the right license for you.  It's free to use in any product, including commercial software, without weird, arcane linking restrictions like the LGPL imposes.  It requires that anyone who uses your code and modifies it release the changes under MPL, but it doesn't touch or restrict any of the rest of the code in the project.</p>


问:
Bill of materials database design in EF codefirst?
I'm having trouble generating a proper database design for bill of materials in EF Code-first
I just need a general structure then ill add additional fields

So i need to have a Product that is assembled from other Products which are assemblies of other Products.

Example:

Product 1:

Aluminum Box 1x

Aluminum Sheet 4x

Foil 1x

Screws 6x

Product 2:

Wheel Cart 1x

Aluminum Box 1x

Wheels 4x

Screws 4x

Foil 2x

So notice Product 2 (Wheel Cart) is assembled from Product 1 (Aluminum Box) and some additional components, yet same Product Screws and Foil is used in both.

So i think its hierarchical many to many. Or maybe someone knows a better solution.

Doesn't have to be in EF Code-first, i can re-generate code from T-SQL.

Thank you.

EDIT:

Ive been messing around and nothing seems to work,
i have this currently:

Components

ComponentID

Name

Price

ProductID

N

|

|

|

1

Products

ProductID

ParentID

Quantity

ComponentLookupId

First i create a Component, then a Product which can be hierarchical and tie a Component to it, and now i am fetching the Name and Price of the Component via Lookup, which is sort of OK, but having problems with summaries.

If i copy Name, Price then when Component is changed Product isn't.

Or should i try many-to-many with additional fields in a join table.

答:
This concept is called a 'super BOM' its a BOM that is made up of other BOMs.  You need a materials table, a BOM table, a BOMMaterials table and a SuperBOM table.  The SuperBOM table represents relationships between BOMs.

Roughly as follows:

```<code>Material
-------------------------------
ID     Description

BOM
-------------------------------
ID     Description

BOMMaterials
-------------------------------
BOMID     MaterialID

SuperBOM
-------------------------------
ParentBOMID     ChildBOMID
</code>```

OwnerDisplayName: Seeker

Body:
This concept is called a 'super BOM' its a BOM that is made up of other BOMs.  You need a materials table, a BOM table, a BOMMaterials table and a SuperBOM table.  The SuperBOM table represents relationships between BOMs.

Roughly as follows:

Material
-------------------------------
ID     Description

BOM
-------------------------------
ID     Description

BOMMaterials
-------------------------------
BOMID     MaterialID

SuperBOM
-------------------------------
ParentBOMID     ChildBOMID

OwnerDisplayName: Maess


答:
You can store tree style data:

```<code>public class Item {
    [Id, DatabaseGenerated]
    public int Id {get;set;}
    [ForeignKey("Parent")]
    public int? ParentId {get;set;}

    //navigation to parent item
    virtual public Item Parent {get;set;}
    //navigation to children
    virtual public IEnumerable<Item> Children {get;set;}
}
</code>```

where ParentId is a nullable column in the database with an appropriate foreign key constraint. If the ParentId is null, this item is at the top of a hierarchy. You can traverse the heirarchy through the navigation properties - though, with lazy loading enabled, this will generate a lot of little queries, so it may not be appropriate for you.

This doesn't address some of the other issues about BOM systems; for example, you may have an item that is used as a subassembly in one place but not all, so this isn't a complete solution, but it might address some of your question.

Title: Bill of materials database design in EF codefirst?

Body:
I'm having trouble generating a proper database design for bill of materials in EF Code-first
I just need a general structure then ill add additional fields

So i need to have a Product that is assembled from other Products which are assemblies of other Products.

Example:

Product 1:

Aluminum Box 1x

Aluminum Sheet 4x

Foil 1x

Screws 6x

Product 2:

Wheel Cart 1x

Aluminum Box 1x

Wheels 4x

Screws 4x

Foil 2x

So notice Product 2 (Wheel Cart) is assembled from Product 1 (Aluminum Box) and some additional components, yet same Product Screws and Foil is used in both.

So i think its hierarchical many to many. Or maybe someone knows a better solution.

Doesn't have to be in EF Code-first, i can re-generate code from T-SQL.

Thank you.

EDIT:

Ive been messing around and nothing seems to work,
i have this currently:

Components

ComponentID

Name

Price

ProductID

N

|

|

|

1

Products

ProductID

ParentID

Quantity

ComponentLookupId

First i create a Component, then a Product which can be hierarchical and tie a Component to it, and now i am fetching the Name and Price of the Component via Lookup, which is sort of OK, but having problems with summaries.

If i copy Name, Price then when Component is changed Product isn't.

Or should i try many-to-many with additional fields in a join table.

Body:
You can store tree style data:

public class Item {
    [Id, DatabaseGenerated]
    public int Id {get;set;}
    [ForeignKey("Parent")]
    public int? ParentId {get;set;}

    //navigation to parent item
    virtual public Item Parent {get;set;}
    //navigation to children
    virtual public IEnumerable<Item> Children {get;set;}
}

where ParentId is a nullable column in the database with an appropriate foreign key constraint. If the ParentId is null, this item is at the top of a hierarchy. You can traverse the heirarchy through the navigation properties - though, with lazy loading enabled, this will generate a lot of little queries, so it may not be appropriate for you.

This doesn't address some of the other issues about BOM systems; for example, you may have an item that is used as a subassembly in one place but not all, so this isn't a complete solution, but it might address some of your question.

OwnerDisplayName: Mikeb


问:
Company wants to move its programs to a new framework / concept - what are options?
So there is an insurance company which wants to move long term its proprietorially written software for different insurance products to a new platform / framework / concept / something. One of the applications is ~700 pages big.
We would require some workflow application (ibm websphere products?). Transaction control, historisation, support for running batches, integration of different systems (basically our DB2 is on a host zOs system). The front end is a web gui. The business logic code is written in C++.
We would like to move step by step to the new environment.

What would be good options?

答:
Why do they want to move?  Answering that question is pretty important.

On the Java/JVM side I would look at Matt Raible's comparison on comparing web frameworks and then take his advice on putting your own weights on the 20 criteria (+ perhaps some criteria of your own) and then picking the top 2 to prototype with.

Please do prototype several solutions before settling on one :-).


问:
Reverse Engineering PHP application without reading the (ugly) Code
I have this new customer, that has this PHP App. It was written by a single developer that wanted to "make yet another framework" back in 2005. About 3 Years later the developer left the company, and with him all Knowledge on what this thing is actually doing.

Now, as the App already went in production the manager just hired a few more developers / freelancers (that are not available anymore too) to fix bugs here and there and develop some more functionality. Some tried to follow the undocumented guidelines of the software, some did not.

You might be able to imagine how the code looks today ... its an utter mess!

I talked to the manager and told him what I think of his software and managed to get him to realy think about rewriting the damn thing.

But here comes my problem: To be able to estimate the effort needed to rewrite I would need to know what the thing is doing. The manager can tell me from his perspective what it's doing but there is just no technical knowledge about it. And as with all software that grew over years there are these "special edge cases".

Basically my idea is "record/log" the live system for a few weeks to actually get a technical, somewhat complete conclusion of what this thing is doing most of the time and what are the things that rarely get touched/used. E.g. what was the Request and what route did it go to render the results. Reading and trying to understand the code is impossible. It would help though to see which Classes/Functions are called and then read/understand them.

So, is there any tool to log/record Http Request/Responses and what call graph of the php app it triggered? Preferably something that would not have to get written into the code?
I ditched PHP years ago and am somewhat rusty with my PHP Utility and Standard Library Toolset to know of something that could help me here.

答:
You basically need to document the systems in terms of Use Cases\User Screens. Be Sure you cover Every screen in the system in at a least of the use cases.

Then you need to go though all the screens and use cases while running an DB profile.
Document All the Db transactions on each screen. Test every Field for data validation.

Ask users about System integration, basically anything that may be happening behind the screen that is not reflected in the UI or with a Db interaction. (Sending and Email. FTPing something, whatever)

Ask About anything the runs on a schedule.
Look at all the SQL behind the major reports in the System.
Make an ERD.

Document, Document, Document.. Then Finally, once you got all the info you can this way. Start looking at the code for areas where you need clarification.


答:
If you want to rewrite the application then you don't need to know how it does what it does but you do need to know what it does.

Sit down with the manager and go through the system highlighting the functionality that the system must have. This will give you a list of functions (eg. assuming that the application is a blogging system):

Create user

Add blog post

Publish blog post at some point in the future.

Comment on blog post

etc.

Take screenshots of each page so you have a document of what the system looks like. This will also give you the objects and fields that your datamodel must have.

Then you go away and specify how long it will take to implement these functions using your framework of choice.

At no stage do you need to look at the existing code. You are mapping user functionality, not system functionality.

Title: Reverse Engineering PHP application without reading the (ugly) Code

Body:
I have this new customer, that has this PHP App. It was written by a single developer that wanted to "make yet another framework" back in 2005. About 3 Years later the developer left the company, and with him all Knowledge on what this thing is actually doing.

Now, as the App already went in production the manager just hired a few more developers / freelancers (that are not available anymore too) to fix bugs here and there and develop some more functionality. Some tried to follow the undocumented guidelines of the software, some did not.

You might be able to imagine how the code looks today ... its an utter mess!

I talked to the manager and told him what I think of his software and managed to get him to realy think about rewriting the damn thing.

But here comes my problem: To be able to estimate the effort needed to rewrite I would need to know what the thing is doing. The manager can tell me from his perspective what it's doing but there is just no technical knowledge about it. And as with all software that grew over years there are these "special edge cases".

Basically my idea is "record/log" the live system for a few weeks to actually get a technical, somewhat complete conclusion of what this thing is doing most of the time and what are the things that rarely get touched/used. E.g. what was the Request and what route did it go to render the results. Reading and trying to understand the code is impossible. It would help though to see which Classes/Functions are called and then read/understand them.

So, is there any tool to log/record Http Request/Responses and what call graph of the php app it triggered? Preferably something that would not have to get written into the code?
I ditched PHP years ago and am somewhat rusty with my PHP Utility and Standard Library Toolset to know of something that could help me here.


答:
I'd like to build on what ChrisF and Morons have already said.

From ChrisF's answer:

If you want to rewrite the application then you don't need to know how
  it does what it does but you do need to know what it does.

I agree 100%.

From Morons's answer:

Ask users about System integration, basically anything that may be
  happening behind the screen that is not reflected in the UI or with a
  Db interaction. (Sending and Email. FTPing something, whatever)

Ask About anything the runs on a schedule. Look at all the SQL behind
  the major reports in the System.

Agreed. Great point about the scheduled jobs.

Document, Document, Document.. Then Finally, once you got all the info
  you can this way. Start looking at the code for areas where you need
  clarification.

Right.

Test every Field for data validation.

OK.

Then you need to go though all the screens and use cases while running
  an DB profile. Document All the Db transactions on each screen.

I disagree.

Exhaustively profiling the database is not a good use of your time.

It could also be misleading.

Emphasis: As ChrisF said, focus on what the application does, not how it does it.

Also, know that: You will make mistakes! :)

Of course, as the technical lead, it's your responsibility to minimize these mistakes to the extent that the new system mimics the core functionality of the old system.

Having said that...

It seems like this will be a worthwhile effort because you're making the system maintainable and you're erasing a large amount of technical debt.

I just don't think it's useful, productive, efficient, or even fiscally responsible to burden yourself with a overly perfectionist attitude on this job.


问:
Is it reasonable to expect that a senior developer knows what OOP design patterns are?
I'm preparing questions for job interviews for a senior development position. The job would include object oriented design, and the existing software uses design patterns, so I'd like to ask the candidates to explain a few design patterns they know, they've used, how they've used them, why they've used them and so on. However, in previous interviews when I asked senior developers with at least 5-10 years experience about design patterns, almost none ever heard of them. I think two out of twenty developers could name a single design pattern (Singleton and MVC, respectively).

So my question is: does it make sense to ask these questions? Or is this such an obscure subject that you cannot expect new hires to know them already?

Should a senior developer have prior experience with design patterns, or would you say that design patterns are such a simple topic that every decent developer can pick them up during training? If so, what questions would you ask instead to gauge their design abilities?

Add
After reading the answers so far, I should give a few clarifications:

The job is for a .NET developer with experience in OOP/OOD

The existing code uses class names like IParameterGraphVisitor and IStorageFactory in many places

How do you ask people about their past experiences with OO designs they created, if they don't have the vocabulary to explain their designs? That's what I want to do, and all I can come up with is "please you draw the design/object hierarchy of your last project on the whiteboard".

答:
I can think of a senior developer who does not know about design patterns in the following situation:

There are only one book about design patterns. It's the book that made them popular in the first place. If the person has not read this one book, it's possible they do not know about design patterns, or might have heard about them, but do not properly know what they are for

Instead, they would have to know something like uml....

Finding good information about design patterns from the internet is not easy. You're very lucky if you hit the correct web page that has good design patterns knowledge. Simply coming to software after 1995 might make a person not know about design patterns book, because the book is old.


答:
If there is any chance that two of them need to work on the same target at once AND if you can deal with all their work in text files, I'd try shared google docs.

It has awesome multi-editor/collaboration ability--by far the best I've ever seen.  They are also full versioned and can be exported as text files.

But those are two pretty big ifs.


答:
So, is there any tool to log/record Http Request/Responses and what call graph of the php app it triggered? Preferably something that would not have to get written into the code?

The code coverage analysis functionality of xdebug will help you get a sense of what gets executed on each request:

Code coverage tells you which lines of script (or set of scripts) have been executed during a request. With this information you can for example find out how good your unit tests are.

xdebug's profiler outputs profiling information in the form of a Cachegrind compatible file, so in theory you don't have to do a lot in code, as you can configure xdebug via php.ini and htaccess.

This is the practical approach, don't stop here, you should follow the advice given by ChrisF and Morons.


答:
You got the year wrong. It was 2001... Wait, you aren't my old coworker. This must happen everywhere.

When I had to choose between rewriting or patching Frankenstein, it was absolutely clear that a rewrite wasn't going to happen. Not all at once, anyway. Instead, we went page by page refactoring top to bottom (this wasn't exactly a model-driven architecture, so thinking of the site as a collection of pages was reasonable). The "framework" in our case started simple. Draw_Info_Box(some_object). But as the special cases arose, this function became Draw_Info_Box(some_object, true, true, true, false, "Non-default header", true)... well, you get the idea. We started by refactoring these to eliminate one additional parameter at a time. For some, we made the decision to duplicate code and eliminate the special case between the two versions (names like "DoSomethingOrSomethingElse" would get split into "DoSomething" and "DoSomethingElse"). For others, we wrapped them in simple objects and turned the additional parameters into object state variables. This allowed for easier refactoring later on.

Breaking it down into manageable units (in our case, individual pages) allowed some parts of the system to be made more manageable while the system was still being used. This also allowed for simpler bug fixes while the refactoring was going on (which was the case against the rewrite -- there were still things that needed to be done to the system being used).

I actually left before the entire system was rewritten. By then, some parts had actually been rewritten more than once (clearing away one level of organizational chaos often revealed another, but we had a methodological approach that allowed us to handle it).

If I were starting a similar thing today, I'd actually start with Selenium tests on the application and try to get some kind of code coverage metrics from the tests. Then I'd do the same refactoring job, but I'd feel a little more confident that mistakes and behavior differences would be caught.


问:
Why isn't software as reliable as a car?
I had a user ask me this question. We know that cars break down, but that's because of something physical (unless software is involved!).

I tried to answer that software is a much younger industry, but the user countered with "didn't the automobile industry become much more stable than and reliable with less people?".

I also tried to answer that software is more complex, but the user countered that there are many thousands of parts that make up a car. People that design and build cars generally just know their component(s) very well, but they still all end up working together as an end result.

So, why isn't software as reliable as a car?

答:
How many are there car designers? 10,000 top? - they are talented and they know what they're doing.

How many are there software programmers? 30 millions? - and many of them have no idea what they're doing, take for example PHP programmers, you can learn PHP and write your first program in less than a few hours.

If software was to be written only by 10,000 of the best programmers, then it would be as reliable as cars are.


问:
How should a programmer prepare for a new job?
I have just graduated from college and have about 2 months time before I start working at the company. I have experience in C, C++, Java and a bit of Android (developed an app last summer, stopped working on that later). I just want to learn something new while improving on my basic C , C++ and Java skills. </p>

<p>I really need some advice on what I should start learning so that I will be able to work on whatever is given when I start my job... or in the sense that helps me improve from my present level... or that helps me understand things much better, assists me in getting a good understanding of things, etc. </p>

答:
Depends. As a just-out-of-college applicant, my advice is to prepare for your new job in the non-tech sense. Consider reading some articles regarding transitioning from the academic to professional world, how to fit in w/ the team, "soft" skills like communication, etc. The tech focus will come later and, early on, it's unlikely that your employer will expect you to understand specific technologies (though your capacity to learn those technologies is expected).

If you were an experienced dev, my answer would be different. For eg, prior to a previous job, I read up extensively on a technology I knew I'd be using (regarding a specific RDBMS). I recommend doing that if you know before-hand what you'll be doing, & esp if you're already "an experienced developer."

OwnerDisplayName: ravi


问:
How can you explain "beautiful code" to a non-programmer?
When speaking with a non-programmer friend, I happened to mention the concept of "beautiful code" and she wanted to understand what that meant, but I was at a bit of a loss as to how to explain it to someone who would have no context whatsoever.

When all code looks like gibberish to someone anyways, how can you explain what makes one piece of code prettier than another? Analogies could be useful too.

答:
In my humble and personal opinion, beautiful code is like a good novel book:

you can read it from beginning to the end / you should not need to skip ahead to future pages of a book to understand the current page.

it does not have unnecessary repetitions / a book is kind of dull if it is always saying the same things.

the intent of each part is evident almost every time / you should not need to have a dictionary by your side at all times to read a book (unless it's poetry / code golfing xD).

it is organised in substructures of affordable sizes and complexity (modules, functions, statements, etc.), it does not have too much 'nesting' / chapters, paragraphs and sentences are properly balanced; it does not use too many levels of sentence subordination, etc.

it is pleasant to the eye in a aesthetic manner (nicely indented, blocks correctly delimited, etc.) / like a book with a proper typesetting.


答:
Were I able to completely re-platform the applications at the insurance company I work for, I would look into doing it with a Business Process Management/Business Rules Management system such as what PegaSystems offers.  Use this to integrate your JEE app.

First establish the framework.  Again, something like

Then extract what you actual processes are and what your business rules are.  You can do this on an application by application basis.

Write a system that can perform the processes independent of what the actual rules are.

Plug in the rules.

There are a ton of advantages to separating rules from process from data, but it's hard to migrate to the model without completely rewriting your approach.

Oh, and if you're looking for which actual technologies to use--in the JEE world, the JBoss stack is a better bet the IBM's ugliness.

Title: Company wants to move its programs to a new framework / concept - what are options?

Body:
So there is an insurance company which wants to move long term its proprietorially written software for different insurance products to a new platform / framework / concept / something. One of the applications is ~700 pages big.
We would require some workflow application (ibm websphere products?). Transaction control, historisation, support for running batches, integration of different systems (basically our DB2 is on a host zOs system). The front end is a web gui. The business logic code is written in C++.
We would like to move step by step to the new environment.

What would be good options?


问:
Be liberal in what you accept... or not?
[Disclaimer: this question is subjective, but I would prefer getting answers backed by facts and/or reflexions]

I think everyone knows about the Robustness Principle, usually summed up by Postel's Law:

Be conservative in what you send; be liberal in what you accept.

I would agree that for the design of a widespread communication protocol this may make sense (with the goal of allowing easy extension), however I have always thought that its application to HTML / CSS was a total failure, each browser implementing its own silent tweak detection / behavior, making it near impossible to obtain a consistent rendering across multiple browsers.

I do notice though that there the RFC of the TCP protocol deems "Silent Failure" acceptable unless otherwise specified... which is an interesting behavior, to say the least.

There are other examples of the application of this principle throughout the software trade that regularly pop up because they have bitten developpers, from the top off my head:

Javascript semi-colon insertion

C (silent) builtin conversions (which would not be so bad if it did not truncated...)

and there are tools to help implement "smart" behavior:

name matching phonetic algorithms (Double Metaphone)

string distances algorithms (Levenshtein distance)

However I find that this approach, while it may be helpful when dealing with non-technical users or to help users in the process of error recovery, has some drawbacks when applied to the design of library/classes interface:

it is somewhat subjective whether the algorithm guesses "right", and thus it may go against the Principle of Least Astonishment

it makes the implementation more difficult, thus more chances to introduce bugs (violation of YAGNI ?)

it makes the behavior more susceptible to change, as any modification of the "guess" routine may break old programs, nearly excluding refactoring possibilities... from the start!

And this is what led me to the following question:

When designing an interface (library, class, message), do you lean toward the robustness principle or not ?

I myself tend to be quite strict, using extensive input validation on my interfaces, and I was wondering if I was perhaps too strict.

答:
I think that HTML and the World Wide Web have provided a wide-scale real-world test of the Robustness Principle and shown it to be a massive failure.  It's directly responsible for the confusing mess of competing HTML almost-standards that makes life miserable for Web developers (and their users) and gets worse with every new Internet Explorer release.

We've known since the 1950s how to validate code properly.  Run it through a strict parser and if something isn't syntactically correct, throw an error and abort.  Do not pass go, do not collect $200, and for the love of all that is binary do not let some computer program attempt to read the coder's mind if he made a mistake!

HTML and JavaScript have shown us exactly what happens when those principles are ignored.  Best course of action is to learn from their mistakes and not repeat them.


问:
What are the tools/frameworks used to build C# ASP.net applications?
I am basically a java programmer who wants to move to .net. I haven't worked in .NET companies so I don't have any idea about the tools they use. In a Java company people use Maven, Hibernate and frameworks such as JSF or Tapestry.

My questions are:

What are the tools/frameworks that .NET/C# companies use? Do they use ASP.NET MVC? Do they use any ORM tool? Do they use any framework?

I will be happy if someone could tell me about this.

答:
Most of the experts have given you a good starting information as to what can be developed in .NET world. Just to add here, initially .NET was a bit resistant to the open source world as is JAVA. But in recent times lots of Open Source frameworks/Tools have come for .NET also. Also if one can see, all the frameworks which were there in JAVA have made their way in .NET world also. e.g. Log4Net, Spring.Net, AspectJ etc.

ORM Tools :
There are lots of ORM tools available in .NET.

Entity Framework

NHibernate

iBATIS

Habanero.NET and lot more

There is a good discussion at this link about their performance.

There are lots of open source libraries/Frameworks/Tools that are used for the developement in the .NET companies. You can find a good list at - Most Useful .NET Libraries,  Keep up to date with .NET technologies


答:
What about setting up a WebDAV?

It will automagically handle the straight line versioning history for them. All they have to do is connect to the server as if it was a network drive and every save will be a commit.


问:
Use-cases for node.js and c#
I do quite a bit of ASP.NET work (C#, MVC), but most of it is typical web development. I do Restful architecture using CRUD repositories. Most of my clients don't have a lot of advanced requirements within their applications.

I'm now looking at node.js and it's performance implications (I'm addicted to speed), but I haven't delved into it all that much.

I'm wondering if

node.js can realistically replace my typical web development in C# and ASP.NET MVC (not rewriting existing apps, but when working on new ones)

node.js can complement an ASP.NET MVC app by adding some async goodness to the existing architecture.

Are there use-cases for/against C# and node.js?

Edit

I love ASP.NET MVC and am super excited with where it's going. Just trying to see if there are special use cases that would favor node.js

答:
If your just doing restful architecture using CRUD repositories there is no good reason to port an existing application to node.js.

If your writing a new application that does REST and CRUD there may be good reasons to use node.js from the start.

It's really per application dependent.

For example personally I would write REST/CRUD applications fully in node.js because it's personal preference. Node is great to develop in, ASP.NET MVC was an annoying restrictive framework for me.

Verdict: Both tools get the job done. If there are no specific requirements that favor .NET or node then use whatever you want. i.e. It's personal preference.

However I can list some of the obvouis benefits of both platforms

ASP.NET

Windows/.NET integration. If you want your microsoft stack to be tightly coupled and highly integrated then you want .NET

readily available work force

Monolothic frameworks that hold your hand

Has a set of features that work out of the box. If your happy with these features it improves productivity. If you want custom features instead you end up fighting against the tool and reduce productivity.

Node.js

Single language for your entire web stack (if your using noSQL databases that use js for their "queries" like couch/mongo).

Great for soft real-time web applications using tools like socket.io

Great for networking glue when all your server does is talk to n remote end points of various different types.

Only gives you the bare minimal features out of the box. This means you can build up your application in the highly customized way you want.

Collection of small unix style tools that do one thing and one thing well that are easy to mix and match

npm : package management done right

rich Open source community

Title: Use-cases for node.js and c#