Single responsibility principle - am I overusing it?
Posted
by
Tarun
on Programmers
See other posts from Programmers
or by Tarun
Published on 2011-11-30T05:57:24Z
Indexed on
2011/11/30
10:32 UTC
Read the original article
Hit count: 262
programming-languages
|design
For reference - http://en.wikipedia.org/wiki/Single_responsibility_principle
I have a test scenario where in one module of application is responsible for creating ledger entries. There are three basic tasks which could be carried out -
- View existing ledger entries in table format.
- Create new ledger entry using create button.
- Click on a ledger entry in the table (mentioned in first pointer) and view its details in next page. You could nullify a ledger entry in this page.
(There are couple more operation/validations in each page but fore sake of brevity I will limit it to these)
So I decided to create three different classes -
- LedgerLandingPage
- CreateNewLedgerEntryPage
- ViewLedgerEntryPage
These classes offer the services which could be carried out in those pages and Selenium tests use these classes to bring application to a state where I could make certain assertion.
When I was having it reviewed with on of my colleague then he was over whelmed and asked me to make one single class for all. Though I yet feel my design is much clean I am doubtful if I am overusing Single Responsibility principle
© Programmers or respective owner