Variables naming style [closed] - variables

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
What do you prefer to use and what is the best practice - to make long but very meaningful names or to make shorter ones?
For example, if you are writing a class House, will be
int numberOfRooms;
or
int nRooms;
Sure, long names are better for understandig when you read foreign code or give yours to somebody, but they make code longer -> more complicated to read. So I messed up with it. :)

One of the most important things is understanding code.
It's better to name the variable numberOfRooms or numOfRooms than nRooms - nRooms could mean something else and numOfRooms is just 4 characters longer - so, I think, it worths to name it a little longer.

Use the house naming style for wherever you are working. Other colleagues will be maintaining your code in the future and it is best to make it easy for them.
If you are working for yourself then use the standard naming style for the language you are using. Delphi, Java, C# and others all have standard styles.
If you are working on a collaborative project then follow the house naming style for that project.
As Miroslav says, longer names are generally better, within reason.

Related

SQL column naming best practice, should I use abbreviation? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
I want to which is, in your opinion, the best practice for name SQL columns.
Example: Let's say that i have two columns name referenceTransactionId and source
now there is another way to write this like refTxnId and src
which one is the better way and why? Is it because of the memory usage or because of the readability?
Although this is a matter of opinion, I am going to answer anyway. If you are going to design a new database, write out all the names completely. Why?
The name is unambiguous. You'll notice that sites such as Wikipedia spell out complete names, as do standards such as time zones ("America/New_York").
Using a standard like the complete name means that users don't have to "think" about what the column might be called.
Nowadays, people type much faster than they used to. For those that don't, type ahead and menus provide assistance.
Primary keys and foreign keys, to the extent possible, should have the same name. So, I suspect that referenceTransactionId should simply be transactionId if it is referencing the Transactions table.
This comes from the "friction" of using multiple databases and having to figure out what a column name is.

If it is possible to make games without coding, why code one? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm pretty new to coding and while searching on random stuff on the internet i found out that it is possible to make games without a single line of code with the help of game-engines like Unity. So what merit is there in coding a game? I have my guesses but i would like to have an answer to be sure, thank you in advance.
Unity requires coding for anything truly custom
You can get quite far with Unity just using already built stuff, but that's just the problem. You are limited to using the parts someone has already made and combining them. Now, that does allow for a heck of a lot of combinations but that is as far as you can go.
You are also limited in your ability to correct unwanted behavior in precisely the way you want it to be corrected.
You need to learn coding in order to make games and that includes using gaming engines such as Unreal or Unity engines. The main reason on why you would need to learn coding is to add logic to your game such as moving your character.
If you are using Unity I would suggest referring to the following link and learn more about scripting(aka coding) and how can you implement it in your game and that way you would have a better idea on why/when coding is essential to the game you're creating.
https://learn.unity.com/project/beginner-gameplay-scripting?courseId=5c61706dedbc2a324a9b022d

Is there a way to use VBA to modify other VBA code? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I don't know where to start with this. If there is a way, all I need is an object name or collection name, so I can look up the feature on Microsoft's site, and go from there. But, searching there directly didn't turn anything up.
You're probably looking for the VBE Extensibility Library.
However note that depending on what you're actually trying to do ("modify other VBA code"), it may be very hard, if not impossible to implement.
The library will let you iterate modules, locate their members, pull the actual code into strings (from entire modules or just a given procedure)... but that's as granular as it gets.
If you're trying to do anything that requires understanding of the code's semantics, the VBIDE API won't be enough: you need a lexer and a parser for that... and I've yet to see a successful lexer/parser for VBA, written in VBA.
Good luck!

Which documentation package more actively maintained: NaturalDocs or RoboDoc? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I am documenting a small itcl project. Due to shortcomings in itcl support in doxygen, and the fact that Ruff! does not support itcl, I am left with NaturalDocs and RoboDoc as the leading candidates. However, I don't want to pick an unsupported system, and was wondering which is going to be there in the long term?
What will be there in the long term? Who knows! It depends on how much people use it, really, as with all open source code systems. It should be noted that both the tools you refer to are really slow developing at this point: they do what they do and need little significant change to keep on doing it.
As far as I can see, ROBODoc requires that you do pretty much all the annotation work yourself, whereas NaturalDocs will derive a bit more for you. Not very much though; in particular, you will have to write plenty of annotations on things whichever route you use. (I've no particular experience with either though; I tend to prefer to maintain documentation in a separate file with something like doctools but that's a very different approach. I've also done nasty custom things in the past; you really don't want to use them.)

PDO prepare statement parameters [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I just started to learn PDO and i read that in prepare statements you can use named parameters and question marks parameter. So which should i use, or they are completely the same and is just the matter of my decision which to use? Becuase i saw more people choose to use question mark parameters.
As a matter of fact, question marks produce dramatically shorter code.
Being not a novelist but programmer, I prefer concise code like this
$stm = $pdo->prepare("SELECT id FROM table WHERE name=? and pass=?");
$stm->execute(array($name,$pass));
$id = $stm->fetchColumn();
while named placeholders will require me to write every name a dozen times.
But anyway, it's indeed only a matter of personal preference.
You can use both, but using "named parameters" is (for obvious reasons) a lot easier, and more clear.
A good thing about named parameters is that you can see in your code what variable is inserted where in the query, and adding pieces of code (later on) is easier because everything has a name and is not depended on the order of the parameters.