CS FundamentalsVery hardProduct-company placement
Code smells: in system X, adding a new payment type forces small edits in eight classes. In system Y, the class Report is edited for database changes, for new export formats and for tax-rule changes. Which smells are these?
- A. X is divergent change; Y is shotgun surgery
- B. X is feature envy; Y is a god class
- C. X is shotgun surgery; Y is divergent change
- D. Both are shotgun surgery
Correct answer: C. X is shotgun surgery; Y is divergent change
Shotgun surgery is one change scattered over many classes; divergent change is one class changed for many unrelated reasons (an SRP violation). They are mirror images, which is why the names are often swapped.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- Code reads if account.getBalance() >= amount: account.setBalance(account.getBalance() - amount). Which principle does this break, and what…
- In GRASP, which pattern describes creating a class such as OrderPersistenceService that has no counterpart in the domain, so that domain…
- In a Kubernetes service mesh, each pod runs an extra proxy container beside the application that handles mTLS, retries and metrics for all…
- Match each caching write policy with its behaviour. P. Write-through Q. Write-behind (write-back) R. Write-around 1. Writes go only to the…
- Pull requests A and B each pass CI against main and are merged one after the other, after which main fails to build: A renamed a function…
- On main you run git merge f1 f2 f3, where the three branches touch different files and none conflict. What results?