Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8498887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T00:31:27+00:00 2026-06-11T00:31:27+00:00

Hi I’m writing my own high level API of Amazon’s PHP SDK which is

  • 0

Hi I’m writing my own high level API of Amazon’s PHP SDK which is used to manipulate DynamoDB, a nosql database.

I find myself writing roughly 150 lines of code for a single function that does one operation, including error checking, request building and of course, comments. If I keep going this way the API class can easily exceed a thousand lines, which I think is a bit hard to maintain.

Thus I’m thinking of breaking my class down into several smaller classes, each handling a set of operations. Say like, table operations, item operations, and batch operations. But I’m not an expert with software design patterns, so is this really a good way to modularize? Or is there any design pattern that I should comply and make my code easier to maintain?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T00:31:29+00:00Added an answer on June 11, 2026 at 12:31 am

    Your question is a bit subjective, since you do not provide the code so that we can see what you’re trying to accomplish in fact.

    But yes, you need to separate your classes into smaller components, each one with its own responsibility. There isn’t a single pattern that tells how exactly to do that, but the Single Responsibility Principle is a good one to start with. It’s about separation of concerns.

    You said:

    […] including error checking, request building […]

    There you go, separating error checking, from request building, and then separating it again into smaller components, each with just one responsibility. You must have just one reason to change each component, never more then one. You must have a clear domain model defined, with dedicated services for each one of these domain objects.

    Take for example, the answer of @teresko here:

    How should a model be structured in MVC?

    So, bear in mind that you need to separate your application into layers. The request is part of the presentation tier. Which in modern MVC-alike apllications is composed by the Controller Layer and the View Layer, which interacts with the Model layer in order to prepare the presentation for a given request.

    See: http://martinfowler.com/eaaCatalog/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
I am trying to understand how to use SyndicationItem to display feed which is
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.