smiklosovic commented on code in PR #4411:
URL: https://github.com/apache/cassandra/pull/4411#discussion_r2454775502


##########
src/java/org/apache/cassandra/schema/ColumnMetadata.java:
##########
@@ -739,6 +770,15 @@ public void serialize(ColumnMetadata t, DataOutputPlus 
out, Version version) thr
             }
             if (version.isAtLeast(Version.V7))
                 out.writeVInt32(t.uniqueId);
+            if (version.isAtLeast(Version.V8))
+            {
+                out.writeBoolean(t.comment != null);

Review Comment:
                   if (t.comment == null)
                   {
                       out.writeBoolean(false);
                   }
                   else
                   {
                       out.writeBoolean(true);
                       out.writeUTF(t.comment);
                   }
   
   Why can not you be more succinct? You would be making just one null check 
here instead of twice. Same style should be applied everywhere. I prefer the 
style when I do the stuff based on what state some variable is of. Not that I 
am doing a logic and then I am trying to retrofit what goes in there, because 
you will be checking for null twice, for example. This is a trivial example but 
if you can just check for nullity once, why would you do it repeatedly? Start 
with easy comparision first, do not "invert it". Because then you need to 
invert the condition in your head as well as you read it. The snippet I wrote 
above just can not be easier on eyes and code-flow-wise.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to