File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes What is dom? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What is dom?" Watch "What is dom?" New topic
Author

What is dom?

Serap Elbeyoglu
Ranch Hand

Joined: Feb 12, 2010
Posts: 52
Hello,

Can anyone tell "dom" basically?

For example, now I am writing:


/** List the days in each month */

public final static int dom[] = {

31, 28, 31, /* jan, feb, mar */
30, 31, 30, /* apr, may, jun */
31, 31, 30, /* jul, aug, sep */
31, 30, 31 /* oct, nov, dec */ }

Why am I writing "dom" keyword?

Serap Elbeyoglu
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18757
    
  40

serap elbeyoglu wrote:
Why am I writing "dom" keyword?


If I had to guess, I'll say you picked "dom" because it is short for "days of month"?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Serap Elbeyoglu
Ranch Hand

Joined: Feb 12, 2010
Posts: 52



it is short for "days of month"?

Henry

Henry, thank you for your attention, but I think it isn't true. Because I feel that dom is a keyword of Java. (int [] sample.dom) Why do we need to use it ? What do you say? Do you think my question is clear?

Thank you.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61092
    
  66

It is not a "keyword of java". It's just a variable name. It could be fred, or shoomp, or jasgdjhgdasjh or anything else that's an identifier. It's just a variable name.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18757
    
  40

Bear Bibeault wrote: It could be fred


How about "Find the Real End Day"? ...

Henry
Serap Elbeyoglu
Ranch Hand

Joined: Feb 12, 2010
Posts: 52
Thank you for your helps guys, I've got the point
Ulrika Mingle
Greenhorn

Joined: Feb 15, 2010
Posts: 6
serap elbeyoglu wrote:Thank you for your helps guys, I've got the point


You can think of it as Don't Overdo Meaning
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

This makes me think of a story that a colleague once told me. He had been a programmer long ago, in the 1970's. He told me that they always used two- or three-letter variable names, like "a1", "a2", "a3" etc., and they would have a table on paper somewhere that would explain what each variable was used for. Maybe that was necessary in the 1970's, when computers had a very limited amount of memory and were much slower than the chip in your cell phone...

It's very important to choose good and clear variable names. A name like daysPerMonth would have been much better than something like dom. Choosing good variable names makes it much easier to understand and maintain code.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Serap Elbeyoglu
Ranch Hand

Joined: Feb 12, 2010
Posts: 52
Don't Overdo Meaning

Thank you Jesper, it is a very clear explanation. Here is a good tip for java variables: Choose clear variable names for you programing process. AgeOfChildren is a better variable name than AOC. T

Thank you. At this point I want to ask "Why do we use variables?" My answer is that: "Serap, you can think variables are like tools in your kitchen. You have them to cook. The names of them is not so important. But, if you label them with good names according to their function, you would make jour job fast and easy. The important point is that how you will define and use them." Did I understand variables?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What is dom?