Suppose you discover that your most recent release contains a bug whose regression test will require extensive mocking or stubbing because the buggy code is convoluted. Which action, if any, is NOT appropriate?
A. Do the refactoring using TDD on the release branch, and push the bug fix as new code with tests
B. Do the refactoring using TDD on a different branch, push the bug fix as new code with tests, then cherry-pick the fix into release
Create a regression test with the necessary mocks and stubs, painful though it may be, and push the bugfix and tests to release branch
Depending on project priorities and project management, any of the above might be appropriate
查看答案
If you’ve been assigned to modify legacy code, which statement would make you happiest if true?
A. “It was originally developed using Agile techniques"
B. “It is well covered by tests”
C. “It’s nicely structured and easy to read”
D. “Many of the original design documents are available”
Suppose we want to add a Theater model to Rotten Potatoes, with the assumption that a Theater is associated with one Movie, but a given Movie could be showing at many Theaters. In our Rails app we would like to be able to write movie.theaters to obtain a list of all the theaters at which a movie is showing. Which statement is correct?
A. The movies table will need a foreign key theater_id. We must add has_many :theaters to the Movie model. We must add has_many :movies to the Theater model. We must add belongs_to :theater to the Movie model.
B. We must add has_many :theaters to the Movie model.
C. We must add has_many :movies to the Theater model.
D. We must add belongs_to :theater to the Movie model.
If using the DataMapper pattern with a NoSQL database and you want to do one-to-many associations, you can expect:
A. To have to write the association methods yourself
B. Better scalability
C. Worse scalability
D. All of the above are possible
If we also have moviegoer has_many reviews, can we use moviegoer_review_path() as a helper?
A. Yes, it should work as-is because of convention over configuration
B. Yes, but we must declare reviews as a nested resource of moviegoers in routes.rb
C. No, because there can be only one RESTful route to any particular resource No, because having more than one through-association involving Reviews would lead to ambiguity
D. No, because having more than one through-association involving Reviews would lead to ambiguity