tcping icon indicating copy to clipboard operation
tcping copied to clipboard

Functional Options Pattern for initializing tcping

Open Ilhan-Personal opened this issue 2 months ago • 0 comments

Currently, the initialization of tcping instances occurs through a method called processUserInput, which directly modifies the fields of a tcping struct based on command-line flags and other input parameters. This method has grown to become complex and handles multiple aspects of the setup, which impacts maintainability and testability.

We aim to refactor this initialization routine by implementing the Functional Options Pattern, in which the tcping initialization is broken down into a series of small functions, each with a single responsibility: configuring a specific aspect of the tcping instance.

https://golang.cafe/blog/golang-functional-options-pattern.html

Ilhan-Personal avatar Jan 01 '25 21:01 Ilhan-Personal