I have a Report class that is basically an interface for creating HTML reports generated via a Python template engine. The Report class currently generates the report but also has a few methods dealing with retrieving/uploading data from S3. These S3 methods are mostly agnostic to what I would consider the core part of the Report class. The only reason I have them in this class is that they generate partitioning/naming based on some things like the report name and account. With my current setup, the flow would look like this for generating and uploading a report:

billing_report = Report(<account_name>,<type>,...)
billing_report.generate()        # returns HTML report for render or processing
billing_report.upload()          # uploads generated report to S3

The raw data needed to generate the report comes from S3 and then the final report can be put into S3 as well.

According to Single Responsibility principle, it seems like this Report class should be split up since it's both generating the report as well as managing things related S3 retrieval/upload. But, if I split them into say Report and S3 classes, it seems like they would be tightly coupled. Also, the S3 class would be just a lightweight wrapper for a few S3 API calls and I would have to create an S3 object which doesn't make logical sense as an object.

So what is the best way to approach this kind of situation?


There is good practice to name classes with noun AND verbal noun. So in your example


It will be harder (on linguistic level) to put everything into one class and create god objects, breaking SRP.

  • That's a great idea, I never thought about that naming convention. – swigganicks Feb 5 '18 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.