Friday, February 28, 2020

Effective Business Communication (Verbal)

Photo by Brooke Cagle on Unsplash


When we talk about communication, all we understand is, communication means sharing or imparting information. However, communication is not just about talking or writing. It’s about conveying and receiving information with clarity. Many of us are confident about our communication skills because we feel we are fluent in the language through which we communicate, be it English, Hindi, Spanish or the like. All the same, being fluent in a language and being an effective communicator are not synonyms. So, what are the things we need to look at to ensure that our communication is effective.

  1. Assumptions: Please understand that wherever there is assumption, there is place for doubt. Doubt is an enormous hindrance in effective communication. So, whenever you are listening to someone or telling someone about something in the sphere of business, please ensure that there is no place for assumption. Every point discussed and every information received should be crystal clear.
  2. Listen: Communication is not just about talking. It’s about listening too. Listen to the other side of the story. Keep an open mindset regarding problems and their solutions. Once you listen carefully, you will be able to get the best possible solution to any problem.
  3. Distraction: Avoid distractions. Before any office meeting, business negotiations, ensure you keep your mind cool and focused.
  4. Tone: While communicating, it is very important to take care of the tone of your voice. Angry and anxious tone can ruin the entire conversation.
  5. Ask Questions: If you are not sure about something, go ahead and ask questions to get clarity about the entire picture. Relevant question can strengthen business understanding.
We humans are blessed with the power of verbal communication. Let us use it aptly to make communication pleasant, comprehendible and clear. After all effective communication is a major aspect of success.


Monday, February 24, 2020

Engineering Mindset

Photo by Austin Distel on Unsplash



What is Engineering Mindset?

Engineering is a profession where complexity is encompassed to create something that is simple to use and enhances the productivity. Steve Jobs imagined iPhone, but it was his engineering team that enclosed all the complex technology into a device that is ubiquitous and easy to use.
Does anyone think about the complex calculations that go behind the design of the bridge when you are traveling over it? The complexity in the solution is hidden from the user and that is the work of an Engineer’s mind.


Engineering in Software

In other Engineering branches like Mechanical or Civil, typically design has a long cycle to make sure that the product turns out to be right. All the factors internal and external are given due considerations during building the geometry from scratch. The standards provide a significant amount of constraints while undertaking the design process.
These fields of Engineering also are seeing challenges with newer materials, changing technology, being different, breaking the boundaries, etc. But, the timeframe expectations in these fields is not as meager as in software.
Most of the times in software, the specifications are laid out very vaguely. There is little or no idea on what would be the amount of load that would be put on the components. So, what are the key tenets of an “Engineer’s mindset”?

Build Product

Constructing Products / Platforms is as much of a creative endeavor as much as it is a scientific process. The Engineers apply both dimensions of the thought process to conceive and build something that is important to the user and more importantly addresses the need.
In software, these needs tend to be different from consumer to consumer and it is important for the Engineering mind to think components, configurability, extensions, plugins, etc. to address as much of those nuances as possible. The thought process of thinking reusability, generic components, API, interfaces, etc. make the product more robust and easily adaptable to wide range of requirements.

Ability to Accept Uncertainty

There is a need to embrace uncertainty when building a Software Product. The specifications are bound to change, technology is bound to change, the design principles that were used may no longer be valid down the road. The engineers need to have the mindset to thrash what they have done and re-design the system or rewrite the piece of code because it was not optimal in the first place. Sometimes tinkering with the design or code will work, but many a times the developer must have the heart and the conviction to break down the component and rebuild it from scratch.

Pride in the handiwork

Engineers have a pride in the product that they create and thereby they strive for ensuring Quality of the Product. They take immense responsibility in ensuring that the functionality, performance and other technical aspects are tended to properly. They also care about the economic aspects and success of the product in the market.

Comprehend Product’s Future

Engineers have the ability to think about evolving the product in the future. They are aware of the changes that will make the product functionality better or the product more robust. The Experienced Engineers walk the thin line between getting the product today done and making the product better for tomorrow.

Technology Obsolescence

The need to tackle changing and updating technology in software. The well-engineered products / platforms need to be upgraded at various point of time. The Engineering mindset allows the developers to always stay one step ahead and plan for the technology disruption. They will plan for the most pragmatic approach well in advance and execute it.


Engineering @ Kanaka

We at Kanaka strive to build this Engineering Mindset into the Developers, Testers, DevOps, Admins, Analysts, Support and everyone who contributes towards building Products and Platforms. The ownership into the process of building Products / Platforms makes sure that the outcome is successful!


Tuesday, February 11, 2020

Understanding Server-Sent Events


Photo by Víctor Vázquez on Unsplash


Since last few weeks, I have been checking with a lot of developers that I know, if they are aware of server-sent events. Surprisingly, very few of them know what is server-sent event. Let us understand this term.

What is SSE?

As the name suggests, it is an event that is sent or initiated by a server, and this is exactly what it does.
According to the wiki pageServer-Sent Events (SSE) is a server push technology enabling a client to receive automatic updates from a server via HTTP connectionThis is standardized as the part of HTML5. The server-sent event is an API that is operated through the EventSource interface
A client subscribes to a “stream” from a server and the server will send messages (“event-stream”) to the client until the server closes the stream. It is the server that decides when and what to send the client and when to end the stream.

Why should you know about SSE?

Since applications and their users need to be updated in real-time, you need Server-Sent Events. Displaying the latest data updates to your users may change their actions.

Why SSE? I have Websockets....

WebSockets indeed was a long awaited evolution in client/server web technology. It allows a single TCP socket connection to be established between the client and server which allows for bi-directional, full duplex, messages to be instantly distributed. Now there is a catch, if you read this meticulously, you would definitely notice that WebSockets are bi-directional. So if I need only unidirectional, WebSockets will cause latency issues.
SSE is uni-directional (server to client) which improves latency issues. If we are looking from a server load point of view, SSE is way much better option than WebSockets.

Fields

As per MDN Docs, an event stream is a simple stream of text data which must be encoded using UTF-8. Messages in the event stream are separated by a pair of newline characters. A colon as the first character of a line is in essence a comment, and is ignored.
Each message received has some combination of the following fields, one per line:

event

A string identifying the type of event described. If this is specified, an event will be dispatched to the listener for the specified event name; the website source code should use addEventListener() to listen for named events. The onmessage handler is called if no event name is specified for a message.

data

The data field for the message. When the EventSource receives multiple consecutive lines that begin with data:, it will concatenate them, inserting a newline character between each one. Trailing newlines are removed.

id

The event ID to set the EventSource object's last event ID value.

retry

The reconnection time to use when attempting to send the event. This must be an integer, specifying the reconnection time in milliseconds. If a non-integer value is specified, the field is ignored.

Examples

To use the server-sent events, we need to call an API from a client and then the server will keep on sending the events, till the stream is closed.

.Net Core

Create a controller with any route. Add the following code to the controller.
        [HttpGet]
        public async Task Get()
        {
            var response = Response;
            response.Headers.Add("Content-Type", "text/event-stream");

            for (var i = 0; true; ++i)
            {
                await response.WriteAsync($"data: Controller {i} at {DateTime.Now}\r\r");

                response.Body.Flush();
                await Task.Delay(5 * 1000);
            }
        }
In this implementation we are using the writeAsync method in from the Microsoft.AspNetCore.Http namespace. The writeAsync method will write the given text to the response body with the UTF-8 encoding.

HTML

   <html>

   <body>
    <script type="text/javascript">
        if (!!window.EventSource) {
            var source = new EventSource('https://localhost:44317/api/sse');
            source.addEventListener('message', function (e) {
                console.log(e.data);
            }, false)

            source.addEventListener('open', function (e) {
                console.log(e);
            }, false)

            source.addEventListener('error', function (e) {
                if (e.eventPhase == EventSource.CLOSED)
                    source.close()
                if (e.target.readyState == EventSource.CLOSED) {
                    console.log("Disconnected");
                }
                else if (e.target.readyState == EventSource.CONNECTING) {
                    console.log("Connecting...");
                }
            }, false)
        } else {
            console.log("Your browser doesn't support SSE")
        }
      </script>
    </body>

   </html>
When I ran the HTML, this is how the output was showing up in the console.