Monday, June 30, 2008

I know nothing 1 of 2: Confession

"I know nothing except the fact of my ignorance."
- Socrates

Time to come clean: everything I've said so far is true but potentially misleading. Although I really am a professional software developer, and have been for years, my hardware experience amounts to reading 3 or 4 books and as many dozens of articles. I know the concepts of assembly but have never written a complete usable program. C++ made me almost pull my hair out and I've only written rudimentary programs in C. So what the hell makes me think I can remotely have a chance at accomplishing my goals in softHARDsoft?

I got my initial inspiration for this project after reading what is hands-down the most amazing computer book I've read in my life: Charles Petzold's Code: The Hidden Language of Computer Hardware and Software. Code takes you step by step from the basics of electronic circuits to a conceptually viable computer in 400 pages. His attitude is that anyone can understand this if it's properly explained. I completely buy into this. After reading Code the first time, a little idea started swimming around in the back of my head. I wanted to pick up a lot of relays and build a simple computer. It didn't take long to realize that buying just a few thousand relays at $2-3 a piece wasn't going to happen. (Not to mention the electrical engineering aspect, on which I've only ever read 2 or 3 books.) However, I knew I could learn just as much by building my computer from the one resource that was essentially free: I could write it all in code. The benefits of doing it in code are too many for me to ignore:
  • Free, other than time.
  • All components are the ideal versions of themselves. No shorted circuits. No size constraints. No interference from other parts. No decay, breaking, or burnout. Many real world inconveniences disappear.
  • The state of any part can be examined at any point.
  • Components I don't feel like doing yet can be ignored and I can write a good-enough approximation until I want to come back to it.
  • Parts can be swapped effortlessly. This will be especially relevant for the previous point as well as for writing improved versions later.
  • Code is what I know best. I don't have to spend months getting passably good with electrical engineering just to get to the point that I can physically construct a half adder.
  • Any component, no matter how rare or expensive in the real world, is at my disposal as long as I can learn enough about it.
There are more reasons but you get the idea.

The other reason I think I can accomplish a lot of my goals for sHs is: this is all learn-able, I just haven't learned it yet. This is the life story of anyone self-taught at anything. There was a time when none of us knew thing one about computers. Now we do. We learn. And that's all I need to do to make this work as well. Learn.

Friday, June 27, 2008

Licensing

This post is brought to you by the letter 'C.'

I didn't want this licensing decision to be hanging over my head forever so I picked one that looked good enough for now. This Creative Commons license I've selected basically says the following about this software:
  • You can share, copy, distribute, and transmit it.
  • You can remix, adapt, and alter it.
  • If you alter it, give credit to the source and extend these same rights to others.
  • Don't use it in commercial stuff.
  • If you want exceptions made for you personally, just ask. The copyright holder can grant additional privileges.
The lion's share of what I've learned about programming has come from open source communities with licenses such as the one above. It's only fair that I reciprocate in kind.

Wednesday, June 25, 2008

Version control 3 of 3: installation

I'm kinda getting tired of talking about version control software. As I said before, my interest is for it to be a means to an end, not a focus itself. To that end, I'm going to go through my installation then get on with the real purpose of softHARDsoft.

What I'm actually installing is Fortress. It's an ALM (Application Lifecycle Management) software suite that is made by SourceGear: the same company that makes Vault. It has everything Vault has and then some and is also free to single users. To use for a single user, simply do not enter any serial numbers (license keys) and it will default to single license mode. The official setup guide is here.

Download Server and Client from SourceGear.

FORTRESS SERVER
To set up a Fortress (or Vault) server, you need:
  • Windows XP Pro or Windows 2000 SP3 or above
  • IIS 5 or above (included in any above OS)
  • .NET Framework 1.1 or 2.0 (free)
  • SQL Server. 2000, MSDE 2000 (free), 2005, or 2005 Express (free)
I'll be using XP Pro, IIS 6, .NET 2.0, and SQL Server 2005 Express.

IIS
I already have XP and .NET set up. Next, I'll install IIS. Although I long ago removed an old web server I was no longer using (Apache), for some unknown reason I'm unable to start IIS on port 80 -- so I set IIS to 8080. When you install .NET after IIS, the .NET installation does some configuring of IIS automatically. When you do it in the reverse order as I have, you have to run aspnet_regiis.exe -i to get it configured.

SQL SERVER
I installed SQL Server 2005 when I first installed Visual Studio 2005. However, I never use it and have long since set its Windows service to Manual. I set it back to Automatic and started the service. I'm not that familiar with SQL Server so I hope Fortress's installer file takes care of most of the SQL Server configuration for me.

After finally being done with the prerequisites, time to install the server. One oddity on my computer, when it asks for a SQL Server, the default "(local)" option isn't working. I downloaded the free Microsoft SQL Server Management Studio Express to get a better idea of what my server may be called. The default in SQL Server Management Studio is "COMPUTER-NAME\SQLEXPRESS". (Hmm, maybe I have SQL Express after all.) When I try this in the Fortress installer, it works.

The last step of the install took a while to run, but it worked.

FORTRESS CLIENT
Although it takes a couple of minutes to run, it's a no-brainer install.

Enough of this stuff. I want to start the real planning of sHs.

Monday, June 23, 2008

Version control 2 of 3: selection

At work I use a source control system, ClearCase, that integrates very well into my IDE, Visual Studio 2005. What I really want is a cheap or free integrated version control system to use at home. My other need is that I'm setting up a tool to be a means to an end. I'm not looking to invest any more time than possible to learning the nuances of it. I want it to be intuitive. I also want it to be popular so when I hit a snare that I have to Google, there will be plenty of available information addressing my problem.

After poking around online, I found, not surprisingly, that everyone has a favorite and theirs is objectively the best. Seriously though, what I found that matched my criteria the closest is: Subversion + TortoiseSVN + AnkhSVN. I'm heavily influenced by those I respect and I was also swayed by Subversion etc. being recommended by several people who I admire in the coding world. Namely Scott Hanselman, Jeff Atwood, and a CodeProject article with an incredible 4.73/5 rating.

No sooner had I settled on Subversion et al than I found out that my old friend Vault is free to single users! I've heard great things of it and honestly I still feel a little guilty that I never gave it a fair chance at my last job. What about all of those recommendations? That actually almost kept me sold on Subversion but Vault comes with a great recommendation as well. It was started by and is promoted by the amazing Eric Sink.

I still think Subversion + TortoiseSVN + AnkhSVN sounds like a good combination but I'm going to try Vault.

Next: I'll detail my the success, or lack thereof, of the Vault installation.

In case these should be useful later, here are my collected links for the Subversion based trio:

Thursday, June 19, 2008

Version control 1 of 3: taking the plunge

Quite fitting to the mentality behind softHARDsoft, before I start any coding I want to set up source control. Before any step in the process, there always seems to be another step to do first.

In my first job out of college, I was involved in designing technologies but not actually doing the coding. In my next job, at which I worked for a long time, it was almost all coding and I was a self-taught one man army. I kept up with my code and did regular back-ups. Even our other developer teams didn't use version control so I saw no use for it.

During my last few months there, another developer and myself began working closely together and it took no time at all to realize that we needed a real system to synchronize our stuff. (I refuse to admit what we did until we broke down and came to this realization.) In his prior job, he'd used been forced to use Visual SourceSafe (VSS). For our collaborative project he recommended Vault, a version control system which is marketed as a VSS replacement. We started using Vault and I hated it immediately.
Want to change some code? Here's what I was used to:
  • step 1: open IDE
  • step 2: change code
  • step 3: save
  • step 4: there is no step 4
Now we had to do this:
  • step 1: open IDE
  • step 2: check out file
  • step 3: write a comment for this check-out
  • step 4: change code
  • step 5: save
  • step 6: check in
  • step 7: resolve version conflicts
Which is to say: I'd entered a real development team.

That company started to tank so I left and joined my current company where I've been for a few years. Here, from day 1, I've used a source control system called ClearCase. When ClearCase is good, you hardly notice it's there. When it's bad, things go 110% wonky and you find yourself wanting to find a new job rather than continue to use this demonic software. My only saving grace at work is that one of our founders has been using ClearCase at various jobs since the software first came out. He's a guru at it and can fix any of its idiosyncrasies.

I'm embarrassed to admit that although I code frequently at home, I have never used version control there. Every so often I'll decide to do so, find it too frustrating to set up, and put it off yet again. I've found myself wishing for the capabilities of version control countless times but my procrastination has prevented me from taking the plunge.

That ends now.

I want source control for softHARDsoft and I want it for my other home projects as well.

Tuesday, June 17, 2008

Predicted path

Predicted path of softHARDsoft

soft
Since it's what I'm best and fastest with, the initial hardware simulator will be written in C# (.NET 2.0) running on WinXP. There are steps below in the 2nd soft section which will require a lot of assembly and/or C programming. After that, it may be desirable to come back and redo this in non-managed code for speed. Frankly though, I'm pretty excited about starting and I want to begin with my most rapid option.

HARD
create transistors
create simple circuits
create common circuit combinations
create computer components:
  • memory
  • CPU: My original thought was to simulate a 8080 or 8086. Now I'm leaning toward a tiny custom proof of concept followed by either a 4004 or 80386. Possibly all 3 in that order.
  • hard drive: I haven't decided how to do permanent storage yet. Recreating flash memory would stick with it all being in circuits but simulating a regular platter hard drive may be a better starting point. More on this when this stage is reached.
soft
This will depend on the processor made. For a 386, we should be able to run any 386 compatible software on sHs. For a small custom one or a 4004, the basics will probably be hand assembled and a simple C-like/ALGOL-like programming language should be figured out when/if assembly gets tiresome. Insert here the need for a compiler.
Operating System:
  • if 386: We can likely strip down the Linux kernel, alter a tiny Linux distro like Damn Small Linux, or use a microkernel like QNX
  • if custom or 4004: a simple OS will be created
In all likelihood, this is not ever going to be efficient nor resemble a useful or modern computer. I'm learning a lot of it as I go along. Not to mention that I'm unlikely to single-handedly recreate in a few years what it took some of the greatest minds 50 years to evolve. I'm just learning, having fun, and hoping this may also be of some use to others.

Sunday, June 15, 2008

Peeling the Onion

Breakdown of a computer: Practically speaking, a computer is a collection of useful software applications. Software is just arranged 1s and 0s inside of complex hardware. Complex hardware is made of smaller simple pieces of electronics and machinery working together in a predictable manner. A predictable physical item can be simulated in a computer program.

Rewind.

It's possible to make a computer program emulate the basic pieces of hardware. You could use such a program to arrange basic elements into complex hardware. You could even make this program able to run software like a computer does.

So what have we made? Well, mainly the world's slowest and most inefficient computer. But also a learning tool where you can see any part of a computer. You could see and manipulate any piece and understand how these magical machines work.

softHARDsoft is an experiment to create such a program.

Notes:
  • This is not the same as making an emulator. An emulator is a black box that acts identically to the object it's imitating. Behind the scenes, it can use any means. Recreating the innards of a computer, as is the goal here, is much more specific and detailed. [For example: the clock display on Windows is a clock emulator. It does something behind the scenes and displays the time. Windows doesn't have a program to shift each spring and gear that would be found inside a clock.] In fact, I may create an emulator first at some point to solidify my interface or make a proof of concept before recreating the insides. The very base hardware pieces will be emulators because I'm not reconstructing physics itself to make them work.
  • sHs will be open source. License yet to be determined.
    [UPDATE: See the Licensing post]
Disclaimer: I do not have a computer-related degree and am in no way an expert on any of this. Although I've been a professional software engineer for years, I'm still merely a self-taught programmer. The ambitious goals of softHARDsoft will go far into the realms of computer science and potentially into electrical engineering. Everything here is for my personal hobby which I hope will attract other enthusiasts. At any point, if it seems like I'm totally out of my league -- I am. I'm sure there will be times I'll be completely wrong on some things. At these times I hope others will help me out. But I don't want my inadequate starting qualifications to stop me from enjoying the experience or from learning as much as I can.

I highly recommend that anyone unfamiliar in matters of low-level hardware start somewhere other than here. I recommend Charles Petzold's Code: The Hidden Language of Computer Hardware and Software but a brief trip through Wikipedia or HowThingsWork [1] [2] would also be a good first step.

* Regarding the image at the top of this post: it's a combination of an ouroboros (a snake eating its tail) and the circuitry diagramming symbol for a transistor. The recursive idea of a snake eating its own tail seemed appropriate for this "software inside hardware inside software" theme.