Thursday, September 30, 2010

More On Programming

I learned programming in the nineteen seventies and nineteen eighties.  Since then a lot has changed with the advent of graphical user interfaces and object oriented programming, but the basic constructs of procedural programming are still relevant.

The most basic operation is the assignment, usually denoted with an "=" sign.  For instance in C,Java, Perl , and Python , the statement "a = 2 + 5" means stick the result of adding 2 and 5 into a memory location named "a."

Another of statement controls in what order pieces of your program are executed. C and C-like languages have several of these.  "if..else", "while","do..while","for", and "switch" statements all exist.

If and switch statements are used to choose between two or more alternative paths of execution.  For example:

if (a <= TOO_BIG)   {
   a = a + result(a, do_some_stuff(a,b, uncertainty);
 } else {
     ErrLog.write("a too big\n");
     clean_up()
 }

switch(a)  {

case 1: do_thing_1();
           break;

case 2: do_thing_2();
           break;
default:

}


While, do..while , and for statements are used to repeatedly execute a block of code until a certain condition is met.  For example:
for (a = 0 ; a <= 10 ; a = a + 1) {
    do_some_stuff();
}
a = 0;
while ( a <= 10) {
   do_some_stuff();
   a = a + 1;
}

a = 0;
do {
   some_stuff();
   a = a +1;
while ( a <= 10);

As you may have noticed all three looping constructs are more or less equivalent in meaning but in any given situation, one of the three is likely to be more intuitive than the others. Before the nineties, these constructs plus function calls and data aggregates , which I'll cover in my next post, were close to all there was to programming languages.  Once I cover these basics, I'll start getting into more modern and maybe more interesting ideas, involving GUIs, object oriented programming, and event driven programing. 

Wednesday, September 29, 2010

Multiple Strategies for Learning to Program on Your Own

Programming at a basic level is easy to learn on your own.  There are many references on the Internet.  Things I've done or heard about.

1. PostgreSQL is easy to download for all platforms, Oracle Express is free for download, and MySQL comes with MacOS.  Why learn to use an SQL database? Because most systems use them to store persistent data.

2.  Installing the optional XCode tools on a Mac is easy and gives you access to C, Objective C, C++, and Java compilers.  For a few bucks you can get Apple's professional compiler and intregrated development environment (IDE.)  Another IDE I've used Eclipse, which is again open source and have many useful features for Java development.

3. Even without XCode, Macs come with Python, Perl, and Ruby installed if you want to code in those languages.

4. Finally, one can program JavaScript in your browser itself.

All these tools can help you master the syntax and semantics of a programming language.  Of course, once you know a language or languages you need also to learn the best ways of expressing ideas a programming language, tracking and fixing bugs, and testing your code.  All go over some tools for that in another post.

Some Basics

There are some basic things that everybody needs to know if they want to submit writing essentially anywhere.

1.  Get the mechanics right.  This one is hard for me as I seem to have some kind of attention disorder and consistently produce manuscripts with doubled words, typos, omitted words, and other mistakes.  Despite the fact that it is tedious and hard, the struggle to produce clean copy is necessary.

2. Read the guidelines.  Submitting work that's in the wrong format, is the wrong length, or with the wrong theme is a path to rejection.

3.  If you write a book length manuscript get an agent.  Not all published authors start with one but most successful authors acquire one.

4.  Hardcopy self-publishing rarely works and is expensive.  No one would look down on you for self publishing a chapbook of poetry, but outside of that it's not accepted.

5.  Get a thick skin.  Especially if you are just starting out multiple rejections are the norm.

Tuesday, September 28, 2010

Avoiding Science Howlers

How do avoid people throwing your book across the room because they have an issue with your science.  First avoid the urge the proselytize for a fringe position.  Avoid turning your story into an argument for the existence of immortal souls, intelligent design, the falsehood of climate change, the reality of extraterrestrial UFOs, or other fringe positions.  Oddly, making any of these true in your fictional world won't cause problems for any reader but avoiding using your story as a soapbox to argue the truth of these propositions in the real world.

Second, know what you don't know.  If you have an idea you want to use in a story think about and research it.  One writer created a story based on the idea that all biochemical changes are reversible.  Without that idea he had the makings of a good adventure, but he needed to come up with another device to do the work that idea was doing in his story since it is clearly silly.

Finally when you make stuff up, do so wildly.  If characters nanotechnology then readers may balk at being used to summon ancestral spirits.  If you go ahead and call it magic than most readers won't have a problem.

Monday, September 27, 2010

Women Priests

I've been reading a book by an American convert to Orthodox Christianity.  He finds the Idea of women priests absurd and the existence of women priests in the Anglican Church is one of the reason he, as well as some other Orthodox converts I've known, has left the Anglican fold.

Now this puts me in a girlish snit, as I don't see why somebody with the same kind of body I have can't legitimately be a priest.

The question is, however you feel about the idea of women priests, can you use the idea in a story.  If you are indifferent to religion, a woman who wanted to be a priest would seem as absurd as he would find her, though not ungodly.  In a story written from an atheistic viewpoint such desires could be used to show a female character as power hungry, overly fascinated with religion, or simply immature.

In a story written from an Orthodox viewpoint one could use a desire to be a priest as an indication of a woman's spiritual immaturity.  As she matures her ambitions could change, she could lose interest in religion, which from a Christian viewpoint would be a further fall,  become a novice monastic, decide to marry someone and forget about the priesthood, or go though some other spiritual metamorphosis.

Another possibility, though not one an Orthodox Christian would consider correct would be for her to become a Pagan or Anglican priest.  While Orthodox Christians wouldn't see this as at all positive, others would.

Depending on an author's beliefs, her or she can take the fairly simple idea that a woman wants to be a priest and run in several directions with it.  Science and Science Fiction of course could add other wrinkles, for instance the woman could choose to be masculinized in her quest for ordination, or the woman could be an intersex.  The key to a good story in a case like the one above which deals with a complex topics is to make all the characters complex.  In a good story, the woman could not simply be an ungodly feminist and Orthodox tradition should not be presented as just mindless patriarchy.

Friday, September 24, 2010

Geeky Gamer Stuff and Observations About Creating Secondary Worlds

I used to play role playing games and still have several game books.  My most recent purchase is volume one of the sixth edition of the Hero System.  From a while ago, I also have a d20 3.5 Player's Handbook.  To entertain myself I've looked at converting a few 3.5 spells into hero system powers.  For the most part, I've found doing so workable if you don't ask for 100% compatibility.

Back to writing.  One thing that makes many game worlds seem a bit silly is the extent of magic powers characters develop and the fact that having so many spells and powers make's it difficult to give a game world a coherent flavor.  Like in a superhero comic book, everything is true.  Looking at monsters, rather than spells, you have dragons and gryphons which are inspired by heraldry and legend but you also have shambling mounds which have a much more twentieth century biological feel.   Looking at character classes you have enough combinations of special powers to make one's head spin.

In writing fantasy or science fiction you really should avoid a lot of that.  While you can have strange things that don't tie into anything else in the world in a way the reader or the characters understand, you need to keep control of such aspects of your world or risk it descending into incoherence.   If your characters have magic powers, there should be a sense that limits to magic exist.  Even if there are no real rules and a powerful adept could warp reality in any way he or she chooses, there should be interesting dangers and consequences involved in using powerful magic.  You see this in the Lord of the Rings where both the Ring itself and the Palantiri had problems associated with there use.

Thursday, September 23, 2010

A Beginner's Error in Writing

An error I've made and also seen in the work of other's is to have a tag-along character. This is a character, often the protagonist's husband or wife, who is there strictly to watch the action and comment on the protagonist's doings.

Because they don't actually do anything they are hard for the reader to sympathize with or even remember. There are two solutions to this. One is to have other character stay home and simply have the main character think about them. The other, obviously, is to give the tag-along something of his or her own to do. This doesn't mean the tag-along has to go fight the bad guys but he or or she should be portrayed as acting somewhat on their own.

A good example of a well done secondary character is Abigail Adams in the musical 1776. She does not play a part in writing the US Declaration of Independence, something that would be historically and culturally inaccurate, but neither does she passively admire her husband or hesitate to bother him for more detail on what do when he casually suggests that she and her friends manufacture salt peter without explaining how they should do so.

Wednesday, September 22, 2010

Energy Beings

Beings made of pure energy are trope that occasionally occurs in science fiction. They speak to our desire to leave behind the decaying wet mess of organic life. I also think they appear only occasionally for good reasons.

Energy in real physics appears to me to be more of an accounting device than a thing in itself. The closest thing in real life to fictional energy beings in real physics is electromagnetic radiation. Could an intelligence be made of this? Not really. There is no internal structure to hang a brain on. Now I confess that I haven't studied quantum electrodynamics, but nothing I've ever seen in written about suggests electromagnetic fields are capable, by themselves, of the kind of complex interactions that brain cells engage in.

I also think that their may be good story reasons not to over-use energy beings or other immaterial forms in fiction. An energy being's invulnerability, while a pleasant fantasy, distances it from us. We have both the physical intuition that they are not real and a certain emotional distance from them based on the fact that they do not share the difficulties of our form of life. I think this is why when energy beings are seen in fiction, they are almost always depicted as falling into or leaving our matter bound form of existence. The circumstances where they touch are realm are more interesting to us than the idea of their existence.

Tuesday, September 21, 2010

Aliens freak me out. Not most aliens you see in the media but the idea of actual aliens freaks me out. While other mammalian species on this planet do posses a modicum of empathy with us, an alien being would have no taxonomic relationship to us and would probably be completely nearly unreadable to us except on an intellectual level.

There are some things that I imagine all biological beings having in common. For example, you have to look at something to attack it, so I can imagine an alien finding a stare threatening if they can recognize our eyes. This though, is a very crude type of empathy. I doubt their'd be mutual recognition of signs of affection or most displays of status.

Other things that aliens might share with us are hierarchical forms of organization. I'm convinced these come about not simply because of desire of some humans to dominate others, but also because a tree structure is an efficient way to share information. However, hierarchies can be permanent or impermanent and all encompassing or only encompass a few activities.

The boss alien on Tuesday might not be the boss alien on Wednesday and we'd have a difficult time understanding that.