问:
How should I select continuous integration tool?
I found this cool comparison table for integration servers on Wikipedia, but I am a little uncertain how to rank the tools vs. my needs and interests.  The chart itself seems to have a lot of boxes marked unknown, so if you are comfortable updating it on Wikipedia, that could be great too.

Are there a few top performing products so I can quickly narrow down to four or five options?

Which products seems to have the largest user communities and most ongoing enhancements and integration with new tools?

Are the open source offerings best, or are there high quality tools that can be a great deal for a single user at home?

Will use of multiple systems (primary desktop, local only home network server, personal and work notebooks, multiple virtual machines spread across all) create problems and how can they be managed?

答:
As Bryan already said starting with Jenkins is always a good idea when setting it all up yourself. It is proven technology and has tons of support.

You can take a look at the jenkins installation of the apache project to get a feeling for it https://builds.apache.org/

If you are ever interrested in a hosted solution we provide a Continuous Integration and Deployment service at Railsonfire. We currently support Ruby, but going into other technologies soon.


问:
Methods to Manage/Document "one-off" Reports
I'm a programmer that also does database stuff and I get a lot of so-called one-time report requests and recurring report requests.

I work at a company that has a SQL Server database that we integrate third-party data with and we also have some third-party vendors that we have to use their proprietary reporting system to extract data in flat file format from that we don't integrate into SQL Server for security reasons.

To generate many of these reports I have to query data from various systems, write small scripts to combine data from the separate systems, cry, pull my hair, curse the last guy's name that made the report before me, etc. My question is, what are some good methods for documenting the steps taken to generate these reports so the next poor soul that has to do them won't curse my name? As of now I just have a folder with subfolders per project with the selects and scripts that generated the last report but that seems like a "poor man's" solution. :)

答:
Honestly, it sounds like you're on the right track with what you're doing.

Things that I would do to "take it to the next level":

implement a lightweight source control system (svn, git, Hg etc...) where you keep those folders.  This will also make it easier to see what's changed over time.

have a related documents folder for the 3rd party documentation, if any.

create a standard documentation set that you apply to the mini-projects.  A README or START_HERE type document is always a good first step.  That lets the poor soul who comes after you know where to start looking for information.

have a standard document that says how to run the XYZ to generate the report.

identify the things you wish you had been left behind and make sure the mini-projects have that aspect available.

ContentLicense: CC BY-SA 3.0


答:
A year or two ago I was testing a change I had made and got annoyed by having to do a calculation manually over and over.  I wanted to write a graphical utility to do that calculation for me.  Since I write embedded software, I didn't have any programming environments already set up for GUI programming, so for no other reason than it was readily available, I implemented it in JavaScript in a single HTML file.

When I finished the feature and submitted it for testing, the tester asked me how to do that calculation.  It was harder to explain than to just give him the utility, so that's what I did, after adding a little polish. He put it on an internal web server that the testers use and I promptly forgot all about it.  A couple weeks ago someone in a completely different department sent me a patch for that utility.  It had spread by word of mouth and I had no idea anyone else was even using it.

I tell you this story to illustrate how putting it on a web server made it trivial to share and reuse a "one-off" script, even though that wasn't the intent in the beginning.  My recommendation is to spend a little extra time making your reports able to be run from a web page, and put them on an internal web server somewhere.

Title: Methods to Manage/Document "one-off" Reports

Body:
I'm a programmer that also does database stuff and I get a lot of so-called one-time report requests and recurring report requests.

I work at a company that has a SQL Server database that we integrate third-party data with and we also have some third-party vendors that we have to use their proprietary reporting system to extract data in flat file format from that we don't integrate into SQL Server for security reasons.

To generate many of these reports I have to query data from various systems, write small scripts to combine data from the separate systems, cry, pull my hair, curse the last guy's name that made the report before me, etc. My question is, what are some good methods for documenting the steps taken to generate these reports so the next poor soul that has to do them won't curse my name? As of now I just have a folder with subfolders per project with the selects and scripts that generated the last report but that seems like a "poor man's" solution. :)


答:
Source Control is an obvious one.  I'd suggest git, or maybe you have a VSS or TFS server somewhere on your network since you're an MS shop.

Another option is setting up a wiki on your network -- easy enough to update and can't beat the user-friendliness.  This will also earn you some brownie points with the bosses for initiative :)


问:
How to add a new developer to the team
I run a small company composed of only 2 developers. We are building a very big application for one of our clients. Development on this project has gone on for 1.5 years.

Now this client has secured an important sponsorship, and they are organizing events related to this project. So now we have a deadline in 2 months and we can't miss it.

We are thinking of adding a new developer to the team, and I am wondering what we can do to help his integration.

This is the situation:

We are approaching the threshold of Brooks's law -- the point when adding new developers will be counter-productive.

The application is relatively well-designed, but the implementation is chaotic in some points (especially older code).

There are unit tests only for more recent code. When this project started, we didn't regularly conduct tests.

Documentation and comments are incomplete.

The application is both large and complex.

The client has written down almost every detail about his project, in a very clear and "programmer-friendly" way.

Is it a good idea to add a person now? If so, what can we do in order to help the new developer integrate into the team?

EDIT:

The sponsor is organizing an internet-based sport event for next spring. It must start on a specific day of the year. We can't change it.

What we developers (I am one of the two) need to do is:

Completing the existing application (about 25% of the work to do).

Creating a new module, essential for the organization of this event (about 75% of the work to do). This new module can't be developed without understanding the main program's API.

I can't do an exact time estimation, but we are in a risky situation.

答:
Rather than adding a new developer to the team, consider adding an experienced consultant for the two-to-three months period to handle the temporary increase in your company's workload. The idea is to get someone who can handle near-zero start-up time, but at the same time may not necessarily be the best addition to your team.

Even if you think that the increase in workload is not temporary, now is probably not the best time to grow your team organically: adding a third developer is a stressful thing for a team even without a pressure from the project deadline; tight deadline only makes the transition worse.

The tradeoff is that in exchange for a temporary help you will get code written by an outsider. To mitigate this risk, make sure that both of you do all code reviews with him. Make sure that you review and understand all of his unit tests, too.

Title: How to add a new developer to the team


答: Best thing to do is not to throw the new developer into the fire, but instead carve out some functionality and/or bug fixes that the developer should have no trouble jumping in to.  Find an area that needs work that doesn't require a person to know the entire architecture, requirements and code-base all at once.  Maybe have him or her work on documentation to learn the system faster.</p>

Title: How to add a new developer to the team

Body:
I run a small company composed of only 2 developers. We are building a very big application for one of our clients. Development on this project has gone on for 1.5 years.

Now this client has secured an important sponsorship, and they are organizing events related to this project. So now we have a deadline in 2 months and we can't miss it.

We are thinking of adding a new developer to the team, and I am wondering what we can do to help his integration.

This is the situation:

We are approaching the threshold of Brooks's law -- the point when adding new developers will be counter-productive.

The application is relatively well-designed, but the implementation is chaotic in some points (especially older code).

There are unit tests only for more recent code. When this project started, we didn't regularly conduct tests.

Documentation and comments are incomplete.

The application is both large and complex.

The client has written down almost every detail about his project, in a very clear and "programmer-friendly" way.

Is it a good idea to add a person now? If so, what can we do in order to help the new developer integrate into the team?

EDIT:

The sponsor is organizing an internet-based sport event for next spring. It must start on a specific day of the year. We can't change it.

What we developers (I am one of the two) need to do is:

Completing the existing application (about 25% of the work to do).

Creating a new module, essential for the organization of this event (about 75% of the work to do). This new module can't be developed without understanding the main program's API.

I can't do an exact time estimation, but we are in a risky situation.


问:
How to build MVC Views that work with polymorphic domain model design?
This is more of a "how would you do it" type of question.

The application I'm working on is an ASP.NET MVC4 app using Razor syntax.

I've got a nice domain model which has a few polymorphic classes, awesome to work with in the code, but I have a few questions regarding the MVC front-end.

Views are easy to build for normal classes, but when it comes to the polymorphic ones I'm stuck on deciding how to implement them.

The one (ugly) option is to build a page which handles the base type (eg. IContract) and has a bunch of if statements to check if we passed in a IServiceContract or ISupplyContract instance. Not pretty and very nasty to maintain.

The other option is to build a view for each of these IContract child classes, breaking DRY principles completely. Don't like doing this for obvious reasons.

Another option (also not great) is to split the view into chunks with partials and build partial views for each of the child types that are loaded into the main view for the base type, then deciding to show or hide the partial in a single if statement in the partial. Also messy.

I've also been thinking about building a master page with sections for the fields that only occur in subclasses and to build views for each subclass referencing the master page. This looks like the least problematic solution? It will allow for fairly simple maintenance and it doesn't involve code duplication.

What are your thoughts? Am I missing something obvious that will make our lives easier? Suggestions?

答:
I think your most practical option is just to check what flavor of IContract you're dealing with and then extract the custom markup into partials that contain the markup that's specific to that model object.  This way your main view handles the generic IContract markup output and the partials have the custom WhateverContract details.

I would only write separate full views if the objects were so different as to where there would be little or no markup repetition.  Its better to have a few if/elses in your main view than having to update multiple views when you need to make a change.

OwnerDisplayName: Johann de Swardt


问:
Resurrecting a 5,000 line test plan that is a decade old
I am currently building a test plan for the system I am working on.  The plan is 5,000 lines long and about 10 years old.  The structure is like this:

```<code>1. test title
   precondition: some W needs to be set up, X needs to be completed
   action: do some Y
   postcondition: message saying Z is displayed
2. ...
</code>```

What is this type of testing called ?  Is it useful ?

It isn't automated.. the tests would have to be handed to some unlucky person to run through and then the results would have to be given to development.  It doesn't seem efficient.  Is it worth modernising this method of testing (removing tests for removed features, updating tests where different postconditions happen, ...) or would a whole different approach be more appropriate ?  We plan to start unit tests but the software requires so much work to actually get 'units' to test - there are no units at present !  Thank you.

答: This might be called an "Acceptance" test.  If it dictates what the program must do to be considered "complete", then I would call it an "Acceptance" test.  It depends on when this testing occurs in the development cycle as to what name it is called.</p>


答:
I'm heartened that you mentioned Brook's Law.  Nicely done.  The primary problem with adding another developer is the overhead in getting them up to speed and the overhead of synchronizing state with them about where you are in the project.  Therefore, if you do decide to get a third developer, I would try this:

Give the new guy an area where the up-to-speed costs are low and he can get going as quickly as possible.  This will depend a lot on who you hire and what skills they have.

Make sure this area is loosely coupled with other areas of the application so that the synchronization overhead is less.  Sending him in to do intense DB work and reorganizing tables may be too much.

Do what you can to keep morale up.  As others have noted, adding a new team member can be stressful so perhaps an investment in fizzy beverages might help.

Title: How to add a new developer to the team


答: If you have  work on other projects that you can give him that will free up time for the 2 current developers to concentrate on the big deadline deliverables that could help. </p>

Title: How to add a new developer to the team


问:
Questions about identifying the components in MVC
I'm currently developing an client-server application in node.js, Express, mustache and MySQL. However, I believe this question should be mostly language and framework agnostic.

This is the first time I'm doing a real MVC application and I'm having trouble deciding exactly what means each component.
(I've done web applications that could perhaps be called MVC before, but I wouldn't confidently refer to them as such)

I have a server.js that ties the whole application together. It does initialization of all other components (including the database connection, and what I think are the "models" and the "views"), receiving HTTP requests and deciding which "views" to use.

Does this mean that my server.js file is the controller? Or am I mixing code that doesn't belong there? What components should I break the server.js file into?

Some examples of code that's in the server.js file:

```<code>var connection = mysql.createConnection({
    host : 'localhost',
    user : 'root',
    password : 'sqlrevenge',
    database : 'blog'
});

//...

app.get("/login", function (req, res) { //Function handles a GET request for login forms
    if (process.env.NODE_ENV == 'DEVELOPMENT') {
        mu.clearCache();
    }

    session.session_from_request(connection, req, function (err, session) {
        if (err) {
            console.log('index.js session error', err);
            session = null;
        }

        login_view.html(res, user_model, post_model, session, mu); //I named my view functions "html" for the case I might want to add other output types (such as a JSON API), or should I opt for completely separate views then?
    });
});
</code>```

I have another file that belongs named session.js. It receives a cookies object, reads the stored data to decide if it's a valid user session or not. It also includes a function named login that does change the value of cookies.

First, I thought it would be part of the controller, since it kind of dealt with user input and supplied data to the models.

Then, I thought that maybe it was a model since it dealt with the application data/database and the data it supplies is used by views.

Now, I'm even wondering if it could be considered a View, since it outputs data (cookies are part of HTTP headers, which are output)

答:
It is definitely considered best practice to keep the views clean from control logic and lower-level concerns such as cookies and session. Typically those concerns are handled by the controller calling helper methods or services to determine the logical flow (session) or return view models (ASP.Net MVC) or instance variables (Rails) that will be passed to the view.  The repeated calls to these services or session can be further reduced by the use of the concept of filters (before_filter in Rails and Action Filters in ASP.Net) that are implicitly called before the invocation of the controller.

So those types of concerns are more closely associated with the controller than the view and the use of helpers or services can keep the controller clean of repetitive code.


答:
You need an answer to the question, "Remember that report you ran for me last year?"

First, take care of the housekeeping and be able to track:

Who made the request?

When was the request made and the solution provided?

How was it done? code, scripts, and any other documentation.

Second, formalize the request process. I know this is easier said than done. Try to at least avoid the "Drive By" request. This is where someone literally walks past your desk or stops you in the hallway/coffee machine and asks for a report. Use your boss or a fear of forgetting as an excuse, so they'll send an email.

Third, Source Control. Don't let these little one-off requests fool you. They can have even more change requests than a production application. "Can you put back that column I had you take out and exclude the Honolulu Branch for the 4th quarter only?"

There are a lot of tools out there to handle some of these things. I've always made it a habit to create a new database with each new job I get and throw as much in there as possible. Not only reporting, but the new person may want to know what is that database AccountingMonth7 used for?


答:
There are a couple of different ways I'd consider investigating:

Hold off on hiring the new developer until after the deadline passes so that it would be easier to focus on passing domain knowledge to the new guy.  This would be my preference as it could be slightly challenging in a few ways.

Bring in the new developer to work on documentation, unit tests and other stuff that isn't changing any of the existing code.  This would be what I'd suggest if you do bring on the new guy to try to minimize impact on the current work load.

Title: How to add a new developer to the team


问:
Programming languages with a Lisp-like syntax extension mechanism
I have only a limited knowledge of Lisp (trying to learn a bit in my free time) but as far as I understand Lisp macros allow to introduce new language constructs and syntax by describing them in Lisp itself. This means that a new construct can be added as a library, without changing the Lisp compiler / interpreter.

This approach is very different from that of other programming languages. E.g., if I wanted to extend Pascal with a new kind of loop or some particular idiom I would have to extend the syntax and semantics of the language and then implement that new feature in the compiler.

Are there other programming languages outside the Lisp family (i.e. apart from Common Lisp, Scheme, Clojure (?), Racket (?), etc) that offer a similar possibility to extend the language within the language itself?

EDIT

Please, avoid extended discussion and be specific in your answers. Instead of a long list of programming languages that can be extended in some way or another, I would like to understand from a conceptual point of view what is specific to Lisp macros as an extension mechanism, and which non-Lisp programming languages offer some concept that is close to them.

答: To get what you're looking for you really need those parentheses and a lack of syntax. A few syntax-based languages may come close, but it is not quite the same thing as a true macro.</p>


问:
Reuse the data CRUD methods in data access layer, but they are updated too quickly
I agree that we should put CRUD methods in a data access layer， However, in my current project I have some issues.

It is a legacy system, and there are quite a lot CRUD methods in some concrete manager classes.

People including me seem to just add new methods to it, rather than reuse the existing methods.

Because

We don't know whether the existing method is what we need

Even if we have source code, do we really need read other's code then make decision?

It is updated too quickly. Do not have time get familiar with the DAO API.

Back to the question, how do you solve that in your project? If we say "reuse", it really needs to be reusable rather than just an excuse.

答:
In a DAO you may return 3 columns from table A, joined with 2 columns from table B, etc. Maybe 4 tables are touched in a single transaction.  It will be a necessity to create a new method for new functionality, even on existing tables. The possible permutations are endless. It is not possible to cover every database interaction with generic CRUD methods.

Actually it's possible to cover every interaction with generic CRUD, but it would be like forcing a circle through a square shaped hole.

Usually some sort of framework provides generic CRUD access to the tables. The methods are often designed for working on 1 record at a time. If you fall within this scope, then use the generic CRUD methods. But you wouldn't want to use these methods to update 5 million rows as they would literally perform 5 million separate updates. (they also tend to redundantly update all columns of the row, whether edited or not causing locking issues). You cannot use them for transactional functionality if they are non-transactional.

Just identify when to use the generic CRUD methods vs custom methods.


问:
TDD, BDD or both?
I'm a little bit confused about BDD. I'm doing TDD currently.

My question is whether BDD is complementary to TDD or it's a whole new thing and my team should do both TDD and BDD? Or is it enough to do just one or the other?

答:
This discussion has been very active lately in the software development community. For me at least BDD has caused a mind shift, a shift that emphasizes software behavior over implementation. Bringing the ubiquitous language in all parts of the development process is of great benefit and BDD teaches that. BDD has a broader audience tester, managers, analysts.

Rachel Davis has a nice explanation of BDD="Shared understanding by discussing examples". So describe what you want the system to do and talk about some examples. If you want to read more on this topic check out this discussion on one of the father's of BDD blog: BDD is like TDD if ...

Title: TDD, BDD or both?


问:
All around design book for a developer (Javascript dev)
I have begun doing a lot of javascript development recently, mostly front-end but also using node.js. As I am currently in the transition from large company to startup, they expect me as a front end developer to know how to produce semi decent designs (Which I cannot)

I am looking for a book (or set of screencasts) to give me some good well rounded advice on design. I know CSS, but my design are always awful looking, I also know nothing about Photoshop (and am on Linux and have no access to it)

What are your picks? I am not looking to be a full time designer I would just like to be able to contribute.

答:
Web design may sometimes seem like a "mirage". You are tempted to believe that the only way to achieve a pretty design is with complex CSS3/Photoshop tricks but almost 80% of websites look nice with a simple and lean design. Learn how to build a 'useful' layout for all devices, read about nice colors, pretty fonts.

A relevant example is right in front of your eyes -  www.google.com . Do a search, navigate through the menus and you'll see that without any fancy quirks you have a very pleasant user experience (which in the end is the main goal for all web developers).

Then a very good place to start is Twitter Bootstrap which will help you produce the decent design that you're after.

The more advanced stuff (Canvas/Photoshop etc.) you should leave to the real pros (the ones that don't write Node.js backend code).


答:
Is it a good idea to add a person now?

No.
If at all possible, try to have the client agree on reducing scope instead.

Adding a person this late will add significant risk, and the deadline can't be pushed (as far as I've understood).

Title: How to add a new developer to the team


问:
QA - Developer communication
I am a developer and have worked at this company 4~5 years by now.

We have been practicing scrum for about 2 years.

I think, I have been worked well with QAs.

I believe QAs/developers/technical writers are all one team.

We are also actively hiring new team members.

As a legacy member of the team, I have faced to assist new member(including developers and testers) with my business knowledge.

We work on 2 weeks base scrum.

I usually deliver my user story completely by the first date of second week and do some qa build with partial functionality of my user story so that QA has a good idea about my implementation and flow.

Recently, I have met some QAs.

In first week, the QAs do not talk... In stand up meeting, they say they are developing test cases regardless I deliver the user story or not.

In second week, I do not have a single defect till Thursday afternoon and suddenly I have a major defect with several minor UI defect, which I delivered one week ago.

Or I have one or two minor defects on second week however major defects on Thursday afternoon or Friday morning.

This eventually make the story rolls over to the next sprint.

Major defect takes time to fix and more importantly it would trigger the regression test for the story... Even if I worked Thursday evening and fixed it, the testing will not finish.

And this happens multiple times with certain QAs.

As a same team member, I talked to the QAs if they could test major defect with higher priority... Rejected... Because I do not understand QA process..

So I asked roughly how many major test cases are covered so far in the stand up meeting on 2nd week Wednesday.. The response is I should not ask this to the QA in the stand up meeting...

What do I do?

答:
So I asked roughly how many major test cases are covered so far in the stand up meeting on 2nd week Wednesday.. The response is I should not ask this to the QA in the stand up meeting...
  What do I do?

Effective communication is a key. Speak with your QA's personally, not just in meetings.  Try to set meetings or sent an email requesting the status of testing, if you don't hear back from your QA or if they work remotely.

This might be a common scenario when the scope of project is big and QAs have to make regression test without automated tools.

Or it might be the case with QA's that are less experienced. Who are testing UI things first and main functionality after that :(

Another approach would be spending time to understand how your story will be tested and writing down possible test scenarios that may be. Covering test cases in parallel with development is preferred way to go, but hard to accomplish. However, one you get used to this type of development then 99% your code will be safe.

Title: QA - Developer communication


答:
Don't do it.

Yet.

Traditional View

In your question, you refer to Brooks's law from Mythical Man-Month.

Adding manpower to a late software project makes it later.

To ignore Brook's law carries a price. Don't multitask. Focus on delivery of your Minimum Viable Product (MVP). Then focus your energy on recruiting, resourcing, training, and managing a new team member.

Two months is so short. Plan recruiting with a burn down list and you will see how time consuming it can be.

Larry Page and Sergei Brin spent two years choosing the initial team for Google.  Your pick for employee number three should also be a careful one.

Agile, New Millenium View

Competition drives dynamic teaming more now than in the era when Mythical Man-Month was written (mid 1960s).  Long careers at one company are gone.  Now we migrate frequently between projects and companies.  Rapid team building creates success. Slow ramp-up is a severe limiting factor.  Great examples come from open source projects, startups, and the increased use of team projects in computer science courses.

Potentially, Agile teams factor constraints into their schedules. They are not late because they are optimized to the available resources. Integrating new staff is one more constraint, and considered as a trade-off between short-term and long-term goals.  The Agile team continually integrates code, so why not people too?

Agile team technical and social integration for new staff can use:

daily scrums

pair programming

refactoring

adding missing unit tests

fattening up lean documentation

code reviews

The Sacrificial Lamb

In "Organizational Patterns of Agile Software Development" James Coplien discusses group dynamics and costs of adding new team members. His pattern "Sacrificial Lamb" assigns all mentoring and training to one person, guarding the rest of the team from interruption.

It's a strategy that you may want to consider implementing.

Another strategy is to assign new hire mentor(s) who covers questions from new hires for particular hours each day.  If you can spare only one guy, perhaps he works without interruption in the mornings or afternoon and answers questions in the afternoons or mornings respectively.  The group I am in had ten interns last summer, so a lot of people were interrupted a lot.

Presently mentoring is done by one person, primarily during and immediately after our morning scrum (8:30 am until around 9:15 am, combined), and in the afternoon between 12 and 3:30 (he works 7 am - 3:30 pm).

Title: How to add a new developer to the team


答:
I think the BDD/TDD systems have undergone a change in what they were originally about, but nevertheless, they still have their uses and are complementary. TDDs via unit tests are very popular today, but adding BDD via something like Cucumber allows you to drive your components in a more user-focussed way. I think of them today as TDD being ways to test the objects, and BDD to test the applications/components.

You can still do BDD using Unit test tools (as I think it was intended) by writing your tests and then creating objects to fulfill them (ie not just as a method level granularity), but with 'story based' testing tools, you can create higher-level tests that are a little more evolved than using unit-test tooling.

Title: TDD, BDD or both?

Body:
I'm a little bit confused about BDD. I'm doing TDD currently.

My question is whether BDD is complementary to TDD or it's a whole new thing and my team should do both TDD and BDD? Or is it enough to do just one or the other?


问:
What are the fundamental differences between C and C++?
Many tend to write "C/C++", as if they were the same thing. Although they share many similarities, they are clearly not the same.

But what are really the fundamental differences between C and C++? Is C++ an enhanced version of C, or are there features in C which do not exist in C++?

答:
The following points relate to C++:

(user-defined) static type system: allows static checks about your data and their usage - points a lot of easily done errors in C.

multi-"paradigm":  allows working like in C, with object-oriented paradigms, with generic paradigms etc.

Constructor/Destructor: the only way to say once what to do when creating or destroying something and be sure the user will not have to find the right function and use it like in C.

RAII (badly named): you don't have to always manage memory. Just keep things in scope and use smart pointers describing your objects lifetime. Still can use raw pointers.

Templates: better than macro, a real language to manipulate and generate types before the final compilation. Only lacks a type system (see Concepts in future C++ standards).

Operator overloads: allows to describe operations in a simple syntactic manner and even to define embedded domain-specific languages inside your C++ code.

Scoped names: namespaces, classes/struct, functions, etc. have simple rules to make sure names don't clash.

Exception system: a way to propagate errors that is often better than return code. In fact, return code are good for domain-specific logical errors, because the application has to manage it. Exceptions are used for "hard" errors, things that make the following code just incorrect. It allows for catching errors higher in the call stack if possible, react to such exception (by logging or by fixing the state) and with RAII, if well used, it doesn't make the whole program wrong - if done well, again.

The Standard Library: C has its own, but it's all "dynamic". The C++ standard library is almost (not IO streams) made of templates (containers and algorithms) that allows generating code only for what you use. Better: as the compiler has to generate code, it will know a lot about the context and will hapily apply a lot of optimizations without having to require the coder to obfuscate its code - thanks to templates and other things.

const-correctness: The best way to make sure you don't change variables you shouldn't. Allows to specify read-only access to varaibles. And it is only checked at compile time so there is no runtime cost.

ContentLicense: CC BY-SA 2.5


问:
MVC two models required?
I've been doing software for a long time, but almost all of it has been back-end centric.

I recently decided to learn Swing and tried to apply MVC principles.  I realize that in Swing the View is handled for you by the components you add to the window/frame/panel, and the Controller is your code responding to the events.  However, when it comes to Model I quickly found that I needed TWO models.  One is the back-end model representing the underlying data universe.  That model is completely unaware of the UI and the fact that it's even being displayed.  The second is a version of the model with additional attributes governing display-related aspects.

For example, the project I chose was a tool that cross-references the database instances, schemas and tables in a huge enterprise application containing 140 db instances, several hundred schemas and thousands of tables.  Sometimes when looking at unfamiliar code you have a table name but finding which instance and schema it's in is a chore.

The tool displays 3 columns: DB Instance, Schema and Table, and each column contains only unique names. When you click on a table name (for instance) the schema and instance columns get filtered showing where that particular table occurs.  Clicking on a schema name or instance name results in similar filtering behavior on the other two columns.

I have a backend model containing a three-level tree (Instance, Schema, Table) but this is inappropriate for the UI I want to display.  So I have a second "display-model" that is built from the backend model, and backs the three columns.  That is where I store flags indicating which entries are visible based on user input.  The two models are significantly different in structure, and the display-model entries contain references to the backend-model entries. In a sense the display-model entries are adapters that allow the backend-model entries to be handled in a display-appropriate way.

I haven't run across any references to this, but my gut feel is that this must be a very common problem.  Has anybody else run into this issue, and what are the "accepted" UI programming ways to accomplish the objective?

答:
This is a fairly common situation and your choice of pattern is very dependant on the circumstance and your personal preference.

Where you're not simply writing a CRUD application, you can have a domain model which models the business domain and a view model, specific to the application, for displaying and editing that data. Some would argue that even when the two models look the same, you shouldn't expose your data model directly to the view anyway.

Or you can consider the domain to include more than just your data (known as Fat Models), in which case the way that  you access it -- the API exposed to your front-end application -- doesn't have to relate to the way that you store it in any sense.

Also have a look at the related pattern called Command-Query Responsibility Segregation. This is based on the theory that the data model you use to manipulate data is almost always different from the data model(s) you use to view the same data. It draws a very distinct line between the two and allows you to develop the two independently.

Title: MVC two models required?

ContentLicense: CC BY-SA 4.0


问:
Does using a wrapper class for pointers make sense?
In C++, pointers generally have a lot more functionality associated with them than is really necessary.  A class template that wraps a pointer and removes most of the less-used features (arithmetic, indexing, deletion).  Each function could then decide how powerful a pointer it requires and take the appropriate type.

Would using such types make sense in an actual project, though?  Are errors caused by unintentional arithmetic/deletion common enough to justify the additional effort?

To clarify: I am considering this as a system alongside existing weak_ptr, shared_ptr, unique_ptr -- those three are great when ownership is involved, but sometimes non-owning nullable or reseatable references are useful.

答:
Not sure about arithmetic, but pointer ownership(who deletes it?) is a major source of bugs.

You might be interested in learning about smart pointers. They definitely change some of the pointer semantics, which makes them very useful.

As for nullable types, they might be useful. See Boost.Optional.


答:
You need to ask the question why you are not finding these major defects yourself. Once you find that answer, you may find the answer to the question why they are finding them on Friday morning. </p>

<p>Are they finding defects in work you did (arguably unacceptable), or regression (Maybe tighten you UTs), or requirements defects?   </p>

Title: QA - Developer communication

Body:
I am a developer and have worked at this company 4~5 years by now.

We have been practicing scrum for about 2 years.

I think, I have been worked well with QAs.

I believe QAs/developers/technical writers are all one team.

We are also actively hiring new team members.

As a legacy member of the team, I have faced to assist new member(including developers and testers) with my business knowledge.

We work on 2 weeks base scrum.

I usually deliver my user story completely by the first date of second week and do some qa build with partial functionality of my user story so that QA has a good idea about my implementation and flow.

Recently, I have met some QAs.

In first week, the QAs do not talk... In stand up meeting, they say they are developing test cases regardless I deliver the user story or not.

In second week, I do not have a single defect till Thursday afternoon and suddenly I have a major defect with several minor UI defect, which I delivered one week ago.

Or I have one or two minor defects on second week however major defects on Thursday afternoon or Friday morning.

This eventually make the story rolls over to the next sprint.

Major defect takes time to fix and more importantly it would trigger the regression test for the story... Even if I worked Thursday evening and fixed it, the testing will not finish.

And this happens multiple times with certain QAs.

As a same team member, I talked to the QAs if they could test major defect with higher priority... Rejected... Because I do not understand QA process..

So I asked roughly how many major test cases are covered so far in the stand up meeting on 2nd week Wednesday.. The response is I should not ask this to the QA in the stand up meeting...

What do I do?

Body:
You need to ask the question why you are not finding these major defects yourself. Once you find that answer, you may find the answer to the question why they are finding them on Friday morning.

Are they finding defects in work you did (arguably unacceptable), or regression (Maybe tighten you UTs), or requirements defects?


问:
I have an MIS degree. How do I sell myself as a programmer?
So, I graduated with a BSBA in Management Information Systems with honors almost 2 years ago which is more of a business degree.  As of right now, I do have a job title of "Programmer", but it's more of a report writing position in an arbitrary, proprietary language called PowerOn with the occasional interesting project using more mainstream technologies like .Net and Java.  I am also somewhat isoloated being the only programmer in the workplace, which I beleive is a detriment to my career path.  The only people I have to bounce ideas against are those on the various SE sites.

I don't regret going MIS, but over the past couple of years I have discovered my passion for coding, even though I have been doing some form of coding profesionally and as an enthusiast for years.  I do want to persue my Masters in CS (at a later time), but I am not sure if I necessarily need a CS degree to get in with a team of programmers.  In addition, I do have a number classes I have taken for different laguanges on the way (C++, Java, SQL, and VB.Net)  I beleive my strength is in problem solving where code is just a tool to tackling to problem if needed.

My question:  How do I best sell myself as a programmer?  Should I continue pounding out reports and wait till I have my masters in CS?  Or am I viable to be a programmer as I stand?

答:
While more experience with mainstream languages will certainly help you get a programming job with a team of other programmers, it should not be necessary to complete a Masters in CS first. Some companies may have a hard requirement that you have a CS degree of some variety, but experience and the ability to learn will count for a lot.

For the past few years, at career fairs my employer has been advertising that they are specifically looking for CS majors. While I was in college, a lot of other companies did this as well. I don't actually have a CS major, though. I also graduated with MIS major, and a CS minor. I had an internship in the past, and was able to show them that I had the ability to program.

While you aren't really in the position to do an internship now, the same principle applies - if you show that you can program, companies will be more willing to hire you as a programmer. As many others have said here, the best way is to just program. Since you rarely get to use mainstream languages in your job, try writing some programs of your own. Or better, see if there is an open source project your could contribute to - that has the added advantage that some employers may check github or other such sites for examples of people's coding (or at least that is the impression I have gotten).

You mentioned that you are isolated in your current position. Try checking if there are any user groups in your area. That would give you more exposure to other programmers, which helps spark ideas and enthusiasm.

If you sell yourself well, though, you have all the tools you need to start looking for a programming job now. You said you believe your strength is problem solving, and code is just a tool. There will always be new languages to learn - it is harder to learn how to troubleshoot issues. Because of your MIS degree, you may have a wider perspective on business than programmers who are more narrowly focused on code. If you haven't seen it before, you might want to take a look at Patrick McKenzie's article "Don't Call Yourself A Programmer, And Other Career Advice". There are a number of relevant points in that article. One is general good advice - your resume should show how you have created value for your former/current employers (highlighting how you can create value for your potential employer), and the broader business knowledge from an MIS degree can help here.

In short, go for it now. Showing potential employers that you have programming ability and are quick to learn will do as much good as having a degree to wave around.


问:
Starting off with web dev with php
I'm currently working with Java / C++. I'm interested in web development and am planning to shift my stream. I heard that PHP is a good platform to start off and also it does not require that much of knowledge in technologies like JSP / Servlets or frameworks like springs / struts / hibernate.

I have basic ideas about HTML and Javascript as well. I have gone through previous posts in SO and found out the relevant resources as well:

http://net.tutsplus.com/tutorials/php/the-best-way-to-learn-php/

http://www.webhostingtalk.com/archive/index.php/t-1028265.html

http://www.killerphp.com/

http://phpforms.net/tutorial/tutorial.html

http://www.php5-tutorial.com/ etc.

Now, my question is: I heard of PHP frameworks like CodeIgniter, Zend Frameworkd and Yii.

Doesn't learning PHP & MySql implicitly makes us aware of these frameworks?

Am I making a good choice in stating with PHP?

Is it a good idea to shift streams?

答:
One of the best lessons for me was: surround yourself with the best people! Then you will learn quickly.

So if you have a chance, start off with a good language for web development. Haskell is a very good language for this. From my point of view, everything is better than PHP. If you choose Haskell, you will read stuff written by very good programmers.

-- Look up:

"Real World Haskell" -- http://book.realworldhaskell.org/read/

"Learn You a Haskell for Great Good!" -- http://learnyouahaskell.com/chapters

Snap Web Frame work -- http://snapframework.com/

If it has to be something else, then use "Scala". If it has to be a scripting language, I would choose in this order: Ruby, Python, and as a last option Perl.

--
Why get interested in Haskell?

https://stackoverflow.com/questions/1604790/what-is-haskell-actually-useful-for

https://stackoverflow.com/questions/775726/whats-the-fuss-about-haskell

A career decision to switch to web programming in haskell (or scala, ocaml, etc.) is good as you can transition back to well paid programming jobs. There a multiple companies that search for haskell and ocaml programmers, as for example: Standard Charter, Citrix, Merril Lynch, Credit Suisse, and to some extend at Google and Microsoft.

Look at why google is interested in haskell:

http://www.youtube.com/watch?v=b9FagOVqxmI

I talked last week with Mark Lentczner and he is a really a very very good programmer.

BTW the snap framework, mentioned above, was initially created by google employees.

Also the advice of Donald Knuth might be helpful:

http://www.youtube.com/watch?v=75Ju0eM5T2c

--

If you need more information on how functional programming is used and why it is considered as one of the best options, look at:

http://www.youtube.com/channel/UCP9g4dLR7xt6KzCYntNqYcw

Also to be clear. I think a very good programmer can program very good in PHP and be productive in the language. BUT, very good programmers tend not to want to program in PHP. So my point is, use a language that very good programmers are comfortable with. You will break even a little bit later, but your investment on learning functional programming will pay off.

Title: Starting off with web dev with php


答:
For me "non-owning pointers" are nearly non-existant. If I will be storing a pointer to an object in a member variable, then there is some kind of ownership in play, even if it is weak ownership. If this is for passing arguments to a method, then there are references (which have none of the problems you mention).

The only exception I can think of is when iterating through a raw array, maybe serializing/deserializing binary data. In that case I want to be able to do pointer math, but not deletion. But it would be incredibly difficult to accidently delete a pointer, especially when I hardly use delete anyways!

Title: Does using a wrapper class for pointers make sense?

Body:
In C++, pointers generally have a lot more functionality associated with them than is really necessary.  A class template that wraps a pointer and removes most of the less-used features (arithmetic, indexing, deletion).  Each function could then decide how powerful a pointer it requires and take the appropriate type.

Would using such types make sense in an actual project, though?  Are errors caused by unintentional arithmetic/deletion common enough to justify the additional effort?

To clarify: I am considering this as a system alongside existing weak_ptr, shared_ptr, unique_ptr -- those three are great when ownership is involved, but sometimes non-owning nullable or reseatable references are useful.


答:
Wrapping a pointer is close to the right idea. Explore value classes. Build your classes so that the pointer is an implementation detail of the actual behavior. std::string and std::vector are good examples of value classes. You can copy them, assign them. They work like you expect an object to work.

This talk given by Sean Parent explores how to make polymorphism an implementation detail. I've used this pattern several times. I find it quite wonderful.

Value semantics are how to avoid pointer mistakes. No pointers, no mistakes.


问:
Why is there still case sensitivity in some programming languages?
I don't see any use for case sensitivity in a programming language, apart from obfuscating code.

Why implement this in a programming language?

Update:

It looks like someone you know made a statement on this.

答:
In addition to the excellent answers given so far, I'd like to point out that case sensitivity gives you also additional "namespaces". For example Perl has some special blocks like BEGIN and END that run at different times than normal code (BEGIN at compile time, END after the normal program has terminated), and having those as all-caps makes them stand out, and means that the lower case variants aren't reserved words.

One can go even further and reserve all-uppercase names for future use by the language, and don't do any harm to normal programmers, who usually DON'T SHOUT IN THEIR CODE.


问:
What to look for in a training course
My development team is looking to expand into some new areas that we don't currently have direct skills for.  We're trying to evaluate the available training courses, but there's not much depth of differences that you can plumb from a webpage or two and a brochure.  So the root of my question is what should we be looking for while selecting a training course?

I think the best approach at this point is to send an RFC (request for comment) to the firms we've identified and ask the following:

syllabus of coursework

amount of hand's-on-work versus lecture

preparatory references they recommend

instructor biographies

rough estimates of number of students trained*

amount of time in training*

amount of time in training on this subject*

results of end-of-class student satisfaction surveys

expected student background

general class size

how they tailor the course to the individual student's needs

*No, these aren't great measures for the quality of a courses but I struggle to identify a more relevant metric.

The Real Question(s) -->

What else should we be asking about or investigating?

Is there a superior approach to evaluating training courses?

This question is perhaps the closest to answering my question, but it didn't gain much traction.  In addition, it seems oriented towards how to design the course instead of what to look for.

This question is related, but the person asking the question didn't appear to want the training.  That's definitely not our situation - we have a known skills gap and we're looking to close it.

The links from this question didn't really have any content that met my needs.

This question and this question are related to the training (iOS development) we're particularly interested in.  The questions are slightly stale, which is part of why they are off topic for P.SE.  One nugget that I liked from these two questions was to purchase and review books published by the training firm if they're available.

答:
I actually think you have a good set of questions to ask. These are the other things I would consider:

What published materials are included with the course. Most classes come with custom course notes, but some include published material. For example, a class I took on business analysis once included books by guys like Karl Weigers and Alistair Cockburn. I can't guarantee you'll agree with everything Weigers and Cockburn say, but research will show that those guys are reputable sources. If you get the actual title of the book, you can of course read reviews online. And regardless of how you receive the course, good materials provide a platform for both reference and continued learning, as they'll likely go into detail the class won't have time to. Some courses won't come with books though; some have dropped or reduced books from their courses in efforts to cut costs.

Similar to the above, see if the class comes with source code or examples. Most programming classes do, but be sure. The C# class I took, the instructor did a nice job of including a big file of the exercise solutions but he also added several custom examples from our class where he went beyond the printed material.

What post-course support is provided? You may have questions after the class, or you may be taking the class a couple weeks in advance of when you'll use the material. Would the instructor be able to answer reasonable questions after the class?

Look for references or find testimonials about the course. Don't get the ones from the provider's web page, only positive comments will show up there. But check with other people at user groups, online, forums, sites like this one, and anywhere you can to see if they've taken training from the provider. Can't beat the first-hand accounts.

See if you can converse when asking about some of these things with the actual instructor. If you can't find other feedback on the course or instructor, this may be a way to get a preliminary gauge of the instructor's comfort level with the material and his/her communication skills. Ah, nothing like those days at university when I'd walk into the first day of a math class and find out the instructor didn't speak my language clearly. Math + inability to communicate = too much fun. And it's probably similar for a complicated programming subject.

There was a post on here a couple years back (since deleted) where someone asked about training and one of the responses was from an arrogant former instructor that was quite cynical about training and thought all training was worthless. There was a sliver of validity to his point ("The sharp ones already know the material or could figure it out themselves, the dumb ones won't ever get it..."). But I think that person's concerns depend a lot on either the instructor or student or both not being very serious about the material. A good class can do a lot, and I think you're showing that you're serious about it. Best of luck to you.

Title: What to look for in a training course


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

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

答: I have been developing MS-Access applications since ver 1.0 and programming in various versions of Basic for 10 years prior to that. 20 years ago there was a big push, in Canada at least, for the government to purchase seats at Computer Schools. Everyone and their dog took these courses for the dream of big money and ample opportunities. Unfortunately to be a programmer takes a certain type of person. Many of these people who took the courses couldn't hack the course and/or couldn't hack it once they got into the real world. Some of them gravitated to MS-Access. If I had a dime for every Access database developed by one of these inexperienced people I had to overhaul. This has given MS-Access a bad name. Is Access meant for everything, no of course not. In the hands of a capable and experienced developer, it is powerful. I work mostly at banks and insurance companies. When these people want a new application, if they go through their IT departments, it can take months, if not years to get something developed. Put the same request in the hands of an experienced MS-Access developer and it make take a few days or weeks. The reason for the difference is A) IT department red tape and B) all these programmers they trained who don't really like what they are doing, don't do it very well, but do the bare minimum to hold on. As long as they are in the abundant structure of an IT department and spoon fed spec sheets, they can survive. Real programmers can walk up to a client, gather specs on their own, innovate, dream up the most elegant and flexible solution for any size project and then develop it all on their own from start to finish. At the very least, I think MS-Access in the hands of a seasoned developer still has a place in prototyping a solution rapidly to then be handed off to IT for conversion. In many cases portions of VBA code can be cut and pasted into a .NET solution.</p>


答:
I agree with pdr that this is a common situation – in fact I’ve been dealing with it throughout my 20 years in software engineering. Consider the simple case of a managed database and its users. Users write queries to return result sets. Result sets are tables – so each user can build their own model from the internal data model. At some point a user asks the DBA, “Can you add this query to the db as a view so I can query against my own abstraction?”

The same issue arises with “Command-Query Responsibility Segregation” or whatever pattern, diagram, or scheme anyone dreams up. You can’t segregate the models because the models have to interface with one another. The provider and the consumer have to speak a common language.

In my experience, flexibility has to be architected into both sides, that is, there has to be a mechanism for the provider to expand the data model so as to offer compound objects, views, or some similar facility of that kind to provide the higher level abstractions clients require. And also, clients need to be able to build further higher level abstractions in their own domain in a clean maintainable way. If these two facilities aren’t designed into the system, programmers will kludge them, and your code base will become a nightmare, eventually useless.

Title: MVC two models required?

Body:
I've been doing software for a long time, but almost all of it has been back-end centric.

I recently decided to learn Swing and tried to apply MVC principles.  I realize that in Swing the View is handled for you by the components you add to the window/frame/panel, and the Controller is your code responding to the events.  However, when it comes to Model I quickly found that I needed TWO models.  One is the back-end model representing the underlying data universe.  That model is completely unaware of the UI and the fact that it's even being displayed.  The second is a version of the model with additional attributes governing display-related aspects.

For example, the project I chose was a tool that cross-references the database instances, schemas and tables in a huge enterprise application containing 140 db instances, several hundred schemas and thousands of tables.  Sometimes when looking at unfamiliar code you have a table name but finding which instance and schema it's in is a chore.

The tool displays 3 columns: DB Instance, Schema and Table, and each column contains only unique names. When you click on a table name (for instance) the schema and instance columns get filtered showing where that particular table occurs.  Clicking on a schema name or instance name results in similar filtering behavior on the other two columns.

I have a backend model containing a three-level tree (Instance, Schema, Table) but this is inappropriate for the UI I want to display.  So I have a second "display-model" that is built from the backend model, and backs the three columns.  That is where I store flags indicating which entries are visible based on user input.  The two models are significantly different in structure, and the display-model entries contain references to the backend-model entries. In a sense the display-model entries are adapters that allow the backend-model entries to be handled in a display-appropriate way.

I haven't run across any references to this, but my gut feel is that this must be a very common problem.  Has anybody else run into this issue, and what are the "accepted" UI programming ways to accomplish the objective?


答:
Funge-98

Funge-98's fingerprint feature allows could be done to allow a complete restructuring of the entire syntax and semantics of the language. But only if the implementor supplies a fingerprint mechanism that allowed the user to programmatically alter the langauage (this is theoretically possible to implement within normal Funge-98 syntax and semantics). If so, one could literally make the rest of the file (or whatever parts of the file) act as C++ or Lisp (or whatever he wants).

http://quadium.net/funge/spec98.html#Fingerprints

Title: Programming languages with a Lisp-like syntax extension mechanism

Body:
I have only a limited knowledge of Lisp (trying to learn a bit in my free time) but as far as I understand Lisp macros allow to introduce new language constructs and syntax by describing them in Lisp itself. This means that a new construct can be added as a library, without changing the Lisp compiler / interpreter.

This approach is very different from that of other programming languages. E.g., if I wanted to extend Pascal with a new kind of loop or some particular idiom I would have to extend the syntax and semantics of the language and then implement that new feature in the compiler.

Are there other programming languages outside the Lisp family (i.e. apart from Common Lisp, Scheme, Clojure (?), Racket (?), etc) that offer a similar possibility to extend the language within the language itself?

EDIT

Please, avoid extended discussion and be specific in your answers. Instead of a long list of programming languages that can be extended in some way or another, I would like to understand from a conceptual point of view what is specific to Lisp macros as an extension mechanism, and which non-Lisp programming languages offer some concept that is close to them.


问:
Review before or after code commit, which is better?
Traditionally we performed code review before commit, I had an argument with my colleague today, who preferred code review after commit.

First, here's some background,

We have some experienced developers and we also have new hires with almost zero programming experience.

We'd like to perform fast and short iterations to release our product.

All team members are located at the same site.

The advantages of code review before commit I've learned:

Mentor new hires

Try to prevent errors, failures, bad designs early in the development cycle

Learn from others

Knowledge backup if someone quits

But I've also had some bad experiences:

Low efficiency, some changes may be reviewed over days

Hard to balance speed and quality, especially for newbies

One team member felt distrust

As to post-commit review, I know little about this, but the thing I'm most worried about is the risk of losing control due to lack of review.
Any opinions?

UPDATE:

We're using Perforce for VCS

We code and commit in the same branches (trunk or bug fixing branches)

To improve efficiency, we've tried to split code into small changes. We've also tried some live dialog review, but not everyone followed the rule. This is another problem though.

答:
There is a mantra that no one seems to have quoted yet: Check in early and often:

Developers who work for long periods -- and by long I mean more than a day -- without checking anything into source control are setting themselves up for some serious integration headaches down the line. Damon Poole concurs:

Developers often put off checking in. They put it off because they don't want to affect other people too early and they don't want to get blamed for breaking the build. But this leads to other problems such as losing work or not being able to go back to previous versions.

My rule of thumb is "check-in early and often", but with the caveat that you have access to private versioning. If a check-in is immediately visible to other users, then you run the risk of introducing immature changes and/or breaking the build.

I'd much rather have small fragments checked in periodically than to go long periods with no idea whatsoever what my coworkers are writing. As far as I'm concerned, if the code isn't checked into source control, it doesn't exist. I suppose this is yet another form of Don't Go Dark; the code is invisible until it exists in the repository in some form.

...If you learn to check in early and check in often, you'll have ample time for feedback, integration, and review along the way...

I've worked for a couple companies that had different approaches towards this. One allowed it, as long as it didn't prevent compiling. The other would freak out if you checked in any bugs at all. The former is much preferred. You ought to be developing in a kind of environment that would allow you to collaborate with other people on things that are still in progress, with the understanding that it will all be tested later.

There is also Jeff Atwood's statement: Don't be afraid to break things:

The most direct way to improve as a software developer is to be absolutely fearless when it comes to changing your code. Developers who are afraid of broken code are developers who will never mature into professionals.

I would also add that for peer reviews, if someone wants you to change something, having the history of your original version in source is a very valuable learning tool.


问:
Testing of visualization projects
We develop small to large visualization projects for different tasks and industries and sometimes while rewriting them a couple of times in the process we hit walls because we discover that we need to add a lot of code to support new requirements. Now we have established a design process that seems to work well (at least we reduced the development time for each new project quite a bit), but we're still left scratching our heads around this question: what exactly should we test when testing visualizations?

If everything that we want to explore is on the screen (bounded
visualizations)?

If the data is ok - if data is valid (that's one of the nice things about visualizations you can spot errors in your datasets)?

Usability?

User interaction?

Code quality?

I can tell you for sure that a simple check of the code quality is certainly not enough! Is there a classic paper / book about how to test visualizations? Also do you happen to know about classic design patterns for visualizations (except the obvious ones like Pub-Sub)?

答:
You could read through the excellent treatise The Grammar of Graphics, which elaborates on different properties of visualizations and how they convey or obstruct the flow of information to the observer. Although the book does not list a test plan for visualizations, it certainly brings to light to connection between code, model, media and perception. For me it was a most inspiring read.

In my opinion, visualizations are neither inherently right nor wrong, but there are certainly best practices. Eg., having an understanding of the perception of color will help you find good ordinal color scales.

Title: Testing of visualization projects


问:
Is there a constant for "end of time"?
For some systems, the time value 9999-12-31 is used as the "end of time" as the end of the time that the computer can calculate. But what if it changes? Wouldn't it be better to define this time as a builtin variable?

In C and other programming languages there usually is a variable such as MAX_INT or similar to get the largest value an integer could have. Why is there not a similar function for MAX_TIME i.e. set the variable to the "end of time" which for many systems usually is 9999-12-31. To avoid the problem of hardcoding to a wrong year (9999) could these systems introduce a variable for the "end of time"?

**Real example **

End of validity date: 31/12/9999. (official documents are listed like this)
The blogger wants to write a page that is always on top, the welcome page. So it's given a date as far in the future as possible:

3000? Yes, the welcome page which you're facing is posted at 1 January
  3000. So this page will be kept on the top of the blog forever =) It's actually posted at 31 august 2007.

答:
There generally isn't such a value, because it would not be useful as a language construct.

MAX_INT and it's kin all serve a purpose. They can be used in your code to check against overflows. This is useful if you're going to be creating and managing large data objects in arrays, vectors, whatever. It's also a fairly platform-specific value.

The use case for a MAX_DATE value is more difficult to see. Typically these are just values, they're not used as part of the structure of the program, and so the value circling around wouldn't have disastorous consequences to the program (though it may to the data). Also, the date and time types in C, C++ etc. are usually more strictly defined; and so the people writing the program don't have to worry that it may change between platforms.

Title: Is there a constant for "end of time"?


问:
What is the difference between Windows 8, WinRT, and Windows RT?
I just read that there will be two versions of Windows available: Windows RT and Windows 8.

Could someone please describe what the differences between Windows RT and Windows 8 are? And how these differences may affect developers creating apps for one or the other?

Also, what is WinRT?

答:
Windows RT vs. WinRT vs. Windows 8!!

One of the things that I was confused about in the last few hours, and I am confident that many more people are going to be confused about in next few months is the difference between “Windows RT” and WinRT. Here is the simple version:

Windows RT:

It’s an OS.

It’s a variation of the Windows 8 OS that Microsoft has specifically designed for devices running ARM devices.

(In case you are wondering) ARM is an architecture used by many processor companies to design their chips, including Qualcomm, nVidia, Texas Instruments and several others.

What that means is that when you go to the Settings -> PC Info screen of a tablet device running an ARM processor, it will show you “Windows RT” and NOT “Windows 8″. So, it’s a full-fledged OS that is branded and sold separately by Microsoft to tablet OEMs (aka manufacturers) who are using ARM processors in their tablet devices. In fact, it used to be called as “Windows on ARM” earlier but was later on re-branded as Windows RT.

WinRT:

it’s a runtime.

Conceptually, it’s not very different from .net, java or any other runtime in the sense that its main goal is to create a cross-platform application architecture on Windows 8 that supports multiple languages (C++, C#, JavaScript, etc.).

Difference between “Windows RT” and “Windows 8“:

Now that we know that Windows RT is an OS, I am sure that some of you are wondering how it is different from Windows 8. Here it is!!

Not much different from user experience point of view as both support Metro/Modern UI.

Windows RT is not sold directly to consumers, and is meant only to be sold to device manufacturers (aka OEMs).

The goal behind Windows RT is to give end users consistent experience across tablets being offered by various manufacturers (including Microsoft’s own device called as Surface).

Windows RT will come pre-packaged with MS Office, whereas Windows 8 users will have to buy (and install) Office separately.

There are similar differences in terms of applications shipped out of the box in Windows RT and Winodws 8, as well as the kinds of applications you can develop/install/uninstall on them. Windows RT seems to be more locked-down version of the two.

You also cannot use Win32 and COM APIs on Windows RT, so you are pretty much restricted to using WinRT APIs. Although, over next few days I am going to be closely working on a project that requires access to underlying System Information on a Windows RT “ARM” device. It seems that there may be a way to access a subset of Win 32 API on a Windows RT device. If it works, I will post my experience in a subsequent post.

If you need any other question please post here itself


问:
Programming languages with a Lisp-like syntax extension mechanism
I have only a limited knowledge of Lisp (trying to learn a bit in my free time) but as far as I understand Lisp macros allow to introduce new language constructs and syntax by describing them in Lisp itself. This means that a new construct can be added as a library, without changing the Lisp compiler / interpreter.

This approach is very different from that of other programming languages. E.g., if I wanted to extend Pascal with a new kind of loop or some particular idiom I would have to extend the syntax and semantics of the language and then implement that new feature in the compiler.

Are there other programming languages outside the Lisp family (i.e. apart from Common Lisp, Scheme, Clojure (?), Racket (?), etc) that offer a similar possibility to extend the language within the language itself?

EDIT

Please, avoid extended discussion and be specific in your answers. Instead of a long list of programming languages that can be extended in some way or another, I would like to understand from a conceptual point of view what is specific to Lisp macros as an extension mechanism, and which non-Lisp programming languages offer some concept that is close to them.

答:
Forth is another language that is highly extensible.  Many Forth implementations consist of a small kernel written in assembler or C, then the rest of the language is written in Forth itself.

There are also several stack-based languages that are inspired by Forth and share this feature, such as Factor.


答:
Ask yourself why you need such a variable in the first place.

Most likely, you are lying about your data: whenever you need an "end of time" variable, you are not referring to the actual end of time; rather you are expressing things like "there is no upper bound for this date", "this event continues indefinitely", or similar.

The correct solution, then, is to express these intents directly instead of relying on a magic value: use nullable date types (where null indicates "no end date set"), add an "indefinite" boolean field, use a polymorphic wrapper (which can be either a real date or a special "indefinite" value), or whatever your programming language has to offer.

Of course, the correct solution is not always feasible, so you might end up using a magic value after all, but when you do, you have to decide on a suitable value on a per-case basis, because which dates do and do not make sense depends on the domain you're modelling - if you're storing log timestamps, 01/01/2999 is a reasonable "end of time"; the chances of your application still being used almost 1000 years from now are, I would reckon, practically zero. Similar considerations go for calendar applications. But what if your software is to handle scientific data, say, long-term predictions about the Earth's climate? Those might actually want to look a thousand years into the future. Or take it one step further; astronomy, a field where it is perfectly normal to reason in very large timespans on the order of billions of years, both into the path and the future. For those, 01/01/2999 is a perfectly ridiculous arbitrary maximum. OTOH, a calendar system that is able to handle timespans ten trillion years into the future is hardly practical for a dentist appointment tracking system, if only because of storage capacity.

In other words, there is no single best choice for a value that is wrong and arbitrary by definition to begin with. This is why it is really uncommon to see one defined in any programming language; those that do usually don't name it "end of time", but rather something like DATE_MAX (or Date.MAX), and take it to mean "the largest value that can be stored in the date datatype", not "the end of time" or "indefinitely".

Title: Is there a constant for "end of time"?

Body:
For some systems, the time value 9999-12-31 is used as the "end of time" as the end of the time that the computer can calculate. But what if it changes? Wouldn't it be better to define this time as a builtin variable?

In C and other programming languages there usually is a variable such as MAX_INT or similar to get the largest value an integer could have. Why is there not a similar function for MAX_TIME i.e. set the variable to the "end of time" which for many systems usually is 9999-12-31. To avoid the problem of hardcoding to a wrong year (9999) could these systems introduce a variable for the "end of time"?

**Real example **

End of validity date: 31/12/9999. (official documents are listed like this)
The blogger wants to write a page that is always on top, the welcome page. So it's given a date as far in the future as possible:

3000? Yes, the welcome page which you're facing is posted at 1 January
  3000. So this page will be kept on the top of the blog forever =) It's actually posted at 31 august 2007.


答:
Doesn't learning PHP & MySql implicitly makes us aware of these
  frameworks?

No, in fact PHP's creator advocates not using any additional frameworks.

See: "The no-framework PHP MVC framework"

Another thing is there are quite a few PHP MVC frameworks, neither one is the clear winner.

Am I making a good choice in starting with PHP?

No. I'ts a bad choice.

Technical reasons

it's horribly designed and it's a mess (see: "PHP: a fractal of bad design")

there is not language specification, only the implementation

OOP is just an add-on, it's not part of the core language

it's web only, all attempts to enter general purpose market have failed

typically used as mod_php which is totally obsolete server model

lot of parts that would normally be handled by framework (low level HTTP processing) are hardwired into the language itself. Thus alternative solutions are not possible

cannot use as asynchronous framework, because of above

it's not thread safe (thus limiting the choice of efficient webservers)

cannot self-host, always requires 3rd party webserver

terrible security record (see: https://softwareengineering.stackexchange.com/questions/62070/what-attributes-of-php-make-it-insecure)

while the language itself is open source, unlike other OSS projects it's not controlled by a foundation, but rather by a private company. Its business model is selling complementary products, which are not open source.

Career reasons

it's not well regarded and is stereotyped as language for amateurs. (example: My university doesn't provide php courses because it is an "easy" programming language?)

although community is large, it doesn't provide much value (see: Why do ruby and python seem to have more community contribution than PHP?)

since few years it's no longer a platform of choice for new web apps. It's maintained as legacy platform by some big ones (Facebook being prime example — for PHP code they have moved to Hiphop, while the rest of their projects are mostly not PHP)

on average, PHP programmers are paid significantly less than programmers using other languages (example: salaries for PHP vs Java vs C++)

Is it a good idea to shift streams?

It's impossible to give general answer to that. But seems like a bad idea to switch to something which is regarded less and with inferior pay.

Title: Starting off with web dev with php

Body:
I'm currently working with Java / C++. I'm interested in web development and am planning to shift my stream. I heard that PHP is a good platform to start off and also it does not require that much of knowledge in technologies like JSP / Servlets or frameworks like springs / struts / hibernate.

I have basic ideas about HTML and Javascript as well. I have gone through previous posts in SO and found out the relevant resources as well:

http://net.tutsplus.com/tutorials/php/the-best-way-to-learn-php/

http://www.webhostingtalk.com/archive/index.php/t-1028265.html

http://www.killerphp.com/

http://phpforms.net/tutorial/tutorial.html

http://www.php5-tutorial.com/ etc.

Now, my question is: I heard of PHP frameworks like CodeIgniter, Zend Frameworkd and Yii.

Doesn't learning PHP & MySql implicitly makes us aware of these frameworks?

Am I making a good choice in stating with PHP?

Is it a good idea to shift streams?


问:
Why are many programmers moving their code to github?
For the past 6 months or more, I've been seeing many codes hosted at sourceforge.net as well as other hosting sites "Move to GitHub". A mere Google Search with the phrase "Moved to Github" returns several results containing the text moved to github. This is very confusing for me, and I'm wondering, why exactly are people moving? Does it mean that GitHub is better or is there some special advantage I'm not seeing?</p>

答:
I think one of the reasons is different audience: sourceforge is primarily for hosting applications, probably the most prominent feature of a project page is a link to the compiled executable (or some other download). In other words, it's targeted at users, not developers.

On the other hand, github is primarily for hosting source code, the most prominent feature of the project page is directory listing of the master branch. It's targeted at developers (either wanting to modify or use code from a project), not users.

I think this is one of the reasons why developer-targeted tools and libraries are moving to github.


问:
Advantages of paid Java Application Servers?
What are the advantages of Weblogic or Websphere over Glassfish or JBoss, since they may reach costs of millions of dollars?

Edit: Is there additional functionality? The all are Java EE Full Certified.

The question is about technology, not business or marketing. From the technological POV how are the servers different?

答:
Here's a list (note that not all of the points may applay in every case):

Better performance

Better management/admin tools

Better integration with various other products

Better support - usually included in the license costs.

Someone to blame when things go wrong

Note that you can get paid support for JBoss and Glassfish as well (in the latter case via a separate "Oracle GlassFish Server" edition).


问:
Depending on fixed version of a library and ignore its updates
I was talking to a technical boss yesterday. Its about a project in C++ that depends on opencv and he wanted to include a specific opencv version into the svn and keep using this version ignoring any updates which I disagreed with.We had a heated discussion about that.

His arguments:

Everything has to be delivered into one package and we can't ask the client to install external libraries.

We depend on a fixed version so that new updates of opencv won't screw our code.

We can't guarantee that within a version update, ex from 3.2.buildx to 3.2.buildy.

Buildy the function signatures won't change.

My arguments:

True everything has to be delivered to the client as one package,but that's what build scripts are for. They download the external libraries and create a bundle.

Within updates of the same version 3.2.buildx to 3.2.buildy its impossible that a signature change, unless it is a really crappy framework, which isn't the case with opencv.

We deprive ourselves from new updates and features of that library.

If there's a bug in the version we took, and even if there's a bug fix later, we won't be able to get that fix.

Its simply ineffiecient and anti design to depend on a certain version/build of an external library as it makes our project difficult in the future to adopt to new changes.

So I'd like to know what you guys think. Does it really make sense to include a specific version of external library in our svn and keep using it ignoring all updates?

答:
Does it really make sense to include a specific version of external
  library in our svn and keep using it ignoring all updates?

That depends...

I have experienced both approaches, and neither is always right, nor always wrong.

Key considerations relate to how dynamic the other library is, and what risks are possible if the library updates in the future.  Also, how critical your system is.

Dependencies are not ideal, and need to be managed carefully - and if you go ahead with the "fixed" approach, I recommend reviewing the development of the library periodically.  It may be that the best approach is a mix of both... keep it fixed within your system, but update occasionally.

If the library is a key component, any update of that library may require wholesale re-testing of your code... which is not desirable.


答:
If it ain't broken don't fix it.

Is there a feature you really need to use which is available in the newer version, and was missing in an older one?

Is there an issue (bug, performance issue, etc.) which affects your project and was solved in the newer version?

If your answer is "no" for both questions, there is really no need to update, especially since updating to a new version requires you to check if it doesn't break anything in your code, thing which may sometimes be complicated.

If your answer is "yes" for at least one of the questions, you should decide if the upgrading to the new version really worth it, keeping in mind the risk of breaking existent code and spending time checking the compatibility of your code with the newer version.

You can also inspire yourself from other large projects. For example you can see that Programmers.SE relies on JQuery 1.7.1, while on 9/14/2012, the latest version is 1.8.1.

Also see:

"If it ain't broken don't fix it." in When is SO going to upgrade their jQuery version?

Reason to use older versions of jQuery?.

Title: Depending on fixed version of a library and ignore its updates

Body:
I was talking to a technical boss yesterday. Its about a project in C++ that depends on opencv and he wanted to include a specific opencv version into the svn and keep using this version ignoring any updates which I disagreed with.We had a heated discussion about that.

His arguments:

Everything has to be delivered into one package and we can't ask the client to install external libraries.

We depend on a fixed version so that new updates of opencv won't screw our code.

We can't guarantee that within a version update, ex from 3.2.buildx to 3.2.buildy.

Buildy the function signatures won't change.

My arguments:

True everything has to be delivered to the client as one package,but that's what build scripts are for. They download the external libraries and create a bundle.

Within updates of the same version 3.2.buildx to 3.2.buildy its impossible that a signature change, unless it is a really crappy framework, which isn't the case with opencv.

We deprive ourselves from new updates and features of that library.

If there's a bug in the version we took, and even if there's a bug fix later, we won't be able to get that fix.

Its simply ineffiecient and anti design to depend on a certain version/build of an external library as it makes our project difficult in the future to adopt to new changes.

So I'd like to know what you guys think. Does it really make sense to include a specific version of external library in our svn and keep using it ignoring all updates?


答:
What are you "testing" for? Are you testing for accuracy of the visualization, in other words, whether the visualization matches the system it describes? In this case, consider a View Model: an object structure identical to the visualization. Write code that compares it to either (1) the view model to the system it describes or (2) a known correct visualization for a certain system and repeat for as many different visualizations as required.

If you want to test the visualizations themselves, specifically how they appear on the screen, this is more challenging. You can "screen scrape" (compare the bitmap representation) but this could be foiled by changes in rendering engines between OS or library upgrades among a number of things. Depending on the graphics library and operating system used, a GUI testing library may be available to help. See http://en.wikipedia.org/wiki/List_of_GUI_testing_tools for a list.

Are you testing whether the visualization is at the appropriate level of abstraction or whether it makes sense to customers? This is not really "testing". This is more UI or visualization design and is a much bigger topic.

Title: Testing of visualization projects

Body:
We develop small to large visualization projects for different tasks and industries and sometimes while rewriting them a couple of times in the process we hit walls because we discover that we need to add a lot of code to support new requirements. Now we have established a design process that seems to work well (at least we reduced the development time for each new project quite a bit), but we're still left scratching our heads around this question: what exactly should we test when testing visualizations?

If everything that we want to explore is on the screen (bounded
visualizations)?

If the data is ok - if data is valid (that's one of the nice things about visualizations you can spot errors in your datasets)?

Usability?

User interaction?

Code quality?

I can tell you for sure that a simple check of the code quality is certainly not enough! Is there a classic paper / book about how to test visualizations? Also do you happen to know about classic design patterns for visualizations (except the obvious ones like Pub-Sub)?


答: I think it makes sense to write an adapter and tests (for the interfaces essential to your application) for the dependency of the 3rd-party library to be able to better adapt to changes without fear of regression. That could convince the technical bosses to accept the upgrades with less fear.  There may be a security update or other problem that forces an upgrade and it would be nice to be prepared for the change or to be able to change to another one if needed.</p>


答: I'm surprised by this rant.  Now that nobody wants you to use an underscore or an m_ in a field name in C#, I've just been using camel case, and if the field name is the same as a public property name, just that the public property name is Pascal case and the backing field is camel case, I figure, "so be it" - that's what the programming community at large seems to want.  It hasn't caused any problems so far.

Title: Why is there still case sensitivity in some programming languages?

Body:
I don't see any use for case sensitivity in a programming language, apart from obfuscating code.

Why implement this in a programming language?

Update:

It looks like someone you know made a statement on this.


答:
I hate to break this to you, but he's right.  I used to think as you do, but experience has taught me otherwise.  I and some of my colleagues have had to update the frameworks of some of our web applications and while I cannot say the framework was worse, it had a lot of unforeseen consequences which was the cause of several bugs that weren't immediately made evident to us but were discovered by our clients.

In that case, we had to update because we required a library which required a minimum version of libraries that were outdated.  Of course, since we were upgrading, we updated to the most recent (stable) version of these libraries rather than get the bare minimum.

If you don't have any need for a more updated version, you should not make your code dependent on a shifting codebase.  If you don't want to have the code on svn, then you should look into keeping only the binaries of a specific version available on svn instead.  Better still, if you use maven, you can download a specific version and all its dependencies.


答:
As an industry we have been notoriously short-sighted and arbitrary in the pursuit of saving a few bytes e.g.

31 Dec 99

January 19 2038

T + 50 years, when hopefully all systems I've been involved in have become defunct or been replaced (or I'm dead, whichever comes first).

IMHO the best bet is to stay with a appropriate, mainstream level of abstraction on 'max date', and hope that a common solution has addressed the issue before the time arrives.

e.g. in .NET, DateTime.MaxValue is arbitrarily 23:59:59.9999999, December 31, 9999, exactly one 100-nanosecond tick before 00:00:00, January 1, 10000. So if my assumptions about my own longevity are false, and the year 10000 arrives, I'm rather hoping that a recompile of my app with a later version of the framework will extend DateTime.MaxValue ( e.g by changing its underlying type) to a new arbitrary value and kick the problem further down the road for another few millennia.

Edit

(Reinforcing tdammers' point that rather than fudging an artificial date, that it is more correct to explicitly highlight the fact to the consumer that we don't have an end date.)

As an alternative to using null, which has the negative consequence of being type compatible with any reference type (including .Net Nullable`), which will likely cause NRE issues in consumers who forget to check, in FP languages, it is commonplace to use an Option or Maybe Type wrapper around a value which may, or may not be returned.

Pseudo code:

```<code>Option<DateTime> LeaseExpiryDate(Home rental)
{
    if (... expiry date can be determined ...)
       return Some(rental.ExpiryDate);
    else
       return None;
}
</code>```

The benefit of doing this is that it forces the consumer to reason over both cases. Pattern matching is also commonplace here:

```<code>LeaseExpiryDate(myHome) match {
     case Some(expiryDate) => "Expired"
     case None => "No Expiry"
}
</code>```

Title: Is there a constant for "end of time"?

Body:
As an industry we have been notoriously short-sighted and arbitrary in the pursuit of saving a few bytes e.g.

31 Dec 99

January 19 2038

T + 50 years, when hopefully all systems I've been involved in have become defunct or been replaced (or I'm dead, whichever comes first).

IMHO the best bet is to stay with a appropriate, mainstream level of abstraction on 'max date', and hope that a common solution has addressed the issue before the time arrives.

e.g. in .NET, DateTime.MaxValue is arbitrarily 23:59:59.9999999, December 31, 9999, exactly one 100-nanosecond tick before 00:00:00, January 1, 10000. So if my assumptions about my own longevity are false, and the year 10000 arrives, I'm rather hoping that a recompile of my app with a later version of the framework will extend DateTime.MaxValue ( e.g by changing its underlying type) to a new arbitrary value and kick the problem further down the road for another few millennia.

Edit

(Reinforcing tdammers' point that rather than fudging an artificial date, that it is more correct to explicitly highlight the fact to the consumer that we don't have an end date.)

As an alternative to using null, which has the negative consequence of being type compatible with any reference type (including .Net Nullable`), which will likely cause NRE issues in consumers who forget to check, in FP languages, it is commonplace to use an Option or Maybe Type wrapper around a value which may, or may not be returned.

Pseudo code:

Option<DateTime> LeaseExpiryDate(Home rental)
{
    if (... expiry date can be determined ...)
       return Some(rental.ExpiryDate);
    else
       return None;
}

The benefit of doing this is that it forces the consumer to reason over both cases. Pattern matching is also commonplace here:

LeaseExpiryDate(myHome) match {
     case Some(expiryDate) => "Expired"
     case None => "No Expiry"
}


答: All the complaint servers (whether paid or unpaid) will have all the features that are mandated by the Java EE standards. I guess however there are areas where the paid servers may excel. For example the facility to provide efficient clustering and monitoring (plus obviously the support) is something that paid servers usually boast. I guess Application server clustering is not that is something used by all applications and different paid servers may have better offering in terms of extra tools.</p>

Title: Advantages of paid Java Application Servers?

Body:
What are the advantages of Weblogic or Websphere over Glassfish or JBoss, since they may reach costs of millions of dollars?

Edit: Is there additional functionality? The all are Java EE Full Certified.

The question is about technology, not business or marketing. From the technological POV how are the servers different?


答:
The old adage "nobody ever got fired for buying IBM" applies here.

Also, the open source salesmen can't wine you, dine you and take you on paid vacations.