Null Reference

A slight bit less than nothing, just a space
where you could put a little something in.
You know just where to find it, if you just
had found the time to see it really was
a thing and set its address down right here.

I'm just a symbol of an object, not
the thing you want, itself, and if you ask
me for the thing before you told me where
it was, I'll throw you an exception hot,
which you had better be prepared to catch
or lacking that prepare to meet your Doom
and die a painful unexpected death.

Much better 'tis to wear a leather glove,
a catcher's mitt with which to soften blows,
or better yet to peek inside the orb
before you try to take a deadly sip
of nothing from inside. So much more comes
from nothing sipped when thirsting for the thing.
A thirst so great that it affects the mind,
and renders naught the seeker's very self.

© 2018, Paul Guernsey Player

Code Cowboy

The user tells us what he wants, and so the job begins.
A wink, a nod, a tiny plan, forgetting former sins.

We code and test, and code and test, and then we test again.
So, is it done? Oh no, not yet. I’m guessing nine of ten.

An incremented version num, it’s ready to deploy.
An email to the user now, and I’m a Code Cowboy!

Code Cowboy

Paul Guernsey Player, © 2018/07/16


Fourteener: iambic heptameter

Source Code Poetry: The Preamble

The calling code:

using System.Collections.Generic;

namespace PGP.Poetry
{
    class Program
    {
        static void Main(string[] args)
        {
            // See Source Code Poetry: Genesis 1:1 for more on creating a God
            //
            USConstitution.Creator NaturesGodProvidence = new USConstitution.Creator();

            // Create a Constitution
            USConstitution.IConstitution UnitedStatesOfAmerica = new USConstitution.Government();

            // Form some States
            USConstitution.State Delaware = new USConstitution.State { Name = "Delaware", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 60000 };
            USConstitution.State Pennsylvania = new USConstitution.State { Name = "Pennsylvania", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 434000 };
            USConstitution.State NewJersey = new USConstitution.State { Name = "New Jersey", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 184000 };
            USConstitution.State Georgia = new USConstitution.State { Name = "Georgia", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 83000 };
            USConstitution.State Connecticut = new USConstitution.State { Name = "Connecticut", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 238000 };
            USConstitution.State Massachusetts = new USConstitution.State { Name = "Massachusetts", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 475000 };
            USConstitution.State Maryland = new USConstitution.State { Name = "Maryland", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 320000 };
            USConstitution.State SouthCarolina = new USConstitution.State { Name = "South Carolina", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 250000 };
            USConstitution.State NewHampshire = new USConstitution.State { Name = "New Hampshire", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 142000 };
            USConstitution.State Virginia = new USConstitution.State { Name = "Virginia", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 821000 };
            USConstitution.State NewYork = new USConstitution.State { Name = "New York", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 340000 };
            USConstitution.State NorthCarolina = new USConstitution.State { Name = "North Carolina", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 429000 };
            USConstitution.State RhodeIsland = new USConstitution.State { Name = "Rhode Island", IsAmerican = true, IsUnited = true, ThePeople = new List(), PopulationCount = 69000 };

            // Add the original 13 states to the union.
            UnitedStatesOfAmerica.States.Add(Delaware);
            UnitedStatesOfAmerica.States.Add(Pennsylvania);
            UnitedStatesOfAmerica.States.Add(NewJersey);
            UnitedStatesOfAmerica.States.Add(Georgia);
            UnitedStatesOfAmerica.States.Add(Connecticut);
            UnitedStatesOfAmerica.States.Add(Massachusetts);
            UnitedStatesOfAmerica.States.Add(SouthCarolina);
            UnitedStatesOfAmerica.States.Add(NewHampshire);
            UnitedStatesOfAmerica.States.Add(Virginia);
            UnitedStatesOfAmerica.States.Add(NewYork);
            UnitedStatesOfAmerica.States.Add(NorthCarolina);
            UnitedStatesOfAmerica.States.Add(RhodeIsland);

            UnitedStatesOfAmerica.States.ForEach(s =>
                {
                // Create ThePeople (in each state)
                for (int i = 0; i <s>
                    {
                        p.Ordain(UnitedStatesOfAmerica);
                        p.Establish(UnitedStatesOfAmerica);
                    });
                }
            );

            // Prudence, indeed, will dictate that Governments long established
            // should not be changed for light and transient causes; and accordingly
            // all experience hath shewn, that mankind are more disposed to suffer,
            // while evils are sufferable, than to right themselves by abolishing
            // the forms to which they are accustomed.
            while (UnitedStatesOfAmerica.Evils.AreSufferable)
            {
                // We the People of the United States, in Order to form a more perfect Union, establish Justice,
                // insure domestic Tranquility, provide for the common defence, promote the general Welfare, and
                // secure the Blessings of Liberty to ourselves and our Posterity, do ordain and establish this
                // Constitution for the United States of America.
                UnitedStatesOfAmerica.FormAMorePerfectUnion();
                UnitedStatesOfAmerica.EstablishJustice();
                UnitedStatesOfAmerica.InsureDomesticTranquility();
                UnitedStatesOfAmerica.ProvideForTheCommonDefense();
                UnitedStatesOfAmerica.PromoteTheGeneralWelfare();
                UnitedStatesOfAmerica.SecureTheBlessingsOfLiberty();

                // We hold these truths to be self-evident, that all men are created equal, that they are endowed
                // by their Creator with certain unalienable Rights, that among these are Life, Liberty and the
                // pursuit of Happiness.--That to secure these rights, Governments are instituted among Men,
                // deriving their just powers from the consent of the governed,
                UnitedStatesOfAmerica.States.ForEach(s =&gt;
                {
                    s.ThePeople.ForEach(p =&gt;
                    {
                        p.Rights.ForEach(w =&gt; p.Exercise(unalienableRight: w));
                    }); ;
                }
);
            }

        }
    }
}

Some underlying classes:

using System.Collections.Generic;

namespace PGP.Poetry.USConstitution
{
    public interface IConstitution
    {
        // We the People of the United States,
        // in Order to form a more perfect Union,
        // establish Justice,
        // insure domestic Tranquility,
        // provide for the common defence,
        // promote the general Welfare, and
        // secure the Blessings of Liberty to ourselves and our Posterity,
        // do ordain and establish this Constitution for the United States of America.

        List States { get; }

        void EstablishJustice();
        void InsureDomesticTranquility();
        void ProvideForTheCommonDefense();
        void PromoteTheGeneralWelfare();
        void SecureTheBlessingsOfLiberty();
        void FormAMorePerfectUnion();

        Evils Evils { get; set; }
    }

    ///

    /// Prudence, indeed, will dictate that Governments long established
    /// should not be changed for light and transient causes; and accordingly
    /// all experience hath shewn, that mankind are more disposed to suffer,
    /// while evils are sufferable, than to right themselves by abolishing
    /// the forms to which they are accustomed.
    /// 

    public class Evils
    {
        public bool AreSufferable { get; }
    }

    ///

    /// and to assume among the powers of the earth, the separate and equal station to which the Laws of Nature and of Nature's God entitle them,
    ///
    /// ...with a firm reliance on the protection of divine Providence, we mutually pledge to each other our Lives, our Fortunes and our sacred Honor.
    /// 

    public class Creator
    {
        public class PersonFactory
        {
            public Person CreatePerson()
            {
                Person returnValue = new Person
                {
                    // Endow each person with certain unailabale rights
                    Rights = new List
                    {
                        new Right{ Name = "Life", IsUnalienable = true },
                        new Right{ Name = "Liberty", IsUnalienable = true },
                        new Right{ Name = "Persuit of Happiness", IsUnalienable = true }
                    }
                };

                return returnValue;
            }
        }

        public Creator.PersonFactory Factory { get; set; }

        public Creator()
        {
            this.Factory = new Creator.PersonFactory();
        }
    }

    ///

    /// Governments are instituted among Men, deriving their just powers from the consent of the governed,
    /// 

    public class Government : IConstitution
    {
        public Evils Evils { get; set; }

        public List States { get;  }

        public Government()
        {
            States = new List();
        }
        public void FormAMorePerfectUnion() { }
        public void EstablishJustice(){ }
        public void InsureDomesticTranquility(){ }
        public void ProvideForTheCommonDefense(){ }
        public void PromoteTheGeneralWelfare(){ }
        public void SecureTheBlessingsOfLiberty(){ }
    }

    public class Person
    {
        public List Rights { get; set; }

        ///

        /// Middle English ordeinen, from Anglo-French ordener, ordeiner, from Late
        /// Latin ordinare, from Latin, to put in order, appoint, from ordin-, ordo order
        /// https://www.merriam-webster.com/dictionary/ordain
        /// 

        ///
        public bool Ordain(object target)
        {
            return true;
        }

        public void Establish(object target)
        {

        }

        public void Exercise(Right unalienableRight)
        {

        }
    }

    public class Right
    {
        public bool IsUnalienable { get; set; }
        public string Name { get; set; }
    }

    public class State
    {
        public bool IsAmerican { get; set; }
        public bool IsUnited { get; set; }
        public string Name { get; set; }
        public int PopulationCount { get; set; }
        public List ThePeople { get; set; }

    }

    //public class America
    //{

    //}

}

ReadMe

PGP.Poetry\PGP.Poetry\USConstitution\ReadMe.txt
2018/06/16 PGP [Paul Guernsey Player]

This is a project to demonstrate the Preamble to the U.S. Constitution in code.
______
Things I Learned*

Who Ordains? Who Establishes?
One of the first things that I learned while doing this project is Ordaining and Establishing the Constitution. I had originally placed these methods [verbs] in the Preamble class, itself. Should there even be a Preamble class? Not sure yet, but its text clearly states who is doing these actions, so I moved the methods to the Person class.

Another thing I learned, or had to decide the proper position of People in the hierarchy of things. So far, a State has People. So far.

God figures prominently in this story. Had to go back to the Declaration of Independence to get the proper perspective. Given this, what type of God is the Declaration’s Creator? Under what authority did the framers seek “the separate and equal station” among Free and Independent States? And here we find the Declaration and the Preamble in complete accord. The Representatives “in the Name, and by Authority of the good People of these Colonies” publish and declare…We the People do these things. How do I model this in code? What properties do the people possess who can make such a Declaration? Whence do a government’s Just Powers derive?
______

*”Learned” may be too strong a word. I know these things, but doing a demonstration can CEMENT concepts in a way that had been missing before the exercise.

Source Code Poetry: Genesis 1:1

using System.Diagnostics;

namespace SourceCodePoetry
{
    class Program
    {
        static void Main(string[] args)
        {
            TheBeginning();
        }

        private static void TheBeginning()
        {
            // Genesis 1:1
            // In the beginning God created the heaven and the earth.
            God God = new God();

            Heaven theHeaven = God.HeavenFactory.Create();
            Earth theEarth = God.EarthFactory.Create();

            // Genesis 1:2 And the earth was without form, ...;
            Debug.Assert(theEarth.Form.HasValue == false);

            // ...and void;
            Debug.Assert(theEarth.IsVoid == true);
        }
    }
}

This code needs some World Class Exception Handling.

There are Source Code Poetry competitions, but my program does not strictly comply with the rules [1. I always comment my code, and 2. my code is less literal than the example]:

The poetry must be written in any programming language. 

Submitted source code must rhyme (however, modern masterpiece may ignore this rule)

Submitted source code must compile (however we accept poems written in interpreted programming languages)..

Comments and string literals are NOT permitted.

EXAMPLE:

You will(Need no){
 Example at=ALL;
 if (You.are(GOOD))
  at.writing(Your.CODE);
}