Oh, the title? I wish it were some sophisticated project that I were working on. It isn't; it's a bastardized word. Genesis, Nexus. Genexus. I can't wait until it's copyrighted and I get in trouble for having it in my journal.
No, this is actually a dual journal (which is why it will only barely be appropriate for this site). It's a journal of two things:
Attempts on my part to keep momentum throughout my school year and my current project (I'll get to that in a minute)
and
Design information about my project, which has a deadline of November 1st at this point and I doubt will change.
I considered that since there's going to be large sections of this that are just "wow, this is hard sometimes" in various forms, this might not be appropriate for the space.
However, since 1/2 of the journal is going to be about current design of a software project in Perl, and the other half is going to be 1/2 about working in Perl anyway, that means about 3/4 of my stuff will be on the topic of Perl in one way or another. So I figure it's doable.
So. Without further ado, I give you: My First Thoughts On Perl.
'WOW does this look hard,' I said to myself over two years ago when I first picked up _Learning Perl_, at the urging of my friend and mentor J.D. J.D. worked for NASA then, and I trust everything she recommends implicitly.
To be honest, I thought she'd blown a fuse.
This stuff was WAY beyond someone who had never even heard of UNIX yet, I said to myself.
I couldn't read the book very well. I had some real trouble, especially with setting it up (ha ha ha, bitter laughter track and insert your favorite "W1nd0ze Sucks!" joke here). However, Larry's introduction made me wonder.
I stopped wondering for a while. I set the book aside after I couldn't get it to operate on the machine I used then, and gave it about a year and a half. During that time, I read up on Linux, UNIX, and Windows, and the differences between them all. I spent a little time going through _UNIX In A Nutshell_, and understood little, but enough.
And now, perhaps three months ago, I picked it back up, and on my new computer, sat down and redownloaded the ActiveState perl for Windows, and got everything up and running. (Setting up DJ Delorie's GNU-licensed C compiler helped significantly, cementing what little I knew about compilers and had learned from my old, old Pascal class back in middle school.)
And, shockingly enough, when I tried it, it worked. I cannot realistically say that it was luck; I can only say that I didn't try hard enough two years ago, and as a result, I'm two years behind where I should be with Perl.
This brings me to the here and now, but it doesn't explain the project.
A friend of mine (who, hopefully, will be my actual employer soon) has decided that he's going to start a business. He has contacts, he has a name set up, and he's got credentials of a sort in the business world. He's working on setting up a physical business, but in the mean time, he'd like a real net presence. Something better than just listing a bunch of things on eBay.
He knows I'm a code hacker. He wants to know if I can build him a website and a working inventory system behind it.
"Well," I say to myself, "he needs something that knows when he sells something physically as well as electronically. It's got to be linked, or else he'll sell things in the store and find out an hour later that it got sold already on the net. That's unacceptably stupid."
So I told him I could do one better; I could create a system flexible enough to be used as a register as well as a customer interface on the Web.
We have hashed a price out, we have a deadline (November 1st), and we have a goal.
I spent a LOT of time in my life looking for goals. So long in my life I felt as though I were learning for no reason, and would stop; if there is understanding behind it, and I want to know it, no force on Earth can keep me from that knowledge.
But if I don't want to know it...horse, water, and old cliche. You get the idea.
So here I am, newly motivated, and I must admit Perl is really, really pretty in a way. Lots of programming languages let your brain be lazy the wrong way, the way that forces you to use redundancies and seven letters to perform a function that really only requires two. Lots of them are strict the wrong way, making you deal with things that the computer should be doing all on its own. Perl is precisely where a high-level language should be, IMHO. It sacrifices redundancy and things you should memorize anyway in order to let you do the important thinking, and does most of the important stuff all on its own.
How can you not fall in love with this language? It's so lovable. Like a hedgehog, it's not beautiful, it's cute and perfectly functional.
(Hm. Hedgehog analogy seems wrong somehow. Figure something better out.)
Where was I going with all this?
Okay. The design system essentially runs around a small set of user tools and one webscript. One of them, the inventory adder, takes a plaintext list of things and the number of them, and converts it to the format I want it in. Another, the invoice handler, prints copies of all the invoices for all the sales and packs the data of printed invoices into an archived invoice area, so that old invoices aren't mistaken for new ones and so how many sales have gone through is obvious at any time.
The webscript takes a request that involves a cart file, possibly also a product and a number, and returns a page. Cart files are located on our server; the HTML is the only interaction the customer has with it. When a product is returned, the program knows to add the number many of that product to the cart. When that number is negative, it decrements the number of that product and removes it if it's zero. If that number would reduce it past zero, it sets it to zero. Cashiers in the physical store are shown how to set up an order through the server; this way, I can show my friend how to set up an order and he can train any number of cashiers in almost no time flat. The system handles everything, including cost. (If I can figure out how to rig up an actual cash drawer, it'll even LOOK like a register, and act like one, by checking if a drawer is attached to the computer and, if it is, triggering it open. I have foolishly - but simply - assumed that the cashier is 100% trustworthy, only because if they're not, no amount of security attempts will prevent the loss of income. My friend had better be damn sure he trusts anyone he puts on the register.)
Okay. This wouldn't be a problem except that this will be the longest program I've ever written, the first one I've had to actually work out design with, and the first one I've ever had to beta test. Had I more experience with any of these, it probably wouldn't even be worth noting.
But I don't.
I've been slacking off lately. It's a little hard for me to get started just because I feel uncommitted; there appeared to be two, equally functional ways to do it, and I hate doing things one way and finding out it was the wrong way after I've pumped a bunch of work into it. However, in the interests of my deadline and my sanity, I've said to hell with it, picked a route, and decided that I'm going to have the cart file be an actual file on the server as opposed to a cookie or a set of hidden fields on the page. I realize this might seem lazy; I don't know for a fact that it is. I think it's my best bet for reducing the overhead once we get a significant number of hits to the script; the first few things will be slow, but after that, it's smooth sailing, and when you ask for your invoice, it'll be lightning fast.
I hope.
A tinge of doubt is present in all of this, due to my rather extreme lack of experience with Perl. I spent the first week learning how the language deals with strings and arrays, and it wasn't easy, but it felt really good.
I hope, I work, I wish - if I can do this, I can do anything.