Pro Tips

Are you a software developer looking for remote jobs in Silicon Valley tech companies? If yes, these clean code tips can help you ace your game!
For Developers

Looking for Software Developer Jobs? Learn How to Write a Clean Code First

Are you a software developer looking for remote jobs in Silicon Valley tech companies? If yes, these clean code tips can help you level up your game!

We live in a world where software runs everything—from TVs to iPads, washing machines to microwaves, smartphones to IoT devices—you get the idea. It takes several million lines of code to run software and execute specific tasks. Coding is not a one-time thing; it’s an iterative process where the programmers are required to make continuous improvements in the code, add new features, and so on. With the increase in code complexity, it becomes essential to follow clean code practices. We’ll go through just that in this blog! I’ve used Rober Cecil Martin’s aka Uncle Bob’s “Clean Code” as a reference for this post. I highly recommend this book to anyone looking for software developer jobs.

The clean code practices apply to all programming languages. For demonstration purposes, we’ve used Golang in this post. If you are more familiar with Java, please refer to the examples given in the book.

Let’s get started!

// Commentaries

The primary purpose of comments is to explain the code which can’t explain itself. Comments are pretty helpful in debugging and analyzing code, troubleshooting errors, and preparing documentation. They come in handy when a new team replaces the old one and gets to work on the existing code. 

A rule to follow: A comment only needs to exist if it’s beneficial 

Additionally, you need to be careful while writing commentaries. Some types of comments that one needs to avoid are:

Useless commentaries

Looking for Remote Software Developer Jobs in Silicon Valley Tech Companies Learn How to Write a Clean Code First

Now, this comment is harmless but clearly out of context. The version control system should handle author information, creation, and update dates, not the code itself. Failure to do so will increase useless lines of code in the program and certainly cause the following problem.

Outdated comments

Here’s the thing: your commentary will become outdated at some point in time.

So not just header comments like the above example, but even comments like this one can be problematic:

Remote software developer jobs

When the comment shown above was added, the function only received an Id, name, and phone number, but now it expects an address too! You should avoid these kinds of outdated comments, which can be misleading at all costs.

Poorly written and redundant commentaries:

When the code is self-explanatory, comments like the one below are redundant. They just add useless lines of code and force developers to read what they don’t need to:

Learn to write a clean code

Clean code

When writing comments, always ask yourself: “Are they essential?” If they are, write them as clearly as possible. Remember, the comment should help you, not cause confusion.

Commented Code

At times, we add an entire block of code as a comment thinking that we may use it in the future.

How can a software developer write a clean code

However, most of the time, these commented codes are never used. And so, it’s best to avoid writing comments like the one in this image. 

Think about it: If that piece of code were so important, it wouldn’t be a comment, right?


To write clean and readable code, one should define meaningful names for variables, functions, classes, interfaces, etc. Furthermore, the name of a function, class, or variable should justify its existence and importance in the code. Simply put, good names are investments that we make to improve the code quality. 

It is difficult to search meaningful names while writing a clean code

Meaningful Names

Take a look at this example:

Remote software developers should know how to write a clean code

It might take a while to understand that this is a median function. 

Now, take a look at the same example with well-picked names:

This is a clean code

Meaningful names like the ones above make the code readable, understandable, and clean. 

Project Patterns

Following a project convention is a good practice for choosing names. For example, if you have defined a function that deals with a user object, don’t create function names like:

Project patterns

Using GetMemberName instead of GetUserName will just confuse the readers.  So, be very mindful while you decide the names of the elements in your code.

Ambiguous Names

Names should clearly describe what a variable is or what a function does. And so, avoid using ambiguous names, like this one:

Ambiguous names

Ok, but renaming what? It’s better to create big names instead of short ones, but ambiguous. So it would be better to create something like:

How can you write a better code, coding tricks and tips

Effect Names

Names should clearly define the action and the purpose of the element, for example:

How can remote software developers write a clean code for better jobs

This function is not just detaching a User from an Account but is also deleting the User. A better name for this would be DetachUserAndRemove().


Functions play an essential role in the world of programming. As a result, these functions have gained more traction with functional languages such as Elixir, Scala, Kotlin, Swift, Haskell, Golang, etc.

Almost every programmer knows the basics of functions. However, here are a few pointers that will help you write cleaner and better functions:


Have you ever seen a function with hundreds and thousands of lines? 

Have you ever seen a code with thousand lines

A function should be short enough to help the reader understand its purpose at first glance.  But how short should it be? We won’t impose some magic number of lines here, but if your function consists of more than 20 lines of code, try refactoring into a smaller one.

One practical way to shrink your functions is to avoid adding logic into if, else, while indentations. Here’s an example:


The function name shows that it prints prime numbers between two arbitrary numbers. Here’s what you can do to make the function more readable and understandable:

Remote software developers should learn to write a clean code

This function is easier to understand than the earlier one. 

We removed the logic inside the “if and for loops” and defined them separately in other functions, making them more concise. Here are those functions:

Writing clean code

Note: Take a look at the order of the functions. When you are decomposing the function responsibility, the reader of your code must read it as quickly as a journal or a story. So try to maintain a top-to-bottom readability of the code.

Single responsibility

A critical concept in functions is the single-responsibility principle (SRP). This concept is the first principle of the SOLID principles in OOP. It states that each function should have one single responsibility, which must be well-defined and executed.

Take this example:

This is how a remote software developer can write a clean code

This function has more than one responsibility. Hence, it is best to refactor the code when a single function is responsible for multiple tasks.


A function with a lot of parameters is difficult to understand. Here’s why:

Clean code writing

These kinds of functions make the code reviewing process time-consuming and messy. 

To prevent this, you need to ensure that you use a limited number of parameters that clearly define the objective of the function.

How to write a clean code as a remote software developer

Note: Use the same idea to deal with return arguments.

A clean code has various benefits. First, it helps in performing code reviews efficiently. That way, your peers can understand the code, flow of data, and underlying logic with minimal effort. In addition to this, new joiners can easily understand the old code, making their onboarding process smoother. A messy code might take a developer months to add a new feature or fix a bug. However, a clean code makes the process a lot smoother. And thus, a clean code can save a lot of time, money, and resources in your remote software developer job search!

Happy coding!

Do you want to apply to remote US software jobs from the comfort of your home? If yes, Turing may be able to help you very quickly. Visit our Jobs page to know more!

Join a network of the world's best developers and get long-term remote software jobs with better compensation and career growth.

Apply for Jobs

By Sep 14, 2021
Best Strategies to Reduce Unhealthy Employee Attrition
For Employers

Greenhouse CTO Shares How to Reduce Unhealthy Employee Attrition

According to Boufford, organizations shouldn’t aim for zero regrettable employee attrition but implement strategies to reduce the unhealthy turnover rate.

A high employee retention rate has many tangible benefits, including an experienced workforce, lower recruitment and training costs, etc. However, zero regrettable attrition should not be an organization’s only goal. According to Mike Boufford, CTO of Greenhouse, analyzing the reasons behind healthy and unhealthy turnover is more important than aiming for zero regrettable attrition.

In a recent blog post, Boufford shares three strategies designed to reduce regrettable employee turnover:

Foster a culture of open communication and respect 

Lack of proper communication is one of the prominent reasons why employees quit their jobs. Therefore, you must cultivate a culture of openness by discussing the company values with your employees. Open up conversations about the organization’s compensation philosophy with them. This way, the employees will feel a strong sense of belonging in their organization.

In addition to this, studies affirm that employees would stay at a company longer if it invested in their careers. And thus, providing learning opportunities can show your employees that the company values their personal growth. This encourages them to remain committed to the organization.

It is equally important to build a culture of respect in the workspace; work proactively to show that bad behavior is not tolerated in the organization, according to Boufford.

Replace ‘regrettable’ with ‘healthy’

When you focus on the regrettable attribution metric, you are more concerned about the number of people leaving rather than the reason why they are leaving, Boufford explains. Regrettable attrition is a poor proxy for gauging your employees’ satisfaction and loyalty. It obscures workplace issues that need your attention, he adds.

“There are healthy and unhealthy reasons for turnover — that’s where our focus should be, instead of simply on deciding whether or not the company mourns their departure,” says Boufford. He shares a few pointers to encourage a healthy turnover. Specifically: 

  • Make it clear to your employees that it’s okay to consider other opportunities for their careers. 

  • Show them that you are genuinely committed to helping them achieve their career goals. 

  • Talk about your own ambitions and, in turn, encourage them to be vocal about their future plans. 

  • Help them identify and examine new opportunities.

Most importantly, handle resignations with respect and grace. Ensure you part on good terms.

Develop a framework to analyze the turnover

There are several reasons why employees may consider quitting, according to Boufford. The CTO also adds that a detailed framework that analyses the causes of employee turnover can help you take the necessary measures to reduce it.

He shares a sample framework to identify a few healthy and unhealthy causes of turnover:

Healthy Causes:

  1. They’ve found a new passion and need to devote their time to pursue it.
  2. They’ve found a better opportunity to advance their career.
  3. They want to do something on their own.

Unhealthy Causes:

  1. They resign to join a competitor. 
  2. They feel like they were mistreated or have issues with the team dynamics.
  3. They don’t feel like they’re learning anything new.

Strong employee retention has significant benefits, but it pales in comparison to the advantages of fostering healthy company culture, according to Boufford. A company with solid values assures that people stick around, not because they haven’t found a better opportunity, but because they want to. And thus, if you take steps to cultivate healthy behavior, a high employee retention rate will be just one of the many benefits your organization sees.

Read the complete article. 

Are you struggling to recruit and retain skilled and experienced remote software engineers who are adept in technical and soft skills? Turing can help. Turing’s automated platform lets companies “push a button” to hire senior, pre-vetted remote software developers. Access a talent pool of the top 1% of 700K+ developers who work in your time zone. There’s no risk. Turing offers a free two-week trial period to ensure your developers deliver to your standards.

For more information, visit Turing’s Hire page.

People vector created by pch.vector –

Tell us the skills you need and we'll find the best developer for you in days, not weeks.

Hire Developers

By Sep 4, 2021
Creating personal branding is necessary for individuals as well as companies
For Employers

Here’s Why Tech Companies Should Not Ignore Personal Branding

Personal branding helps engineering companies establish themselves as thought leaders in the field, create a loyal audience base, and build a solid network.

Do you fear that creating a personal brand as an employee will affect your job? Or are you an employer who doesn’t want employees to build their brand because it might not align with the company’s culture? This post will help you address these concerns. 

Anjuan Simmon, an engineering leader, and public speaker has created a guide on why and how organizations should incorporate personal branding into their culture. 

Here are the key takeaways:

Show your work and scale your brainpower

A quote from Simmons’ Twitter thread reads: “One reason I started speaking at tech conferences is to “show my work” and try to portray the thoughtfulness and deep understanding I have about working in software development.” The public speaker emphasizes that this way, you can present your skills in front of a larger audience and enhance your communication skills in the process. 

Simmon also states that it’s essential to create a backup brain that can act as an automatic responder for queries that come your way. In his case, the backup brain is his blog. People can learn about his work and areas of expertise through his blogs. 

Don’t miss free training and create a more comprehensive recruiting network

Simmons says that when you sign up as a public speaker, you learn about various technologies from people using them or who have created them. You get to learn about what is working in the industry and what improvements you can make. You also gain insight into the innovations going around— all of this, at no cost whatsoever! The engineering leader turned speaker has attended many seminars and has been able to bring some good ideas to their company. This way, personal branding efforts can aid company growth. 

He recalls one such instance: “I attended a conference where an engineer discussed how they use a sponsorship spreadsheet to document the ways they support every engineer at their company. I loved the idea and presented it to my boss, and she empowered me to implement the same at Help Scout.” 

What’s more, such events can also help you land good talent for your company. “I’ve always got my hiring manager hat on at conferences. I meet all sorts of people looking for new opportunities, and I’ve placed roles based on people I’ve met. It’s increased my pipeline tremendously,” Simmons explains. 

How to develop a talk that can enhance your branding?

People don’t like robots speaking in front of them, no matter how interesting the topic. Simmons suggests that you should develop a funny and friendly talk so that the listeners can relate to it. Make it as factual as possible. He also suggests using relevant and engaging images in the slides to ensure accessible content consumption. This way, you will be able to convey your message without losing the attention of your audience. 

The engineering leader also takes inspiration from the stand-up world. He believes that every speaker should understand and analyze their audience before going ahead with any session. A joke that works on one set of the audience might not appeal to the other. And thus, it is crucial to tailor your pitch according to the audience present.  

Put it all together and practice

Good things take time. Learn from your experience and mend your mistakes. Identify what worked and what was not in your favor. Focus on creating a brand that is a reflection of your work. 

Simmons recalls his experience where some companies he had worked with were not in favor of personal branding. He firmly believes that if a startup is reluctant to have their employees establish themselves as a brand, they are missing a huge opportunity. “Over the past five years, most companies I’ve worked at were very small. But I’m on the speaker list next to people who work at FAANG companies — it lends credibility to be out there, flying your startup’s flag,” he explains. 

Company executives need to be openly supportive and vocal about employee engagement in personal branding. This practice helps employees know that they are part of a work culture that supports organizational and personal growth. Most importantly, personal branding through public events can significantly augment an organization’s credibility. It can also help organizations establish themselves as thought leaders in their fields, create a loyal audience base, and build a solid network of influencers to grow their business. 

Read the complete article.

Want to rise as an engineering leader in your field and boost your team’s performance? Turing can help. The company’s automated platform enables you to hire and manage remote software developers vetted for a Silicon Valley standard with just the “push of a button.” With Turing, companies can hire from a talent pool of top 1% of 700K+ developers with excellent technical and communication skills who work in their time zone.

Visit Turing’s Hire page for more information.

Tell us the skills you need and we'll find the best developer for you in days, not weeks.

Hire Developers

By Aug 13, 2021
Communication challenges in a hybrid model of work.
For Employers

Three Communication Mistakes Hybrid Teams Must Avoid

Communication is key to organizational success. Hybrid teams should avoid these common mistakes to reduce transactional communication and encourage spontaneity.

The rise of hybrid teams has divided employees into two classes: information-haves and have nots. A recent report stated that it has reduced workdays to purely transactional communications and killed spontaneity between in-office and remote workers.

Additional takeaways: 

Uneven visibility and access to information leads to inconsistent decision making

Hybrid teams often face uneven information sharing. Consequently, in-office employees have a considerable advantage over remote employees. This contrast creates an uncomfortable information hierarchy between team members. Hybrid teams should acknowledge this challenge and establish a few ground rules to encourage consistent information sharing. Handbooks with organizational protocols, FAQs, policy terms, and training resource links can help here.

Influence is a product of visibility. Those who are “visible” influence the flow of work and decisions. Naturally, in-office employees have the edge over remote workers in this aspect too. Remote employees often find it challenging to share their opinions during discussions; when the rest of the team is collectively debating an issue in the office, all they can do is rely on their laptop screens. Remote employees may be working longer hours and increasing productivity but still going unacknowledged compared to in-office workers. And thus, hybrid teams should adopt practices to even out these disparities.

One way is always to encourage input from members that logged in virtually before the rest. Additionally, managers must focus on equalizing employee experience by ensuring equal information accessibility. They should ensure that employee benefits are beneficial for both in-office and remote workers. 

The “Zoom gloom” dampens team morale

Hybrid teams tend to suffer from the “zoom gloom.” This phenomenon is a result of the stress and lack of human contact brought by virtual meetings. Zoom offered advice for eliminating the gloom of too many virtual conferences. It shared that seeing oneself during meetings heightened anxiety levels. And hence, hiding self-view could help in reducing stress. Another research found that when participants got a break and meditated between sessions, their stress levels dropped significantly and did not build up over time. 

Using informal communication channels to build employee relationships is a big challenge for hybrid organizations. More than two-thirds of workers wish to spend more time with their in-office peers to develop better connections. The virtual workplace gets work done but ends up losing out on ‘hall talk.’  Hall talk is crucial for organizations as it encourages new ideas, information-sharing, and relationships. What’s more, virtual workplaces eliminate spontaneity and hamper the quality of communication. Eventually, this can dampen team morale. 

Promoting relationship-building activities in day-to-day work calls can help fix this issue. Activities like ‘creative introductions’ and ‘team kudos’ can help build a rich hybrid workplace. 

Inconsistent engagement leads to misunderstood concepts

The physical office space does not serve as the central hub for engagement in hybrid teams. The absence of a central hub makes it challenging to conduct events that require high levels of engagement, like high-value client meetings. Video calls, although convenient, cannot replicate the richness of face-to-face communications, especially when complex issues are under discussion. As a result, 53 percent of remote workers fear being left out of crucial team meetings and other activities in the office. And thus, managers are in a constant quest to find arrangements that satisfy the communication needs of hybrid teams.

Managers should design a selection guide that allocates workplaces based on the task. This guide can help in identifying and harmonizing activities that genuinely require face-to-face conversation. Similarly, leaders should invest time into equipping hybrid teams with the tools and resources necessary for rich engagement. 

Read the complete article.

Turing is an automated platform that lets companies “push a button” to hire senior, pre-vetted remote software developers. Firms can hire from a global talent pool of top 1% of 700K+ developers with strong technical and communication skills who work in their time zone.

For more information, visit Turing’s Hire page. 

Business vector created by stories –

Tell us the skills you need and we'll find the best developer for you in days, not weeks.

Hire Developers

By Jun 28, 2021
Developer Testimonials

How to be a successful remote software engineer

This blog post covers how a developer can be recognized, find a remote job, and be successful working remotely. However, it’s important to understand what is in it for organizations hiring remote developers.

*Full Disclaimer: All the views expressed in the blog are solely my personal views and biased based on my personal experience. The best-practices, technologies, or benefits listed are no silver bullets. The article is focused on engineers in the web development space. 

Remote working is not a new concept but working remotely is gaining popularity during these times. Many organizations are forced to rethink how they work. Covid-19, has impacted every person in the world, but with the challenges the pandemic has created comes opportunity.

There has never been a better time to work remotely, especially for engineers. Many organizations have now turned remote-friendly, some have also started hiring developers from regions unheard of – the reason? Untapped potential!!

This blog post covers how a developer can be recognized, find a remote job, and be successful working remotely. However, it’s important to understand what is in it for organizations hiring remote developers.

Why organizations should hire remote developers

It would be unfair to say that organizations do NOT want to hire remote developers as they are bound by government laws which prevent them from going beyond their country to hire a person on their payroll. It’s only possible for large corporations.

Let’s first understand the benefits of hiring remote engineers. As an organization you can:

  • Hire engineers who have untapped potential – these engineers have high productivity and are eager to learn.
  • Hire engineers from countries with lower GDP – allows you to pay people less than you would if you hire local talent.
  • Add diversity to your company culture – allows sharing different ideas and perspectives that you did not have before.
  • Become a 24×7 company – by hiring engineers in varied timezones you can move faster and support customers globally.

Now that you understand why a company wants to hire you, let’s discuss why a developer would want to work remotely.

Why engineers should consider remote jobs

There are many benefits (and few drawbacks) of working as a remote engineer. 

  • Choose your hours – Since you work in a different timezone, you can choose the hours you want to work, though it’s important to have some overlap. (more on that later)
  • Work with people with diverse backgrounds – there is a different thing about people who are well-traveled, right? Why is that?
  • Get paid more than your peers – you can only earn what your industry pays you, what if you changed the local industry? 😉
  • Choose where you work– Home, Coworking office, Coffee Shop? It’s recommended though you have a consistent setup (again, later!)
  • Better work-life balance – Save time traveling, get more time off (remote organizations are usually flexible), be with your loved ones often.
  • Choose your own technologies – though it helps get better jobs depending on the tech you work with, organizations are looking for the skills you’ve developed to help them identify what you’d work on.
  • Immense growth – working with people globally brings a lot of different perspectives allowing you to 10x your growth.

Why would organizations consider you

We have established that organizations want remote engineers, now let’s look at why an organization would consider you? What do you need that makes an organization believe you are remote-friendly?

Open Source Contributions
Organizations want to look at the work you have done. 

  • It increases the credibility of your work
  • It shows that you love writing code
  • It gives them a glimpse into the code you write

Remote-friendly technologies
If you are looking to join a startup, most likely they use technologies that are popular right now. Having experience in current tech is a great way to get noticed. Some of these technologies are (but not limited to):

  • Javascript (Node and React)
  • GraphQL
  • Python (Django)
  • Kubernetes and other cloud devops experience is a huge plus

It usually helps to be able to work on both backend and frontend (Full-Stack), since it’s crucial to be self-driven in a remote environment.

Solid previous experience and profile
Organizations love when they find a person who is a great problem solver. Working on multiple projects and industries, at different roles, are usually indications that you will do well in their company. Companies will also check your Linkedin profile to understand you better. Having an updated profile and strong recommendations from previous employment can go a long way towards helping you find the right remote job.

I saved the most important one for the last. Companies hire for attitude rather than skill. Skill can be learned, but attitude takes a long time to correct. Having the right attitude is the only way to get good remote jobs. 

So what do I mean by having the right attitude? 

Display a willingness to learn more about their company, show a genuine interest in the company’s industry and what it cares about. Read the company’s vision, its core values, culture, and apply only if these attributes excite you. It’s essential that you’re a quick learner so that you can developed the required skills to perform at the company.

How to find remote jobs

So, if you have what it takes to be a good remote engineer, the question is, how do you find a remote job that you love?

Apply to a company’s remote jobs (via portals or company website)

If you do a quick search on Google, you will see many platforms like WeWorkRemotely,, and others.

You can start by looking at the skill you want to target and applying on the posts (make sure you research the company before applying). You need to have a great cover letter. Cover letters are a great way to express why you are the best person for the job they posted. A strong cover letter makes you stand out as companies receive 100s of applications.

Which application do you think they are most likely to open first? The one with the cover letter! You can also search for companies which are remote-friendly and apply directly via their websites.


Freelancing is also another way to get jobs. Freelance positions offer more flexibility and let you have a better work-life balance. Freelance work also gives you the chance to choose your hourly rate, but you may sacrifice job security, and you might also waste time hunting for your next gig.

Platforms like Turing, guru, Upwork, and freelancers are good places to find remote gigs.

Personal Connections

Twitter is a great place to build relationships with other fellow developers. These connections will help you find your next job. 60% of organizations hire people that are referred by the people already working in their companies. This means the more people you know in the industry, the better chance you will have to get a good job. 

Turing is a unique platform that bridges the gap between a freelance platform and a job portal. It is truly focused on the developer’s well-being, growth, and tools to be successful in working remotely.

Turing is different because:

  1. You do not have to hunt for jobs – Turing will understand your goals and find you a job that you want. 
  2. You get long term work – You will work with a real company as their team member. You get the benefits of the company you are working for under turing. 
  3. You still get the flexibility as you choose your own hours and your rate.
  4. Turing pays you on time – you do not have to follow up with your clients to get paid or depend on a rating system to get jobs. 
  5. Turing handles issues that may arise between you and the client. 

Turing gives developers peace of mind by allowing them to focus on their skills and their job instead of spending time doing administrative work that reduces their productivity.

Working Remotely

Getting a job is only the first step. There is a lot more that you need to do to be successful at your job. 

Being an effective communicator is the key to being successful at a remote job. Working remotely means you need to make extra efforts to communicate with your manager.

  • Have regular check-ins with your manager (weekly as well as monthly)
  • Have at least 3 hours of time overlap between yours and your team’s work hours. 
  • Make sure you and your manager(and your team) are always on the same page, and that expectations are clearly understood. actually does a great job improving your communication with your manager. 

You need to be self-driven. The more you have to depend upon another person on the team, the more difficult it will get to be productive in your job. It certainly helps if you are a full-stack engineer, as this allows you to do both the frontend and the backend by yourself – if it is not possible then you must try to separate (but not isolate) your responsibilities.
The more time overlap you have with your team, the more flexible you can be with respect to separating your work responsibilities.

Having a decent office and workstation setup is very important. You cannot be productive at your work if you have “pebbles” on the race track you are trying to win.

  • Make sure you have a good (and consistent) place to work
  • Your environment should be distraction-free
  • Good camera and microphones to have calls with your team. 
  • A fast computer that can handle your daily workload

Remote teams are happy and do more if they trust each other.

Here is a great article.

With this, I wish you luck finding a great remote company to work at. It can be hard, but rewarding. I trust that can help you find the next job that you love. 🙂

Join a network of the world's best developers and get long-term remote software jobs with better compensation and career growth.

Apply for Jobs

By Oct 27, 2020
MySQL Client / Server Protocol Using Python & Wireshark: P2
Developers Corner

Understanding MySQL Client / Server Protocol Using Python & Wireshark: Part 2

In this blog, we’ll learn how to write our own native MySQL client from scratch without using a connector or external libraries.

In the previous article we researched MySQL Client / Server Protocol using WireShark. Now lets start to write our code in python to simulate MySQL native client. Final codes are here: Github repo

First of all we have to create MYSQL_PACKAGE class. MYSQL_PACKAGE class is the parent of all other package classes (HANDSHAKE_PACKAGE, LOGIN_PACKAGE, OK_PACKAGE and etc.)

It accepts resp parameter on initialization. Resp is the binary response received from the server in bytesarray type. One of the important and interesting method of this class is next method.

Method next reads a portion of the bytes from the binary response. When we call this method, it reads some portion of bytes and puts a pointer to the last position where reading ended (changes a value of self.start and self.end properties). When we call this method again, it starts to read bytes at the point it last stopped.
Method next accepts five parameters: length, type, byteorder, signed, and freeze. If freeze is True it reads some portion of bytes from the binary response but does not change pointer position. Otherwise it reads a portion of bytes with given length and changes the position of pointer. If length is None then method reads bytes until the end of response bytesarray. Parameter type can be int, str, and hex data types. Method next converts a portion of bytes into the appropriate datatype according to the value of type parameter.
Parameter byteorder determines the conversion of bytes to integer type. It is up to the architecture of your computer. If your machine is big-endian, then it stores bytes in memory from the big address to the little. If your machine is little-endian, then it stores bytes in memory from the little address to the big. Thats why we have to know the exact type of our architecture to be able to convert bytes to integer correctly. In my case, it is little-endian, that’s why i’ve set the default value of byteorder parameter to “little”.
Parameter signed is also used in conversion of bytes to integer. We tell the function to consider each integer as unsigned or signed.
A second interesting method of this class is encrypt_password. This method encrypts a password with the given algorithm.

This method accepts two parameters: salt and password. Parameter salt is the concatenation of two salt1 and salt2 strings from the Greeting Packet received from the server. And parameter password is the password string of mysql user.
In the official documentation password encryption algorithm is:
Here “20-bytes random data from server” is concatenation of salt1 and salt2 from the Greeting Packet received from server. To remember what the greeting packet is look at the previous article
Now I want to explain the encrypt_password method line by line.
bytes1 = sha1(password.encode(“utf-8”)).digest()
We are converting password string to bytes, then encrypting it with sha1 function and assigning to bytes1 variable. It is equal to this part of algorithm:
Then we are converting salt string into bytes and assigning to the concat1 variable.
concat1 = salt.encode(‘utf-8’)
Third line of the method is:
concat2 = sha1(sha1(password.encode(“utf-8”)).digest()).digest()
Here we are double-encrypting password string with sha1 function and assign it to the concat2 string.
Now we have two concat1 and concat2 variables. We have to concatenate them into one byte array:
bytes2 = bytearray()
Then we have to encrypt concatenated bytes with sha1 function and assign to the bytes2 variable.
bytes2 = sha1(bytes2).digest()
So we have two variables with encrypted bytes: bytes1 and bytes2. Now we have to do bitwise XOR operation between these variables and return the obtained hash.
hash=bytearray(x ^ y for x, y in zip(bytes1, bytes2))
return hash


In the previous article we’ve learned about Int and String data types of MySQL Client / Server protocol. Now we need some classes to be able to read fields from received packets.


Int class implements INT data type of MySQL Client / Server protocol. It accepts package parameter on initialization. Parameter package should be the instance of any package class inherited from MYSQL_PACKAGE class. Method next detects the type of integer (int<fix> or int<lenenc> (see previous article) and calls the next method of package object to read the byte portion of received response.


Str class implements STRING data type of MySQL Client / Server protocol. It accepts package parameter on initialization. Parameter package should be the instance of any package class inherited from MYSQL_PACKAGE class. Method next detects the type of String (String<fix>, String<Var>, String<NULL>, String<EOF> or String<lenenc>. See previous article) and calls the next method of package object to read the byte portion of received response.


HANDSHAKE_PACKAGE class is used for parsing the Greeting Packet received from server. It is inherited from MYSQL_PACKAGE class and accepts resp parameter on initialization. Parameter resp is the Greeting Packet response in bytes type recieved from the server.

Method parse reading fields from the response using Int and Str classes and puts them into a dictionary and returns.


This class is used for create Login Request packet.

OK package and ERR package are the response package of server after authentication or after sending query to server on command phase.


MYSQL class is the wrapper class which creates TCP connection with server, sends and receives packages from server using above classes.

I think everything is clear in this class. I’ve defined __enter__ and __exit__ to be able to use this class with “with” statement to automatically close TCP connection. In __enter__ method i’m creating TCP connection over socket. And in __exit__ method i’m closing created connection. This class accepts host, port, user and password parameters on initialization.
In the connect method we receive greeting packet from server:
resp = self.client.recv(65536)
In the login method we create Login request package using LOGIN_PACKAGE and HANDSHAKE_PACKAGE classes and sends to the server and gets OK or ERR packages.
That’s all. We’ve implemented the connection phase. To avoid making this article too long I will not explain the command phase. Because the command phase is easier than the connection phase. You can research it yourself with the knowledge you’ve accumulated from this and previous articles.
Demo Video:

If you’re a brilliant developer looking for remote software jobs, Turing may be able to help you very quickly. Head over to the Jobs page to know more!

Join a network of the world's best developers and get long-term remote software jobs with better compensation and career growth.

Apply for Jobs

By Oct 9, 2020
Smart Slack hacks ultimate guide

The Ultimate Guide to Slack Hacks

Slack is one of the most popular communication tools for remote teams. With the ability to coordinate conversations by a specific theme, within a team or company-wide, there is great power in this platform. Long popular with remote teams, here are some tips and tricks that you might have missed. Use these to make the most of your time and communication efforts.

Slack is one of the most popular communication tools for remote teams. With the ability to coordinate conversations by a specific theme, within a team or company-wide, there is great power in this platform.

Long popular with remote teams, here are some tips and tricks that you might have missed.

Use these to make the most of your time and communication efforts.

We will cover:

Notification Management

Pin important messages

Keyboard shortcuts

Polls and surveys

Star items = quick list

Slackbot Reminders

Include posts

Keyword Notifications

Find mentions quickly

Search Smarter

Quick link to previous posts

Bookmark location in a channel

Formatting for Impact

Deep Work Time – DND

Customized Emojis

Integrate! Apps, bots, and workflows

Notification Management

Pin important messages

    • You might want to pin the most current update of the project you are working on or your guide to using the channel. You can pin up to 100 messages per channel, but keeping it to crucial information is better.

Keyboard shortcuts

    • You can use keyboard shortcuts to navigate around the Workspace, mark a message as read or unread, format your messages, and more. Saving time and giving flow and process to your time in Slack.
    • When all the pictures and GIFs are making it hard to follow the conversation type “/collapse” into your text box, which will leave text only within the chat and reverse this type “/expand.”
    • To see the list of shortcuts hit “ctrl” and “/.”

Notification Management

    • You may not need notifications for all activity within a channel. Adjust your notification requirements by selecting the settings icon (cog) at the top of the channel on desktop or using the drop-down menu (3 dots) on mobile, then settings, then notifications/notification preferences.

Polls and surveys

    • Want to get some quick feedback from the team? Or trying to decide on meeting times? Use the command “/poll” and follow the instructions to call up the “Polly” app. Both powerful and fun.

Star items = quick list

    • Click “Show starred items” or use the keyboard shortcut “crtl_shift+s” for a quick list of all your starred messages. This hack can be useful to quickly review essential items and help you to come back to something you might not have time to handle at the moment.

Slackbot Reminders

    • Use the “/remind” command to give you a personal reminder, or to remind someone else on your team. An example is “/remind @Jeff of meeting at 2 pm”, your reminder will be sent at 2 pm to Jeff about your upcoming meeting.

Include posts

    • Where you need to share longer-form content, you can include posts in your Slack messages. You might want to share project plans, or quickly link to your code of conduct, vision, and mission statements.
    • Create a post – (On your desktop). Select the attachment icon (paperclip) → “Create new” → “Post.” From here, you can share your post, edit it, allow others to edit it, format the article, and add images to it—further instructions via the Slack help section

Keyword Notifications

    • While you will get notifications if you are tagged or mentioned, it can be useful to get a notification. Likewise, when someone uses a specific keyword. Go to preferences, then notifications to set up your desired keywords. You will receive the notification, and the channel will display a badge.

Find mentions quickly

    • You can use the @ symbol on the top right on desktop to show, or hide, mentions if you are looking for a recent conversation (or you’re drowning in notifications). Or use the keyboard shortcut “ctrl” + ”shift” + ”m” to show and hide your mentions.

Search Smarter

    • Use modifiers that help you to search smarter. “From:user”, “in:channel”, “during:March”, or “has:emoji-code”, this one is particularly useful if you follow a specific process of emoji usage within your Workspace. You can find a complete list of search modifiers here.

Quick link to previous posts

    • Using the timestamp (time beside your name above a post), you can copy this as a link and paste into a new post, bringing old posts back into the conversation quickly.

Bookmark a location in a channel

    • Some channels require more attention from us than others, if you need to read everything in the channel then use “Alt+click” on the message where you are leaving the channel, it will mark all subsequent messages as unread. On mobile, this should be a long press/hold on the message.

Formatting for Impact

    • Need certain parts of a post to stand out? Then use formatting. E.g., using * either side of a word will embolden it i.e., *here* now becomes here. Or traditional keyboard shortcuts also work. You can also add formatting like inline code or block quotes, very useful to help faster communication of crucial information. More on formatting your messages from Slack.

Deep Work Time – DND

    • DND – You can type in “/dnd” into the text box and then set a time, or use the bell icon to the top left and select a time frame. Stopping you from receiving any sounds or notifications in the time frame you specify, and your co-workers will see a sleeping symbol beside your name.

Customized Emojis

    • Emojis can be useful to speed up communication within your team or to help strengthen branding and team identity. You can add the custom emojis from the drop-down menu on the top left and choose “Customize Slack.” Admins have the power to limit who can edit these.

Integrate! Apps, bots, and workflows

      • Slack supports integrations with 100s of apps. Here is a list of some of the most popular ones. See the Slack help center for details on each and a full list of apps available, or click here 
      • Zoom for SlackStart a meeting, join a meeting and make a call with Zoom phone. Remember, you must register your Slack and Zoom accounts with the same email address.
      • Trello for SlackManage cards on your boards from Slack, add conversations to cards, and update due dates.
      • Asana for SlackCreate new tasks and turn your conversations in Slack into to-dos in Asana
      • Salesforce for SlackSearch Salesforce records from Slack, configure Salesforce alerts for Slack. Send Slack messages to Salesforce, or send Salesforce records to Slack.
      • Twitter for SlackYou can set up mentions on Twitter to feed into a channel that the team can keep an eye on. You can also follow similar businesses or your suppliers.
      • Google Calendar for SlackView your full schedule and have your status update when you are scheduled in a meeting.
      • Donut for SlackDonut helps to improve team-building; there are prebuilt connection programs in Donut, one of the most popular functions is virtual random coffees. This helps to encourage cross-organizational bonding.
      • Loom for SlackMention @person or #channel directly in your Loom videos, and they can watch the clip without needing to leave Slack.
      • Polly for SlackThis Polls and surveys bot lets you get quick feedback. You can also use pulse surveys directly in Slack.
      • Greetbot for SlackAn onboarding assistant for Slack. You can use this to customize welcome messages and schedule follow-ups.
      • You can also create custom integrations, build your bot, create automated workflows, and much more, read more on this via the Slack help center here.


Do you have a workflow or trick that works well for you in Slack? Then please share it with us over on Twitter @Turingcom.

Tell us the skills you need and we'll find the best developer for you in days, not weeks.

Hire Developers

By Mar 31, 2020