Interface segregation (ISP) 00:00:00 Make a prediction You will split a wide interface according to two clients' actual needs and show how the split prevents accidental authority. A network stream can read but cannot seek backward. Should it have to implement a seek method just so a copy routine can read it? No. The copy routine only needs bytes. Depend on a narrow source reader and a destination writer, and leave seeking to clients that actually require it. 00:00:29 Asha and the remote Give a television viewer a remote with volume and channel buttons. Making every remote also control a stage crane forces the ordinary viewer to carry dangerous unused controls. An interface describes what this particular caller may ask. A class with more capabilities can expose them through different contracts. The interface segregation principle (ISP) says: clients should not be forced to depend on methods they do not use. It is the I in SOLID. A fat interface couples its callers to each other. Someone needs a new method for billing, and the code that only prints must be compiled, tested and delivered again. 00:01:09 Give a copier only reading rights A copy routine needs to read from a source and write to a separate destination. It has no reason to close or seek every source it can read. Give the source a small read contract. A network stream and an in-memory buffer can both fulfill it without pretending to rewind. Give the destination a write contract. Two small fakes can now test copying three bytes and then reaching end of input. Give the copier a read-only source with three bytes. Run until end of input and confirm those same three bytes reach the output. If the source interface also demands write, its test double must invent behaviour for an operation this caller can never legitimately request. 00:01:53 Separate reporting from mutation A dashboard only reads stock levels. A warehouse receiving station also adjusts inventory. Give the dashboard a read-only view so a test double need not implement stock adjustments and the UI cannot mutate inventory accidentally. Show yesterday's count in the dashboard, then let the receiving desk add one unit. The dashboard should be able to observe the new count while lacking any ability to change it. That concrete boundary is a stronger reason to split roles than a target interface size. Dividing one natural operation into dozens of tiny interfaces can make a caller assemble an incoherent puzzle. Watch which operations real clients repeatedly use together. A client needing both reading and cleanup may receive both roles if it actually owns the resource. Go: package io. Reader and Writer have one method each. Larger ones such as ReadWriter are built from them. Effective Go says that interfaces with one or two methods are common in Go code. Go: interfaces live with the client. The Go code review guide says that interfaces generally belong in the package that uses the values, and that the implementing package should return concrete types. New methods can then be added without breaking anyone. 00:03:14 Try an interview follow-up When would you keep a wide interface on purpose? I would keep a wide interface when there is one coherent client role that regularly needs nearly all of it. A string or a small collection may already be the right unit. I split when named callers need meaningfully different abilities; otherwise every extra wrapper becomes another combination that implementers must maintain. An information kiosk can display a store credit balance. A staff terminal can also issue refunds. If both depend on one large interface, the kiosk's test double must implement refund behavior it never uses. Give the kiosk a read contract. Then change refund approval and count which clients need to change. 00:03:59 What to take with you Look at the callers, not at the class. Group the methods by who calls them, and give each group an interface named after the need. One class may implement many. Empty bodies, not supported errors and mocks with twenty unused methods are the signs. The gain is fewer rebuilds, honest classes, small test doubles and less power handed around.