Yes, but the above if (this.dataType == PDataType.decimal) is used to determine the maxLength. In that case, maxLength has special logic to determine it. For example, it has special logic when the type is CHAR, DECIMAL, and not VARCHAR.

Scale, on the other hand, only has special logic for when it is DECIMAL.

So in the current configuration, we first determine what should be the maxLength, depending on the type. Then we determine scale. The logic for maxLength and scale are separated. That's what I mean grouping logic by the field.

If we combine the two, we are saying if the type is DECIMAL, then we have some logic to figure out maxLength and scale; and if the type is VARCHAR, we have another special logic to figure out the maxLength and scale. That's what I mean grouping logic by datatype.

In the above case, grouping by fields is more straightforward in my opinion. Since if we group by datatype, maxLength has this logic to ignore its value unless it'a CHAR, VARCHAR or DECIMAL. For scale, we have the rule to ignore the value unless it's DECIMAL. So we end up placing extra logic in the if block for CHAR and !VARCHAR.

It's just my personal preference. Either way would work for me.