Unit Tests

I don’t understand unit tests. I’m getting strong de ja vieu from my earlier posts on object oriented programming which I am just starting to get a handle on. Unit tests are a highly contested from what I read on the internet … but what would the internet know.

So what is a unit test? The short answer say you have a function, here is a super simple one a function that takes in a number and returns the number multiplied by three. Ok so your unit test would be something like double(3) = 9. So if you put 3 in and you don’t get the answer 9 the system throws a warning telling you that you need to fix what some idiot had done (you may or may not be the idiot, unit tests do not discriminate).

So that works right. That make sense! Ok so how do you test and object. Lets think about this lets make a variable which holds the double class; number.variable = 9. ok so stuff is still working but how do I test if a visual element has been made? How do I mock objects. Where do I start and why should I bother? Or even worse what happens when I start querying the database?

Unit tests are very important for continual integration, as that is not something I know how to set up or maintain I suppose this hinders my desire to do unit tests.

Should I even be worried about doing tests? This one I am not so sure about. Like I have said many times I don’t see myself as a programmer so I don’t really see an advantage in learning how to write these. In my own software build I am manually testing a lot of the functionality and this is partly because I don’t know how to make tests but partially because I am still very much learning how to program so I need to see the cause and effect between what I write and what it does.

The next thing ill have to learn is how to do de-bugging. Still have no idea what this is or what it does. By now you will be thinking I must be the worst programmer of all time and you would be right. I know there is something about break points and tracing stuff back but that is about it as far as I know.

Lastly I have been thinking more and more about using the application to learn more ways of achieving the same result. So in the future I think ill change my super simple SQLite database that works perfectly well for what I want to something like MongoDB. Why? Because its hard and then I would learn how to use a NoSQL solution to get the same result. Currently I don’t know how I will implement this but I suppose that is half the fun.

Well back to trying to get this thing working for the first time 🙂


Back to the binary mines

So anyone who follows this blog will notice it’s very patchy as to when I write. The short answer is I’m very busy, currently I am in full time work, doing uni over a summer semester and attempting to learn more about databases in my spare time. All this tells me is that I need to sit down and focus on the weekends.

My current coding project has been put by the way side but I still want to complete it even if it never meets my original goals. Something I have found amusing is that I opened up my code after a three month break (way too long I know) and I can still read it. I attribute this fact to how many comments I write. I use PyCharm as my IDE for my current project and it enforces PEP8 which I strangely find a nice feature. Who knew that having a program constantly nag you to write comments and leave spaces would be helpful. So my code is littered with descriptions of what things do, that in conjunction of learning how to do object oriented programming a little better (I’m still terrible) means I am spending a lot less time tracking down variables and what classes and sub classes do.

My future plans for this program are to open source it and use it as a base to rebuild it again but with an online form. Part of my degree has been web design and cloud computing, because of this I want to get a better handle on NoSQL databases as I feel I will have to work with these systems at some point. While the type of data I’m using isn’t really suited to a NoSQL database I still think it will be worthwhile to learn these systems above and beyond reading about them.

While working on this program it amazes me how many programs you were once able to download and install are now online apps. While this is not inherently a bad thing and it certainly allows me to not install cruft onto my machine, I have to admit I get annoyed now with having to create an account or deal with slow loading times and advertisements. I understand there is a huge gap between the type of stuff I’m doing and commercial products and the complexity of their work must be commended. But I do feel a little sad for the days where I could use a program locally and natively on my system. I think a large part of this is to do with the fact. But I do feel a little sad for the days where I could use a program locally and natively on my system. I think a large part of this is to do with the fact that running apps online is platform independent and now we are running so many platforms this can be a huge advantage. But for my quaint little project that is essentially a learning experience I have to say I’m having fun with making a windows only program.


How is an it project built? No body really knows. I have a problem with how Agile Methodologies (grammatically speaking it should be method but we are IT students not English majors) are taught at uni. I don’t blame my lecturers … directly. Industry says “We use agile, we want students to know what agile is and how to use it.” Uni then creates courses that cater to teaching agile which is on balance a good thing. However agile methods are described as best used by senior developers who know what they are doing. Uni students have no idea what they are doing.

The other thing that agile relies on is communication. All projects require communication but when you work on an agile project you are expected to be in daily communication. Now for the modern uni student your week consists of eating, sleeping, working, going to lectures, having a heart attack about that assignment which is due next week. Occasionally I will concede that that you will sit down and watch a movie and feel terrible for the rest of the day because of it.

A bigger detracting factor perhaps is how many mini milestones and marking criteria you must complete. Agile at its core suggests that you build functionality over documentation which is something I think makes a lot of sense. When you add in all these criteria of Design briefs and UX goals that must be submitted with deadlines and then you tell your class that they wont be marking some of these but you will have to mark each other the whole thing smacks of laziness and doubling up on our workload.

What do I mean by doubling up the workload, the course in question has to have something to mark, that makes sense. But you cant just mark the project because they don’t really have the time or office space that is usually associated with a project so we will do the normal thing of they have to produce a document. Generally this leads to the group splitting up its task into two main camps things for the project at the very end of the course to show to our real client (that we see once every 2 weeks) and tasks that have nothing to do with our project but are needed for marking.

It’s not all doom and gloom, you do end up learning some skills you didn’t think you would. As a for instance I am doing the database and whatever else I can help out on. I am learning a bit of Laravel as it will interface with my database quite a bit this is good. Other skills I am learning are what does the international student mean in this paragraph. Who to yell at for not doing the weekly blogpost or reflective journal. And how to avoid facebook… more.

The problem here is I dont know how to fix this situation. I can imagine a scenario where our course co-ordinator sat down long and hard and wondered if this was really the best way to do things. They probably concluded that this was not really the best way to run a course and get the most learning out of it. Then they probably looked a re-working some of the assessment pieces then found out that if they changed anything it would then require an exam at the end of term. Also the project could not be used for anything because of some arcane rules put in place by the university administration to make sure that their global ranking stays where it is.

There is no real solution to this one as far as I know, I just wish they would slow down on telling us how we are learning agile and how it is so important. From my perspective I am just doing another course which mimics the real world enough to get by but not enough to really help you if you are in that situation.

High Workload

As mentioned I have been very busy with Uni, One thing that I have found is that I have no time for video games at all. This is not the worst thing, I probably played too many games anyway. However I have a slightly different perspective on my life at the moment. This perspective comes from a place where I have almost no free time, this is quite sad however is a choice I made and felt that I may be able to handle such a thing.

I have worked full time before and lived the time constraints that puts on you, however that usually has the advantage that when you finish work you no longer need to worry about it. With Uni you can never stop, there is always something that you can be doing, something to review or re-write. Learning is a long and slow process for me but it is also rewarding, learning is a lot easier when you are doing something that you enjoy rather than something that you are forced to do.

What gets me though learning some of the things that I dislike is having an end goal in sight. I theoretically am in the last twelve months of my degree and I want it so bad so I can close a chapter on my life. The desire to finish my degree outweighs how much I don’t care about C# or Java or Microsoft Access. That lets me sit down and study for sometime, while not the most effective method it means that I can get though subjects that I need to pass my course however do not like in the slightest.

Speaking about learning stuff, in the last week I have completed an assignment in Visual studio. While I found this a very complete solution for building a website you are able to very simply call info from a database or save it. Handle internal logic using C# instead of PHP or having to install anything else onto a server. While you shouldn’t expect to see my personal website transitioned into C# any time soon there would defiantly be advantage to it.

Another of my courses is COMMS1000 I chose this because I like analysing text and it may give me a chance to brush up on my English. Sadly I am regretting it, I am finding it a very pedantic course where the definitions of ordinary words like “Stereotype” are over analysed. I understand why this is a necessity but it is frustrating trying to limit your tool set of analysis to metonymy, paradigm, myth, stereotype and symbols. While you must start at the start when analysis it feels a little constricting to limit ones self in this way.

Lastly I have been doing a lot with group work, as every Uni student knows group work is rarely good. There are many reasons for this; personality clash, different expectations, the guy who always asks questions instead of doing work, the list goes on. While your lecturers will talk at length about how to resolve there are three basic strategies. One try to become friends and leverage that against work. Second try to create a new enemy (the assignment) to work against. Third get angry, tell on them using your tutors. The last is the last resort but unfortunately it works. The problem is most of the times when you are doing a group assignment it is so you get some industry experience in working as a group, the problem is the power dynamic is completely different with the real world. In a real job you will have to do tasks in a group where someone has more power, more resources and ability to requisition where other members do not. This is a huge difference that education has not found a way to emulate.

So that has been my week in a nutshell. Hopefully next week will be less stressful.

Microsoft Heavy

So this week one of the new things I have been playing with include Microsoft visual studio and Windows 10. So it has been a very Microsoft heavy week this week, and I must say I’m not regretting it. Microsoft has copped a lot of flack over the years and a lot of it has been deserved, I can’t say I liked the Ballmer years very much but they are now over. Windows 10 I would say to many people is a modernisation of Windows 7, and there is nothing wrong with that.

Windows has become very familiar and safe to a lot of people. While OSX offers an environment where people feel they can do no wrong, Windows offers an experience that is the same as always until you start playing. Everything is just a little more integrated now, while this can be a little scary and I highly recommend that you turn off some of the internet connected options, like websearch for the start bar. Overall these features make the whole system seem faster and more productive, like my Skype account knowing who I am because I logged in with my Outlook account.

While I still hate apps, true to Windows form you can mostly ignore them. I have Windows 10 installed on both my laptop and desktop computers now and I can tell you there are few things more annoying to me than an app locking you to one screen when you have a dual screen setup. I just find the apps generally to be inefficient when considering multitasking and I absolutely loathe when I accidently open the app version of one note compared to the full version. The app only loads pages on demand so I am waiting for them to download and the menus are drastically simplified which makes it annoying if I want to do anything like math (yes I use one note for math).

Overall my transition from Windows 7 & 8.1has been very smooth and generally uneventful. There have been only two issues that have really bothered me, firstly on my laptop as Windows keeps wanting to update to the latest drivers. This is great except for the fact that the latest synaptics touchpad drivers have a glitch where on some models (mine included) you can’t change the defaults so my touchpad is stuck with reverse scrolling enabled. Secondly on my desktop for the last week the numlock has been disabled by default. THIS IS UNACCEPTABLE why would anyone ever want to turn numlock off? I can think of no reasons at all. So I had to as the internet for help, open up regedit and change a default and everything seems to be fine now.

As mentioned earlier the other thing I have been playing with this week has been Visual Studio. This is another thing I have been avoiding for the longest time. I remember playing with visual basic more than a decade ago and it wasn’t what I would call an easy or refined process, to be fair programming is rarely easy or refined. Visual Studio is like Visual Basic except it has more. One of my courses this term asks its students to use Visual Studio to build projects that are dynamic websites. I am not exactly proficient with PHP so it was off putting, however when the project half built itself and I saw that JQuery was already installed for the project along with Bootstrap I suddenly felt like I was in more familiar ground. As mentioned I am not a huge fan of object oriented programming I have become a little better as I have been doing more with python in my private projects but I would still say I am not very accomplished with it. C# is heavily OO just like Java and this is very daunting for me however how ASP passes information through form its aspx files its cs files makes things very easy for me to follow. There is a whole system where each element of a website has its own code file attached to it and you can push the variable values to it and back again though the use of div ids. This may sound a lot like JavaScript to you and in many ways it is however in reality it allows for server side processing but lets the pass though happen easily.

The true brilliance of this is that once you know how to do the C# processing you can use the same code with a desktop application. I could be wrong about this but I am of the impression that this also is able to be used in phone app creation as well though the use of Xamarin. Version control is a breeze as you can link to your github account natively though Visual Studio. You can also link to a Visual Studio or Microsoft Azure account to back up or even deploy your project to. This is the sort of integration I was talking about before I can literally work on a project and once I’m happy upload to Azure servers with no mucking about with making sure the database is installed or that your framework is set up properly. Generally speaking if it worked for you locally once you push it to Azure it all works as you have seen before.

While I will continue to learn this for my course it has made me tempted to use .net systems for my personal website but we will see how I feel once I have enough time to delve into all of that again.

New Learning

In the last few weeks I have been learning a lot and fast. Firstly I have got basic functionality working in the filmophile project that I have mentioned before. Programming for me is very much dominated by the eighty twenty rule. It takes twenty percent of the time to do eighty percent of the work required, the remaining twenty percent will take eighty percent of the time to do. So while I have got some really good basic functionality happening it will take a considerable amount of work to make the program feel finished.

A new problem encountered with this project is that I now want a complete UX overhaul. My project is being built in python 3.4 with Tkinter as it’s GUI framework. Tkinter is very good at allowing you to quickly prototype a UI for your project and for the most part it works well. Tkinter is a well-established and refined framework it often lends itself to designs that were popular in the mid 2000’s. To cure this I think I will ask one of the people working with me this term on the group project at university to look at the project and advise me.

Other things that I have been learning about is 3D printers, there is a lot to learn. The first thing to know about any 3D printer is they are fun. The second thing to know is that you can build practical things with them but you may have to bend your mind a little to realise it. Unfortunately when you first start looking at 3D printers you probably would have seen some amazing works of art and inspiring bits of engineering but you must remember it takes time to perfect printing. While it is very easy to get started with a printer and get something useful out of it, getting a super smooth great looking print will have some learning curve to it.

I hope soon to have a very solid grasp of how to make a clean print in many filaments and hopefully a very good understanding of the mechanics and maintenance of 3D printers. There are many elements that go together to get a printer working. From the model to slicing it, heated beds and extruder temp plus more, there are a lot of elements that need to work together and understanding them well only comes with experience.

All of this learning takes time and while I am most defiantly enjoying it I fell that I need to dedicate one day a week to nothing. Willpower is a finite resource according to Scott Adams and giving myself a day off can make getting all of my uni work done that little bit easier. While I have less time to do the work in, focus is easier when you feel well rested.

I will have some pictures of the projects coming next week when I feel that I have refined my ideas a little more.

Holiday week 2

So it’s toward the end of week two of my holiday, what have I done. The short is not as much as I would like and yet more than I intended. In the first week I had some visitors to catch up with, this was very fun and involved leaving the house which I found novel. Last weekend I went camping with an old friend on his family’s property which is something I have not done in years. While not considered productive it was a well earned break and good to catch up with some people I have not seen in quite a while.

But since I have returned home I have had to check on university enrolments and making sure my course is on track. Meeting with an academic advisor is something I would recommend to anyone who has any insecurities about their course. For me I wanted to make sure that my selections would count toward my degree, I received helpful advice about how I was over complicating matters. My University has a couple of “free electives” which don’t have to be related to my field of study. This is something I didn’t know, the advisor was surprised at some of the peculiar choices I had made and suggested some more diverse subjects for my last year. This has greatly lowered my stress in course selections and I am now on the hunt for a photography related subject.

The second time consuming task I have given myself is working on the Filmophile project that I mentioned in last weeks blog. This is turning out to be a fun and challenging project while currently I have been having issues with what I want to do with the UI. This is a two sided problem as I don’t feel my UI design skills are particularly good and I am using Tkinter for the UI design which is notorious for looking pretty bland without considerable skill. Part of me would like to change the project to WX.widgets or QT but I have not used these before and would require a lot of work o do so from this point. So for the moment I think I will keep on working with Tkinter and see what I can make and only when I have a clear and solid understanding of what I can or cannot do will I look at moving across to another system.

A large part of the reason for creating this project is so I get some experience with creating and maintaining a database. The database in question will hold the information for the combinations of films and developers for Black and White film processing and the time it requires for the combination to give an optimal result. While I have already started this soon I think I will launch a google form asking for more times from users as I have so far been building this database from times I can find from the manufacturers websites. While this I feel is good from the perspective of getting one version of the truth many photographers have created their own methods that give particular results and I would like to include these if the photographers in question are willing to share.

To facilitate this I will create a google form and try to pre-empt all of the things I will need to know to successfully add these to my database. Unfortunately using this method I will still have to manually transfer this information to my database. This however does mean I can check and curate my database as entries come in.

This leads to the final item I have been thinking on is licensing and IP. The reason why I am asking users for their times and using those supplied by manufacturers is while there are some other repositories of times I am of the understanding the compilation of this kind of information would be a form publication and thus have its own copy write that is owned by the compiler. So building my own would be the simplest solution rather than trying to convert someone else’s work and seeking their permission. However once I get this information how should I licence the project as a whole, one part of me feels that the simplest solution is to use GPL v2.0 or MIT licence so everyone can use the code and modify it to their needs but this would mean that everyone would see my very amateur code and I would have to publicly host it somewhere. At the same time selecting a closed source licence seems against my plans of letting people use the project. Finally a small part of me would like it if I could make a nominal amount of money for the project even if that is just by donations. This comes from the perspective that I have already spent a lot of time on the project and while it is primarily it is a showcase of many of the things I have learnt while at uni part of me still feels that it is a measure of success or validation if someone was willing to donate money for my creation. Also I have no idea how to set this up or claim it on tax so maybe its better just to leave the whole thing free.

I will look into these issues and see what I come up with.