Node Js

 

a departure from what is normal, usual, or expected, typically an unwelcome one

Aberration 

This is not meant be an insult or even a critism but more just a statement of how it probably is. It’s also not necessarily a bad thing although the use of the word aberration usually is as the the second part of the citation above states.

Node started off as a neat attempt at solving concurrency problems. Mainly, I think, due to the popularity of JavaScript and ease of adoption, it has snow-balled and in London at least, it seems node skills are very much in demand.

Ryan Dahl himself has said that he left Node behind as he felt that golang provided a better solution the issue of concurreny: https://medium.com/@imior/10-things-i-regret-about-node-js-ryan-dahl-2ba71ff6b4dc

Perhaps if he stayed in charge of the languages development things would be different but I'm not sure if that would be for better or worse. From what I understand Ryan was for callbacks and against promises. I think he has since changed his stance but from what I read, there are still a minority of node developers who believe node should be callbacks alone and if you organize your code correctly callbacks are easy to read – perhaps they are right.

Both callbacks and promises seem very unintuitive to those not used to them and fit with the term abberation in that you need to think differently to the previously traditional ways of doing things. I have been happy to adopt async await as I am pretty comfortable with that from C# at this stage.

It is probably fair to say that Node and JavaScript don't represent the safest way of programming though. Dependencies seem chaotic at times. Package lock was introduced to make things better but is it's own special brand of chaos. Many of the packages up there seem to be well intentioned but maybe lacking in let's say 'polish'.

I think Node has helped a lot of people to get started with programming as it is so easy to get going. Issues are being ironed out as I speak.

JavaScript is the language of the browser so designers and people with a little coding experience are able to get more easily involved. In many cases the role of designer and developer have probably merged and I think JavaScript is partially responsible for this fushion of skills, although languages like PHP existed before and arguably have the same properties in terms of ease of use and learnability.

This is good and bad. There is more code but the code is not always better, and the problems tend to come further down the road. The point is though, Node and JavaScript have influenced the industry a lot. As well as getting more people involved, it has probably influenced the way other languages have developed, see C# and NodeJs – a brief comparison.

I’ve been programming with Node for 5 or 6 years (on and off) now and Javascript longer and I appreciate some of its advantages but I also see and understand a lot of the issues it creates.

 

 

Messaging Systems

Intro

Why use messaging at all ?

Recover-ability – if all else fails hopefully you will still have messages and once normal services have been restored, then you can proceed getting your systems back online, hopefully with minimal damage done.

Dealing with spikes in traffic – you want to make sure that you systems can handle load above it's capacity even if takes a long time to process each message.

There are probably other reasons also but those are two main ones I can think of right now.

Options

I have used a few and here is a brief discription of each and a comparison of their value. 

RabbitMq

Rabbit is written in Erlang. It is an interesting language and has the following characteristics, from wikipedia  – it is functional, fault-tolerant, highly available, soft-realtime (soft means tolerable if there is a delay in processing): https://en.wikipedia.org/wiki/Erlang_(programming_language)

It is also known for it’s pattern matching capabilities which I guess are useful with topics (more later) and above all I guess concurrency is it’s principal strength – which is great when you are dealing with millions of messages.

I once spoke to guy who programmed in Erlang and he seemed so engrossed in the language that I am sure he swapped English for Erlang and was speaking to me like so.

It uses a protocol called AMQP.

It also has many client libraries in Js, C# and many other languages which are pretty well implemented. This shouldn’t be taken for granted!

Messages are submitted to exchanges and queues are bound to the exchanges. You can have one to one relationships or indeed one to many.

Topics

You can submit with topics which ensures only the consumers with that specific topic receive those messages.  Subscribing to the relevant queue with the correct topic ensure that you only get messages you desire.

You can host yourself or use something like cloudAmqp.

SQS

To SNS or not to SNS

This is Amazons messaging system. Can be used in conjunctions with SNS or on it’s own. When used with SNS – SNS works as a sort of exchange and SQS as the queue.

SQS uses standard http underneath and offers a polling model for subscription. Is a little primitive in my opinion. The client libraries are also pretty basic although people are starting to build better libraries on top. With dotnet as an example though, easynetq is much more complete than any client offerings in SQS – we have had to essentially roll our own.

It’s not as sophisticated as something like RabbitMq. It’s strengths lie in it’s simplicity and it’s ability to scale, also the fact that hosting is taken care of by aws means we don’t have to worry about that side of things and also that it plays well with other AWS technologies such as lambda Dynamo db.

JMS

JMS is from the Java community and is an API specification as opposed to a protocol like AMQP. It can use a number of different protocols underneath – we use tcp in our implementation.

Coming from a dotnet background I found it a little difficult as had to consume using a c# library called NMS.

It has various implementations and the one I used was called ActiveMq. It us open source and relatively easy to install although creating and consuming messages is a little trickier.

Summary

All three options are useful depending on your needs. Rabbitmq probably has the nicest feature set but is not the easiest to get setup and started. Sqs is a better option if already using aws and I guess jms / active mq is nice for those who use Java. 

There are other options also such as Kafka but I would encourage you think if you really need the complexity of a messaging system before implementing as it does add it's own complexity.

Up the Deise !

Roy Keane once said Irish by birth, Corkonian by grace of god boy! I’m from cork myself but I have mixed blue blood in that my father comes from just outside the Waterford border in Tallow.

He is a keen supporter of the hurling and in particular the Waterford hurling team. When I was younger despite protesting that I was from cork and that I should be brought to see Cork play, I was brought to all the Waterford games instead.

This was in the early 90s and Waterford were not as good then as they are now. I remember dads clinched fist rise though when Waterford scored a goal better than anything else. I was quite young then but old enough to sense that it meant a lot to him.

I live in London these days and living abroad probably makes you more aware of where you come from in a sense. Ireland and the UK are next door to each other and so there is a keen rivalry when the two play in sports. It’s not particularly enjoyable to have to go into work surrounded by supporters of the other side either following a devastating defeat at their teams hands. Living and working in Cork all his life meant that dad has had to face the music on probably more than a few occasions but is fair to say he had last laugh (for the day) a few times also.

Also being married to a serious cork supporter was probably going to focus your supporting game. I’m not saying anything in particular only that a few flags have been known to go missing from time to time and accusations of unsporting supporting behaviour have been mentioned in the past also.

I also think that losing makes you a better and more loyal supporter. I don’t know why that is but I guess it proves you are there not just for the good times. Waterford have had their fair share of wins and losses over the years but there is probably no team more deserving of an all Ireland win in hurling the Waterford. Galway are funnily enough an other team that spring to mind, but I think no one would begrudge either side winning – even a Cork man close to the border.

There were so many great Waterford players over the last 10 years. Paul Flynn, Ken McGrath, Dan Shanahan, John Mullane and Tony Browne. I won’t say it is a crime that they didn’t win an all Ireland because crimes are for more serious matters. I won’t say tragedy either because no one died and it would be more of a tragedy if we started think like that. Sport should be for enjoyment alone – no room for tears. It is a pity though that they haven’t won an all Ireland at senior level since the 50s.

This is not the case under age though. The younger players have experience of winning and I think this shows in their play. Dan Shanahan seems to be doing a good job of adding his experience from the sides. So hopefully Waterford will have their day this September, they deserve it and so too does my dad!

When your 3ds freezes

I bought my 3ds about 5 years ago when I first moved to London.

Unfortunately I thought it had cooked it today when after searching high and low for it, Lex found it in the freezer! Amazingly it survived 24 hours at sub zero conditions.

I put it up on the radiator to taw it out and let it dry. I then googled ‘frozen 3ds’ to see if anyone else experienced the same thing and to see if I could find a prognosis. Then I have to admit I was surprised when I powered it on that it still worked!

I bought it from game around Oxford Street – which is one of the busiest shopping streets in world. It has been a great companion to me and has seen me through tick and thin. I feel it’s one big sign of wear and tear – it’s crack on the top right is a testament to what we have been through together.

For those who don’t know – a 3ds is the latest in the line of Nintendo handheld consoles which originated with game boy (or at least became famous). The switch is out now and is also portable and I’m planning on getting one of those at some stage but I still feel a connection and strong bond to my 3ds.

I bought mario kart first, then street fighter. I really got a lot of value from mario kart and played street fighter a little also. Then – I don’t know the exact order but I think it is…I got ocarina of time which is my favourite game of them all. Followed by majoras mask and possibly lylat wars. I got a link to the past and new super mario bros.

Lately, I have gotten into the virtual console which is all the old Nintendo games rereleased.

I was half way through Zelda links awakening, so am happy that i’ll get to finish that out! Nintendo games age so well.

So if you have frozen your 3ds and are wondering the chances of it working again then know that it did for me! I would leave it thaw out well though before switching it on and make sure water has evaporated.

I visited Turin recently, it is a lovely city. My wife wrote about it and you can read about it here.

I have always liked the title of my website only sometimes I think that I might change it to something more positive in the future.

Starting your website with the word “no” might been interpreted as negative when really it is just an acceptance that it is not easy to find a good web address today that is free.

There are also a lot more domain extensions available today also such as “.me”. I think I’m really saying I had fun with nogoodurls maybe now it is time to change!

Aws Musings

I wasn’t sure what to entitle this post – I woke this morning with a sort of an urge to write about Amazon AWS and my experiences developing applications and using its tools to this point. So I settled with the above.

I guess I have been using aws for 4 or 5 years now and have used a wide variety of the tools on offer. Initially, like a lot of people I could appreciate it’s advantages in terms of flexibility and scalability but what I realise more and more is just how it spreads beyond that.

I have been using lambda quite a bit recently and sns and sqs also. They give you great control over your costs just like ec2, autoscaling etc. Likewise dynamo dB. Balanced against that though is the old ‘with great power comes great responsibility’ Peter Parker chestnut.

It is possible to get your auto scaling wrong and end up with far too many server instances. You also have to be aware that you get charged for polling messages in sqs, long polling helps with this but it’s not default. There are many pit falls and it is worth bearing this in mind before you go too far down the AWS path. S3 costs can really mount also if you are not deleting.

The point is though it means developers need to be more aware of costs than before as they have direct control over that – so I think it changes your role a bit and the things you think about from day to day. I guess in the past there was still a lot of input from developers on software and infrastructure selection and it’s costs but not to the same degree.

Another thing I found or maybe not found is documentation. AWS has grown rapidly and it does appeal to our imagination in that things like lambda bring a certain amount of excitement with the thought of the possibilities but the other side is sometimes I feel like shortcuts have been taken.

Documentation is probably one of the first things to go when time is of the essence. There is a lack of it when it comes to AWS in general, particularly with some of the newer technologies.

Stumbling on

I have supported Liverpool since the age of 11 or 12. In Ireland, at least when I was growing up everyone supported either Liverpool or Man United. So a premier league ‘derby’ in Ireland was Liverpool VS United. Many of my school chums back then initially supported Liverpool but then as the balance of power shifted towards Manchester there was a slew of transfers in that direction!

I kept the faith though, I suffered for a lot of years and in many cases on my own. I did my part with regards recruitment – I signed my brother Gerald and sister Betty (whom I don’t even think liked football) to the cause, I think I also converted my cousins in West Cork, or at least had a positive influence on them. My youngest brother Liam was allowed support United as I thought it was healthy to have a little rivalry in the house and I think I felt like I had done my bit. Liam lost interest anyway but I’m still a fan, though my interest has waned at times.

I remember listening to the crackle of 5 live and Alan Green on my dads radio with Gerald (my brother), often in the middle of winter. We couldn’t hear a thing and the noise always seemed to got worse when the action happened – ‘Gerrard…great pass..to Michael Owen..now…..tackled by Hen..Beckham….Robbie Fow….’ and then an explosion of crackly noise! You knew something had happened of significance but you weren’t always sure what it was, but it was the worst kind of torture because you were never sure which team had struck the mortal wound to the other! These are nice memories to have looking back really and I do value them but I think, still we did suffer for our team!

I also remember being told to grow up by mum when Man United beat them in the FA cup final – she could never understand my sorrow. I was 11 or 12 but it was the last time I cried about football because I think I soon after realized it was only a game. That is kind of my attitude to this day – I love to see them do well but I don’t get too upset when they lose.

And I learned from one of the best supporters of anything in my dad. His sport is Ireland’s own indigenous hurling. It is a great sport and I think soccer could learn a thing or two from it. It is full of passion, love of the game, but also loyalty. I digress slightly but my dad loves hurling probably more than he loves me and he definitely loves Waterford more than he loves any one thing in the world. It really affects his mood though and the Monday after Waterford have been knocked out of the championship is the end of the word – for everyone. I don’t think it is worth that anymore.

So I learned from watching him but I also learned from my own experiences. I remember going to Anfield for the first time with another massive Liverpool fan – my friend Anil. We came over from Ireland assured our tickets were in place but when we arrived it seemed like something had gone awry at the ticket office and our entry was in doubt – I couldn’t believe it after coming all the way over – I think if I didn’t get in that day it would have ended my ties with the club as the taste would have been too bitter!

We got in at the last as the confusion was cleared up – it was really only on Anils clear head and thinking though. Once we got inside we headed straight to the sidelines to get as close to the players warming up as we could and there they were, all the lads; Stevie, Pepe, Crouchie. I felt like waving at them as I new them so well. It is the strangest kind of feeling but then you realize and remember that they don’t know you at all. I thought there was an unhealthy unbalance in this relationship and I think it sunk home then a bit. One way relationships are never good.

None the less I really enjoyed the experience and was happily able to return the following year with my brother and I think my support levels recovered a bit. It was the era of Rafa Benitez and Liverpool were really good – they got to two champions league finals, winning one and became the top ranked team in all of Europe at one stage. I got carried away – we all did and I remember not getting too excited by them winning the FA cup. It seemed like a matter of time before thy won the league and ended the wait. Then it all fell apart.

Xabi Alonso left for Real Madrid. To be honest I think his loss was as much psychological as anything else as he grew in reputation as a player with every day away from Liverpool. I blame the fans – they lost faith in Rafa and the team. Things went down hill quickly, Roy Hodgson was brought in and to be fair he never stood a chance. He got a few months but everything had got so negative it would have been hard for anyone.

King Kenny was brought in to save the day and results picked up for a while but it didn’t last and the final nail in the coffin was hammered when Fernando Torres left. I’ll not talk about Fernando as his story is a sad story and every one knows it. That was the worse moment for me as Liverpool supporter – it was et tu ‘El Ninio’. You are leaving too. A part of Stevie G died that day and apart of the Liverpool in me died too. I don’t know if I will ever get that back.

I felt like I have been through a great many highs and lows as a Liverpool fan but I think I will always support the team. I think though at times Liverpool (and other clubs doubtlessly) take supporters for granted and should give more back. I live in London these days and try to go see them once or twice a year. You need to pay for a membership before you any real chance of getting tickets though and basic membership is around 26 pounds. I got a membership for both my brother and I this year and made the mistake of telling him that I was gonna get tickets for both of us an Xmas present.

I was gutted when I logged in on sale day to find all tickets had gone! I was disappointed to have to tell my brother that I had failed in getting the tickets but I was a little angry and disappointed with Liverpool Football club too. I wrote to them asking if I could transfer my membership to next year as I had little need for the membership this year. Despite persistence I was repeatedly told what felt like ‘computer says no’. I was angry because I felt that Liverpool were using my loyalty towards them against me, assuming that I would sign up again next year regardless. I guess they think, what is he going to do, support Man United? – ha ha ha. I wouldn’t do that of course!

I think if football clubs are to continue to do well they need to support the fans back. There ticketing policy doesn’t seem wholly fair and I think it needs a review. I have invested a great deal of time, money and emotion in watching and supporting my team over the many years and I think I should be seen as more than just a customer. I don’t expect Stevie to come over or wave at me when I go to a game but I expect a little bit more back from Liverpool in situations like this where I have spent my hard earned money and to no avail.

Sterling Effort

I think the coverage of Raheem Sterling’s reported decision to sit out England’s qualifier was unfair and very unhelpful to the English team, British football not to mention Liverpool.

He is still very young and as one of Liverpool and England’s outstanding talents he should be protected. Statistics have shown that he has played a lot of games and he probably did feel that he needed a rest. Whether he was being over cautious or was in fact need of rest, I believe the issue should not have gotten the coverage it did.

It is negative and must be massively distracting for everyone involved. Hodgson is getting criticized for disclosing that it was Raheems decision not to play, Rodgers and Liverpool are being accused of putting the idea in Raheems head and being overly protective of their players and Raheem is being painted in a poor light also. The player’s focus should be on helping his club and country – how can it be with all the nonsense floating around his head.

A lot of older senior player like Frank Lampard and Rio Ferdinand backed him and said that they thought he was brave and I agree I think it showed courage to admit that he was tired and couldn’t help the team and in fact would probably would only injure himself. I think to be be honest he might have shown a little bit of innocence but even at such a young age I would guess he knows his body better than anyone else and his opinion should be respected and I think his honesty should be also be respected.

I do think that Hodgson will regret having handled the issue in the way that he did. People should realize also that the media looks for controversy and don’t always have a vested interest in the truth. The truth is Raheem Sterling is a great player and should be protected and encouraged – like all young people.

It will be interesting to see this weekend how he deals with it. Hopefully he bangs in a few goals for Liverpool against QPR!