Showing posts with label books. Show all posts
Showing posts with label books. Show all posts

Wednesday, November 06, 2013

References from Habits of a Responsible Programmer

A list of references from my talk, Habits of a Responsible Programmer at Øredev. First out is the blog post that inspired the talk

Habits

Some books about habits and how our brain works in good and not so good ways.

Typing

Steve Yegges blog post that made me realize that it is time to learn to touch type along with some tools that can make it fun to learn.

Clear Code

It is worth learning Smalltalk, just to understand the book, Smalltalk Best Practice Patterns.

Programming Techniques

SICP is a classic and it deserves to be read but Concepts, Techniques, and Models of Computer Programming is just as good if not better.

Read Code

Source code to a number of projects with beautiful code.

  • CloudFoundry - beautiful Ruby code, OS Platform as a Service.
  • Levelup - Node wrapper for the LevelDB key-value store.

Explicit

A good short article by Marin Fowler on the tradeoffs involved with writing explicit or implicit code.

Refactoring

The book by Fowler is a timeless reference book and it is required reading for anyone serious about programming. Kerievsky's book gives more in depth examples and finally Reg's blog post discusses reasons for not refactoring just to please your own ego.

Simple vs. Easy

Great talk!

Testing

I like Sandi Metz way of explaining why testing is important.

Documentation

Documentation matters, but keep it simple.

Git

The original gitcasts.com is no longer available, but the videos are uploaded to You Tube.

Scripting

Generating Code

Tools for generation code. Here documents are the simplest possible way, but if you want to generate multiple files it is better to use Thor or Yo.

Environments

The ultimate book on continuous delivery, a must read for anyone interested in automation. And, that should be everyone!

Projects

Wonderful book about different people stereotypes.

Estimation

Two articles on estimation by Martin Fowler and Dan North.

Life, the Universe, and Everything

Books about happiness, the mind, and other things.

Saturday, February 26, 2011

Continuous Delivery

I just finished the book, Continuous Delivery by Jez Humble and David Farley. It's a great book, but it is a bit wordy (512 pages), so here is the gist of it.

Continuous delivery builds on a simple foundation, continuous integration, automation, and version control. But in order to get it to work you must version control and automate everything. It's that simple! Version control and automate everything! Everything means different things to different people, but to Jez and David it means a lot.

You should version control:

  • Source code and test code
  • Assets, images, media files, base data, etc.
  • Build scripts
  • Deployment scripts
  • Secret configuration settings, like keys and passwords
  • Environments, development, production, test, staging, ...

The first three you are hopefully doing already, but the fourth is unusual and the fifth and sixth, I rarely see anywhere. Secret settings should be kept in version control too, just don't put them into the public repository. Here are some question to ask yourself:

  • Can you set up a complete development machine with one command?
  • Can you set up the deployment pipeline machine with one command?
  • Can you set up a fresh test environment with one command?
  • Can you set up a complete production environment with one command?
  • Can you upgrade the application, including data migrations, with one command?
  • Can you roll it back, in case it fails, with one command?

The Deployment Pipeline

Continuous Delivery uses a Continuous Itegration server to drive the Deployment Pipeline. In the simplest form of application, a deployment pipeline may have only one step. This step, runs all the tests and if all goes well it will deploy the application. But as soon as the application grows this will take too long, the single step needs to become a pipeline.

A deployment pipeline may have arbitrary many steps and they should be as automated as possible. A common setup of a deployment pipeline contains the following steps.

  • The Commit Stage (automatic)
  • The Integration Test Stage (automatic)
  • The Acceptance Test Stage (automatic)
  • Exploratory Testing Stage (manual)
  • Perfomance Testing Stage (automatic)
  • Deployment Stage (triggered manually)

The main reason for the deployment pipeline is to provide feedback as fast as possible. The commit stage typically only contains unit tests that run very fast. The steps after that only run if the step before succeeds.

The steps above may contain everything you need, too much, or in the wrong order. Feel free to remove and re-order as you please. If performance testing is cheaper than exploratory testing, in your case, switch them. There is no one-solution-fits-all when it comes to pipelines. Customize it, to fit your needs.

One important aspect of the deployment pipeline that I rarely see is that the final product should be created by the first commit stage and then resused by the other stages. Very often I see that the separate stages check out and build a new version from scratch, albeit a tagged version but still. The reuse of the same artifact through all the steps not only ensures that the same artifact has passed all the stages, it also speeds up the deployment pipeline, removing redundant work.

Another thing worth noting is that the manual steps described above should be as automatic as possible. If a tester want to test the latest build that has passed the acceptance test stage, he should be able to do it with one click. That one click may involve:

  • Create a fresh production like environment.
  • Install the selected artifact into the new envrionment.
  • Apply all the relevant configuration.

If the tester decides that the build should fail or succeed, he should be able to do that with one click. And, the feedback with the result should be fed back into the deploynment cycle so that the developers know that it failed, and why, or the operation guys knows that there is a new version ready to deploy.

Conclusion

The book is a good read and I highly recommend it. In the process of describing continuous delivery, it provides tons of useful tips on keeping your code and data under control. Among other things it describes.

  • Release strategies, such as canary relasing and blue-green deployment.
  • Test strategies for acceptance tests, capacity test, etc.
  • Why not to use long-lived feature branches and how to avoid it.
  • Dependency management
  • ...

Sunday, June 20, 2010

Ruby and Rails Summer Reading

If you ask a Ruby programmer why he is using Ruby, you will probably get several answers like: It is dynamic. I allows me too keep my code DRY. I get results faster. Aside from all these statements, there is one statement that almost always comes up.

I use Ruby because it makes me happy!

If you search Amazon for Ruby you get 8,829 Results and if you search for Rails you get 14,113 Results. What books should you get?

Here are the books I recommend:

Ruby

Beginning Ruby is a superb book for people coming new to Ruby.

If you are not a complete novice, you should instead go for The Well Grounded Rybyist.

When you have finished the Well Grounded Rubyist, you are ready for Metaprogramming Ruby where you learn metaprogramming techniques to help you keep your code DRY and readable.

Rails

Since Rails is currently being updated to version 3, there are not that many books available. I can recommend The Rails3 Way, currently only available as a Rough-Cut.

The lack of updated books is not a problem. The The Ruby on Rails Guides are excellent. Make sure you select the edge version.

Even more information is available through the videos from Railsconf, subscribe to them in iTunes. The first videos where published, the day after they were filmed. Fantastic!

Have a happy Ruby-red summer.

Tuesday, October 27, 2009

Some thoughts from "A Theory of Fun"

I just finished reading the book A Theory of Fun by Raph Koster. It is funny how everything comes together once you start focusing and noticing certain patterns. It is a good book and worth reading even if you're not into game design.

I already learned from personal experience and from other books, that our conscious mind is terrible at multitasking. It is however very good at internalizing things, learning things so that the brain can perform them unconsciously, without conscious supervision. Raph calls this chunking.

The act of learning is about turning many steps into chunks that we don't need to think about as separate entities.

When we don't see something, we don't perceive it, but once we become aware of a certain pattern, we see it everywhere. Koster calls this noise.

Noise is any pattern that I don't understand.

A good game keeps us on the edge of our abilities constantly and once we learn something the game will become harder. This is a variant of flow. But since a game cannot continue for ever it is doomed to become boring once we have mastered it.

The destiny of games is to become boring, fun is the process and routine is its destination.

Koster also mentions some of his grandfathers carpentry practices.

  • Work Hard on Craft
  • Measure twice, cut once.
  • Feel the grain, work with it not aginst it.
  • Create something unexpected, but faithful to the source from which it sprang.

That is not bad advice for anything.

Monday, August 10, 2009

Notes on The User Illusion, part Two

This is part two of a summary of the fantastic book. The User Illusion

Our conscious mind consists of symbols that map into the rest of our mind. Every second more than 11 million bits are reduced to less than 50 bits of meaningful information at apparently no time at all.

Half a second before we try to do something consciously our brains has started its activity. Half a second!

Experiment
  • Sit down and hold one finger up.
  • Whenever you feel like it, bend your finger.

Half a second before your finger is bent, your brain has started its activity! It does not feel like half a second does it? There is no way! 0.1 second is more likely. But the data has been reproduced and it is undeniable.

The consciousness of wanting to do something appears almost half a second after the brain has initiated its activity.

Our actions are initiated unconsciously.

Benjamin Libet

Benjamin Libet performed some experiments, in the sixties, while a friend of his was performing brain surgery. Libet stimulated the brain with electrical impulses and found that if the brain was stimulated less the half a second, it was not noticed at all. If the brain was stimulated more than halv a second the patient felt it. It appeared to the patient as if a certain area of his body had been touched, since there are no normal sensors inside the brain.

Libet then performed some other experiments. He stimulated a part of the brain that related to the left hand and at the same time he stimulated the right hand and the patient was to say which hand was stimulated first.

The hand had to be stimulated half a second after the brain to give the appearance to the patient that they where stimulated simultaneously.

The conscious experience is projected back in time so that the conscious mind believes that they are almost simultaneous. The brain is fooling itself.

The conscious is delayed, but it does its best to hide it. For itself. It is very convenient since it gives the mind the time to perform the reduction of the sensory data to what is needed to get a full experience.

Everyone knows that it doesn't take half a second to remove a hand from a hot stove, but it takes half a second to get the conscious back-dated experience.

So does this mean that we don't have free will? Libet does not think so. He says that there is time for the conscious mind to veto the unconscious decision.

The conscious is not a top-level unit that gives orders to its underlying processes. It is a selecting mechanism that chooses between the different options that the unconscious provides.

As long as the unconscious action-proposals work in sync with the conscious thoughts and feelings, they are hardly noticed. They are merged together with the conscious motives that take all the credit! --Harald Høffding

The conscious veto is often associated with an uncomfortable feeling, we usually feel best when we are not making conscious decisions. Compare this with for example Flow

I and Me

Nørretranders defines I as the conscious mind and Me as the rest of us.

I have free will, but it is not my I that has it, it is my Me.

The conscious mind is allowed to use its veto in situations where the Me allows it to. In situations where speed is critical, for example when something is threatening us, the conscious mind is left out of the loop.

A comfortable state of mind is when the Me is allowed to do what it does automatically without interference of the I. This state is neither associated with nervousness nor shyness, but with comfort and carelessness.

The User Illusion

The user illusion is a term coined by Alan Kay of Smalltalk fame. He used it to describe the metaphor of the desktop that was invented by him and his colleagues at Xerox PARC. His great idea was that it does not matter what really happens inside the computer as long as the interface presented to the user is useful and consistant.

Nørretranders argues that our consciousness is our user illusion. Our consciousness is our map into ourselves and our possibilities to affect this world. I am the user illusion of Me.

The conscious mind may appear when the brains' simulation of the world has become complete enough to require a model of itself. --Richard Dawkins

Experiments with split-brain patient has shown that the mind doesn't think twice about making up a story that is consistent with something that does not have anything to do with reality. An example of this is:

  • A split brain patient is shown two images
    • The right eye was shown a snowy landscape
    • The left eye was shown a chicken's foot.
  • The patient pointed to two images.
    • The right hand a snow-shovel.
    • The left hand a chicken.
  • When the patient was asked why he pointed at the two images:
    • He said that he picked the chicken because it matched the chicken's foot
    • And that he picked the shovel because you need the shovel to clean out the chicken house.

The mind lied without hesitation to make the selection of images consistent.

Our consciousness is delayed to allow it to perform the required calculations. First we sense, then we simulate, then we experience. But we have no notion of the simulation. Consciousness is depth appearing as shallow.

Learning and Knowing

There are lots of things that we know how to do that we cannot explain. How do you ride a bike? How do you walk? How does your mother look? Its impossible to explain, but simple to know, once it has been learned.

The I's role in learning is to have the disciplin to learn by repetition, and the foresight that when I have learned this I will enjoy practicing it. The consciousness, usually, gets in the way while learning and, certainly, gets in the way when we practice what we have learned.

Science, usually, clarifies what we already know. It explains what we already know but cannot explain to each other.

Science is just refinement of everyday knowledge --Albert Einstein

The relationship between the conscious learning and the non-conscious ability is similar in both practical areas, such as ballet, and theoretical areas such as science; in both cases we must put in a lot of hard work for something we don't completely understand, but that we still can share with others.

The Rise of Consciousness and Religion

Nørretranders brings up another researcher, Julian Jaynes, who argues that the consciousness of man didn't exist 3000 years ago. He has various theories to prove this. Among other things he brings up the Oracles of Ancient Greece and the voices religious people hear as examples of people who are acting without a consciousness. A pre-conscious man is just a me, and a conscious man thinks he is just an I.

He also makes an interesting point about religion. The I has to recognize that there is something greater than itself. But it is not a god it is the me. God is the part of man that the I cannot explain. Religion is too important to be left to the religious. It is the struggle between the carefree me and the worrying I.

The Limits of Consciousness

Most of the processes that go on inside our bodies we know nothing about. We cannot feel the blood flowing in our legs or our immune system attacking viruses, until the problems become large enough for the body to raise the temperature to increase the effect. We cannot hold our breaths long enough to kill ourselves. The unconscious part of us wont let us

The Beginning of the Universe

In the Universe there is as much negative matter as positive matter. The sum of it all is Zero. According to the laws of quantum mechanics it is possible for Nothing to split into something for a very short while. The less it is the longer it is allowed to exist. So, it the sum of everything in the Universe is Nothing can exist forever.

Emergence

Emergence is the appearance of group characteristics when the number of elements increase. An example of this is Temperature. There is no temperature when there are only a few molecules but when the number of molecules increases the Temperature property emerges. In the book Gödel, Escher, Bach, Douglas Hofstadter talks about the emerging properties of the brain, the thoughts that cannot be described at a lower level.

Gödels proof suggests the possibility that an view from a higher level may have an explanation capacity that is totally missing at a lower level. --Douglas Hofstadter

A larger system consisting of simple rules can show characteristics that cannot be deduced from the rules.

It is impossible to know how yourself or another human will react, because it requires you to have access to all the information yourself or this other person has had and this is impossible since human being mostly function unconsciously.

The Liars Paradox, "I'm lying" is not a liars paradox. It is the truth about our consciousness. --Thor Nørretranders

Monday, May 11, 2009

Notes on Strangers to Ourselves

Strangers to Ourselves by Timothy Wilson is a book in the same spirit as the User Illusion by Thor Nørretranders. Both books are about how our unconscious mind plays a much bigger part in our lives than our conscious mind gives it credit for.

Our senses register 11 million bits per second and our conscious mind can only deal with 40. What happens to the other 10 999 960 bits is the topic of this fantastic book!

Adaptive Unconscious

In one study a woman suffering from lack of short-term memory was visited several times by a researcher. Every time he visited her, he had to re-introduce himself, since she didn’t recognize him. Then one time he pricked her with a pin when they shook hands. The next time he visited her, she didn’t recognize him, but she refused to shake his hand.

Attention and selection: the non-conscious filter. We become aware of new things even though we are in the middle of doing something completely different. For example: I am talking to someone at a dinner somewhere and then I hear someone mentioning my name in a different group talking amongst themselves. Suddenly my attention shifts to that of the other group

Interpretation: the non-conscious translator. Our preconceptions affect how we interpret situations. For example: If you after hearing something positive about someone it is a lot more likely that you will interpret their actions as good than if you haven’t heard anything positive. Studies with teachers show that teachers that were told that a random selection of students were likely to succeed, were affected so much that the selected students actually improved more than the other students.

Feeling and emotion: the adaptive unconscious as evaluator. In a study where the subjects were given cards from 4 decks of cards, A, B, C, and D, they were able to select the best decks on “gut-feeling” even though they could not verbalize why they selected as they did.

Unconscious goal setting. When we are playing games with our kids we may select not to win the game to make the kids feel happy and ourselves fell gracious. After doing this a lot our unconscious may automatically select for us not bothering the conscious with the burden to select.

Who’s in Charge?

Is our conscious in charge or are the non-conscious processes in charge? Some believe that our conscious is like a president, and makes all the executive decisions about what our non-conscious processes should be doing, others believe that our consciousness is more like a child playing demo games. They think that they are playing, but in reality it is just a simulation that they can do nothing about.

If I feel hungry and decide to go to the kitchen to eat a sandwich, it may feel like I make a conscious decision but, it may well be that my desire to eat arose non-consciously and triggered both my conscious thought and my trip to the kitchen. The consciousness may just be an illusion.

The truth is probably somewhere in between. Our consciousness, differs from our adaptive unconsciousness in several important ways.

Adaptive unconsciousness Consciousness
Multiple systems One system
On-line pattern detector After the fact check and balancer
Concerned with now Long view
Automatic (fast, unintentional, uncontrollable, effortless) Controlled (slow, intentional, controllable, effortful)
Rigid Flexible
Developed and mature Slower to develop
Sensitive to negative information Sensitive to positive information

Knowing Who We Are

Personality has been defined as the psychological processes that determine a person’s “characteristic behavior and thought”.

We probably have two personalities, one conscious and one unconscious. The conscious is measurable through questionnaires, while the unconscious is only measurable through indirect techniques.

As an effect of our two personalities we are also likely to have dual motives and goals. If our motives and goals and thus our two personalities correspond well, we are more likely to feel emotionally well.

Knowing Why

Our conscious is fantastic at making up causes for why we act the way we act. In a study with a split-brain patient (a patient who have had their brains split in half), researchers showed the patient pictures, one for the left eye and one for the right. At one time he was shown a picture of a snow scene to his left eye and a chicken claw to the right eye. He was then asked to pick up cards that related to the pictures. He picked a shovel with his left hand and a chicken with his right. When he was asked why he picked the cards, his answer was: “I saw a claw and picked a chicken, and you have to clean out the chicken shed with a shovel”. Our speech center is in our left hemisphere so the patients brain knew that it had seen a claw. It had no idea, however, why he had picked a shovel so it made up a reason.

Why do we do the things we do? We really have no idea. When an idea pops up into our head we may trace the thoughts causally back until we reach something that seems to be a reasonable cause of our thought. But, this thought may just be made up by our conscious mind to get a felling of control.

If I decide I want a sallad for lunch today and I am asked why, I will probably justify it with, something like, I am trying to lead a healthier life, etc., etc. But the real reason may be that I saw an obese person earlier this morning and he generated the thought later that day.

The theory is that we have no access to our mental processes, only to the mental contents that are the results of those processes.

Studies made in this area, have shown that a stranger may be as good as we are at predicting why someone did something. It may be as accurate to call a random person up, give them some data about what you have done during the day, and then ask them how you feel as to try to figure it out yourself!

Even if we, personally, have access to more information, there is no reason that this extra information will make our conclusion any more accurate.

Knowing How We Feel

Our feelings have always been believed to reside in our conscious, what good would they do if we didn’t notice them? But, not even our feelings are sure to be completely conscious. The author gives the argument that, sometimes we feel something and not until later do we realize that we didn’t have that feeling at all. Wilsons example is a couple of people that talk about a horse they owned as a kid, one of them says, “Good, I hated that horse!”, and the other person realizes that she has always hated it too. Even though she didn’t acknowledge it at the time.

Another example is that when we experience something scary, like losing control over a car, the feeling of fear doesn’t strike us until after the incident is over. Wilson argues that we get an unconscious feeling and only afterwards does the feeling appear in our conscious.

Other feelings that we fail to recognize are prejudice feelings. We think that we are very liberal but, at a deeper level we feel the feelings anyway and others can tell even if we don’t allow ourselves to see it.

The reason that we have these unconscious feeling is that they react a lot faster than our conscious feelings do. When we see a stick lying on the ground we may first react scared, thinking it is a snake, only to realize afterwards that it was only a stick and move on. If it is a snake the faster reaction may say our life.

Knowing How We Will Feel

If it is difficult to know what we feel at the time, how are we to guess what we will feel in the future? When we try to predict how we will feel in the future we usually exaggerate the feeling. How would you feel if your wife died? I would never get over it. How would you feel if you won twenty million dollars. I would live happily ever after, doing whatever I please.

Neither of these replies are very likely. There are a number of reasons why we exaggerate our future feelings. First, they are thought of in isolation, we don’t take into account all the other things that will happen at the same time as the events take place that we are imagining. Second, as soon as something happen to us, we start to internalize it. If I win the lottery I will be happy for a while but, after a while this will be the status quo that I compare things against.

This implies that we know very little about ourselves. Is there hope for us to improve this?

Introspection and Self-Narratives

It is often thought that to introspect our feelings, to think about why we feel a certain way, is a good approach to self-improvement. But this is not always the case.

The problems with introspection is that we may try to make too much out of what we find. If we are asked why we love our spouses and try to make a list of reasons why, we run the risk of believing that this is the whole story and not just a small subset of it. It may not even have anything to do with why we feel the way we feel. When we try to articulate our feeling we diminish them.

He who deliberates lengthily will not always choose the best. —Goethe

So, are we supposed to ignore why we feel the way we do and just act on impulses? No, it is important to distinguish between informed and uninformed gut-feelings. The trick is to gather enough information to develop an informed gut-feeling and then not analyze that feeling to much. We should let our adaptive unconscious do the job of forming reliable feeling and then trust those feeling, even if we cannot explain them entirely.

If we try to imagine, in detail, the situation that would occur if we acted on our feeling, perhaps we would be better at recognizing our true future feelings

Looking Outward to Know Ourselves

To complement knowing ourselves by introspection, we can look outwards instead. We can look at the research done in psychology. For example, in one study, a group was tested for automatic prejudice. The study showed that people unconsciously made different decisions when they were not given enough time to think over their replies consciously. To know that our unconscious opinion may be different than our conscious one is good knowledge to have.

To try to figure out what we are like by observing how other people react to what we do is an approach that isn’t very fruitful. Our observation of the other person gets filtered by our unconscious and it is not at all unusual to think that someone admires you, while they think you are a complete idiot.

A better approach is to ask others what they think and use their description as a clue to finding out how we are. But the people you ask have to be very honest.

Observing and Changing our Behavior

Despite years of research on self-perception theory, there is an enduring question: Is the self-perception one of self-revelation or one of self-fabrication. Self-revelation is good in that it helps us understand ourselves, while self-fabrication isn’t since it infers things that didn’t exist before.

In the end, the only way to change how we are is to change how we act. Since acting in a way you want to act will make you a person who acts like you want to act.

Wednesday, April 29, 2009

Notes on seven habits of highly effective people

To be rather than to seem.

This quote illustrates the importance of self-reflection. What others think matter little if you know.

Circle of Concern and Circle of Influence

The circle of concern are things that affect you but that you can do nothing about, such as the weather, stock market, etc. The circle of influence is things that affect you, that you can do something about. Don’t worry about the first kind.

Important or Urgent

What is important to most people, family, friends, etc., is often neglected because urgent matters take their place. Make up you mind on what is important to you and make sure that matters that are less important, however urgent, don’t let you neglect them.

Organize Weekly

A smaller time period will force you to only prioritize crisis. The week is a time period that is large enough to give you time for all important things, yet small enough, to give a sense of perspective for what the big things are.

Monday, April 27, 2009

Notes on Pragmatic Thinking and Learning

Andy Hunt has written a good book on thinking and learning. It contains light reading about how our minds work. Here are some gems from it. This is by no means a review of the book it is just my notes on things that I had not heard before or felt I needed to remind myself of.

Always consider the context.

Nothing happens out of context. Nothing! There is no objective truth.

Learn by synthesis as well as by analysis.

This is learning by doing instead of by studying. Instead of dissecting a frog, try to build one, to figure out how it works.

Every read is a write!

This has to do with our thinking and it means is that every thought we think affect our brains and thus all the rest of our thoughts. No wonder thinking positively has profound effects on us.

Our brain works in two modes, linear and holistic.

To take advantage of the holistic part we need to defocus and allow the “back” of our brain to do its work. The R-mode as the holistic part is called cannot verbalize its thoughts and we are therefore forced to use the L-mode to be able to talk about the ideas that R-mode may have come up with. Beware that details may be lost in the process.

Are you making a logical argument, an emotional one or just a familiar one?

It is an interesting question to ponder every time you get into an argument.

SQ3R – Scan, Question, Read, Recite, Review

To get the most out of a book, use SQ3R.

It is by logic we prove; it is by intuition we discover. —Henri Poincaré

It is important to acknowledge that the seed to our knowledge have nothing to do with logic at all.

You got to be careful if you don’t know where you’re going, because you might not get there. —Yogi Berra

Set goals!

SMART – Specific, Measurable, Achievable, Relevant, Time-boxed

Goals that are not SMART are visions, important in the large, but they need to be complemented with SMART goals.

Documenting is as important as documentation.

Writing documentation brings out problems and clarifies what the code or product is supposed to do. The insights from this process may greatly improve it.

Establish rules of engagement to manage interruptions.

Since context-switching is very expensive it is very important for teams to have clear rules for when, where and why anyone can be disturbed.

Thursday, April 16, 2009

Refactoring Books

Here is a list of the books mentioned in my talk on Large Scale Refactoring.

Refactoring: Improving the Design of Existing Code is the original book written by Martin Fowler. It is a must have to anyone doing object-oriented programming.

Refactoring to Patterns is a very good book written by Joshua Kerievsky. This book is one of the best books I have read on patterns. It shows how some smells in code can be removed by refactoring them into design patterns.

Refactoring Databases: Evolutionary Database Design is a superb book that deals with refactoring databases. If you do any work with databases, you have to read this book.

Refactoring in Large Software Projects is a book about how to refactor large software systems. It is an OK book, but very far from the other refactoring books mentioned above.

The Mythical Man-Month by Fred Brooks is the classic, more than 30 years old, dealing with problems in software development. It is well worth reading. You can also listen to his talk at OOPSLA 2007, which is very, very good.

Tuesday, March 03, 2009

Are your lights on?

I just read the book Are your lights on?, by Donald C. Gaus and Gerald M. Weinberg. In it there are some interesting sayings about problem solving.

  • A problem is a difference between things as desired and things as perceived.
  • You can never be sure that you have a correct definition, but don’t ever stop trying to get one.
  • Don’t solve other people’s problems if they are perfectly capable of doing it themselves.
  • If it’s their problem, make it their problem.
  • If a person is in a position to do something about a problem, but doesn’t have the problem, then do something so he does.
  • There are two kinds of people in the world, those who do work and those who take credit. Keep in the first group, there is much less competition there.
  • Do we really want to solve the problem?

There are som many options available when solving a problem.

The first quote, for example,

A problem is a difference between things as desired and things as perceived.

gives us the options of solving the problem by changing the desire or the perception of the problem instead of actually changing the reality to what is desired.

Wednesday, January 28, 2009

Brain Rules

I just read John Medina’s book Brain Rules. It is a book about how our brains work. What I find most interesting is how it applies to learning.

Attention

Our brains are able to pay attention to three things. It can be characterized by these questions.

  • Does it want to kill me?
  • Can I have sex with it?
  • Does it remind me of anything?

All three questions are relevant to how you give a presentation. If everyone seems to be dozing off they can be awakened by I sudden sound or a picture of something sexy. But these measures are just that, attention grabbers, and if a presentation is so boring that I have to slam the table all the time I’m definitely doing something wrong.

The third question: Does it remind me of anything? is different. It is very important both to giving presentations and to learning. If I can find a way while giving a presentation to have the audience relate to my subject in any way, they are more likely to pay attention. It’s the same with learning. If I’m learning something that reminds me of something else it will be easier for me to put it in a context that means something to me and that will enable me to learn it much better.

I find this very interesting since lately I’ve found that I like doing things that I suck at. The things I like and suck at are very diverse. I have started to like skateboarding, playing Guitar Hero, and even carpentry. I think that it is because I know more now and even if I’m no good at these things they remind me of other things that I’m better at. And just as important, they widen my frame of reference, so next time when maybe I have to weld something I wont find the entrance barrier to high to even imagine doing it. The more I recognize, the more I relate to, the more I like. It is a good loop.

Memory

In the book Medina also talks about memory. There are, at least, two kinds of memory, short-term memory and long-term memory. The short-term memory is our working memory and it is good for very short periods of time. To store something in long-term memory, repetition is required. The more I repeat something, the better I will learn it.

The best books I have read that take advantage of repetitions without being boring are The Little Schemer-series, The Little Schemer, The Seasoned Schemer and The Reasoned Schemer. These books are built up as a series of questions in one column and the answers in another. The difficulty increases gradually as you read more.

The point of The Little Schemer is to teach to think recursively in Scheme. It does a great job of teaching this, probably because of all the repetitions that are involved.

The point of The Seasoned Schemer is to teach more advanced concepts of functional programming in Scheme, such as continuations.

The point of The Reasoned Schemer is to teach logic programming in a functional context.

It is interesting that the concepts taught in the books are quite complex and still they never feel hard when presented in this way. I highly recommend them to anyone.

Another interesting thing about repetition is that it seems to be happening while we sleep. When we are sleeping our brains keep repeating things that we learned during the day. After going to sleep while reading The Seasoned Schemer, I remember waking up one morning and finally getting how continuations work. Quite a good feeling.

Stress

Stress affect learning in a bad way for almost everybody. Stress is defined, to allow researchers to measure it, as having three criteria.

  • It has to create physical arousement.
  • If you could avoid it, you would.
  • It has to feel like it is out of your control.

If any of the above is true, it is said to be stress. When we are stressed our brains cannot focus on the task at hand and this will decrease our learning abilities severely.

You can also listen to John Medina talking about the book on the Ruby on Rails Podcast.

Friday, November 07, 2008

How (not) to buy books

If you, like I, read a lot of books from different areas you probably buy a lot of books that are of questionable quality. I used to do this too. Now, I use libraries instead. Some of the advice here will be specific to Sweden, since this is where I get my books, but you can probably find similar places where you live.

  • Find the book you want. If it is an English book Amazon is the place to go. If it is Swedish use Bokus or AdLibris. The value of these websites is that they provide a lot of information about the book, such as summaries, reviews and references to other related books. The related books are interesting since they provide you with options based on what others bought, the author and other people’s recommendations. All to help you find the best book for your topic.
  • Use the ISBN, title, author, etc and search in your local on-line library catalog. In my case it is the library in Staffanstorp. If you find it all is well, just reserve it and pick it up the next day.
  • If you don’t find it in your local library goto your country’s common library catalog. In my case it is called bibliotek.se. If you don’t find it here you will have to buy it, but I have found more than 90 percent of my books here lately.
  • If you find the book, go back to your local library catalog and make an Inter library loan (fjärrlån in Swedish). Make sure you say that you found the book in the common catalog and that you want it delivered to your local library unit. The book is usually delivered in about a week at the cost of 5 SEK.
  • If you like the book and think you will read it again, buy it. If you don’t, just return it and feel content with that along with saving a small tree, you didn’t encourage a crappy author to write another book :)