3

I have read this post and I am wondering where would abstract methods fit in for an abstract class.

Any convention known for this?

Jai
  • 8,165
  • 2
  • 21
  • 52
  • 2
    I've always seen them treated just as any other method, whatever the grouping convention used. – JB Nizet Aug 16 '17 at 07:07
  • I put them at the beginning of the visibility block they belong to, because I see them as kind of interface methods for the subclasses. – daniu Aug 16 '17 at 07:14
  • i believe (might be wrong) there is no such convention (in the sense of standard) regarding method sorting. The 2 main approaches related to that, that i know about, are about "grouping based on functionality" or "based on visibility" (public, protected, private etc). I have not seen any specific regarding abstract so i guess the 2 other main approaches remain. In my case, but that's me, i follow visibility approach (same as it is stated for class members) and put abstract method the last of their "visibility group". – albert_nil Aug 16 '17 at 07:15
  • @JBNizet Hmm, okay... Somehow the OCD side of me is telling me that mixing abstract with non-abstract methods is messy. – Jai Aug 16 '17 at 07:16
  • That question was "closed as too broad", so perhaps this should be also? Personally, I just put methods close by to where they are used, and stick to small classes. – Stewart Feb 12 '18 at 13:20

0 Answers0