"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog

Saturday, September 20, 2003

A simple proof that -1*-1 = 1

Carlos Scheidegger sent this proof which is better than my attempt at why -1 * -1 = 1...

The definition of multiplication for whole numbers is:

x * y = y + y + y + ... + y + y, where y appears x times.

Using this, it is easy to prove that, being (succ x) the successor of x, 

if x * y = z, then (succ x) * y = z + y, and vice-versa.

By definition, 0 is the successor of -1. Also by definition,

0 * x = 0, 

and so, 0 * -1 = 0.

(succ -1) * -1 = 0
(succ -1) * -1 = 1 + -1

Now, we apply the property:

(succ -1) * -1 = 1 + -1 ->

-1 * -1 = 1

----

This proof's only assumption is that -n + n = 0, which is easily
provable. (Very easy using peano arithmetic)

Thursday, September 18, 2003

Testing considered harmful?

A number of wonderful (literally) thoughts are wrapped up in Ian's item on testing, Dijkstra, Turing, and beautiful code.

One at a time...

  1. Dijkstra... would certainly have bristled at the notion that "once your tests pass your code is done"
  2. [By] rereading, I may feel more certain of the correctness of the program, as well as the conceptual integrity. Unit tests are good, but unit tests do not make code *beautiful*.
  3. I believe the Turing Machine is not applicable to real programming, because no useful programs can be reduced to a Turing Machine.

On point 1, I would say that developing in a test-driven way is kind of like developing proofs incrementally. Once your code passes the tests, you have not proven the absence of all bugs, but you have at least proven the absence of all bugs you thought were important at the time. So you are not done, but you are significantly closer to being done.

On point 2, I would say that rereading (and refactoring) to achieve "conceptual integrity" is kind of like making a proof more comprehensible. You have done the messy work, now make sure it is presentable so others can use it, extend it, or carry the "proof-in-progress" further with more tests.

On point 3, I would point out that the lambda calculus is not talked about enough in computer science education generally. Developed by Alonzo Church, a peer of Turing, the calculus is both equivalent to the Turing Machine and closer to modern programming languages than is the Turing Machine. (Of course, it doesn't have I/O either, so I am not sure what to do about that argument.) Programming language semanticists as well as compiler writers actually use properties of the lambda calculus all the time. I am not sure the same could be said for the Turing Machine.

Negative x Negative = Positive

Sean asks for an explanation of why a negative times a negative is a positive.

Here we go...

-x * -y = (-1 * x) * (-1 * y) = (-1 * -1) * (x * y) = 1 * (x * y) = x * y

Obsessive Update: The above assumes -1 * -1 = 1. Why? The only thing I thought of, which really becomes a general rule is to create a contradiction. If -1 * -1 = -1 then...

-1 * (1 - 1) = (-1 * 1) + (-1 * -1)
-1 * (0) = (-1) + (-1)
0 = -2
...which is the contradiction we're hoping for.

Update: maybe Sean is looking for an applied explanation rather than a proof?

Hmm... that would be a good one. When do we do -x * -y in the real world?

Well, I do x * -y in the real world when I pay my mortgage (-y) for some number of months (x). So maybe I could ask how much I would have had had I not paid my mortgage (-y) the previous number of months (-x).

Clearly the result of these two formulas should be the opposite. If I paid -$N USD then if I didn't I would have saved $N USD.

Tuesday, September 16, 2003

Car Purchase - SUV = Photovoltaic System

A Maryland resident, who installed a photovoltaic system and now contributes more juice to the grid than he draws, made the point on CSPAN that, at current PV prices, someone making a car purchase could buy a less expensive car instead of an SUV and have enough left over to install a PV for their house.

Given current events at home and abroad, would you recommend to your representatives to increase incentives and funding for making each of us net contributors to the grid?

Independence and self-sufficiency is the American way, no? This should be a federal priority at least as important as the federal highway system. A solar system in New York produces 80% of the output as in the Southwest, so this is more than a regional option, especially combined with insulation and other improvements.

Conversion would make a healthy contribution to the employment situation as well as the environment.

Wednesday, September 10, 2003

Data Warehouse Review has an RSS feed

Data Warehouse Review has an RSS feed. Have at it.

Update: Thanks to Karl Lewin for pointing out a typo in the URL.

Battery-backed RAM closer on the horizon

With both Motorola and IBM firmly lined up behind a single contender, the five-year search for a "universal RAM" technology offering a combination of non-volatility and high-speed random access appears to be all but over.

Among other things, MRAM is designed to eliminate several of the most infuriating artifacts of the computer age: the interminable wait for devices to boot up and power down, and those irritating operating system messages about "loading" and "saving your settings."

"Currently computers need to load information into local memory from the hard disk when the power is turned on, and that data transfer can't even start until after the hard drive has spun up to speed," Way said. "Whenever you shut down, data has to flow back in the other direction from the volatile memory to the hard drive.

"MRAM is designed to allow programs and data to remain in the local memory and may even, someday, allow us to simply reach out and touch an on/off button to turn off Windows in lieu of going through a ritualized shut-down procedure."

BTW, opportunities for software entrepreneuers abound.

Monday, September 08, 2003

Paper models

http://www.nedbatchelder.com/blog/200309.html#e20030905T073200

Wednesday, September 03, 2003

"The Factory" vs. "The Studio"

How many of you are software developers working in a location which is referred to as "the factory" by senior management, sales, and marketing? Maybe even by engineering management, since they tend to align more with the rest of the company?

This label always (and I have been hearing it and commenting on it for the last 20 years) struck me as odd and indicated more of a misunderstanding if not a misguided wish on the part of management. The last time I had a sit down discussion with someone on it was 10 years ago. Since then I just shrug it off and work on the bigger issue from other angles.

When I had that discussion I was talking with people who came from Tektronix, a manufacturer of oscilloscopes among other things, including then X Window terminals. (Does anyone remember those? Are they still sold?)

The analogy I made went like this...

TV designers get together in the lab and iterate over ideas. Those ideas take shape, and eventually are ready to be produced on an assembly line. The activities in the lab are design-time. The assembly is factory-time.

Software designers get together in the, well, cubicles, actually. Those ideas take shape, and eventually are ready to be copied to tape. (Remember shipping software on tape?)

The cubicle activities are design-time. The copying to tape is factory-time.

What's the significance? Factory-time is something step-by-step repeatable and can be treated and "optimized" as such. The cubicle time is repeatable in the sense that a carpenter uses basically the same tools and materials every time he builds a kitchen cabinet. But each time the kitchen is a different shape, the wood has different features, and the customer has varying tastes. What gets repeated each time is a creative activity.

The TV lab and the software cubicle are really studios. The only organization I know of that treats software as a studio process is Ken Auer's Role Model Software. The XP bull pens aren't talked about in these terms, but they should be.

Do I need to add that Ken comes from the creative Smalltalk community of the 1980s where software has long been seen as a collaborative, creative set of activities?

Software Factory at ASU

Although the name is horrible, the idea is commendable. Arizona State University has an organization called the "Software Factory". Their mission...

Here, as at other universities, software development is becoming ever more crucial to research. Researchers typically develop software by “ad hoc” methods, hiring students to do their programming. This works out in some cases, but more often than not the students lack experience in software development and the faculty lack experience in software engineering. This leads to a sub-optimal learning experience for the students and poor software products for the researchers.

The software factory idea, then, is simple: Gather these part-time student programmers in a common facility, put them under professional management and mentorship, and use sound software engineering techniques in the development process.

Tuesday, September 02, 2003

How to win friends and...

Mark Pilgrim writes of the launching of a new MSFT web service...

I’m going to repeat that, in case you missed it: the documentation for the web service is wrapped in a Windows installer which will only install over Visual Studio .NET.

I'd cry if I wasn't laughing so hard that tears are already streaming down my face.

Straight talk on EAI adapters

Sean McGrath gives us the business on EAI adapters. What a breath of fresh air. A truly useful economics of integration that lines up with the EAI vision if your intent on taking proprietariness out of the picture.

Here's how I interpret his hints toward an alternative for 80% of the cases a proprietary EAI solution might be purchased:

The hard part is already proprietary to your legacy applications and ERPs. Sometimes the term "adapter" seems intended to imply "easy to implement". Unfortunately customization, vendor quality and the "stovepipe" nature of EAI products themselves get in the way.

Distributed (and evolutionary) version control

The build instructions make this system seem a bit fresh yet, but Ted Leung points today to a very interesting version control system, especially for distributed open source evolutionary systems. In particular...

  • defining different "acceptance criteria". monotone's update algorithm permits sorting and filtering by certificate; this means you can tell it to ignore changes until someone you trust is willing to attest to their quality, either by code review or test results. simply committing code does not force any other end-users to run it. (this feature is only partly finished -- the UI for it is still wired to one setting).
  • decentralizing trust. monotone's operations are all based on checking RSA certificates. there is no central authority to which you must appeal to participate, or to be granted "commit access". on the other hand, nobody has to trust or accept your certificates, unless they happen to like you.

Monday, September 01, 2003

The Road Ahead

Don Box charts the course. If they get this particular item right, there's reason for a good long party...

Contain the growth of platform surface area - it's easy to design a complex framework - it's much harder to design a simple one. Now factor in ~30-50% growth in functionality with each release and my ears start to bleed.

To mix metaphors this is a tough row to hoe. Removing production features is almost impossible. Adding new features that don't conflict with or duplicate in some way existing features is hard enough. Merging features to get more expressiveness (increasing the power/effort ratio) is an art form that few people can even comprehend.

Consider arguably the most famous software framework: Smalltalk-80. The team's focus was on simplicity and a high power/effort ratio. They began (rounding off a bit) about 1970. They remained mostly under wraps for about a decade with significant evolutions about every two years.

Smalltalk-80 really hit the mainstream's awareness with the 1981 Byte articles. By 1984 several books were published and vendors from HP to Tektronix had ported the system to their hardware. In 2003 the Smalltalk-80 system is still recognizable, and even operates, within the many commercial and open source Smalltalk implementations.

The Smalltalk platform is still yielding results. Tektronix has had implementations running in oscilloscopes. Object Technology International (now part of IBM) has had real-time implementations (which have led to IBM's real-time Java implementations). And recently a 128kb real-time implementation has become available, including a TCP stack. How does this stack up to the dotnet "compact" framework?

A tough row to hoe indeed.

There are two classic platforms available today: Smalltalk and Unix (let's say BSD and Linux). Legitimate reasons exist for not building on either of them. But every new system should begin with these questions: Should either of these systems be the foundation for this new system? Why or why not?

Friday, August 29, 2003

Higher Values

An interesting article on "offshore" IT. ("Offshore" if you're in the US at least.)...

Libertarian IT workers who watch their jobs go overseas should derive joy from geographic shifts in employment. Their "dog eat dog" creed requires them to be happy whenever the marketplace finds a way to pay workers less and increase business owners' profits.

I thought this was an insightful connection with the seemingly disproportionate number of self-professed libertarians in the IT industry.

A couple of observations about this "offshore" movement...

  • Of course capitalism and libertarianism are idealistic theories. They assume perfect knowledge and model behavior. The real world is not so tidy, and so dislocations have been and continue to be painful for all industries.
  • More importantly in my opinion is this: when you choose to move some jobs to a lower cost market, or for that matter, when you choose to buy a product, "offshore" to cheaper labor, in some sense you are making a value statement of another kind. You are saying you don't care that the labor conditions "over there" are worse than they are "here".

What's that? We're talking about IT. How are labor conditions worse for IT workers? Well, for example, I am diabetic. Diabetic care in the US is great* but in lower cost labor markets even well off IT workers suffer from less advanced and available diabetic care. This is just one example that hits home for me.

So employers who move jobs "offshore" without providing equivalent benefits are very much saying they value their workers less. Maybe this is to simply stay competive with everyone else, maybe its to satisfy stockholders who demand growth or as much as possible in a down market. But this is still a value decision that should not be ignored for Adam Smith's sake.

In theory wages and benefits should average out. "Ours" will come down a little and "theirs" will go up. And in theory improved productivity will lead to advances in technology and society as a whole, and we'll all rise with the tide. Of course the difference between theory and practice in theory is small, but in practice it is great.

What do we really value? Are we making good choices that reflect our higher values? Don't they need jobs "offshore" too? Of course. There are no easy answers. Jobs should go "offshore" to capable people.

The real problem is we should be putting our governments (plural) to work to reflect our higher values. Governments should be made effective market shapers when the "natural" course of a market does not appear to be moving in a desired direction. What I think our governments need to be shaping is the development of "appropriate" technology. We cannot deny that we need to do more with less, and concetrate truly scarce resources where they will have the best long term benefit.

Can governments be so efficient as to reflect our higher values?


*(In spite of the fact that vendors are not eager to cure such a money maker, and religious fundementalists are not eager to appear yielding an inch to the abortion/cloning faction, yet stem cell research is neither.)

Use the source!

James provides a response to Danny's bare arse scenario.

I would add two things:

  • Type information *does* add value, but it's generally not worth the cost.
  • Having all the source code adds even more value, at very little cost.*

*Mark Weiser, "Source Code!," IEEE Computer, November 1987

Windley's gone off the deep end!

I know, you're going to hate this idea. You're going to say "Windley's gone off the deep end!" and "I'll never use Microsoft's ID program!" and "Microsoft will turn it to commercial advantage!" All of those things may be true, but the alternative, in my opinion, is much worse. At some point, legislatures, spurred on by their constituents, will undertake to solve this problem and no matter how well intentioned, you'll lake that solution even less---I promise.

I may not like a legislated solution but it has some advantages:

  • I vote for my representatives. (They don't give me the time of day, but they do give me form letters.)
  • I don't use Outlook at home. (I have to at work.)
  • I don't use Windows at home.

But actually...

  • There is no reason Microsoft cannot conform to a standard.
  • I don't want this at all, from anybody.

Dell takes customers to a new low

He said he couldn't give me his phone number or mailing address, and that he didn't have a boss who could talk to me.

Who do they think they are, the cable company?

Thursday, August 28, 2003

Accounting for Web Services

From Ephraim Schwartz in Infoworld: "From everyone I speak to, it is a foregone conclusion that Web services are a less-costly alternative than other integration technologies."

I sure would like to see some analysis of what these folks are claiming. What costs are they including or excluding? What systems are being integrated? What is the environment (departmental, enterprise, external, global, regional, etc.)? What are the architectural components?

I don't doubt that web services in general are the direction. That's a fete accompli. How people are using them currently, and how they are accounting for their success or difficulty is a topic worth exploring in much depth.

New Stuff, But Still Fun?

Gordon Weakliem's not having fun anymore...

I think I've had it beaten out of me, I've spent too many nights and weekends chasing down stupid quirks, stuff that's not even programming, just accounting and janitorial stuff. I still read programming books in my free time, but most books just depress me. That thought occurred to me while reading one of the Agile process books, so I quit reading about process and started trying to find things that would take me back 12 years, back to when Pascal was neat, and everything seemed easy.

Every time I put fun and programming in the same thought, I go to Ward Cunningham, who still seems to find ways to have fun.

Lately I have been enjoying PragDave's Katas. These get back to the heart of programming and don't require VisualJ2ESharpPlus. Just me, Emacs, and Python.

I am surprised and not surprised at the lack of an outcry for simpler ways to program. My fear is all the good ideas and fun will be left behind.

But XML-RPC is fun. And Chandler looks like it could be the source of fun. Eclipse only looks like fun seen through a Jython lens. (Jython is the best way to get an interactive experience with Java classes!)

dotnet will have the Jython kind of fun eventually.

XML + Java = Lisp?

What I just wrote about interactive programming with various languages brought up an old thought, and I'm not the only one to think on this. But I've not read anyone else with this same angle. I wrote...

Lists, maps, arrays, even self-referencing structures can all be entered end edited in a command loop or workspace using a very simple (i.e. few characters) syntax. There are also the mundane (now that Java brought them to the masses) aspects of these languages like garbage collection and array bounds checking.

How I believe the Java-like family will get even closer to this experience is via XML. Complex structures (i.e. nestedt structures as well as "primitive" values) is fairly simple in XML. The Java family of languages will eventually make the leap from XML constants expressed as strings and DOM'ized via a library. They will leap to the world where the DOM and the expressions are "native". These will be the "self-referencing structures that can be entered and edited in a command loop or workspace" that Lisp programmers have been doing for 40 years.

Then someone will create a Java with transparent persistence with shared paging so the structures don't all have to be in memory. Oh wait, been there, done that (more than once), and literally have several of the T shirts.

Of course these language communities first have to get over their fascination with such things as "generics" and "partial types", etc. Think simple. How simple can you go?

Blog Archive

About Me

Portland, Oregon, United States
I'm usually writing from my favorite location on the planet, the pacific northwest of the u.s. I write for myself only and unless otherwise specified my posts here should not be taken as representing an official position of my employer. Contact me at my gee mail account, username patrickdlogan.