JavaScript loop and object iteration (optimization)

Reading Time: 3 minutes

Nowadays, it’s interesting that loops become part of our life as developers and we use them at least one time a day. Because of that, one day I decided to investigate and go deeper into JavaScript loops, where I found very interesting things and if I do not share them with you, I am going to feel guilty.

Before you continue reading, I would strongly recommend you to read my previous blog which I believe you will find very useful to create a full picture of the loops. So, go on and read it.

Object properties iteration

Let’s first analyze object iteration and suppose that we have an object, something like:

var obj = {
    property1: 1,
    property2: 2,
    …
}

First, what comes to our mind is to iterate them with the standard for each iteration:

for (var prop in obj) {
    console.log(prop);
}

In this case, we are going to iterate through the object properties but is it the correct way? The answer is yes and no, depends on your needs. Another way to iterate trough is to exclude all inherited properties, which in some case we do not need. So, we can exclude them by using the JavaScript method hasOwnProperty(). You can find an explanation about in operator and hasOwnProperty() in my previous blog.

Since we learned some object optimization/improvements/usage, now the question is, can we really do an optimization?
The answer is yes. Before I am going to show you how we can do that, let’s spend some time on the loops.

Loop iteration

In order to continue the previous example, I will continue explaining the loops with object iteration (of course you can test it with a list of integers like the speed test examples or anything you want).

To accomplish that, we will need the JavaScript method Object.keys().

  • Object.keys() method returns an array of a given object but only the own properties of the object

Let’s write the standard for loop:

var keys = Object.keys(obj)
for (var i = 0; i < keys.length; i++) {
    console.log(obj[keys[i]]);
}

Now we have a solution where we decreased the iteration time by eliminating the time for the evaluation `keys.length` from O(N) to O(1) which is a big time saving if we iterate big arrays.
So, during the development, if you are not limited (like applying some best practices,…), you can add another optimization, by using while loop.

var i = keys.length;
while (i--) {
    console.log(obj[keys[i]]);
}

In this case, we do not declare a new variable, we don’t execute new operations and the while loop will automatically stop when it reaches -1.

Speed testing:

Since the new browsers like Chrome are very fast and optimized, in order to see the best speed differences, I would suggest executing the loops on IE where you will be able to see a real speed difference between the loops.

var arr = new Array(10000);

Example speed test 1	
console.time();                        
for (var i = 0; i < arr.length; i++) {
    // operations...		
    var sum = i * i;   		
}
Execution 1: 4.4ms		
Execution 2: 5.5ms		
Execution 3: 5ms			
Execution 4: 4.6ms			
Execution 5: 5ms	
					
Example speed test 2                    
console.timeEnd(); 	          
while (i--) {
    // operations...
    var sum = i * i;
}
console.timeEnd();

Execution 1: 3.7ms
Execution 2: 4.8ms
Execution 3: 3.9ms
Execution 4: 3.8ms
Execution 5: 4.2ms

Thank you for reading and I would appreciate any feedback.

What is White Labeling in Software Development? How to implement it for Android?

Reading Time: 3 minutes

What is White Label?

A white-labelled product is basically a software product or a service that is developed or created by some company and other companies can buy and rebrand it to their need so the users of this product don’t know about the real creator of the product but the brand. To explain it better, assume that there is a white-label company that makes an app and sells it to companies A and B and then they rename the app name to A and B and change the content of the app corresponding to their products so then the application becomes the service of companies A and B.

Why to use White Label product?

White label products become handy in certain situations. Especially it is better to go with a white-label solution when you want to enter a market with a minimum cost and time. It might be in case you want to start a startup project and don’t want to invest much in the beginning then the white-label solution is a good choice. Some advantages and disadvantages of using a white-label solution are listed below:

Advantages:

  • Less time to market time
  • Cost-efficient (time, money)
  • No developer hiring needed

Disadvantages:

  • Fewer customization capabilities
  • No control over the quality of the software
  • Dependency on external sources (developer)

Important points to consider

There are some important aspects which should be considered by a company which makes a white-label solution and by a client of this product.

  • Technical documentation – complete technical documentation of the software depending on the agreement between both sides.
  • Scope of customization – both sides must know which parts of the product can be customized, what kind of new functionalities can be added, what kind of limitations might occur or etc.
  • Maintenance & Support – for how long and what kind of maintenance and support should a client expect.

A simple explanation of how to implement a White Label for Android application

In Android, it is simple to do white label implementation thanks to “productFlavors” and “flavorDimensions“. By means of these two terms, it is possible to have different resources for different applications such as different themes, colours, logos, application names and etc. Additionally, using the” gradle” file we can also create some configurations to enable or disable certain functionalities of the app based on the needs of the customer. At the end when we build the application, only the resources which belong to the selected flavour and dimension will be included in the apk file.

Conclusion

To conclude the blogpost I would emphasize the two reasons which I think the most important reasons to use a white label product for your projects. The first one is it would cost you less financial investment (saving money). The second is less time to market time (quick launch) since you don’t need to do everything from scratch. These reasons sound good but it is better you always do your own analysis and comparisons before you decide what is best for your scenario.

Thanks for reading!

Below I have listed some links which I think is worth checking if you are going to implement a white label for an Android project:

Experiences of FrontendConnect 2019 conference Warsaw, Poland

Reading Time: 4 minutes

INTRODUCTION

Everybody has an open lifetime book full of blank pages, waiting to be filled. We write the story as we go, so back in November 2019, I have started the chapter ‘Frontend conferences’ by attending the FrontendConnect2019 in Warsaw, Poland, thanks to my company N47.

My motivation to choose this conference was the fact that I will gain new knowledge, and exchange practical ways of using frontend frameworks. Despite this, given the fact that there were great speakers from the IT world, I had no doubt choosing this tech event. Duration of the event was three days, one workshop day and two speaking conference days.

WHICH WORKSHOP DID I ATTEND TO?

As I was experienced with Vue.js, I wanted to upgrade the knowledge with Nuxt as their workshop description was “It may take it to the next level, thanks to its convention over configuration approach.” I got a certificate of attendance and completion of “My first Nuxt.js application” by the Vue.js Core Team member Darek ‘Gusto’ Wędrychowski. Coding under the eye of ‘Gusto’ and having a wonderful panorama view of Warsaw in my horizon, was definitely a day well spent.

WHICH PRESENTATION DID I ATTEND TO?

Rich agenda with scheduled talks, thoughts about which ones to choose, moreover similar questions were going through my mind. I attended the ones that caught my eye and were mostly within my interests.

At the beginning of each day, there was a high valued speaker opening the day with their talks. The first day I had to meet and listen to the very appreciated, Douglas Crockford with his JSON Saga.

The second day, there was Minko Gechev, a Google engineer working on the Angular framework with the talk ‘The Future of Front-End Frameworks’.

Some other topics that I attended to were about the state management in a world of hooks, some optimizations of the modern JavaScript applications and loading them instantly, as well as Angular and Vue.js 3.0 topics.

WHAT CAUGHT MY MIND?

Two of my favourite talks were ‘The JSON Saga’ – Douglas Crockford and ‘Vue 3.0 for Library Authors’ – Damian Dulisz.

The JSON Saga

Douglas was retelling the story about how he discovered JSON (JavaScript Object Notation). He explained how he did not invent, but found it in the early 2000s, named it and described its usefulness. JSON is a format for storing data and establishing communication between the servers. He explained how some companies complained and did not want to accept JSON because they were used to XML, and could not consider anything else, at that moment. He mentioned that some of the people denied its usage because of it not being a standard. So, what he did next was buying JSON.org, a website which after a few years spread among the users. After a while, JSON got the support of all languages. He announced that there will be no more changes to JSON because for him there is no feature more important than the stability of JSON.

Vue 3.0 for Library Authors

Getting more in details about this topic and Vue 3.0-alpha version will be covered in my next blog.

THE CULTURE AND ENVIRONMENT IN THE CONFERENCE

Frontend Connect was happening in the theatre of the Palace of Culture and Science in Warsaw, Poland where the history and modern world meet at the same time. It is one of the symbolic icons of Warsaw and the place of the city`s rebirth. There were people from all over the world, and the atmosphere was really friendly. Everybody was discussing the topics and shared their work ethics.

CONCLUSION

Visiting conferences is a really good way to meet new friendly people that you have a lot in common with, as well as having an opportunity to reach out to the speaker if you enjoyed the talk, and discuss what you found interesting. We should always strive for more experiences like this and face new challenges within modern technologies. With that being said, we need to nurture our idea to reach our full potential, in order to make a bigger impact in the IT world.

WeAreDevelopers 2019 Berlin – The Good and the Bad parts

Reading Time: 7 minutes

You can find my expectations here. And here are my actual impressions:

Arrival

The conference took place on the 6th and 7th of June at the CityCube in Berlin. The CityCube is an exhibition site which is located roughly 10km from Berlin centre. My hotel was in Berlin-Charlottenburg, which is a nice area located just 2 stations from the exhibition site.

I arrived late on the 5th of June. Having not really planned my attendance I wanted to check the usual suspects (eg the web page) for more information. But wait. There is an app for that right? And there was. After downloading the app from the Appstore, I quickly set up an account and was ready to take a look. Overall the app was solid (with some bugs or undesired features; later more on that). I found the activity stream pretty useful. The activity stream is like a chatroom where attendees can exchange thoughts. After reading a little bit, I was able to gather most of the important info and got a little bit hyped by the people in the room. There was also an agenda section in the app which I could browse either by date and time or speakers. Each talk or workshop had a brief description. Each talk could also be added to a favourites section which was nice. In that way, I gathered rather quick my favourites and after going through them again by time and eliminating the less interesting ones I was ready for the first day.

Pro-Tip 1: A calendar or timeline section in the app where one could view one’s favourites would be nice. In that way, intersecting talks could be easily spotted.

Day 1

I arrived a little bit early at the venue because in the chatroom there were also some concerns about long queues. The weather was really nice, so I was not really worried to wait a little bit. But the fear of waiting for hours was not justified. There was enough stuff to take care of the attendees. I waited maybe 10 minutes. So all good.

Once I arrived at the main stage I also realized that there was more than enough space to accommodate everyone. With my schedule it went from here like this (Some of the talks I attended):

Welcome by WeAreDevelopers

The usual greetings and organizational stuff. It didn’t take so long so it was okayish. But already here I realized that the sound was really bad. Sitting somewhat in the middle you would get an echo. And that was without any other talks being held in parallel.

Pro-Tip 2: Please test the venues sound properties beforehand and adjust accordingly.

Where Machine Intelligence Ends and Human Creativity Begins – Garry Kasparov

As a starter, this talk was really good. Garry Kasparov is really a charismatic person. The main claim of Garry Kasparov is that eventually a huge amount of (non-creative) work will be replaced by AI. And there is nothing that we can do about it. His conclusion was that it doesn’t have to be a bad thing. We will have more time to do more important stuff.

Business vs Agile – Crimes against development teams continuously committed by management – Gerta Sheganaku

This one I chose based on the title. I was hoping for some entertaining session, actually against management (Sorry I’m a dev). The thing which I’ve got from the talk is that agile works best with top devs in an organization. For this group productivity and “happiness” increases. With diminishing skill set of the devs involved the gains of agile decreases and are even counterproductive in case of devs with decreasing skill set (I do not know how the skill set of devs was measured here and the productivity output either; it’s a company offering, so they have probably some empirical data on this). The fun story was that one consulted company consulted by this company fired almost all stuff based to rehire again for agile.

Lunch

Lunch was an epic disaster. Honestly, I thought lunch was included in the ticket price. It was not. There were around 5 food trucks with different types of food. So this was ok. The problem was that the capacity was way too low. You had to wait like 1 hour in full shining sun to get your food. After waiting for about 15 mins. I decided to go somewhere else to get some food. Doing so I discovered that the part of the CityCube the conference was held in was about 15 min away from the nearest restaurants. Ok, that’s another minus. (PS There was a massive rant about this in the app. Even some invited companies jumped in to deliver some food and free water. Shame, shame, shame…)

Pro-Tip 3: You know how many people will attend. Throughput of the trucks should also be known. Calculate with the worst case.

The Quake Postmortem: The End of the Original Id – John Romero

Yes, this John Romero. The talk was about people, growth, success and the price paid. Romero pictured a small company which was overwhelmed by its “astonishing” success. In the beginning, there is a passion but with success there comes the appetite for larger games and one have to scale. In the end, it’s not about fun anymore. Delivering is what counts. This reflects on the team.

Flutter – Google’s latest innovation for mobile, web, and desktop apps

It was nice. But we have SwiftUI now. Thank you.

Pro-Tip 4: When designing the app, please think about people on a mobile data plan. Scale down pictures posted in the chat (I had like 400MB data usage by the end of the day). 

Day 2

Once in my hotel room I quickly set up my schedule for the last day (Here some of it):

Thoughts on the Future of Programmable Money – Andreas M. Antonopoulos

This talk was epic. Andreas drew a coherent picture of what is wrong with the mindset of closed ecosystems. Starting with castle walls and getting to modern times firewalls was a nice analogy to draw. Eventually we “outgrew” castle walls/castles. Will we be able to break out of closed systems? Andreas has no doubt about it.

25 Years of PHP – Rasmus Lerdorf

I’m not a PHP dev but I wanted to hear the inventor of PHP talk about this un-opinionated language. So Mr Lerdorf is a nice, near to the ground guy. He explained very well that PHP was developed out of necessity. The desire to have a “simple layer” over CGI/C to write programs faster and more readable.

2nd day the lunch situation didn’t really change. There were water and free beer though.

Conclusion

I’m pretty undecided if I would visit this conference again. The speakers were really great but the organisation was seriously lacking.

N47 Playground: Be up-to-date with the latest technologies and don’t waste resources

Reading Time: 4 minutes

Our company is established from techies 👨🏼‍💻 for techies 👩🏼‍💻 and therefore we love ♥️ technology. This passion brings us always forward 🏃🏿‍♂️to learn the latest technologies and keeps us hungry for solving also our own issues with some cool 😎 and fun-making technologies 🤩.

To be an attractive technology focussed employer

A simple agency lifestyle with working on preselected technologies from clients for a long period can (and will) be boring 😕 for every technology enthusiast. 🧝‍♂️ To keep everybody on a high level of motivation 💪🏻, we think a company has to develop his own spirit and in our case, these are solutions with the latest frameworks, technologies, languages, gadgets,…

How not to waste time and money?

But in agency life is hard to reserve some resources 💰 just for a playground 🎮 or disposable products. Therefore you will need a setup, where you transform the need for discovering 🔍 new areas and costs 💰 into an intelligent investigation 🤑. By this frame, we decided, that every outcome of our playground should result as a standalone solution either for our company or as a resealable product. By doing this, our new unit LABS 🧪 and researchers 👩🏼‍🔬👨🏻‍🔬 are born.

How our unit LABS are working?

First steps into the new area!

In LABS 🧪 we get in the first touch with latest technologies and for sure we will face with all the issues ☄️, problems 👮🏻‍♂️, bugs 🐞, challenges 👨🏼‍🎤 and we learn a lot about the bad sides of new technologies. If we overcome all this problems and troubles 🧗🏿‍♂️, we move this new technology from our #playground to #weStandFor, which means that we are that good in that new technology and faced and solved all issues, that can occur. Now we are ready and stand for the latest technologies! 🏆🥇
Thus, the outcome of an e.g. 3 months focus in LABS is a great knowledge about a brand new technology and a gorgeous new product or solution. I think we can be proud of both! 👏🏻👏🏻

The movement of technology from #playground to #weStandFor. Every stack has his own topic leader, so don’t miss changes and updates.

To manage this pipeline from playground 🎮 to the output ✅ we set up a backlog with great projects. Everybody in our company is free to add some projects to our backlog and come up with ideas 💡. In this accelerator program, we decide the sustainability and the potential of this suggested project 📊 and evaluate the sexiness of the technologies 🙀. If we all agree with this internal pitch we plan and start having work and fun! 🥳

What does this mean for our partners and clients?

With our LABS unit, we can offer you an overview and solutions by using the latest technologies 👩🏼‍💻, which can give you more security 🔐, to be an early adaptor 🥇 on your specific market or even save money 💵!

What does this mean for our techies and applicants?

At N47 you have great development possibilities 📈 and learn always new technologies. You are not stuck into a technology for years 🤷🏼‍♂️, that you miss new things. In our LABS unit and also with our Hackdayz you have the opportunity to develop awesome products and contribute a great environment for yourself and your teammates. Join us today in Zurich 🇨🇭, Konstanz 🇩🇪 or Skopje 🇲🇰.

It’s all about teamwork, creativity and cultural change

Reading Time: 6 minutes

People of different religions and cultures live side-by-side in almost every part of the world, and most of us have overlapping identities which unite us in very different groups.
We can love what we are, without hating what- and who we are not. We can thrive in our own tradition, even as we learn from others, and come to respect their teachings

Kofi Annan

Over the past few years, the field and management sector of major companies have a big problem of how to arrange the days of their employees, something that will give a bit of strong light and positivity, which will avoid monotony and on the other hand give a great impetus to their creativity and vision, much greater motivation and strong spirit in overcoming further obstacles and challenges. The problem is even greater if companies are stationed in several locations in different countries so that communication is interconnected constantly through technical apps, almost virtual, simply a voice, perhaps a shy picture or video call and of course mostly text and chat conversations.

N47 locations: Switzerland, Germany and Macedonia.

It is very often the case that the company hierarchy is a list of members of different cultures, nationalities so that it becomes an even more difficult task of organizing team buildings. But on the other hand, it is one of the reasons why that makes them special.

The differences are part of us, the differences are making us so special, and of course differences, we know well and we have become accustomed to it.

Differences – make us special and unique.

Team building, joint team events or hacking term in the IT industry are part of every company agenda, happens every year and they often happen a few times per year.

It’s a chemistry thing, it’s the time where you can share your points of view, your thoughts, your personality, your creativity, your vision, it’s the time when you are not representing just yourself, but also your culture, your country.

But, the idea of creating an event, that will bring together – Team Building and Hackathon event?  Yes, we did it and we arranged and created. Almost one week, gathering the team together. The Family!

24 hours of work, pure juice of 100% creativity, dedication and hard work.  Commitment always brings success, and YES some of the team after the deadline and voting for the best team and the best project made, they had a shootout with the Champs Titles and Presents. Absence Hub – Resource Guru and Absence.io connector TEAM did it, they collected the votes and drove all the way through like Real Madrid in Champions League.

Yes, it was worth it! Title goes to the winners!

The event was a success, the employees loved it. And all of them are sharing the same opinion, maybe some time and somewhere everything is not 100% perfect, but even the misses are part of that. People create, sometimes in the process of creating always is something missing, but in the end, the finish line and the title – that’s all that matters!

Final conclusion – 100% success and that’s what all IT companies need, at least once, but it’s good to be twice or even more per year.  It’s chemistry, it is fun, it is releasing the creativity inside all of the members of the company that doesn’t have a chance before to describe themselves with their own words.
It’s a fact that programmers find Hackathons the perfect venue to unleash their ideas, it’s often that these kinds of events produce ingenious products or ideas, or even they show the real potential, creativity, talents of employees. It’s an easy challenge, but the benefits of it can be great for the organization, company or network. And together with team building events, it’s double more fun and joy for the team.

The last moments after the end of the event, the euphoria of the faces of all colleagues, but also a bit of grief over why it was all too short, everyone wants more time together. But that’s the idea and motivation for the next event. Where, how, when, what’s next? Give your thoughts and ideas, let’s take a look and decide together. Мaybe somewhere on the sea, fishing, hiking, or mountain and skiing? Or on some great concert with DJs or maybe Stones or U2?

Afterwards, travelling back to home town, sitting in the aeroplane and thinking about the past few days, wow it happened all so fast and the days flew like a fast cigarette break…

The A-team surrounded with lots of positive energy and good memories. And the question is what next, where to go next, what should we arrange next?

I think, whatever, just bring it on baby!