Delegates

A delegate is a special type, where you can store a reference to a function. With delegates you change the way how you work, and somehow reverse it. Give it a function, and after that you give if the requested values for that function, and process it.

Why? So you can assign an action (or maybe with if’elses or a for loop, different actions) and then after that give it the values and process it. Even you might not understand it yet completely, this makes code easier, and things possible that maybe wouldn’t be possible without this.

This sounds a bit crazy, but lucky enough it’s rather easy, you just need to understand it. Nothing better than some example to make you understand!

Read the rest of this entry »

Code conventions

Programming in groups, and even alone, becomes harder without them. Without what? Without Coding conventions! Never heard about it? Then you probably aren’t a programmer!

What are they in short? How to write and choose a name for a class, a variable, a setter or getter, a button, and more. It could also be a rule, that says when you have a string variable, you name it strVariableName. CamelCase (upper and lower) are one of the important things in coding conventions, it’s about Uppercase letters.

When everybody uses the same conventions in a project, it’s easier to understand code other people made!

Read the rest of this entry »

Example Observer Application: Traffic Lights

This is the post where you have all been waiting for (I hope J), after reading the informative post what an Observer Pattern is. If you have no idea what an observer is, you better start reading my previous theoretical post about the Observer Pattern.

First an overview of the application we are going to build in this post:

  • An application to create a traffic light who changes his colour
  • Easy expandable
  • Future equipped (easy to add changes)
  • Object Oriented
  • With the Observer Pattern

Read the rest of this entry »

Add items to the Bulleted List Control (in the code file)

My next tutorial will be a really short one. But still I have spent a really long time to find what I was looking. Maybe because it was way to easy?

I wanted to generate a BulletedList Web Control, in my code file. Inside a for-loop I wanted to add texts to my list.

Read the rest of this entry »