So, you want to be a software developer? Part 4.

So I’ve mentioned the various resources you can use. I’ve also said that you need to train to think more logical and to visualize your designs. And I’ve told you to pick a target platform for which you will be developing at first. (You can always pick more platforms later.) So if you’d expect that I would start focusing on programming languages then you’re wrong!

Even though I did mention C as a very practical language since it is supported by a lot of platforms, I will still have to focus on a very important process in software design, which is basically the whole development cycle.

As I said, I learned programming from my father. My father, who was a software developer for the ING, a large bank in the Netherlands, has had quite a few trainings in software development. This included the System Development Methodology that was developed by a company in the Netherlands called PANDATA. (Now known as CapGemini.) This was a very important development for managing large projects and focuses on planning and organisation of new projects.

With SDM, several phases are identified that can still be applied to modern development. While it originated as a Waterfall model because you would move from phase to face, yet the same model can also be applied to Agile software development but on a smaller scale. SDM isn’t just the process of turning an idea into a final product but also to adding changes to existing projects. And you can do this in a few big steps and thus have a waterfall, or you do this in a lot of small steps and thus be Agile.

So let’s look at the phases defined by SDM and how you would use them for your own projects.

IP: Information planning

In general, each new project of addition to an existing project starts with an idea that needs to be evaluated. For example, you want to create an online address book for your employees with information about valuable clients. There are plenty of projects that already do this but I just need an example.

You would have to start to look at what you want to solve by this project. How much will this project improve your business. Who will be using it and what does everyone expect to get out of this project?

These questions also occur in an Agile environment because you will often see new feature requests that you will have to consider if they should be implemented and what people would expect from this implementation.

In general, this is when you would also sign a contract with the client for whom you’re going to make this once both sides agree on what the idea will be. And no, this does not mean that you will set a deadline for when it will be finished but you are agreeing on the steps that need to be taken to turn the idea into a final product. As a result, you will need some good documentations about this idea before you continue with it.

Thing is, once documented you will have to stick to whatever you’ve agreed with the customer unless things are impossible to implement. Once the project is done, it should match this documentation. But you are allowed to change the documentation if your client agrees to those changes!

DS: Definition study

Once you have an idea of what everyone expects, you could start looking at the needs to implement this. Do you need extra resources for data storage? Do you need extra security? Are there any possible legal issues with storing data of clients in your database? (Some countries do have strict privacy laws!) Which techniques will have to be used and how important will this be?

In an Agile environment, this would basically mean that you create a new work item into the system which will be split in smaller steps in the next phases. You will have to check if you have the required resources to create and publish the project. For example, your customer might have a Linux web server while you use Windows to develop your PHP code. This means that you need at least one Linux environment similar to what the customer uses for testing purposes and additional experiments. That would be a resource that you need to get.

BD: Basic design

During this phase you will consider how the project will look like when it is functional. Basically, this means creating a functional design with images of what the user interface will look like. You will also need to consider how the various parts of your project will work together without being too detailed.

This doesn’t need to take much time, but you need your customer to agree upon how things will look. For one project I’ve worked on, the customer wanted an export button as part of a desktop application that would send a selection of data as XML to a web service. So I used Microsoft Paint to just draw an extra button on a screenshot and mailed this to the customer together with a short description of the data fields that we would sent. It can be that simple and often people don’t even notice this phase during the design.

But in general, you will have to discuss the look & feel of the project with your customer. Even when you’re using Agile methods, your client still needs to be informed about how it would look. Thing is, if the customer disagrees with the new GUI layout, you’d better know this before you’ve written all the code than afterwards.

These functional designs and screenshots would become part of the child work items for your project. In an agile environment, this could mean that you have a dozen or more small designs that are put on the backlog to be picked up.

DD: Detailed design

The next step is going into more details. Here you would think about the database structure, generic architecture of the project, additional libraries that you might need and basically all technical requirements that you will need for each work item from the previous phase.

In my case with the export button, I needed to know which web service I needed to call and what data structure it needed for me to send data to it. I also needed the data model of the application itself so I could make a plan for collecting the data and sending it to the web service.

It is likely that you will have multiple child work items for each work item from the BS phase. For this button I would have a work item for adding the button to the form, a work item to get access to the web service and a work item from mapping the data from the database to whatever the web service needs.

I could also have added just one child work item but it is good to be detailed in the things you do, so you can check if you haven’t forgotten anything. And even though these are all small tasks to do, it is useful to know which part will get you stuck for whatever reason. In this case, it could be that the web service that I try to connect to has problems. When others are examining the work items, it is much clearer when the item “Connect to web service” is still open than if “Add button” is still open. With the latter, it would be more unclear why things got stuck.

R: Realization

This is when you do the actual coding! You create the database, create all the forms, add all the logic to connect it all and you’re basically going through all work items in the system until the root work item is telling you that everything is done.

In a waterfall environment, this often means that you might have a few hundreds of pages with text, containing both functional and technical designs. In an Agile environment it is more likely that you’re just dealing with a few hundred work items that all need to be solved, although even Agile can create large documents for any new project.

But if you’ve done the Agile stuff properly, those documents should have been already translated into many small work items so the progress of the project can be measured more exactly.

I: Implementation

Once the coding is done, the project should be finished but in general it will have a lot of flaws and issues that are not conform the agreements with the customer. These could be critical errors like the system losing data when you click a specific button to trivial ones like two buttons which aren’t aligned properly.

I once had a customer who disliked the fact that the [OK] and [Cancel] button were the same size on a form, even though both words have various lengths. He didn’t like the white space on the [OK] button and it took some time to convince the customer to still agree with two buttons of the same size.

Another customer needed to be convinced that Comic Sans is not a good font for a serious desktop application, no matter how much he liked it.

But testing of your project is extremely important and this is where Agile methods have an advantage! When you’re doing Agile development then you can build weekly or even daily builds of the latest source code so the testers can start testing all things that have been implemented and the customer can take a peek at how far the current progress already is and provide feedback, if need be.

This feedback would generally mean going a few phases back for the current work item and would generally not have a huge impact on the other items. So in an Agile environment all phases tend to be mixed together, since the customer might already be making change requests while the testers are testing the project and you yourself would still be writing code.

In a Waterfall, the testers would need to wait until all your work is done. And feedback from the customer generally has to wait until even the testers are done. The waterfall has a clearer division of the various phases but tends to add more work when the design needs to change during development, simply because you have to go back one or more phases.

O&S: Operation and Support

Once the project is done and well-tested it is time to deliver it to the customer. Web applications are stored on a web server and desktop applications are packaged in a special installer. App Store applications are sent to the proper App Store and for mainframe applications you would generally send some developer over to the mainframe with a floppy disk or USB drive containing the source code to compile the project on the mainframe itself!

And with the Arduino, you’d upload the application onto the processor, add the additional electronics and case and ship it to the customer.

So, what would you need?

What you need is creativity to come up with new ideas for interesting projects. You need to be able to describe them and you need to be able to draw images of the design. You might even need to draw database models and programming structures and more. Knowledge of UML would provide a bonus but you have to be careful with such modeling principles.

Making models and documentation doesn’t need to be perfect! You can misuse UML any way you like for as long as you can get the idea across to your team members, your customer and the users.

UML is like a programming language: just a tool to change an idea into a product. It just isn’t that important although it is very useful.

Personally, I prefer to take pen and paper and just draw my designs freestyle. It saves me the time to open up some drawing application and then messing around to make a proper design. If I’m on the computer I could just as easily use my development environment to create the forms and GUI parts and thus finish the job faster. But if I do that, I would already be in the Realization phase while the previous phases aren’t finished yet. It tends to lead to more mistakes in the final product.

Besides, I have a scanner. Once my drawing is done, I use my scanner to scan it and if need be, I would add more texts and other stuff using Paint. But by visualizing the design and drawing it on paper you should get some very good designs to discuss with your customer. And customers don’t mind if you’re just showing them some hand-made drawing, as long as you can bring the concept across!

Thing is, while UML is praised all over in the Academic World, it is generally not used in the industry. And if it is used in any way, it is generally used in informal ways with ad hoc sketches. Rarely does anyone in the industry make complete designs in UML for their projects, simply because it is complex, gets out of sync with projects real fast and generally doesn’t provide that many advantages compared to the effort it takes to create these diagrams.

As a developer, you will need to learn to read documentation and to follow these instructions very strictly, unless there’s a good reason why something would not be possible. If something is impossible, you should provide feedback to the management and/or the customer explaining why something cannot be done. This, as soon as possible so there is plenty of time to change the designs.

As a developer you should also be able to write your own documentation and it should not surprise you if you’re spending more time on documenting your work than writing actual code! Thing is, most code is not as self-explanatory as most people expect it would be. Even if you include comments in your code to explain how everything works, things could still be unclear to other developers or even to yourself if you review your own code one year from now! Your code and your documentation need to be synchronized so people can check if your project does exactly what you’ve described. This allows better testing and for the customer it will be clearer to know what he agreed upon.

So make sure that you know how to document your projects properly!

As a good example of why this is so important there’s one situation that I resolved that succeeded because of me properly writing the documentation! A new feature needed to be added to a desktop application and a colleague of mine was given this task to implement this and 5 weeks to finish it. And this period included Christmas and New Year. He started working on it and started writing code, experimenting and asking advice but did not manage to get any idea of how to solve it and out of frustration, he’d just quit his job! Poof! Gone…

So, with three weeks to go and me having two weeks off for the holidays, it became my task to take this over. It had already been promised to a customer to be finished in the first week of the new year so failure wasn’t really an option. So I started working in my weekend to solve the problem. This meant reading what was required and coming up with a solution that could be implemented in just two weeks. Fortunately, there were two other developers who could help me to implement it all, but we first needed a good plan.

So, on saturday I started reading and making notes. I stayed away from my computer and only used print-outs of the functional design and existing code. It took most of the day but I did end up with some good ideas.

On sunday, I started up my computer and started writing a Word document with lots of details about my plan that would solve it. I added various diagrams and defined specific tasks that needed to be done for the project to finish. I also kept in mind the experience of the other two developers and checked which tasks they could do and which tasks I would have to do. And on sunday evening I printed several copies of this document and also emailed it to my colleagues.

On monday, I discussed my plan with my colleagues and made clear that everyone knew what their part in the design was. Even management had a copy of the design so everyone could take part in this discussion to make sure that my plan would provide what we needed. And once everyone agreed, we started coding.

On friday, we already had a good working version. A week afterwards, we had a well-tested version with some minor issues. And when we were supposed to be finished I was already enjoying my holidays and my colleagues had done the last finishing touches and the whole thing was delivered just in time. And it worked great, even though it had been a lot of work with all kinds of pitfalls.

But because I wrote a detailed document explaining what needed to be done, we could make a success out of something that appeared to become a disaster. And that’s why having proper documentation is so important.

I also have tales telling how not documenting your work can lead to failure. I’ve seen plenty of developers with whom I worked who just skipped making any documentation of the work they did. In one case, a colleague had written a very complex framework but without any proper documentation there was only one person who could use it. Which is very annoying when you have a team of 10 or more developers who all need to use that framework!

It also didn’t help that this framework had all kinds of design flaws which this developer would need to solve. Which he did, but for the others it was still hard to use this framework because some functionality did not work as expected and some weird dependencies were all over the code.

If there had been any documentation then everyone could compare the framework with the documentation and just read the documentation to find possible flaws, or to point out flaws in the code when the code did not do what the documentation told it would. The lack of documentation causes a lack of quality and made things harder for all developers involved. Unfortunately, this is how many developers like to work because they focus on the tools, not on the final product.

Which is why you need to learn hot to plan, design and document your projects even before you learn how to program!

In the next post, I will finally start talking about the programming language that every developer needs to know: Standard C.

So, you want to be a software developer? Part 3.

By now, you should know about useful resources where you can find information you need. And you have trained yourself to think logically and to visualize your ideas. So, should you start picking a programming language now?

Nope! It is still a bit too soon, although it doesn’t hurt to look around a bit. No, you need to build up your knowledge first and decide on which platform you would actually want to start developing.Ramona on Computer 3_0001.png

Mainframes

To begin, you could decide to start developing on mainframe systems. Mainframes have been in use by large organizations and often require specialized personnel to operate them. Learning to use these systems is difficult since you can’t easily buy one to train at home. These are the Behemoths of computing, the Goliaths in a world full of dwarves. And some of them are quite antique and have already been in use for decades.

This is also where computing meets archeology since mainframes need to be extremely strict in backward compatibility. The systems of today might still be running software that was created 30 years ago.

Modern mainframes can run multiple operating systems using virtualization so it is possible to install Windows or Linux inside such virtual machine. But there are several operating systems that have been created to run on mainframes and most of them are very similar to Unix. IBM actually supports Linux on their mainframes. So learning to work with mainframes isn’t that difficult anymore. But in this field, you need to have good skills to manage a mainframe system.

Mainframes are still very popular in large financial organisations like banks because they’re made to handle huge amounts of data.

Supercomputers

A second group of computers would be the Supercomputers. Here too we would be dealing with specialized hardware that require well-trained experts to handle it. With modern supercomputers you’re actually dealing with a machine that contains thousands of processors that will run instructions parallel to speed up their calculations. These machines are created to make a huge amount of calculations, where mainframes were made to handle huge amounts of data.

Supercomputers are especially useful in environments where you need to make complex calculations. For example, for weather forecasts and molecular modeling, a supercomputer happens to be an excellent tool.

They also make extremely powerful chess engines!

Supercomputers used to have proprietary operating systems but are also moving towards using Linux. Since Linux is an open-source operating system, it has become a very popular choice too.

Home Computers and Apple

About four decades ago, most computers were still mainframes or supercomputers. Having a computer at home was not considered very useful since computers were quite difficult to use and needed experts to handle them. So, not many people considered the option to start building cheaper models for people to use at home, except for a few hobbyists who liked to tinker with electronics.

When Apple was founded by Jobs, Wozniak and Wayne in 1976, no one really expected that the computer they had designed would become so popular. And while the first Apple I kits were still hand-build by Wozniak, it didn’t take long before this inexpensive machine became popular and encouraged other companies to also design similar, cheap computers. Brands like Commodore, Atari and Sinclair suddenly became well-known names even though these systems were far less powerful than the average smartwatch of today. There was a rise in people who started buying computers to use at home, for games and educational purposes. And the first computer magazines started to be sold in bookstores and various other places. And some of these systems also found a nice place in various offices, automating all kinds of things people needed to automate, like their bookkeeping and letter-writing.

Home computers are rare these days and Apple has turned into a variant of the personal computer and into some smart devices.

Personal computers

The Personal Computer started about 3 decades ago as the answer of IBM to the popularity of the Apple computers and the many Home Computers. In 1981 the first IBM PC was created but it took a few years before it started getting momentum on the computer market.

IBM mostly targeted small offices but also tried to get access to the Home Computer market, at which they succeeded. Of course, it did help that many other manufacturers started creating machines that were compatible with the IBM PC and that IBM allowed these manufacturers to do so. Apple did not allow any copycats and their prices were much higher than these new PC’s, thus Apple lost a huge market share in the end.

The Home computer did compete against the PC too, but with 640 KB of RAM versus the 64 or 128 KB that most Home Computers had, it was clear that the PC had the upper hand. Although Atari did last quite long against the PC but that was also because Atari had become popular as a video editing computer. Apple had more specialized in desktop publishing. The PC just became a more generic device.

The PC is still used today and most developers will develop software for the PC. The modern PC can also be used as a server for web pages, databases or files and is thus a very versatile device. Today’s choices in operating systems for the PC would be Windows or Linux although there are a few other alternatives. (FreeBSD and OpenSolaris, for example.)

The PC is an inexpensive yet very powerful device that has many uses. This is definitely something to learn more about.

Laptops, Netbooks, Apple and servers

A simple PC can be set up to serve as a server. With either Windows Server software or Linux, you could turn a PC into a web server to host a web site. Or change it into a database server so your data gets stored in a very optimized way. Or use it as a file server, although people tend to use more specialized NAS disks for this.

Apple has also seen the advantage that the PC has and is trying to become as versatile as the PC is. But with Apple you would limit yourself to their own operating system while the PC can use various different ones. Still, it is possible to install a different operating system on your Apple computer but this isn’t a popular option since Apple computers are generally more expensive than PC’s.

Laptops and Netbooks are limited versions of the PC. In general, a PC could be used 24/7/365 to run continuously without a keyboard, mouse or monitor. I myself am using such a PC as my web server! But laptops and netbooks have been created to serve a user and use batteries so the user does not need to be connected to some wall through wires.

Laptops are excellent devices if you want to develop software and don’t have a fixed desk to work from. You can take them with you wherever you go and thus you could write code while you’re in the bus or train. Well, the lack of Internet might be a problem but they make good tools for travelling developers.

Netbooks are generally smaller versions of laptops. They’re often not powerful enough for the bigger development systems but they can still be useful for maintaining existing code.

You would generally not use servers to develop software but they are very useful for test environments and to allow distribution of your software projects. They can also be used for your version control system that you use to keep track of all changes that you’re making in your code.

And Apple systems are also very useful if you’re developing for IOS devices or are doing visual designs and graphics. Apple has always been popular amongst graphic designers and for desktop publishing.

Tablets, mobile phones and Smartwatches

Today, technology is becoming smaller and smaller. The result is that you can now wear a device on your wrist that is more powerful than the PC was 20 years ago! These devices aren’t generally useful to use for development but they are a good platform to target for your own development.

The main choices you have here are Android and IOS, where IOS tends to be slightly more secure but where it is also harder to get your apps published. There’s also Windows Mobile, the Blackberry and various proprietary systems but they’re generally not that popular.

When developing for these devices you will have to keep all the limitations and extra’s in mind. You are dealing with a device that has limited resources but also a large amount of functions. Things like WiFi, GPS, Bluetooth and often two build-in camera’s are very common in these devices. And you can actually make phone calls with these things too in many cases! Thus it is a very interesting target for developers, although you need a lot of customers if you want to make profits since the prices for apps are generally quite low and the App Market also takes a percentage.

If you fail to make a good app then developing for these devices isn’t very effective.

Raspberry Pi

The Raspberry Pi is technically just a very small PC that can run Linux. The modern version can even run a special version of Windows 10.

The Raspberry Pi is an interesting device if you want to do some hardware prototyping. It is also popular for various home automation projects although it is mostly used by hobbyists.

With Python or C++ (or other programming languages) you can easily write applications that listen to WiFi for incoming commands to turn off the lights, turn on the coffee maker and bread machine and manage all other electronics in your house. You can also connect a hard disk to the USB port and turn it into a simple file server. Or even a simple web server.

Commercially, there isn’t that much use for these devices except for prototyping. Still, the low cost of the Raspberry Pi does open up various uses, even for commercial purposes. It can be used for 3D printers, for example. It has been used with a simple keyboard and monitor to make cheap computers. And there’s a large commercial market for add-ons to the Raspberry Pi, including add-ons for commercial usage.

It might not take long for the Raspberry Pi to find a place in the Commercial World.

Embedded software, Atmel and the Arduino

Currently, the Atmel ATTiny85 happens to be my favorite platform as target for my projects. Basically, you are actually writing applications at the processor-level and not for a whole machine. This is basically when you start working with Arduino boards and similar things.

There is a whole market of programmable processors with additional programming hardware and generally a simplified C compiler so you can write code that gets stored directly inside a processor. This processor would then become part of your own electronic soldering and most likely on a board of your own design and will do basically anything that you have programmed.

These processors are very popular to create tiny robots, to drive LED lights and sound devices and much, much more. This is also a very challenging thing to do because you’re not just programming a processor but you also have to build the whole machine around it.

You need knowledge of electronics and preferably you have the tools and knowledge to make containers for your electronic experiments. Having your own 3D printer would be very useful but then you’d need more skills in 3D graphic design. And learning to work with electronics isn’t easy too, since it differs a lot from programming. It involves a lot of math since you have to make calculations for voltage and current in your project.

These calculations for electronics can be simple. Say, you have a 5 volt battery, a white LED light and some wire. You can connect this but chances are that the LED will burn out because it gets too much current so you have to add a resistor. But to know which resistor you need, you need to know the formula and some other information to pick the right resistor. Well, you have your resources so I have no doubt that you would be able to find that answer.

But imagine how complex it becomes when you have multiple LEDs, a speaker and some other electronic components!

So, make your choice!

So I’ve mentioned several targets that developers can pick for their development. When I worked at IBM, mainframes were my target. Before, it was the Home Computer and afterwards it became the PC. I’m also familiar with Apple, laptops, netbooks, mobile devices and tablets, the Raspberry Pi and a lot of Arduino stuff, including the programming of a plain ATTiny85 processor. (And soon the raw ATMega328 processor.) I’ve seen a lot of it and in my experience, you have to pick one environment first and become familiar with it.

In operating systems, you best start with both Linux and Windows. Linux has more environments where it can be used, including mainframes and small devices like the Raspberry Pi. And technically, Android is a Linux distribution too. So, becoming familiar with Linux is important.

However, most offices and companies use Windows for their computers and Windows is also popular as web server. You should make sure you are familiar with Windows too.

If you want to develop for Apple devices then you will also need to add OS X and IOS to your knowledge base, although OS X is similar to Unix, and thus Linux.

So, it would be best to learn to use both Windows and Linux with a focus on the command line shells, the installation and uninstaling of software and the installation and upgrading of both operating systems. The most practical solution would be to install Windows on your PC and then use a virtual machine to run Linux within your Windows environment.

The biggest problem with Linux are actually the various distributions that are out there. The use of virtual machines would allow you to experiment with multiple distributions on a single PC.

But you will also have to pick some hardware as your development target! And mainframes and supercomputers will be difficult targets for someone with no experience. You need proper training before they would let you work with those things!

So, targets are the desktop computer, meaning building desktop applications. Or the web server with web applications. Or databases on a database server. Or smart devices like tablets and mobile phones. And if you know about electronics you can consider to do prototyping with the Arduino or Raspberry Pi to create a new device to put on the market!

If you try to target all this hardware at the same time, you will only make things very hard for yourself. However, there is a programming language that should be supported by all these hardware systems and whatever operating system they’re using. And that language is called ANSI C. Or ISO C. Or Standard C.

But more about C in a next post! First, you need to pick a target and become familiar with it! Build up your knowledge of your target.

Making 3D prints with OpenSCAD, Poser and Shapeways.

As you might know, I’ve played for years with Poser Pro now. And for about a year, I have created printed models through the services of Shapeways while also creating all kind of artwork with those Poser models and E-ON Vue. But more recently (well, less than a week ago) I started experimenting with OpenSCAD, which is an open-source CAD application where you just “program” a special script file and it will generate a 3D model for you based on that script.

So, to start I will show you how I created a special box for my electronic experiments, which is my Shapeways model. It is a rectangular box with five holes in the side for wires that lead to a small, round container. Not sure what I want to build inside it, but I just like the shape and it is a nice experiment to start with.

This is a box with two different lids. One round, one rectangular. The rectangular lid will also contain a small engraved text.

To start, I create a simple module to create the lid:

module BoxLid(width, height, depth, groove){
    union(){
        cube([width, height, depth/3]); 
        translate([groove, 0, depth*1/3])cube([width-2*groove, height-2*groove, depth*1/3]);
        translate([groove/2, 0, depth*2/3]) cube([width-groove, height-groove, depth*1/3]);
        translate([width*6/20, groove*1, -depth*1/3]) cube([width*8/20, groove/2, depth*1/3]);
        translate([width*7/20, groove*2, -depth*1/3]) cube([width*6/20, groove/2, depth*1/3]);
        translate([width*8/20, groove*3, -depth*1/3]) cube([width*4/20, groove/2, depth*1/3]);
    }
}

This set of cubes will create the lid that will slide in a special slot that we will add to the box. The first three cubes are of various sizes and create a groove to slide over. The lid will completely cover the side of the box.

The last cubes are used to put some relief on the lid to allow it to slide easier up and down. But I want to have it engraved with some text, so I create an engraving module:

module label(name, depth, fontSize){
    linear_extrude(height = depth) {
         text(name, size = fontSize, font = "Lucida Calligraphy", halign = "center", valign = "center", $fn = 50);
     };
}

And I need a second module for the lid including the engraved name:

module NamedBoxLid(width, height, depth, groove){
    difference(){
         BoxLid(width, height, groove, groove);
         translate([width/2, height/2, groove/2]) rotate([0, 180, 270]) label("Team Katje", groove, 8);
     }
}

Yeah, engraving is just that simple! Subtract the shape of the text from the shape of the lid. The most tricky part is actually trying to rotate it and making it fit. But it also tells us how we can create a box. We basically make a box and subtract the lid from it! I will also subtract 6 cylinders from a side for the holes to the round box on the side. And we will also subtract the inner space from the box so it has space:

module Box(width, height, depth, groove){
    difference(){
         cube([width, height, depth]);
         union(){
             translate([groove, groove, groove]) cube([width-2*groove, height-2*groove, depth-2*groove]);
             translate([width*1/5, groove*3/2, depth/2]) rotate([90, 0, 0]) cylinder(h=groove*2, r=groove*2, $fn=precision);
             translate([width*4/5, groove*3/2, depth/2]) rotate([90, 0, 0]) cylinder(h=groove*2, r=groove*2, $fn=precision);
             translate([width/2, groove*3/2, depth*1/5]) rotate([90, 0, 0]) cylinder(h=groove*2, r=groove*2, $fn=precision);
             translate([width/2, groove*3/2, depth*4/5]) rotate([90, 0, 0]) cylinder(h=groove*2, r=groove*2, $fn=precision);
             translate([width/2, groove*3/2, depth/2]) rotate([90, 0, 0]) cylinder(h=groove*2, r=groove*2, $fn=precision);
             BoxLid(width, height, groove, groove); 
         }
     }
}

Or actually, I combine the five holes, the box content and the lid together into a single shape and subtract the whole shape from the box. This way, I know the lid will fit perfectly on the box.

All I have to do now is create the second, cylindrical box on top of the holes. For this, I again start with creating a lid:

module CylinderLid(width, groove){
    union(){
         cylinder(h=groove, r=(width-groove*2)/2, $fn=precision);
        translate([0, 0, groove])
         difference(){
             cylinder(h=groove, r=(width-groove*2)/2-groove, $fn=precision);
             cylinder(h=groove, r=(width-groove*2)/2-groove*2, $fn=precision);
         }
     }
}

Again, a simple procedure of stacking two cylinders on top of each other. However, to make slightly more room, the smaller cylinder is hollowed by subtracting an even smaller cylinder. The result is a ridge to keep the lid in place.

And like the box, I will subtract the cylinder lid from a hollowed cylinder:

module CylinderBox(width, height, groove){
    difference(){
         cylinder(h=height, r=(width-groove*2)/2, $fn=precision);
         union(){
                 CylinderLid(width, groove);
                 translate([0, 0, groove]) cylinder(h=height-groove, r=(width-groove*2)/2-groove, $fn=precision);
         }
     }
}

Now I know that the cylinder plus lid will be exactly the proper height together. All I have to do now is put them all together:

width=40;
height=80;
depth=width;
groove=2;
cylinderhight=12;

Box(width, height, depth, groove);
translate([0, 0, depth+3]) NamedBoxLid(width, height, depth, groove);
translate([width/2, groove, depth/2]) rotate([90, 0, 0]) CylinderBox(width, cylinderhight, groove);
translate([width/2, height/2, depth+10]) rotate([180, 0, 0]) CylinderLid(width, groove);
translate([width/2, height/2, depth]) cylinder(h=10, r=1, $fn=precision);

I first specify the sizes for the box in millimeters. It will be 4x4x9.2 CM in size, which is large enough for a 9 volt battery plus holder, some wires and maybe some other stuff.

Next, I create the box at the standard location. Above the box, I put the lid, with some space in-between to keep them separate. The cylinder is put against the box itself around the holes but the lid for the cylinder is put on top of the lid for the box itself.

The last thing connects the box and the two lids to make it all a single part. On Shapeways, you have to pay extra if it is all separate parts so make sure you connect it all together with thin connectors that you can easily cut away with a sharp knife. And yes, I checked to make sure it doesn’t go through the line of text on the lid!

Now, what does it all look like? Well, just look at these images:
LidBoxCylinderLidBatteryBox

It is all quite easy to do, although it requires plenty of math to get things in the proper locations. I haven’t explained the math part and I won’t. I’m just showing what you can do with OpenSCAD and a few hours of free time.

The result is a .STL file that you can upload to Shapeways to have it printed. As an alternative option, you can also convert it to an .OBJ file format and import the box into Poser, and add a Poser model on top of the cylinder lid, just for fun.

Or you will add textures to the shape and use it in Poser/Vue to create some new image. It can be even more interesting if you can combine a 3D printed model together with a rendered image of the same model.

I still have a lot to learn about OpenSCAD but this tool allows you to specify exactly the shapes that you want for your 3D model and allows you to create modules that will allow you to do some complex things like separating a lid from a box.

Spammer almost fooled me!

SpammerI generally manage to recognise spam quite easily. But this email from payments-messages@amazon.co.uk did an almost-excellent reasonable well trick to fool me. And why did it almost fool me? Because I’ve occasionally bought stuff from Amazon, including the British site.

What made it look reliable was the fact that all links to the Amazon website did indeed point to the Amazon website. Most spammers show one URL in the email but hidden beneath it, you get redirected to a completely different website. So, where did it go wrong for this spammer?

Well, I had not ordered anything from Amazon and I definitely did not return anything to them either. So, this message was unfamiliar to me. It was strange, thus suspicious. Still, I did not see anything harmful until I looked down and saw an extra message and an attachment included in the email…

Spammer IIAnd that was even more suspicious! It is very likely not a document but some malware-thing hidden in a document. I don’t know and I don’t want to know. Opening it will infect my system so it stays closed.

The email claims there’s an “advanced electronic signature” attached to this note and I need to add it as a trusted certificate. Well, never do such a silly thing because someone asks you nicely by email. It can be reasonable harmless and just include advertisements in every webpage you visit from then on. Or, it allows some hacker to do a man-in-the-middle attack with your online banking account. That would cost you a lot of money!

There was a third reason why I knew its fake. I have a whole domain name with the possibility to create an unlimited amount of email aliases. I use a special alias for Amazon and this email was not received by that account.

I also use Google Apps and created a Google group within my domain for those aliases that tend to receive a lot of spam. So, spammers end in this group from where I can collect any data and offer it to anyone I like. And this email arrived in my spam-box! Thus, I knew it was spam before I even looked at it. Still, some emails just make me curious and the Google group is a reasonable safe area to contain this kind of spam.

Too bad, though. I would have liked the extra cash in my bank account.

Still, there are a few more things that should warn you that this is a fake email. For example, the email tells you to download and install Adobe Acrobat Reader but the attached document is a Word document, not an Adobe document. (Not a PDF.) And, the talk about the electronic signature is highly suspicious.

For the technicians among you, there’s even a clear warning signal in the headers of this email:

Received-SPF: fail (google.com: domain of payments-messages@amazon.co.uk does not designate 2.179.101.14 as permitted sender) client-ip=2.179.101.14;
Authentication-Results: mx.google.com;
       spf=fail (google.com: domain of payments-messages@amazon.co.uk does not designate 2.179.101.14 as permitted sender) smtp.mail=payments-messages@amazon.co.uk;
       dmarc=fail (p=QUARANTINE dis=QUARANTINE) header.from=amazon.co.uk

That’s right! Amazon has a special protection on their domain name and Google will check this SPF thing. And the original IP address from where this email was sent is not a valid IP address that is used by Amazon. In fact, spammers seem to use this IP address for more of their spamming and hacking attempts.

So, what do we learn from all this? Well, first of all the use of email aliases tells me this is spam before I even see it. Second of all, you need to read carefully and see if the email makes some strange suggestions. Third, be careful when opening attachments. Better yet, never open any attachment that you did not ask for!

Loterijen zijn geldklopperij! (En toch speel ik mee.)

First an apology to my International friends who don’t understand Dutch. Occasionally, I have a topic that’s just more interesting for people in my region than for the whole World. Like this one, where I’m nagging about lotteries in the Netherlands and how they almost force you to buy tickets. I’m especially talking about some lotteries that are mostly known in the Netherlands and target Dutch people so I write this in Dutch. I do know that Google Translate can do an excellent job at translating, though! But if you’re not Dutch then this is probably not so interesting for you.


Heb je wel eens aan een loterij meegedaan? Heb je daarbij ook wel eens wat gewonnen? De meest gehoorde klachten in Nederland is dat het allemaal pure geldklopperij is, dat het vooral de organisatie is die er rijk van wordt en dat als je dan iets is, de prijs meestal niet eens de moeite waard is en vaak niet eens hoger dan je inleg. En ja, zo denk ik er ook over.

Loterijen zijn niet bedacht om geld weg te geven maar om juist geld in te zamelen voor bepaalde doelen. Vaak is het doel gewoon het vullen van de zakken van de organisatoren maar de wetgeving in Nederland heeft daar een redelijk stokje voor gestoken met de kansspel-wetgeving. De Wet op de kansspelen legt strenge regels op aan kansspelen in Nederland en doet dat mede om het risico op een gokverslaving te voorkomen of te verminderen. Maar ook om criminaliteit te bestrijden want met kansspelen kan veel geld verdient worden door de organisatoren. En de organisatoren hebben een zorgplicht ten opzichte van de spelers en moeten hen wijzen op de risico’s, de kansen en vooral ook aangeven wat het doel is van het geld dat de organisator ermee verdient.

Voor loterijen met (grote) geldprijzen is bovendien toestemming nodig van bepaalde overheids-organen en die stellen vaak eisen aan het doel van de opbrengst van deze loterijen. Vandaar dat in Nederland de meeste loterijen zijn verbonden aan goede doelen omdat ze anders gewoon geen toestemming krijgen. Nu kunnen er ook wel loterijen zijn waarbij het doel gewoon het spekken van de zakken van de organisatoren is maar omdat het doel vermeldt moet worden voor de deelnemers is dat iets wat erg onsympathiek over komt en  dus meestal niet als doel wordt gebruikt.

Daarnaast zal bij iedere prijs boven de € 454 ook nog eens 29% kansspelbelasting betaald moeten worden. En dat moet ook aan de deelnemers worden gecommuniceerd! Het is dan best leuk als je dan b.v. € 1.000 wint met de Lotto maar uiteindelijk komt er maar € 710 op je bankrekening. De Staatsloterij is gelukkig zo vriendelijk om de te winnen prijzen te tonen na aftrek van deze belasting maar die kunnen dat makkelijk doen omdat de prijzen vaste bedragen hebben. Bij de Lotto en de Postcodeloterij kan men dat echter niet en rekenen deelnemers zich vaker rijker dan ze werkelijk zullen worden. Van grote geldprijzen wordt vooral de belastingdienst enorm blij omdat ze dan bijna een derde van het prijzengeld ontvangen!

Nu zijn er drie loterijen waar ik aan mee doe. Zo doe ik al decennia lang mee aan de staatsloterij, iets langer dan een jaar aan de Lotto en enkele maanden aan de Postcodeloterij. Ook de Toto heb ik wel eens ingevuld voor de lol en met dit alles heb ik best wisselende resultaten behaald. Maar je verliest er gewoon meer mee dan dat je er mee wint, tenzij je een der gelukkigen bent die een grote hoofdprijs wint. Maar gezien het aantal deelnemers vraag je dan wel om behoorlijk veel geluk.

Ik besloot ooit mee te doen aan de Staatsloterij omdat ik mij bezig hield over hoe alles op deze wereld zo mooi in balans lijkt te zijn en te blijven. En raakt iets uit balans dan vindt het vanzelf een nieuwe balans. En dan hoor je ook nog dingen over Karma en hoe ieders leven eigenlijk ook een kwestie is van balans tussen van alles en nog wat. En ik dacht bij mijzelf dat geluk en pech dus ook een soort van balans met elkaar hebben. Dus heb je geluk met iets dan krijg je pech met iets anders. En omdat ik graag van mijn pech af ben en het best pech is als je de Staatsloterij niet wint besloot ik eraan mee te doen, wetende dat de loterij mijn pech wegneemt en ik iets meer geluk heb met andere zaken. En zo verlies ik iedere maand weer met die loterij en dat brengt mij iedere keer weer een grote glimlach want dan ga ik met iets anders wat extra geluk hebben.

Okay, bijgeloof. Belachelijk om erin te geloven dus echt erin geloven doe ik niet. Maar wat als het toch waar is? Ach, gezien de lage prijs van een enkel lot kan het geen kwaad om gewoon mee te doen en dus doe ik al enkele decennia mee. Het hoogste wat ik daarbij won was € 75 en meestal win ik niets of minder dan mijn inleg. Wat een pech! Maar daar hoor je mij niet over klagen.

Ik ben eventjes met de Toto mee gaan doen tijdens de kampioenschappen en ik moet toegeven dat sport mij totaal niet interesseert en ik niet eens meer weet welke kampioenschappen dat waren. Maar ik deed mee omdat ik toch altijd pech heb met loterijen en dus ging ik bij iedere wedstrijd van het Nederlandse team een tientje inzetten op de tegenstander. Mijn pech zou ervoor zorgen dat ik verloor en dus ook de tegenpartij en dus zou ons Nederlandse team gaan winnen. En eerlijk gezegd kwamen we behoorlijk ver, tot ik een keer vergat in te zetten. Daarna lagen we eruit.

Dus karma bestaat niet,zeg je? Stom bijgeloof? Oh, dat geloof ik ook nog steeds. Ik deed gewoon mee omdat ik sowieso altijd zou winnen. Als ik met de Toto verloor dan zou Nederland kampioen gaan worden. En als Nederland verloor dan had ik een leuk prijsje verdiend om wat leuks mee te doen. Dus ik won iedere keer, behalve die keer dat ik niet had ingezet.

De Toto en de Lotto zijn beiden van dezelfde organisatie dus mijn deelname aan de Toto deed mij ook eens kijken naar de Lotto. Het leek mij wel leuk en je kon je eigen cijfers kiezen en de prijs is ook behoorlijk laag. Best veel trekkingen ook dus veel kansen om mijn pech mee te verliezen. Wel, ik kan wel wat extra geluk gebruiken dus ik besloot mee te gaan doen. En inderdaad, meestal win ik of mijn speltegoed, of een euro of heb ik helemaal geen prijs en daar was ik best tevreden over. Eindelijk wat extra pech kwijt.

En dan heb je een moment dat je het financieel even lastig hebt en wel een extra zakcentje kunt gebruiken om Oktober door te komen. En dan komt het geluk rollen uit dezelfde hoek waar mijn pech naartoe gaat. Ik had opeens 5 cijfers goed, ofwel een prijs van € 1.000 waar dan weer de belasting vanaf moest. Nou, daar hoor je mij dus niet over klagen. Mijn extra pech-verzamelaar heeft dus lekker voor wat extra geluk gezorgd!

Geloof ik in Karma? Nee, echt niet! Maar het wordt mij niet eenvoudig gemaakt…

En in het begin van 2014 kreeg ik bij een bestelling een gratis lot van de postcodeloterij. Even online invullen en je speelt meteen gratis mee. Wel meteen weer opzeggen want anders zit je er voor een jaar aan vast! Ingevuld, meegedaan en meteen weer opgezegd. Ik won niets en had ook niets anders verwacht maar vond dat ik wel die kans had moeten grijpen toen ik deze voor nop kreeg. Enkele maanden later kreeg ik weer een gratis lot dus weer ingevuld en meegedaan en opnieuw niets gewonnen. Tja, jammer maar opnieuw gewoon de kans gegrepen. Alleen jammer dat ik vergat om meteen weer op te zeggen.

Maar dit keer is het mis gegaan met mijn karma. Ik vergat op te zeggen en daardoor speelde ik ook mee met de nieuwjaarstrekking van de Postcodeloterij. En wat zou ik gebaald hebben als ik indertijd wel had opgezegd want de kanjer-prijs viel op de cijfers van mijn postcode! In plaats daarvan werd ik gek toen ik hoorde dat hij op mijn postcode was gevallen, mede ook omdat de letters nog niet bekend waren gemaakt en dit letterlijk een miljoenenprijs is.

Toch is mijn karma nog steeds in balans. Ik had de kerstdagen doorgebracht met een zware griep en een enorm gebrek aan eetlust tijdens het kerstdiner en ik dacht net hersteld te zijn maar het tweede griepje is er gewoon mooi achteraan gekomen. Geluk met de loterij lijkt ten koste te gaan van mijn gezondheid.

En nu wil ik niet eens meer in karma geloven! Dit begint eng te worden.

Maar gelukkig, de letters zijn bekend gemaakt en dat zijn niet mijn letters. Ik hoef de prijs dus niet te delen met een paar andere geluksvogels maar moet hem delen met een groot aantal geluksvogels, waardoor het toch een relatief kleine prijs blijft. (Want zo werkt de Postcodeloterij nu eenmaal.) De kansspelbelasting gaat er ook nog eens van af dus het valt allemaal best mee. Hoe groot de prijs is moet ik nog te horen krijgen.

Maar ik begin bang te worden voor de jackpot van de Staatsloterij die over een paar dagen getrokken gaat worden. Als ik die win dan vrees ik dat mijn gezondheid zoveel pech heeft dat ik in een houten kist afgevoerd kan worden. Dus nee, ik geloof niet in karma want dan kan ik hem toch rustig winnen zonder nare gevolgen…

Tja, ik vind al die loterijen nog steeds geldklopperij die vooral bedoeld zijn om geld te verzamelen voor bepaalde doeleinden. Vrijwel iedereen verliest ermee behalve de belastingdienst en de betreffende doelen. Ennee, karma bestaat niet, behalve in een klein, onzeker hoekje in mijn hoofd dat er voor zorgt dat ik toch maar een lot blijf kopen. Want je weet maar nooit…

 

2014 in review

The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 12,000 times in 2014. If it were a concert at Sydney Opera House, it would take about 4 sold-out performances for that many people to see it.

Click here to see the complete report.

Kid programmers?

Well, an interesting (Dutch) article was interesting enough for me to share my opinion about the topic. Commissioner Neelie Kroes suggests that all young children should start programming as soon as possible. Preferably at the same moment when they’re learning to read and write. And I like her and often agree with her opinion about these matters but this time I have some doubts.

I happen to be a “programmer” and I often compare the profession with that of carpenters. It is often quite simple but when things become more serious, you need better-trained professionals. You can give a child Lego blocks and they will build a castle with it. The same with programming. Give them a computer and teach them how to use notepad and they can create HTML and thus they can create their own web pages.

But what if they become overconfident? The carpenter child might decide to start building his own castle from wood. He would do what he did with his Lego and just starts building according to his own insights. And who knows? He might even make something very reliable. But often the result will be disappointing or even unsafe to live in. The use of the wrong materials, forgetting to add a door or window, forgetting to make things fireproof… There are many mistakes that even professional carpenters will make, but those kids are more likely to make them. They need a lot more training if they ever want to build their own house that way.

The same is true with programming. Anyone who is literate can learn to write programs. You just learn the proper syntax, the proper programming language and you start programming. And it will be fine for simple things like a personal website. But when they start thinking they can make some professional websites, a lot of things can go wrong because they’re not trained enough, they they have too much confidence in their skills because they were at the top of their programming class. They should be good programmers, right?

In my experience, knowing a programming language is not enough. Actually, the language doesn’t even matter that much. A good programmer knows how things work together, and knows what the risks are. Just like a good carpenter knows which type of wood and other materials to use, so does a good programmer.

You should first start thinking about what you want to make. Start designing it, documenting your wishes and often just work with pen and paper to get the proper idea and to list all your requirements. If you do this behind the computer, the computer might actually distract you too much into doing other things. (For example, you might already start writing code!) Don’t start writing code in this phase! You need a first design, no matter how simple it is.

The next step is making a risk analysis and specifying all the tasks that your design will perform. The risk analysis is important because your website will be attacked. You need to know how secure your site should be, considering the visitors it gets and the content that is on your site. You need to decide which server to use, which operating system, which hosting solution and most importantly: who will have access to which specific parts.

The tasks are important too, because they will relate to your visitor. Visitors will have specific roles and with every role there are a few tasks that can be executed. Some tasks can be done by everyone while other tasks require the user to log in. And some tasks will require the user to be part of the moderator or administrator role. You still have to think about this before you write a single line of code. Yet most inexperienced programmers have probably started to write their code at this point.

The next step is choosing the proper development environment and setting up environments for development, testing and (pre)production. This too is often forgotten, mostly because most programmers will just stick to the development that they know already. Not many C# developers would pick C++ with Eclipse on a Linux system to write their code. Yet any experienced programmer should not have many problems with this switch. If it provides the best solution then use it!

And now you can start writing code, designing the web pages and doing the fun parts of programming. And this is where I expect schools will fail. They probably start with the fun part so they teach those kids to start writing code before having taken the previous steps. Those kids will grow up and probably continue to work that way when they’re becoming more professional. They would then have to learn to slow down and start with the steps I’ve mentioned. And if they happen to work for a company that has more experienced programmers then they will indeed adjust and become very good programmers.

But our society is making people more independent and these young programmers might decide to start their own companies or start working freelance. The lack of insight in proper developer rules will hurt their career because their employers are likely receiving bad results from programmers who work too hastily. I’ve seen a few projects fail simply because the programmer did not think properly about the design. Fail enough times and no one will hire you.

So while teaching young kids to program seems to be a good idea, I fear it will generate a lot of bad programmers who think they’re good at what they’re doing. The result will be that a lot of bad projects will be published, like bad carpenters will produce a lot of bad furniture. But is this my biggest fear? Nope…

My biggest fear involves security. Good programmers start with thinking about security from the start. As I said, do a risk analysis and decide upon how to manage users, roles and anything related to this. Security always tend to be counter-productive but it’s like a log cabin with opening instead of a door and windows. Will children learn about from the start? Will they keep in mind that now everyone should have access to some more important functions? Will they realise that there are “bad people” out there who just want to destroy their work?

Just like the little boy making a sand castle at the beach, only to see a bully stomp it back into the beach, so are hackers destroying web sites made by those who don’t know how to protect them. Do they also learn about those bullies and how do you prevent these kids from becoming bullies (hackers) themselves? Because by teaching children to program, you also teach them how other programs work and that helps if you want to get access to those programs.

Already teens are using twitter, Facebook and 4chan to post bomb threads, announce their plans of killing people and to post nude selfies of themselves and their friends. The Internet is full with teens doing bad things online and teaching them to program teaches them to become better at that, too. Learning them to program will make it easier to find top talent amongst them but not all will be top programmers. Some will be top hackers. It’s a double-edged sword, cutting both ways.

Teaching children to program can be fun if they just learn to program devices. For example, Logo would be great for them, since they would learn how to program a computer to make interesting drawings. There’s this nice Interpreter for them to learn so all they need is a web browser that can handle HTML5. It could also be interesting to teach them about Arduino boards with additional hardware so they can make simple robots and learn programming using C++. But please avoid children making web applications because that is way more serious. It will expose them to hackers who will try and destroy their work. It will expose them to some influences that they might not be ready for at that moment.

So, I am in favor of children learning the proper way of programming and allowing them to start with small, simple things at first. Preferably things that are not on the Internet. The Internet is really a more adult environment, like a busy highway. Without proper supervision and guidance, things could go horribly wrong.

For example, your child might see her site replaced by a video of the beheading of some prisoner by some terrorist organisation. Or she notices a banner on their site leading to hardcore porn sites including bestiality and gangbanging. Hackers can and will do such things if they get a chance.