Posts

Showing posts with the label rant

The early bird catches the worm

Here are three reasons to do things later rather than earlier: You will know more. You will usually be richer and thus can buy some help (at least for part of the task). You might be dead and therefore no longer care about the task :)

My views on blockchain / bitcoin

Going from abstract to concrete: Private currency: good. I would love to have lots of them, just as I love both gold and silver. Blockchain: not so good, more of a solution in search of a problem. The only advantage it has compared to an append-only database is decentralization… and I don't see a need for that. I would much rather have many private currencies. Also, in practice most coins are actually centralized, or at least a very small oligarchy. Bitcoin: nah. Really bad. Incredibly slow to initialize, slow transactions, easy to control by a sustained state-level effort, very low cap on number of transactions per second, plenty of bugs, hard-forks which means the code is actually controlled by a small group (which in turn means that I can't trust that the currency itself is decentralized)… nah. In conclusion, I like the initiative, and I'm 100% behind the idea that we need to separate states and money, but we're nowhere near yet.

Science

I've long used the expression "real science, so called because it can only be found in books and movies". From a talk at Pycon 2014 : The ideals reality of science: The pursuit of verifiable answers highly cited papers for your c.v. The validation of our results by reproduction convincing referees who did not see your code or data An altruistic, collective enterprise A race to outrun your colleagues in front of the giant bear of grant funding H.T to Daniel Lemire .

Avoid boolean parameters

Here's an example of a method in a sim. This started out as a simple method: all days are the same in our simulation, so the method just prints out some activities: void SimulateDay() { Console.WriteLine("Wake up."); Console.WriteLine("Eat breakfast."); Console.WriteLine("Watch TV."); Console.WriteLine("Eat lunch."); Console.WriteLine("Watch TV."); Console.WriteLine("Eat dinner."); Console.WriteLine("Go to sleep."); } Ok, so not much of a life, but this article is supposed to be about programming. :) A new requirement comes up: Sunday should be different. Well, almost; it's actually the same as the other days with a single difference: instead of watching TV, the sim goes to church on Sunday mornings. No big deal, we can augment the method with a boolean parameter: void SimulateDay(int isSunday) { Console.WriteLine("Wake up."); Console.WriteLine(...

Going to college

There's a saying in my country: going to college is not about learning X; it's about learning how to learn, how to study, how to find out things about X by yourself. Which means, in a liberal translation: going to college is for people who don't know how to use Google.

Stop doing this

Pet peeve: I hate micro-management when it comes to code. Yes, it's faster in the short-term but it's a pain when the code has to be changed. (If you don't know that all code has to be changed, you haven't programmed long enough.) In this particular case I have encountered code similar to: var sb = new StringBuilder(); foreach (var p in list) { sb.Append(p.Name); sb.Append(" "); sb.Append(p.Quantity); sb.Append("*"); sb.Append(p.Price); sb.Append("="); sb.Append(p.Value); sb.Append(","); } if (list.Any()) { sb.Remove(sb.Length - 1, 1); } return sb.ToString(); (It's even worse when it's a for loop instead of foreach , but let's not go there.) The problem with this code is that it's extremely easy to get lost in the details. "Oh, I should put spaces around the operations." "Oh, I should add a space after the comma, but then it has to be remov...

On the impossibility of time travel

I've long believed that time travel is impossible. One of the many reasons I have for it is: it violates the conservation of mass/energy (something disappears from the universe at moment A and something appears in the universe at moment B). Recently, I've had to reconsider this problem. I started with an observation: the conservation of mass/energy is not violated when something moves. Formalizing this statement, an object changing its X, Y and/or Z coordinates does not violate the conservation of mass/energy. Now, if I consider that the universe is actually a 4-coordinate system, it can be inferred by analogy that an object changing its X, Y, Z and/or T coordinates is not violating conservation either. (The fact that we don't currently know any such objects is irrelevant; there was a time when we didn't have airplanes or cars.) Of course, this isn't proof , but I wasn't proving a theorem in the first case; all I had was a thought experiment, an apparent c...

Has to

One of the things I've come to hate when it comes to jobs is when the boss says "it has to be done by …". Whenever I hear that, I see red. Seriously. What does that even mean? The world will end if that task is not done in time? Global warming, zombie invasion, what? As far as I can tell, what it actually means is "I / someone made a booboo and promised the customer that it will be done by … Can you save my / their ass?" Now, this makes sense. A mistake was made ( not by me) and I am being asked to fix it. The mistake might actually be costly - the company might lose a hundred thousand dollars if the task is not done on time. Which leads me to the second problem: why is it that, when someone else makes the mistake and I am supposed to fix it, I never get any of the benefits? Why is this problem never put as "I've made a mistake that is going to cost the company $100K unless you finish the job by Friday. However, if you do, I'll give you a $30K ...

Scientific guesses

Assumptions Behind every indirect fact (like a calculation) there are a number of assumptions; some of them of minor import, some of them vital. Most people ignore this aspect so much that they don't even realize the assumptions are there. (To paraphrase Ayn Rand, not only don't they "check their premises", they don't even know what those premises are.) Here's an example: estimating the speed of a moving car. Let's say the car leaves town A at 3pm and reaches town B at 6pm. We can see on a map that the distance between the two towns is 150 miles, therefore we calculate that the car had an average speed of 50 miles per hour (150 miles divided by 3 hours). What assumptions have we made, and how do they impact our result? For one thing, it is unlikely that the car has moved at a constant speed. It might have slowed down when passing through populated areas and sped up when in between; it might have even stopped for refueling. The actual speed was almos...

Smoking causes cancer

Most people are idiots. You can easily prove this because they will agree with the claim in the title. If you try to give them a counterexample — like, you know, the vast majority of smokers not having cancer — they will counter it by "well, it doesn't cause cancer right away". Causality doesn't work like that; it's a "if X, then Y" relationship. Don't use the word if you mean something other than that; say "smoking increases the probability of getting cancer" (yes it does). As an additional counterexample to the claim, here's something most people will dis agree with: passing under a ladder brings bad luck. Mark Twain had a humorous take on this: a character tells another "X passed under a ladder and only six months later he fell and broke his arm" (I'm quoting from memory). That's exactly the same type of "causality" as in the case of smoking: you do X, then long after that bad thing Y happens, and you cl...

World history History of the human race

Here's the official version: In the first ten thousand years, people didn't do much of anything. In the second ten thousand years, people didn't do much of anything. In the third ten thousand years, people didn't do much of anything. In the fourth ten thousand years, people didn't do much of anything. ... repeat for several million years ... Finally, in the last ten thousand years people have started spreading out and inventing cars, airplanes and other interesting stuff.

Science vs dogma

Two hypotheticals: 1. You (common, everyday man) observe something occurring in nature. Every time it happens, you figure out that a specific something causes it. You emit the hypothesis that "A causes B" and devise a number of experiments to disprove it. You fail, and as far as you know everyone else also fails to disprove your theory. You tentatively accept the theory. 2. You observe something occurring in nature. It violates accepted dogma. You note that there is no known case where the alleged cause is known to actually produce the observed effect and, in fact, there is no actual proof that the cause even exists. You are told that you lack the inner grace that allows the high priests to verify that the cause does indeed exist; that there are secret rituals you're not privy to that they have used to confirm the truth of the dogma, and you're better off just accepting it as fact. The first paragraph describes, for example, the idea that complex information is overwh...

Johnny Got His Gun

I don't believe in Hell. Several years ago I decided to fully accept the preterist theory (short version: everything in the Bible has already happened); this has led me to universalism - everyone goes to heaven. I've held this belief for quite a while now. I just changed it - somewhat. I suddenly believe in Hell, a place of such misery and torture that people can't really imagine it. A horrifying place. I also believe I'm in it right now , I just found a tiny bit which is somewhat less horrible. (I try not to make too many waves so I don't get moved to a more horrible part.) This movie is why I think so - Johnny Got His Gun . It made me realize that politicians and soldiers are, if not the Devil, then something very close to it. They do their best to make other people's lives and homes a Hell. Hiroshima and Nagasaki might have been the clearest example, but read this description of the carpet bombing of Tokyo from Wikipedia: On March 9 and 10 1945, B-29 Sup...

Communist USA

Here's something I never thought I'd see in the US (as bad as I believe it has become): Ideas Matter , a pro-IP propaganda site build by Microsoft and others, has the following on their About page: In the words of President Barack Obama: "Our single greatest asset is..." Bear with me while I'm freaking out here. I grew up in communist Romania until I was 18. Any time you wanted to write something - including in school essays - we would have to quote the beloved president. Freaking programming books, few as they were, would have something that the president said in their introduction. What the hell???

Complexity and chance

In one of the Miles Vorkosigan books, the main character has a device installed in his brain and a remote that can trigger a seizure - he needs that because otherwise he would get uncontrolled seizures, usually at moments of high stress (when that's the last thing he needs). One of his problems is having that remote triggered accidentally, so the doctors assure him they coded the connection - no random signal can trigger the seizure, only the remote. What are the possible dangers here? 1) Accidental signals that would match the frequency of the brain device, thus generating a false positive. How does one defend against this possibility? A small code of some sort is usually required for triggering the functionality - like the 4-digit code I have to enter when my Nokia cellphone locks the keys (to prevent me from accidentally dialing out when I keep the phone in my pocket). 2) Intentional signals from would-be hackers who want to trigger the device. In this case, one would need a muc...

Maintainability

Lots of noise on this subject - as far as I know, it started with this article by Patrick Smacchia that has apparently annoyed Ayende, who replied to it (and followed here ). A few days later, Ayende replies to an article by Frans Bouma to explain what he means by maintainability - a definition that goes against what Patrick believes to be true. Now that you're up to date, my opinion :) An analogy from C. S. Lewis helps here. To claim that using toothpaste is good, he said, does not mean that if you find someone with bad teeth, but who uses toothpaste all the time, and someone who never used it, but has great teeth, you have disproved the statement. What matters is: given the same person, is he going to be better off by using toothpaste or not? To apply the analogy: given the same person, whether an average developer from the street or Peter Norvig (or Ayende or Frans or Patrick), which application is he going to find more maintainable: one with - say - hundreds of cyclical ref...

Monkeysphere?

Interesting article at http://www.cracked.com/article_14990_what-monkeysphere.html . They didn't elaborate on the subject of religion, but I think (as some commented) that this is why the so-called golden rule is emphasized: trying to love everyone as you love yourself is another way of saying "realize they're also people just like yourself". No big discovery, I realize :) but I liked the connection.

I'm an idiot

I worked on a crapload of small ASP.NET projects where I spent a lot of time on user management: add users, edit users, change roles, verify roles and so on. This includes tiny projects like a tiny website where the content of about 10 pages can be edited by the customer (mostly by adding news). They'll never have more than one person doing these edits, their primary business is totally unrelated to computers. Well, I was reading this article by Scott Hanselman and what do I see: Does it need an administrative console?, I ask. He says that'd be nice, but it wasn't spec'ed out. He figured this would be pretty low rent. The client even suggested (gasp) that they could just maintain a local XML file. How on Earth can I be so stupid? I always knew that ASP.NET had this feature... it just never crossed my mind to use it. Dammit.

Yes to mentoring, no to certification

Great article here . I hate the programmers dragging the certification bogey-man every time they have a problem with someone's code. Yeah, we really want to have the problems of the medical field. This article is a breath of fresh air.

Take that, ServiceLocator denigrators!

From Inversion of Control Containers and the Dependency Injection pattern by Martin Fowler: The choice between Service Locator and Dependency Injection is less important than the principle of separating service configuration from the use of services within an application. Ha! :P