Posts

Showing posts from August, 2018

Game of life. C# console application

Image
Game of life is a zero-player game as we can read in Wikipedia  It's quite amazing that basing on simple three rules there can be life simulation created. This gives imagination a jug what other rules crates life and what is a definition of life. Yeah it's a philosophical discussion but it's also a programmatic one. TL;DR; Most implementations that I found in west of internet are the ones based on two dimensional tables (in C# arrays). But it start me thinking, this is the simple solution but it's restricted with  some space - and it's consuming all the space. So life and it's absence consumes space. Well space is cheap. But I don't like limitations, It was always strange for me that in computer world silence stored in computer also consumes a space. It's kinda illogical to consume space for life absence or silence. That’s why I wanted to implement the second available way to implement the problem. Wikipedia says: "Alternatively, the progra...

Mobile view lifecycle. Fixing Xamarin.Forms Page lifecycle

Image
For mobile applications the highest priority is user. What user can see and interacts with. Application should react not only on user interacting with it but also user interacting with operating system. That's why not only application has it's own lifecycle but also "view" has it's own lifecycle. In Android view is represented by activity, or a fragment (the right side of android diagram). In iOS view has it's own set of lifecycle methods. In both cases view has the information that application(in this case view itself)  is being suspended and reactivated. View know quite a lot about outside world and view lifecycle is very similar to application lifecycle. Compare below first application and then view lifecycle diagrams: In Android view is represented by activity, or a fragment (the right side of android diagram). In iOS view has it's own set of lifecycle methods. In both cases view has the information that application(in this case view itself)  is...

Mobile application life-cycle Android vs iOS vs Xamarin.Forms

Image
Lifecycle. One of the most common recruitment questions. No matter what technology you work with this is something that should be well known and understood. It's good to know how application behaves, what it is allowed depending on its state and when to react on specific lifecycle events. In mobile world lifecycle is even more complicated because there is no 1 answer but 3 in this case: Android. iOS. Xamarin.Forms. I use also Xamarin.iOS event names in my diagrams, but the sequence is the same. Lifecycle is the definition when your application have access to resources and when react on state change. For mobile the biggest priority is what user can see and interacts with, so active application have priority in using system resources. System has limited pool of resources, so  applications running in background (not visible to user) is limited by system in how much resources can it use and also system decides when application needs to release all resources (be closed/killed/end o...