CS FundamentalsHardProduct-company placement
A service reuses expensive database connections from a pool instead of opening one per request. One request leaves a connection inside an open transaction with a session variable set. Which pattern is involved, and what rule does this break?
- A. Flyweight; flyweights must never hold any intrinsic state of their own
- B. Object Pool; objects must be reset to a clean state when returned
- C. Singleton; the application may only ever hold one connection at a time
- D. Prototype; each connection must be cloned from a template before use
Correct answer: B. Object Pool; objects must be reset to a clean state when returned
An object pool hands out reusable instances, so leftover state (open transactions, session settings) leaks to the next borrower. Pools must reset or validate objects on return or checkout, and close broken ones.
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
- Following Beizer's guidance for testing two nested loops, how should you start?
- A team builds a thin, working path through every layer of a new system (UI, API, queue, database) with minimal features, and keeps that…
- Using the convention that each if, else-if, for, while, case, && and || adds 1 to the count of decision points, what is the cyclomatic…
- For a 32 KLOC project, the Basic COCOMO organic-mode equation Effort = 2.4 x (KLOC)^1.05 person-months gives approximately how much effort?
- Using basic COCOMO in the organic mode (effort = 2.4 × (KLOC)^1.05 person-months), the effort for a 50 KLOC product is closest to:
- A program consists of a main routine and one procedure. Their flow graphs are drawn as two separate connected components with a total of E…