At school Daniel Tomlinson's life was made such a misery by others that he thought of harming himself. A talent for coding and the people he met in that community were his salvation

When I was six years old, I would cry myself to sleep at night. From around year one my school life was hard, but not in the academic way. My difficulty was I couldn't ever fit in with the others. Rather than run around a sports field, I preferred to read about the wider world or take things apart to see what made them tick. Sadly, this made me a target for bullying.

One of the worst incidents occurred around year five, when I was 10. I was on the chubby side and a running "joke" began, the "humour" being that all farts began with me. For example, a blemish on the assembly room floor would result in: "Hey, Dan, did you sit here? There is a burn mark on the floor. Did you fart?"

So it wasn't unusual when one morning one of my classmates claimed I had farted and the whole room burst out into gales of laughter. But what was unusual was that the teacher joined in. She made me go round opening all the windows. As I did it, everybody watched and stared, laughing and making comments as I passed.

Events like this hurt. They hurt because they showed that even the people who were there to look after and protect children didn't really care. I wish I could say occasions like this were rare.

It wasn't always bad though. During reception and the start of year one, I had friends, I did well, and for the most part was happy. School wasn't a huge challenge, and I enjoyed learning about the things I had not yet come across in books. But when I moved to a better-ranking school in year one, I never settled in, and they never quite welcomed me. And when I entered year two, my life began to change into a living hell.

I remember how it started. At first it was a few students who used to make remarks about my weight that I pretended not to hear. But these were then adopted as names for me. So I soon became Fatty or Nerd to most of my peers. They would chant them in the most horrible voices. And then came the quips. They were the worst to bear. "Hey, Fatty! Don't jump – we might have an earthquake." And so on.

My young mind could not understand why they behaved like they did, so I began to blame myself. I thought that I had done something wrong. That I was responsible for everything that was happening. I struggled to try and fit in, to make it stop. But nothing worked.

Then, when we moved into year three, things became physical. They would punch, kick, slap and push and for the first time, I turned to the people who were there to protect me: the teachers. They did nothing.

I would spend a lunchtime writing a letter explaining what had happened; then the bullies might lose a break time. As you might expect, I soon gave up on the system. But this didn't mean that the bullies gave up on their need for self-inflation.

When my parents found out and tried to talk to the teachers, still they didn't act. Recently I spoke to my parents about it and they recalled that one day they booked an appointment with the deputy head. When they arrived and explained the situation, she simply replied: "This meeting is over. Please leave."

This happened a few times. Whenever we tried to get them to deal with the issue, it was swept under the carpet, brushed aside like a dirty little secret. We also tried going to our local council and were promised calls that never came.

For the first year or so, I hoped that it would just be a phase, that people would grow out of it and that it would be over. I hoped that I could move on and have the happy childhood that adults seem to recall every time I said I wanted to grow up, to be done with school.

Then, as if I needed more to differentiate me and give them another point for ridicule, I had to start wearing glasses. Eight pairs a year, in fact. Thrown over fences, torn from my face, chucked under cars, stamped on.

Now I even turned to God. The one who answers prayers. Performs miracles. I tried every day. I begged. I pleaded. I asked. Yet putting my faith in God to solve my problems left me on the edge of suicide.

I became quite violent for a time, responding in kind to the physical onslaught because I couldn't keep in the fury. It's not something I'm proud of, and it is a part of me that I fought to change. Violence solves nothing. I admit that it offered a temporary outlet for my anger and angst but it did not solve any problems.

The first time I was properly violent, I had been riding my bike home from school. I had barely got any distance when someone pushed me over a low fence. I remember the anger boiling up inside, surging to get out. I tried to hold it in. I heard the boy laughing and I let it go. I picked up a fallen branch from a nearby tree, ran at him and swung it at his head. If I'd been an inch lower, he would have been blinded.

I still remember my feeling of liberation – that something was finally being done about the problem. So it continued. And naturally I was the one the school was harder on, because they teach that sticking up for yourself in any way is bad. They teach us to allow ourselves to be manipulated and hurt.

But then, in my darkest hours, the days where I'd spend my time considering the best way to end everything, my love of taking things apart to see how they worked led me to discover programming, a system of logic and creativity.

Daniel Tomlinson at home on the south coast. Photograph: Richard Saker for the Observer

I discovered programming mostly by accident. I was curious about how lots of things worked, and was fascinated by the big black box in the corner of our dining room. Programming was a beacon of hope in a world dominated by sadness. It granted me the freedom to create and destroy, to craft worlds that were mine to manipulate. It also led me to discover some of the greatest friends I could ever imagine. People who would listen to me when I was down, offer advice, and treat me like a human being. An equal.

Through this, I had an outlet, a way to channel my sadness, and that offered moments of true happiness when I built something new. I also developed a passion for making things that still comes through to this day. The joy of taking something from start through to completion, then seeing other people use them on a daily basis, is magical.

Programming also allowed me to learn more, as it provided a practical application for the theories of maths and physics. The art of debugging taught me how to think about problems logically, rationally, and to persevere. It also taught me about teamwork and collaboration, allowing me to work with others in school without wanting to explode in anger. They still bullied me, but it gave me the resolve to block that out and continue with the task at hand. Its logical ways clicked with me, and I loved it.

I loved that it (mostly) did as I said, nothing more, nothing less.

I did still have dark times and bullying for many more years. The days were long and unforgiving, evenings peaceful but fleeting, nights long but sleepless. Some days I still wanted to end it. But the knowledge that people were there for me – people who didn't just sympathise and tell me that others would grow up soon – stopped me from ever harming myself, from ever making that leap, even though I faced more bad treatment in secondary school.

I was beaten both physically and emotionally almost daily by those around me. I remember waking up every morning, physically shaking at the thought of rising and going to school. Some days I couldn't move with fear. I'd pull the duvet over my head to block out the world and hope that when I moved it, it would be Saturday. Other times I would pretend to be sick just to stay away from it all.

I was once chased around the school and fields by someone wielding a stick, because I didn't agree with them. Nothing came of it. Nothing ever came of it. Schools cannot deal with the violence and troubles that happen under their noses. How can they? They have no punishments that really mean anything to the ones that receive them, and the parents of such students do little to reinforce the message.

I recall that, on a particularly bad day, I ran out of an art class and kept running until I got home, because I couldn't bear to stay at the school any longer. I was scared and upset, I didn't know what to do. So I went home and worked on my own things, to give my mind a challenge, and to distract me from the pain.

I was the one everyone teased – because they could. I even began to hate my own name, Daniel Leslie Tomlinson, because whenever anyone remembered the middle bit, I'd be laughed at until they tired of it again. They didn't care that I was named after my granddad; they found it humorous because the female version of the name sounds the same.

I was affected academically, and over the years slipped from being a high-scoring student to barely scraping by. This was due to missed time, and the fact that when I did attend I felt so anxious that I ceased to function. Don't get me wrong; I didn't fail. I let myself down by getting lower marks than I was capable of.

In my later school years, however, there were a couple of truly amazing teachers who helped me to get through my time in school. Their lessons and openness provided me an outlet whenever I needed it, and for that I shall always be thankful.

I am now 17. When people hear about my school days, they often ask: "Is there anything you would change about your past?", and my answer is no. Because even though I suffered for so many years, it shaped the person I am today. A human being who stands up for those who cannot stand up for themselves. A human being who tries to improve the lives of others with everything I do, and who helps anyone that needs it.

Although things at school stayed tough, programming gave me a life outside it. I cannot stress enough the importance of finding a passion and like-minded people if you are being bullied. Connecting with others taught me that it wasn't my fault, that I wasn't to blame, and that there was a better future ahead.

Over the 10 years that I have been coding, I have met amazing people from all walks of life. I've worked on some of the coolest ideas that I've ever seen, won awards and travelled all around the country to meet people and attend or speak at conferences. It has increased my confidence around people, and allowed me to make some amazing friends.

Software development has also given me a new life in a new place, doing a job that I love – building applications that people will be delighted to use every day. I'm looking forward to seeing what the future holds, new experiences that are yet to come, and new people that I'll get to meet.

I also now have the opportunity to aid others who have bullying problems, and will help anyone who needs it. Bullying needs to stop, both in schools and out. It happens around us every day, and far too many people have the wrong attitude towards it. That must change.

If you have been affected by any of the same issues as Daniel, contact beatbullying.org