Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 [WIP] Draft of Style Guidelines
Index -> Programming, Turing -> Turing Tutorials
Goto page Previous  1, 2, 3
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
NeonJack




PostPosted: Mon Jun 25, 2018 12:04 pm   Post subject: RE:[WIP] Draft of Style Guidelines

I use m_ for class instance variables so in the example

class Foo
export bar

var baz, floo : int

procedure bar (baz_, floo_ : int)
baz := baz_
floo := floo_
end bar
end Foo

this would be

class Foo
export bar

var m_baz, m_floo : int

procedure bar (baz, floo : int)
m_baz := baz
m_floo := floo
end bar
end Foo

I think trailing underscores look messy - C# has leading underscores which look equally bad IMHO.

Additionally I think comments are very important. Most professional programmers don't like them and won't put them in: they say you have to maintain them and they just add to the burden of getting the job done. I agree a comment should not describe the code it is annotating but a comment is needed for explaining the business logic - if you need to explain your class or method or procedure or function or, indeed, whole program to someone else, you need to comment it, so that vocal explanation is not required.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 3 of 3  [ 31 Posts ]
Goto page Previous  1, 2, 3
Jump to:   


Style:  
Search: