I prefer private methods to extra classes, sometimes.

Roeniss Moon·2022년 7월 2일
0

가설

목록 보기
2/2

This post is currently just a draft for the idea because I couldn't find some nice examples yet.

  • what private method is for
    • cohesion. "This function belongs to this class, of course."
      • this should be deeply considered with SRP, but let's put aside for now. I'll talk about that later in this post
    • encapsulation. "...But not for others!"
    • and another one - "readability"
  • the third purpose, Readability
    • Verbose long method makes a developer exhausted.
    • At this moment, I think in many, common, normal, daily situation, our class doesn't get complex as much as we worried about.
      • What I want to talk about is that an appropriate abstraction doesn't mean we should make 10 classes, for now. If we carefully arrange and create our class, we can make fewer classes with more readability
      • In other words, you don't have to consider a whole system from a small business logic chunk.

-- until few days ago, I decided not to publish this post because I figured out that my logic and flow is not great than I expected. But for now I publish this because, after few days, my company tech head said something similar to my logic, which makes me feel confident.

references

profile
기능이 아니라 버그예요

0개의 댓글