Comment

Comment by djhworld

> There is some truth to it. This, however, isn’t due (too much) by how you write the code from a syntax perspective: while coding my Python program I noticed that when the function is run in the context of Lambda, the platform expects to pass a couple of parameters to the function (“event” and “context”). I had to tweak my original code to include those two inputs (even though I make no use of them in my program).

This is just a product of bad design

A better approach would be to decouple all your business logic and provide an interface to it.

e.g.

    MyBusinessLogic
        doSomeBusiness

    MyLambdaRequestHandler
        - handleRequest
          - call myBusinessLogic.doSomeBusiness
That way if you need to move away from AWS Lambda, you can simply remove MyLambdaRequestHandler and any associated unit tests and your application code is unaffected.
parent djhworld 10 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton