NRA Turns Schools Into Shooting Ranges

26. December, 2012

Some people seem to object to the stance of the NRA after the last massacre in ConnecticutLaPierre says:

The only thing that stops a bad guy with a gun is a good guy with a gun. (source)

Translation:

I know, like any sane person, the only thing that really stops a bad guy is making it harder to gain access to guns. But me and my colleagues make billions of dollars by selling arms to id… err … lu… err … customers. A little bit of collateral damage is to be expected when this amount of money is turned over, right? You can’t really expect us to give up our fortunes just because a few hundred people get killed every year. If we don’t make it, someone else will get rich.

Of course, he can’t say that. Instead, he points at scapegoats: Video games and violent media.

Penny Arcade summarized this in the Christmas strip:

It is a very odd sort of Patriot that would destroy the First Amendment to protect the Second.

There is no study which can show that violent video games turn anyone into a killer but it sounds good. Killers prefer violent games but not every gamer is a killer – claims to the opposite are a result of overgeneralization. Some studies claim that violent persons use video games to reduce stress, delaying outbursts of violence. Humans are no simple machines; there is no surefire way to know beforehand how someone reacts to something in advance.

What science does show is that a healthy social life will prevent these incidents. But you can’t sell those. Which means the NRA will stick to what they know following the old “wisdom”: “If all you have is a hammer, everything looks like a nail

Still not convinced?

  • Why do hunters need machine guns?
  • Is a machine gun (which goes quickly through the ammunition) really better to protect the USA?
  • Why doesn’t Switzerland have the same problem? They have 45.7 guns per 100 residents (US has 88.8) but only 0.52 people (out of 100’000) are killed with firearms (3.7 in the US, about 5 times more taking the guns per resident into account)

Some reasons why Switzerland fares better than the US:

  • Most people get their rifle during military service. Which means: Only people who have went through basic training get a gun (= most instable persons are sorted out).
  • Military rifles must be presented once per year during the mandatory shooting training.
  • When the training ends (usually at age of 35), you must return the rifle and all ammunition.
  • Ammunition is only dispersed in sealed containers. Ammunition is checked during the yearly training and broken seals mean trouble.
  • Rifles must be locked away.
  • Ammunition must be kept in a different place and also locked away.
  • The striker must not be installed while the rifle is stored.
  • Machine guns are not for sale anywhere. If you want one, you either need to join special forces (police or military) with the additional personal background checks plus training. Or you can try to get one illegally. Which isn’t a good idea. The police hates people with machine guns and if they catch you, they will make sure you notice.
  • Hunters and shooting fans need special permits, training and there is a whole slew of laws and regulations. You don’t get a gun for fun in Switzerland.

So Switzerland is proof that strict laws do work. It also means that Swiss arms makers have to sell most of their goods in other countries. Like the US …

Related:

  • The Truth About Gun Control – YouTube video. “82% of all gun owners totally agree that the Gun Show Loophole should be closed and that all gun purchase should go through a background check. 87% of NRA membership also agree […] we have completely gotten out of whack for that freedom is more important than the responsibilities that go with it.”

The Meaning of Life

24. December, 2012

Minimize suffering.

Examples:

  • We like to help others, minimizing their suffering (main goal of helping others) and our own (we feel shame when we see someone who needs help or sometimes even feel their pain as if it was our own)
  • Laws are designed to minimize suffering. Revenge might be our first instinct but it never minimizes anything. Like the old says: Eye for an eye leaves everyone blind. That might minimize insight but not the pain.
  • Even the most simple animals avoid pain. Plants try to grow out of shade. Excited electrons quickly return to their normal state – a phenomenon which allows us to see.
  • Moral and ethical guidelines help to minimize suffering. Apart from the obvious effects, they help members of the group to behave well without suffering through the long and tedious process of discovering those truths themselves.
  • Religions try to minimize suffering by giving explanations for the inexplicable. Buddhism boiled everything down to this phrase: “Life means suffering” (from The Four Noble Truths[*]).

Merry Christmas and a Painless New Year.

[*]: And their solution isn’t death, it’s ascension – Nirvana: “Nirvana means freedom from all worries, troubles, complexes, fabrications and ideas. Nirvana is not comprehensible for those who have not attained it.”


MVVM: When MVC isn’t Enough

19. December, 2012

MVC is a great concept to create user interfaces in a sane way but it has its drawbacks. Let’s imagine a simple case: A login service.

What do we need? User name and password.

So the model looks like this:


String login;
byte[] password;

Is that enough to create the view? Yes.

But where do we put the code to encode and check the password? Is that part of the model, the view or the controller?

It’s not really part of the model because the data model doesn’t care how we encode passwords. For the model, a password is just an byte array. That’s even enough to check passwords – to compare two byte arrays, you don’t need to know how they were created.

Is it part of the view? The view should just display a “*” per byte, it doesn’t do anything with passwords.

Which means the encoding method goes into the controller. This isn’t necessarily the right place – we’ve just run out of options.

Users can log into our service, now. But how do they register?

For registering, you should allow the user to repeat the password to avoid  typos. The view is simple enough but where do we store the repeated password?

Do we really want to extend our data model for this case?

Also, we need a second password check which works with plain passwords. But the model only stores encrypted passwords. We could convert both passwords into one unencrypted string and store both into the data model for the typo check and encrypt them before saving the data in a database. And we could make the check work for both encrypted and unencrypted passwords and if we make a mistake, unprotected password end up in the database …

So this is where MVC fails: Editors often need additional code and data to edit the plain data model. I could put all this into the view but that would violate the separation of concerns: A view displays a model, it doesn’t contain one. Ideally, views and controllers should have no state at all.

This is what MVVM solves: Instead of using the “real” plain data model, each UI component has a “view model” which replaces the data model. This model contains all the information that the view needs and all special “business logic” where the business is “editing the data.”

The view model knows how to talk to the data model and we have again separated concerns. When the controller is started, it converts the data model into a view model. And when the controller saves the data, it tells the view model to update the data model.

This approach solves a whole host of problems:

  • You can easily split complex data from the model into several, independent UI elements.
  • You have a place where you can put business logic shared by view and controller
  • Needs of the view and the controller don’t leak into your data model
  • The data model doesn’t change while the editor is active.

The last point is important: With the MVC model, it’s hard to share the same model between threads and users because the controller could change parts of the model at any time. It’s often impossible to do these changes in an atomic way, so other controllers might see an invalid state.

With MVVM, you can create locks that protect the model as long as the view model updates the data model. The locks will only be necessary in these update methods and nowhere else. That means you will have a few distinct places where you will need locks and suddenly, the impossible becomes feasible.


Designing a Garbage Bin

17. December, 2012

Many of us have noticed that designing software is surprisingly hard but many don’t know why that is. The simple answer: Design is the art to balance contradicting goals.

Not convinced?

Let’s design a public garbage bin together.

What do we want?

  1. Big enough so it never spills
  2. Easy to clean
  3. Nice to look at
  4. Robust enough to withstand riots
  5. Soft enough to cushion the impact of car
  6. Long lifetime
  7. Cheap

It’s easy to see that “cheap” contradicts almost anything else. “Nice to look at” means an (expensive) artist has to build the form. Big garbage bins ain’t cheap. Easy to clean and robust mean high quality materials for hinges and locks. Easy to clean and long lifetime involve expensive surface materials and finishing.

It should be easy to lift for the cleaning crew but not for rioters. When a car hits it, the bin should give way. So these contradict each other as well.

Still not convinced? Look at my elevator example.