Dec. 19th, 2012

hudebnik: (Default)
Java's constructors have annoyed me for years. They're called and defined with a different syntax from any other method, and they can't be inherited. If objects of a bunch of classes are each supposed to be able to create duplicates or near-duplicates of themselves, each such method has to be written separately, no matter how similar they are, because they all call different constructors. And Java constructors always produce a new instance of the specified class -- they can't return an existing instance, they can't return an instance of a subclass of this one, and they certainly can't return an instance of another class that implements the same interface. All of which means they're heavily tied to implementation, and should not be exposed in an API.

One can get around some of this by using pseudo-constructors, aka factory methods. If the whole purpose of a factory method is to return a (possibly) new object, one must be able to call the method without already having an object of the class, so it has to be static. Unfortunately, static methods can't be abstract, so they can't be specified in an interface; if a dozen classes all have static methods with the exact same signature, you still have to specify them all separately.

guns

Dec. 19th, 2012 06:54 pm
hudebnik: (Default)
So today on NPR, I actually heard somebody saying "if only there had been a few teachers at that school armed and trained with firearms, they could have saved a lot of lives."

That's quite possible, if the teachers made
a habit of bringing loaded guns to school every day and keeping them handy enough to respond in case of a shooter. Let's look at numbers.

There are about 10-30 murders per year in America's 100,000 schools. So if all school ahootinga were the size of the Newtown shooting, the average school could expect one every 100,000 years. Multiply by 180 school days/year, and we have 18 million days of guns in any given school. Multiply by, say, 10 teachers/school to provide adequate coverage, and we're at 180 million gun-days between shootings.

A gradeschool classroom is a chaotic place, and a teacher with 30 students has a lot to think about other than keeping tabs on the gun. Let's say once in a 50-year teaching career (10,000 school days), a child gets hold of my gun, and one in ten of these leads to somebody getting killed. So the proposed level of guns would cause 1800 accidental deaths in exchange for taking down one Newtown-style shooter and saving (say) 15 lives. That's 120 times as many gun deaths with guns in the classroom as without.

But we'd have our freedom, right?


Posted via m.livejournal.com.

Profile

hudebnik: (Default)
hudebnik

January 2026

S M T W T F S
    12 3
45678 910
11121314151617
181920212223 24
25262728293031

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 28th, 2026 10:26 am
Powered by Dreamwidth Studios