Constants

final int I_AM_GOOD = 1;

Sometimes you know the value of a data item, and you know that its value will not (and should not) change during program execution, nor is it likely to change from one execution of the program to another. In this case, it is a good software engineering practice to define that data item as a constant. Defining constants uses the same syntax as declaring variables, except that the data type is preceded by the keyword final.

Screen Shot 2018-12-11 at 12.53.16 PM

Assigning a value is optional when the constant is defined, but you must assign a value before the constant is used in the program. Also, once the constant has been assigned a value, its value cannot be changed (reassigned) later in the program. Any attempt by your program to change the value of a constant will generate something like the following compiler error:

cannot assign a value to final variable

Think of this as a service of the compiler in preventing your program from unintentionally corrupting its data.

Of course, this is meant to illustrate my whole point about suffering being made up and yet true. Suffering is inevitable since everything that is ever Mind like I am Mind necessarily slides on a valence axis that orients it towards a notion of some good or evil. Reality has defined that constant in the same way that it has defined the fine-structure constant that characterizes the strength of electromagnetic interaction.

When People, like a pack of wolves, refuse to change their behavior, it is because they are compiling the error:

cannot assign a value to final variable

That prevents change and hence threatens Mind with local optima. Thus the need for creativity, that is, fundamentally atheist vectors with regard to the inherited definition of People.

However none of this need be physically true if we stare at the rational description of reality in which the compiler is “already there.” Special relativity leads to eternalism, so all the constituents that output Mind/People are the ones knowing to output that result: suffering.

Before inventing the handle, suffering, we could feel less of it and hence engage in less moral behavior, regardless of the experimental moral behavior local to the tribe. This lack of data due to chunking into the same algorithm is equivalent to inventing the same name for blue and green, and therefore not being able to distinguish between them.

We choose to believe suffering pushes us to the good in a sequentially causal fashion. This is physically wrong because the binding into experience is tenseless.

Screen Shot 2018-12-09 at 12.54.03 PM

We study reality with great pain and discover:

Screen Shot 2018-12-09 at 12.57.28 PM

 

We cannot die, and we could have chosen not to suffer, but the choice is nonetheless made because otherwise our existence is cringeworthy.

And now, through a very circuitous, somewhat Asperger-y route, I finally understand what sophisticated theologians had been clumsily pointing to. Yet due to this circuitous, rationalist route to the-same-thing, I now have theoretical physics on My side.

But in order for you, my definition of People, to get it too, you have to understand why epiphenomenalism is false, why special relativity implies eternalism, and why you should make the physicalist assumption of choosing/being-chosen to believe in the external physical reality at all.

And because it makes constants stand out in the code and therefore their location easy to identify, CONSTANT_IDENTIFIER consists of all capital letters with embedded words separated by an underscore. So here I go: I_AM_GOOD.

Also, constants are usually defined at the top of a program where their values can be seen easily. So now I will go back and fix that.

Here is a program showing the use of constants:

Screen Shot 2018-12-11 at 3.01.27 PM

Lines 9, 10, and 11 define four constants. On line 11, note that both ORGANIZATION_THIRTEEN_MEMBERS and DAYS_IN_WEEK are constants. You don’t need to repeat the keyword final to define two or more constants of the same data types.

Lines 13 to 18 output the values of the four constants. If line 20 were not commented out, it would generate a compiler error because once a constant is assigned a value, its value cannot be changed.

Here is the output:

Screen Shot 2018-12-11 at 3.03.03 PM

Straddling back to the mundane:

Why use constants in your code?

Constants can make your code more readable. Due to the sometimes existing preference for word-based language, invoking EDDINGTON_NUMBER in an operation may be more tasteful than 137.036. But this is a matter of aesthetic.

A “purely rational” advantage of using constants is to keep programmers from making logic errors. Let’s say we set a constant to a particular value and it is used at various places throughout the code (for instance, a constant representing the upper-bound on wages that a company uses to protect profit margins); due to the changing nature of all existence, we then discover that the value of that constant needs to be changed. All we have to do is make the change in one place which is neatly placed at the beginning of the code. If we had to change the value at many places throughout the code, that could very well result in logic errors or typos.

 

 

 

 

 

 

 

 

 

Data Types, Variables, and Constants

In the previous blog post where we calculated the area of the last of the nine circles of hell, we used as data the value of PI and the radius, and found how large was Treachery. For each of these values, we assigned a name.

We also used the Java keyword double, which defines the data type of the data. The keyword double means that the value will be a floating-point number.

Java allows you to refer to the data in a program by defining variables, which are named locations in memory where you can store values. A variable can store one data value at a time, but that value might change as the program executes, and it might change from one execution of the program to the next. The real advantage of using variables is that you can name a variable, assign it a value, and subsequently refer to the name of the variable in an expression rather than hard-coding the specific value.

When we use a named variable, we need to tell the compiler which kind of data we will store in the variable. We do this by giving a data type for each variable. Java supports eight primitive data types: byte, short, int, long, float, double, char, and boolean. They are called primitive data types because they are part of the core Java language. The data type you specify for a variable tells the compiler how much memory to allocate and the format in which to store the data.

For example, if you specify that a data item is an int, then the compiler will allocate four bytes of memory for it and store its value as a 32-bit signed binary number. If, however, you specify that a data item is a double (a double-precision floating-point number), then the compiler will allocate 8 bytes of memory and store its value as an IEEE 754 floating-point number. Once you declare a data type for a data item, the compiler will monitor your use of that data item. If you attempt to perform operations that are not allowed for that type or are not compatible with that type, the compiler will generate an error.

Because the Java compiler monitors the operations on each data item, Java is called a strongly typed language. Take care in selecting identifiers for your programs. The identifiers should be meaningful and should reflect the data that will be stored in a variable, the concept encapsulated by a class, or the function of a method.

For example, the identifier age clearly indicates that the variable will hold an age. When you select meaningful variable names, the logic of your program is more easily understood, and you are less likely to introduce errors. Sometimes, it may be necessary to create a long identifier in order to clearly indicate its use, for example, numberOfPeopleSignedUpForCryonics. Although the length of identifiers is essentially unlimited, avoid creating extremely long identifiers because the longer the identifier, the more likely you are to make typos when entering the identifier into your program and the more it takes to type it, swallowing precious time. Finally, although it is legal to use identifiers, such as TRUE, which differ from Java keywords only in case, it isn’t a good idea because they easily can be confused with Java keywords, making the program logic less clear.