The Daily Parker

Politics, Weather, Photography, and the Dog

Sleep in on the weekends if you can

A Swedish psychologist has preliminary data that suggest sleeping in on the weekends can make up for some sleep loss during the week, maybe:

Sleeping in on a day off feels marvelous, especially for those of us who don't get nearly enough rest during the workweek. But are the extra weekend winks worth it? It's a question that psychologist Torbjorn Akerstedt, director of the Stress Research Institute at Stockholm University, and his colleagues tried to answer in a study published Wednesday in the Journal of Sleep Research.

Akerstedt and his colleagues grouped the 38,000 Swedes by self-reports of sleep duration. Short sleepers slept for less than five hours per night. Medium sleepers slept the typical seven hours. Long sleepers, per the new study, snoozed for nine or more hours.

The researchers further divided the groups by pairing their weekday and weekend habits. Short-short sleepers got less than five hours a night all week long. They had increased mortality rates. Long-long sleepers slept nine or more hours every night. They too had increased mortality rates.

The short-medium sleepers, on the other hand, slept less than five hours on weeknights but seven or eight hours on days off. Their mortality rates were not different from the average.

Personally, getting 9 hours seems like a luxury. But I haven't been getting 7 enough lately. I have a dream that someday I will have a full week of 7+ hour nights again. I last had this happen in January.

It was 20 years ago today

On 13 May 1998, just past midnight New York time, I posted my first joke on my brand-new braverman.org website from my apartment in Brooklyn.

My first website of any kind was a page of links I maintained for myself starting in April 1997. Throughout 1997 and into 1998 I gradually experimented with Active Server Pages, the new hotness, and built out some rudimentary weather features. That site launched on 19 August 1997.

By early April 1998, I had a news feed, photos, and some other features. On April 2nd, I reserved the domain name braverman.org. Then on May 6th, I launched a redesign that filled out our giant 1024 x 768 CRT displays. Here's what it looked like; please don't vomit:

On May 13th, 20 years ago today, I added a Jokes section. That's when I started posting things for the general public, not just for myself, which made the site a proto-blog. That's the milestone this post is commemorating.

Shortly after that, I changed the name to "The Write Site," which lasted until early 2000.

In 1999, Katie Toner redesigned the site. The earliest Wayback Machine image shows how it looked after that. Except for the screenshot above, I have no records of how the site looked prior to Katie's redesign, and no easy way of recreating it from old source code.

I didn't call it a "blog" until November 2005. But on the original braverman.org site, I posted jokes, thoughts, news, my aviation log, and other bits of debris somewhat regularly. What else was it, really?

Today, The Daily Parker has 6,209 posts in dozens of categories. Will it go 20 more years? It might. Stick around.

Odd little personal milestone

No, this isn't one of the two Daily Parker milestones we'll see this month. It's trivial and personal.

On this day in 1988, 30 years ago, I bought my first CD. It was an almost-new technology—the first CDs were commercially available in 1981—and it sounded a lot better than scratchy old vinyl records.

Just looking back at what I posted 10 years ago confirms I haven't bought that many CDs lately. I don't have the number in front of me, but I believe I've now got 940 of them, meaning I've bought an average of 12 a year since 2008. That's slightly fewer than the 12 a month I bought in 1990.

For historical context, when I bought my first CD, Ronald Reagan was president, it looked like (but wasn't certain) that Michael Dukakis and George H.W. Bush would be the candidates to replace him, and our arch-rival for world domination was the Union of Soviet Socialist Republics. A Toyota Corolla cost $10,000, a gallon of gas or a gallon of milk cost 96c, and you could buy a 3-bedroom house in my home town for $200,000. (The same house is now close to $750,000.)

6,000

This month will see two important Daily Parker milestones. This is the first one: the 6,000th post since braverman.org launched as a pure blog in November 2005. The 5,000th post was back in March 2016, and the 4,000th in March 2014, so I'm trucking along at just about 500 a year, as this chart shows:

Almost exactly four years ago I predicted the 6,000th post would go up in September. I'm glad the rate has picked up a bit. (New predictions: 7,000 in May 2020 and 10,000 in April 2026.)

Once again, thanks for reading. And keep your eyes peeled for another significant Daily Parker milestone in a little less than two weeks.

All caught up

Two weeks ago I started writing my A-to-Z posts and got all the way to today's before my life became nuts—as I knew it would—with 4 chorus-related events and a huge increase in my work responsibilities. And with the Apollo After Hours benefit this coming Friday, this weekend will be pretty full as well.

I use my email inbox as a to-do list, and right now it has 35 messages, 30 of which relate to the benefit. I'm very glad the A-to-Z Challenge gives us Sundays off, because I don't know how I'm going to get another week ahead by tomorrow night.

The performances were worth it, though.

I is for Interface

Blogging A to ZDay 9 of the Blogging A-to-Z challenge brings up one of the key concepts in object-oriented design: the interface.

In object-oriented design, rule #1 is "program to interfaces, not to implementation." In other words, when interacting with an object in your system, you should care about what behaviors and data you need to use, not what the object actually does with them.

Going back to last week's room-and-window example: the original problem was that I want to close all the windows in the house with one method call. The solution on Saturday involved having a Room class that exposed a list of Window objects which you could iterate over and call the Close() method on each.

That's great, but what if I want to close all the windows, doors, fireplaces, and anything else that I can close, because of the zombie apocalypse? In Saturday's implementation, I need to know that rooms have windows, doors, fireplaces, and other things specifically. That is, I need to know how each room is implemented.

I really don't care whether the thing is a window, a door, or a squirrel's mouth; I want it closed now, before the zombies get in.

So let's do this instead: define the behavior of a thing that I can close, and operate on the behavior rather than the thing itself. In C#, I can define an interface, which would look like this (and refer back to Saturday or the code sample file for the rest of the implementation):

namespace InnerDrive.DailyParkerAtoZ.WeekOne
{
    public interface ICloseable
    {
	    void Close();
    }
}

That defines a single behavior that a class can do. (Interfaces can also define data and events, but that's beyond the scope of this post.)

Now I can add the interface to the Window class:

public class Window : ICloseable
{
	public void Close() { }
	public void Open() { }
}

And then refactor the Room class so that you can add and close all manner of closeable things:

public class Room
{
	public void Add(ICloseable closeable)
	{
		_closeableThings.Add(closeable);
	}

	public void CloseEverything()
	{
		foreach (var thing in _closeableThings)
		{
			thing.Close();
		}
	}

	public IEnumerable<ICloseable> Windows => 
		new List<ICloseable>(_closeableThings.Where(p => p is Window));

	private readonly List<ICloseable> _closeableThings = new List<ICloseable>();
}

Well, that looks different. Instead of adding windows to a room, I can now add anything that can be closed. And because of that, at lines 16 and 17, in order to make sure the Windows list still works, I have to change the code so it only returns windows.

It's still a dumb piece of code, but you can start to see how powerful interfaces are. If in the future I create some new class with a Close() method, I can apply the ICloseable interface to it and stick it in a room. (Books, maybe? Escrow accounts? People named Glenn?)

There are many, many implications to all of this. But this is one of the foundations of OO design. I don't care what the thing is, I care what it does or knows. Program to interfaces, not to implementations.