Stan Belen

Ranch Hand
+ Follow
since Feb 15, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
1
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
10
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Stan Belen

From what I understand, a unit of work must be short-lived.

For example, say there is an imaginary application that is used by a school to maintain information about students. Suppose a student's address changed and a clerk needs to change this information in this application.

One unit of work will be to retrieve the student's information.

The clerk enters the new address.

The second unit of work will be to save the new address.

In the above example, which consisted of two units of work, there is nothing useful about the session cache.

I can't think of a scenario in which the session cache would be useful, given that unit of work is supposed to be short-lived. Maybe somebody can bring an example when the session cache would be useful in improving the performance. Thanks in advance.
Please note: my goal is to come up with an application that will help me to practice Microservices. Below I describe an imaginary company that is developing an imaginary application.

Suppose there is an imaginary company that is starting a project to develop an application that will help people manage their budgets. They called this application Budget Helper. Initially, they want the following functionality:

  • Import Transactions to Budget Helper: The User will export a CSV transactions file from their bank account. Then the User will upload that CSV transactions file to Budget Helper.
  • Register Bills: The User inputs their Bills information which includes the usual transaction text and the amount. Some of the Bills' amount fluctuates (for example, electricity bill) so the amount is an upper boundary.
  • Transactions Analysis: The User provides start and end dates and the Budget Helper shows the transactions, sorted by the amount in descending order, and specifies whether a transaction is a bill. For the Bills transactions, the report specifies if the amount exceeded its upper boundary. Going over this list, the User marks the individual transactions as Acknowledged.
  • Monthly Summary Comparison Report: The User provides a start and end Year-Month combination and the Budget Helper shows the summary of how much there was spent on Bills and non-Bills for each of the months.


  • Below is the only service that I was able to come up with:

    SERVICETransactions
    BUSINESS REQUIREMENTSManage transactions and bills information
    FUNCTIONALImport transactions file, list transactions report, register bills, acknowledge transactions, monthly summary comparison report
    DATA ENTITIESTransactions, bills
    DATA AUTONOMYNone


    I was thinking that for the features above I would be able to create more than one service but unsuccessful so far.

    I want to ask: Can I add another service by either dividing the Transactions service with the current features or adding some more features?

    Thank you for the help in advance.
    1 year ago

    Stephan van Hulst wrote:You divided your services based on technical capabilities, not based on business objects. As a result, your services are not so loosely coupled as you might initially think.



    Yeah, I see this now.

    Stephan van Hulst wrote:For instance, what will happen when the nature of a transaction changes? It's very likely that not only does the upload service have to change, but the query service as well, and if you're really unlucky, the acknowledgement service as well.

    Services in a microservice architecture are responsible for their own relatively self-contained bit of business. Of course it's possible that one service depends on another, but if the business of one service changes, it should not send out big ripples across your entire architecture.

    At the very least, I'd merge your upload and query services into one: a service that's responsible for the storage and retrieval of transactions. It makes no sense to keep those two separate.

    The service that handles acknowledgement could be separate if you want it to. Inside your imaginary company, you can sort of picture it as a separate unit of bean counters that just go into the archives and rubber stamp transactions that are already there, or check whether a transaction has been stamped, without really caring how the transaction ended up in the archive.

    I think you're making a mistake by putting the acknowledgements and the transactions into separate databases though. While it will work, you're denying yourself an important layer of security: Your DBMS will not be able to enforce referential integrity between the transactions and their acknowledgements.



    Stephan, thank you for your feedback. It makes sense to me. As per my reply to Ron, I'll come up with some more requirements for my personal application in trying to make it a candidate for Microservices Architecture and I'll post.
    1 year ago

    Ron McLeod wrote:I don't see the value of breaking-apart the various aspects of a Financial Transaction Logging Service into smaller pieces.



    I'm trying to come up with a personal application to practice various programming aspects such as Test-Driven Development, Spring Framework, Kubernetes, etc.

    At this time I want to practice Microservices Architecture.

    The personal application that I had in mind was a personal finance application with features like budgeting, spend analysis, etc.

    I'll take a bit more time to try to come up with requirements for the personal finance application that would make it a candidate for a Microservices Architecture.

    Ron McLeod wrote:In the real world, I wouldn't expect a financial organization to have separate departments/business-units for uploading, querying, reporting, and acknowledging transaction information.



    Ron, as per your suggestion regarding Memi Lavi, I started watching one of his courses on udemy, Microservices Architecture - The Complete Guide.

    I now realize what you mean regarding business-unit, that a Service should represent a business capability and should be handled by a single team, which encompasses UI, API, Logic and Database.
    1 year ago
    Regarding Building Scalable Java Microservices with Spring Boot and Spring Cloud, I take it back. I started the course and it looks like a lot of emphasis on google cloud services which is not my aim. I'm not against google cloud, I just need Microservices and implementing them.
    1 year ago
    Hello. I don't have any on-the-job experience with Microservices. I'm currently on the job market and it looks to me that a lot of companies want software engineers with Microservices experience.

    This may be a silly question but do you think it would be a good idea to get a Microservices certification and put that on the resume?

    Also, I've been googling to find such certification and the most appropriate one for myself that I found is the Building Scalable Java Microservices with Spring Boot and Spring Cloud which is offered by Google Cloud. Does anybody know of any other Microservices certification that would be more appropriate for a Java/Spring developer like myself?
    1 year ago
    For the microservices architecture, I went over both, Decompose by subdomain and Decompose by business capability patterns.

    For fun, I'm developing an application for personal finance. Based on the above-mentioned microservices architecture patterns, I created and attached a diagram to this post that I plan to use for the application. Can you guys please glance at it to see if it's ok?

    This application is small and has the following functionality:

  • I will upload a file with transactions
  • I will retrieve a report with transactions
  • I will mark transactions as acknowledged which signifies that I looked at it and it makes sense


  • Description of the microservices architecture that I attached:

    For storing and retrieving transactions I used the Shared database pattern. Correspondingly, there are two services, one for inserting transactions from a file and one for retrieving transactions. The reason that I made two separate services is so that it will be possible to scale distinctly the functionality of uploading and querying transactions. The only user will be me but I want to play around with scaling later.

    I used the Database per service for the Transactions Acknowledge service.

    And, finally, the Transactions Report service merges transactions and existing acknowledgments information and sends that to the user.
    1 year ago

    Ron McLeod wrote:

    Claude Moore wrote:I suggest you to have a look at Microservices Patterns by Chris Richardson ...


    He has been featured at a lot of conferences and in video/audio podcasts - you can find a good number of them on Youtube.

    I've also really enjoyed video courses from Memi Lavi - his focus in on architecture rather than design and implementation.  I've gone through a number of his courses on Udemy.  The standard prices on Udemy seem a bit high to me (especially if you are paying for them on your own), but if you subscribe the mailing list, they will send you offers every couple of weeks to purchase courses for around $12 each.



    Ahh, nice. I do find learning from videos easier than from reading but I think that the book and the videos can complement each other. Thank you, Ron.

    Regarding the udemy pricing, I actually recently signed up for their Personal Plan trial. This plan allows you to watch video courses without having to buy them. However, not all courses are available under this plan. They say there are 8,000+ courses that are available. So far I didn't encounter any course that's not covered by this plan. Just FYI.

    1 year ago
    I've skimmed over the book. Looks to me like chapter 2, Decomposition strategies, is exactly what I need. Thanks again, Claude
    1 year ago

    Claude Moore wrote:I suggest you to have a look at Microservices Patterns by Chris Richardson. The book discusses in depth patterns presented on author's website and it's very well written.
    Examples are in Spring Boot.



    Thank you, Claude. I'll check it out.
    1 year ago
    Hello.

    I'm trying to find a resource (a video course or a book, etc) to learn the thought process that goes into designing a microservices system that has a decent-sized example with, say like, 5+ services.

    I already went over a course but unfortunately, the example consisted of just 2 services. Its purpose was to show how to apply Spring Cloud so that's ok.

    The learning resource that I'm trying to find can be technology agnostic, just specifying the REST API(s) of the services, the interactions between the services, and things to think about, like rate limiting, security, etc.

    If the example will be implemented using Java and Spring then that's even better for me because I'm most proficient with that. But the implementation is not important, I just want to learn how to design the services.

    Let me know if you've seen such a learning resource. Thanks in advance.
    1 year ago

    Stan Belen wrote:is it okay if I'll create a public github project for the purpose



    Junilu Lacar wrote:That is an excellent idea. And yes, I'm saying that you would test-drive the refactoring of the code.



    I've created the project github: https://github.com/sbelenky/person-example

    Questions

    Question 1: is it fine how I used TDD to implement Person::setAddress?

    Question 2: how would you go about in implementing the requirements, described in the README.md of the project?

    Junilu Lacar wrote:

    Stan Belen wrote:How can I restructure this code to be able to unit test it?


    Ironically, you'd write a unit test that would show you the ideal structure of the code so that it can be tested in isolation.

    Let's see how you react to this first before I explain further.



    Junilu, questions:

    Question 1: do you mean to use test-driven development in our conversation?

    Question 2: is it okay if I'll create a public github project for the purpose:

     a) the initial commit will be an analogy of what I am dealing with at work - the legacy code
     b) the subsequent commits will be the test-driven development red-green-refactor steps, that is, I'll make a commit for each red-green-refactor step
     c) I will use the commit message to explain what I am doing, why I'm doing, etc
     d) then I will be able to reference a point in which I will be stuck on, or will need a suggestion

    Thanks for the help

    Junilu Lacar wrote:When something is difficult to test, you refactor it so that it's easy to test.



    Junilu, I agree with this.

    Junilu Lacar wrote:Mixing in a API call inside a method like updateAddress seems like a poor choice. I would separate those two concerns.



    Junilu, the thing that I'm stuck on and would appreciate help with is suppose you need to implement the following requirement:

    1. You will receive the ID and the address of a Person
    2. Use the ID to retrieve the Person entity from the DB
    3. Update the address of the Person
    4. Save this information in the DB
    5. Make a call to an external system, for example, a Human Resources system in regard to this change

    How would one write unit tests for such a requirement?

    The part that I'm stuck on is that somewhere in the code we will need to implement something like this:



    How can I restructure this code to be able to unit test it?