Search code examples
functionparadigms

The act of breaking functions apart is called what?


Typically I implement classes (C#, C++) via many private functions that serve no purpose other than to separate concerns & logic for readability, maintainability, and scope. For example, if I see a function that is 100 lines long and has 3 comments in it separating it out into virtual 1/3 section chunks, that to me is 3 functions. So I break that larger function out into 3 smaller ones and now that original function only calls 3 functions.

I don't know the name for this paradigm. At first I thought it might be functional programming or modular programming, but that doesn't seem to be the case. Can anyone help me figure out what this paradigm is called? Additionally, a link to a wikipedia article I could read that talks about this exact use case would be great (Of course if you tell me the name of the paradigm I could easily look this up myself).

Thanks in advance.


Solution

  • Refactoring is changing the code w/o changing its behavior. When you break code into more methods, it's called Refactoring to Method. When you take those methods and put their behaviors into many classes (which can help maintain single responsibilities per object/class), it's called Refactoring to Objects.