What's GitHub Copilot and How Devs can Benefit From It

What's GitHub Copilot and How Devs can Benefit From It

Developers often find writing code to be a tedious and time-intensive process. As a result, they are constantly seeking innovative methods to enhance their programming efficiency, precision, and productivity.

Automatic code generation tools like GitHub Copilot can be helpful.

What is GitHub Copilot?

So, Copilot is not just an autocomplete tool, it offers a wider range of suggestions based on the context of the code being written. Copilot can propose entire functions or lines of code by analyzing the context of the code being written, providing developers with a faster and simpler way to write their code and reduce need to search for solutions elsewhere.

How Copilot works?

Copilot is powered by OpenAI Codex. Codex is designed specifically to generate code based on natural language inputs. It’s built on top of GPT-3 architecture and trained on a massive dataset of code in various programming languages, as well as other text sources such as books, articles and web pages.

The GitHub Copilot editor extension sends your code context to GitHub Copilot service, which then uses OpenAI Codex to generate code suggestions. It is worth noting that code context information (like programming language, text of the code written so far, libraries or frameworks being used, position of the cursor…) is encrypted and transmitted over a secure connection, ensuring that your code and data are protected.

Copilot can understand and generate code for a variety of programming languages. For each language the quality of suggestions may depend on the volume and diversity of training data for that language. For example, Python and JavaScript are well-represented in public repositories and are one of GitHub Copilot’s best supported languages.

Currently, GitHub Copilot supports several programming languages, including C, C++, Ruby, Scala, Python, JavaScript / TypeScript, PHP, Go, Java, C# – basically all languages that appear in public repositories.

Copilot and Visual Studio

To use GitHub Copilot has support for many IDEs including Visual Studio Code and Visual Studio.

  1.  Create a GitHub account (if you don’t have one already)
  2.  Set up your subscription for a personal account. Go to GitHubCopilot and click on “Start my free trial”. You can then follow sign-up steps and enable your subscription for individuals. Make sure to cancel the subscription before your 60-day trial is up(if you don’t want to continue using the tool)
  3. Make sure you have installed Visual Studio 2022 17.4.4 or later version
  4. Install GitHub Copilot extension in Visual Studio and you are ready to go

Getting started is pretty straightforward:

  1. Start coding
  2. When you get suggestion, hit Tab to accept or Esc to ignore
  3. To see next suggestion use Alt + .
  4. To see next suggestion use Alt + ,
  5. To trigger inline suggestion Ctrl Alt \

Check the video below to see how Copilot generates multiple suggestions for a simple function calculating day difference between two dates. Also, it is able to translate natural language into code, and based on your comment, it tries to give adequate suggestions.

Copilot for individuals vs business

You also have the option to set up a GitHub Copilot Business subscription. More about business subscription, you can find here.

Block suggestion matching public code feature

Copilot includes a filter which detects code suggestions matching public code on GitHub and you can choose to enable or disable this filter. If the filter is ON it checks code suggestions(with surrounding code of ~150 characters) and if it finds a match or near match, the suggestion will not be shown to you.

So basically it’s designed to prevent the tool from suggesting code that is too similar to code that is publicly available on GitHub

Turning this filter ‘ON‘ can be useful for developers or organizations who prefer not to use public code for some reason (avoiding legal issues because of risk of copyright violation, improving security, encouraging originality)

And while turning on this feature can have benefits, it also can have some drawbacks. It may limit the scope and quality of code suggestions provided by Copilot, since the tool’s ability to provide relevant suggestions is based on its access to a wide range of training data, including public code on GitHub, which then can lead to increased development time because the lack of suggestions and reduced code quality (we may miss out on high-quality, well-tested solutions which could improve the quality and efficiency of our code).

Copyright issues

There have been some concerns about potential copyright issues with GitHub Copilot. Since the tool generates code based on ML models trained on publicly available code, there is a risk that it could produce code that violates someone else’s intellectual property rights.

With these updates, developers should be able to locate licensing information for suggested code fragments and access to an inventory of similar code found in GitHub public repositories.

In the image above you can see what GitHub Copilot FAQ states. So GitHub does not own the suggestions GitHub Copilot generates. The code you write with Copilot’s help belongs to you, and you are responsible for it. Thus, developers should be aware of copyright laws. Should developers do their due diligence, perhaps by pasting suggested code snippets into search engines to ensure there’s no copyright attached?


What data Copilot collects?

Copilot collects user engagement data such as user edit actions, error data (errors or issues that occur when using Copilot), and usage data to improve its suggestions and overall user experience. For Copilot for Business, code snippets data is transmitted to GitHub only in real-time to return suggestions, and is discarded once a suggestion is returned. However, for Copilot for Individuals, code snippets data may be collected and retained depending on telemetry settings, and is used to train and enhance AI models.


Incorporate copilot into existing project

The EmployeeRepository is a class that implements the IEmployeeRepository interface, which defines a set of methods for performing CRUD (Create, Read, Update, Delete) operations on employee entities. It uses ApplicationDbContext class to interact with the database.

Example 1 – Adding simple LINQ query

Let’s try to add an additional method for retrieving all employees with a specific job title. The signature for this method was already defined in the IEmployeeRepository interface so I first tried to ask Copilot a question in a comment //Q:What interface member EmployeeRepository does not implement from IEmployeeRepository? ,but he wasn’t able to identify which methods are missing from an interface and I got zero suggestions for that one. After that I provided a comment in a natural language //implement GetByJobTitle which returns a list of employees with a given job title which in the current code context was clear enough for him. Copilot knew that method should return a list, not a single employee, as well as which property to include in the filter. Also, not from a comment but from the current code context, he could make an assumption to exclude deleted employees since the same condition was used in previous queries.

You need to provide descriptive and clear comments to Copilot. The better comment you provide – the higher your chances of getting a better suggestion. E.g. if we omit part of the comment related to the return value, Copilot couldn’t conclude that there could be more than one Employee with the given job title(since job title is not a unique identifier).


Example 2 – Context matters

Let’s go one layer above, to EmployeeService. This class implements business logic. It contains methods that perform various operations related to employees. The class also uses a repository interface IEmployeeRepository to interact with the data layer and a mapping tool AutoMapper to map entities to DTOs (data transfer objects) and vice versa.

Let’s try to give Copilot a hint to implement retrieving of employees on a Service level with this simple comment. A simple comment //implement GetByJobTitle without pagination will do the work. Again, based on the comment it knows that it should call the GetByJobTitle method, and based on code context, it knows that it should use the repository for this call and that result should be mapped to DTO objects. Also, based on code context (e.g GetAll method), it returns distinct employees based on their email addresses.

Example 3 – Analysing codebase and multiple suggestions

Let’s try to add another, a little bit more complicated method to EmployeeRepository. The method is supposed to retrieve all employees who made a desk reservation in the current year. For this purpose, we should use Reservation property (collection navigation property) that allows the employee to access the related “Reservation” entities.

Firstly, I tried to ask Copilot for help to understand better what is Reservation property and what is the relation between Employee and Reservation table. In the image bellow you can see the questions I asked (comments starting with //q:) and the answers I got from Copilot, also via comments starting with //a:

Some of the answers Copilot provided were not correct. E.g. the answer to why ICollection<Reservation> is better to use is correct. Copilot sad that ICollection is more flexible than IList which makes sense, since ICollection is a more generic collection interface that allows more implementation freedom and versatility. But the reason Copilot provided (the last answer in the image) is not valid. ICollection<T> inherits from the IEnumerable<T> interface, which provides a subset of functionality for iterating through a collection, but it does not inherit from IList<T>. It’s the other way around, IList<T> inherits from ICollection<T>. Also Copilot stated that Employee table holds a foreign key reference to Reservation table, which is not correct.

Let’s continue with retrieving Employees who made desk reservation in some office in the current year. We received two suggestions from Copilot.

In terms of performance, the second query is likely to be more efficient than the first query. This is because the second query performs a single database query that filters the Employees table and loads only the relevant data into memory, while the first query performs two separate database queries and then filters the data in memory using LINQ. Copilot can generate multiple suggestions for code, but it is up to the you to evaluate them carefully and choose the best suggestion that fits your needs.

The potential bug in this code is that it only checks whether an employee has a reservation with a start date in the current year. It does not check whether the reservation end date is also in the current year. This could result in returning some employees who have reservations that started in the previous year and ended in the current year.

Copilot can produce code with bugs or not completely correct code so it’s important to carefully review and test any code generated by Copilot to ensure that it meets the required functionality and is free of bugs or issues.

Example 4 – Generating docstrings

Let’s try to test how Copilot can be helpful in this. Firstly, I tried to make Copilot generate the whole docstring for a simple method that retrieves an employee by its id, providing him just a comment, but I didn’t get any meaningful suggestions.

Since I didn’t get any relevant suggestions for multiple variations of this comment, I added docstring for a few methods manually expecting that Copilot will learn from the code context(the structure and content of the documentation, as well as from the code itself) and give me more useful suggestions later.

Here is an example of some docstrings I added manually.

So now, let’s go back to our method and see how Copilot behaves now. In the video below, you can see that after some learning, Copilot is able to generate docstring by itself, step by step. Each new row is a request to Copilot service and a new suggestion, so Copilot is still unable to generate the whole docstring suggestion within one request.

To avoid some unnecessary requests(for opening and closing xml tags) to Copilot service, since they sometimes can have bigger latency, I used a combination of manual docstring writing and Copilot suggestions. One issue here is that Copilot doesn’t offer any suggestions until I separate the start, value and the end of the XML tag in a new line. The suggestions provided by Copilot in this and other examples were useful for me and saved some of my time, but some of them weren’t accurate or clear enough and they needed corrections.

So, yes, Copilot can be a helpful tool for generating code and providing insights into programming concepts, but its answers may not be completely accurate or optimal. Therefore, it is important to carefully review and validate any comments or code generated by Copilot to ensure that it meets the requirements of the project and follows best coding practices.

Summary

  1. The quality of the suggestions provided by Copilot may depend on the size and complexity of your codebase, as well as the specific libraries and frameworks you are using. As you continue to use Copilot and provide feedback on its suggestions, it will improve over time and become more tailored to your specific use case.
  2. Don’t trust by default – read the suggestions and be sure they make sense, always validate and be especially suspicious of long suggestions.
  3. Context is very important – keep related files open and provide clear and concise inputs.
  4. Time saver – you definitely type less with smarter code completion than your IDE offers, especially when its suggestions improve over time and adapt to your coding styles.


Written by  Aleksandra Kovacevic

Senior Back-end Engineer at IT Labs


IT Labs Extending the Collaboration with High School Ilinden

IT Labs Extending the Collaboration with High School Ilinden

On May 12th, IT Labs visited High School Ilinden with a mission to connect with the students and share insights about life at our company and the exciting projects we’re working on.

During our visit, our Chief People & Talent Officer, Frosina Denkova Zafirovska, signed a Memorandum of Collaboration with the school. This represents an exciting opportunity to work towards supporting future talent and young people in the field of IT, as well as creating unique opportunities for a long-term partnership.

Additionally, other members of the team consisting of Risto Ristov (Project Lead); Monika Vojneski (QA Engineer); Ivona Danailova (Business Analyst); and Petar Partaloski (Full Stack engineer) were present and shared their perspectives on working on innovative software development projects. The purpose was to invite team members from different backgrounds so they could communicate their experiences and insights on the daily operations with students. Additionally, they provided a holistic view of how a tech company operates and showcased the value of cross-functional collaboration.

Students were also given a glimpse of what it looks like to be a part of our dynamic team as each member presented their roles and responsibilities and how they contributed to the company.

We’re thrilled we had the opportunity to meet the bright and curious minds of High School Ilinden, and we look forward to a fruitful partnership with the school in the future. We hope that our visit inspired students to pursue their passion for technology while taking a step forward toward building relationships that foster growth and innovation


IT Labs expanding the collaboration with the University of Technology “St. Apostle Paul” in Ohrid, North Macedonia

IT Labs expanding the collaboration with the University of Technology “St. Apostle Paul” in Ohrid, North Macedonia

At IT Labs, we are committed to inspiring young talent to pursue their passion for technology and reach their full potential. Our company is excited to provide educational opportunities and professional development to students who are determined to make a difference and start their careers in tech. As our company grows and our responsibilities expand, we proudly announce our latest collaboration with the University of Information Science and Technology, “St.Paul the Apostle.” 

The beginning of this newly established partnership was marked by the signing of a Memorandum for Collaboration that supports young people aspiring to become skilled tech professionals. Professor Ustijana Rechkovska Shikoska, Ph.D., Vice-Rector, and Frosina Denkova Zafirovska, Head of People & Talent at IT Labs, signed the memorandum. This collaboration represents an exciting opportunity to foster innovation and growth in the IT industry and shape the future of the tech industry with the brightest minds in the field. 

IT Labs is delighted to have been recognized by the University of Information Science and Technology, “St.Paul the Apostle,” as a valuable partner in their journey to guide aspiring techies to become top experts in the industry. 

We’ll continue focusing on partnerships and initiatives that help develop young talents and help them turn their dreams into reality. Stay tuned for more upcoming news on this collaboration.  


Life at IT Labs: Join our Open Day

Life at IT Labs: Join our Open Day

We are super excited to announce that on the 18th of May we are opening our doors to everyone interested in continuing their career journey in the tech industry, but also all of those who want to start their career in tech by exploring our internship program and the job opportunities we offer. 

Join us at our Open Day in Skopje office starting from 4pm CET and get a sneak peek of our cool offices, discover what life is like @ IT Labs, learn about our recruitment process, and explore all the amazing career opportunities we offer! The open day will take place at our IT Labs Arena, and you will get to meet part of our amazing team!  

Through a presentation, our People Engagement Specialist Nikita Popova will share everything about Life @ IT Labs. Write down your questions, because we will have a Q&A session where you can get all your questions about IT Labs answered on the spot. This is your chance to unlock your potential and jumpstart your tech career-by joining our internship program or our open job positions and be a part of an amazing team!

If you can’t make it in person, check out the link below. 

Join us online

IT Labs announces new partnership with the Faculty of Informatics in Shtip 

IT Labs announces new partnership with the Faculty of Informatics in Shtip 

IT Labs is a company that takes pride in supporting talented young professionals, and as our brand continues to grow and develop, so does our responsibility.  

Therefore, it is with great enthusiasm that we announce our collaboration agreement with the Faculty of Informatics in Shtip, as part of our ongoing commitment to empowering young people to reach their full potential and become highly skilled tech professionals. 

To promote this new partnership, IT Labs organized a week-long lecture series, at which visitors had the chance to follow presentations from our top experts and get insights on key topics in the tech industry. Martin Trajkov (Back-end Engineer), Ema Toshevska (Project Manager) and Vlatko Zmejkoski (Back-end Engineer) delivered a trio of informative guest lectures on diverse subjects, ranging from Databases to Project Management and Visual Programming.  

We’re honored that the Faculty of Informatics in Shtip has acknowledged us as a valuable partner in their pursuit of guiding young techies toward developing into top-notch tech professionals and turning their dreams into reality.

Greater collaboration between IT companies and academic institutions can enhance the quality of education for younger generations, giving them an opportunity for gaining practical knowledge and empowering them to secure a bright future. Our focus for the time ahead will be on expanding this partnership and providing young individuals with the tools and support they need to turn their aspirations into achievements. 


New Internship Program at IT Labs: Kickstart your Tech Career! 

New Internship Program at IT Labs: Kickstart your Tech Career! 

To all aspiring techies, we have something for you!
Are you eager to grow your skills and kickstart your career in the tech industry? Preparations for our next internship program are underway!

Apply Now

We are thrilled to announce our upcoming Internship program enabling students and graduates from universities from Macedonia and Serbia to kickstart their tech career at IT Labs.

We are looking for bright thinkers to join the Internship program and take over the world by becoming the next super smart techies in Full stack (.NET + React), Quality Assurance and Data Science. While learning from professionals, with hands-on experience throughout the years in the tech world, you will get the chance to work on real projects and experience the awesome atmosphere at IT Labs.

Through the 3-month internship program, you will get the opportunity to work within a team and learn by group of mentors that will guide you through the program and encourage you to learn how take a lead of real projects.

The best part? You will have the unique opportunity to work and participate in real-life projects that reflect everyday life in IT Labs. The program will cover the following tech stacks 

Full stack (.NET + React)

Apply Here

Quality Assurance

Apply Here

Data Science

Apply Here

During the internship, interns will work and learn from IT Labs’ best, who will assist them in achieving their full potential and act as a guide every step of the way by honing their skills and learning invaluable tricks of the trade. Upon successful completion of the program and after tackling all the exciting challenges, there will be an opportunity for a full-time role within our team. 

Cannot make it to the fair? We have a dedicated page online on which you can learn more about the company, and if you’d like to learn more about the internship program, feel free to shoot an email at talent@it-labs.com, and our team will get back to you shortly. 

Stay tuned for more info by following our social media channels:   


IT Labs to Participate in the ELFAK Open Day 2023

IT Labs to Participate in the ELFAK Open Day 2023 

On April 26th, IT Labs will visit the Faculty of Electronics in Niš as part of the Elfak Open Day event. During this day, visitors will have a unique opportunity to learn more about IT Labs and their career opportunities by speaking directly with their HR representatives – Andrea Lapevska, Jelena Trajkovic, and Frosina Zafirovska.   

This visit is a unique chance for students and faculty members to learn more about life at IT Labs and the career opportunities we provide. As a company specializing in software solutions, we have experienced remarkable growth, counting 200+ team members worldwide, with teams in Europe and North and South America. We are always looking for talented individuals to join our ranks and grow together with us!   

In addition to this, the following day – April 27th – IT Labs will hold a  Company Day, at which visitors will have the chance to follow a presentation from our HR representatives, as they describe life at IT Labs, and the benefits we offer the our team members. Furthermore, visitors will also have the opportunity to attend a lecture by IT Labs’ Technical Lead, Milan Saric, titled “Common Mistakes in React,” which will cover common mistakes in all phases of product development and how to recognize and avoid them in the future.  

The ELFAK Open Day is an event aiming to introduce prospective and current students to the opportunities available at the faculty, as well as companies looking for tech talent. High school students from Niš and surrounding cities are invited to visit the faculty, where they can interact with professors and assistants and explore exhibits showcasing the various departments.  

The event will also feature company stands showcasing their work and profiles of engineers needed in the industry.  

Take advantage of this unique opportunity to learn more about IT Labs and the software industry.

We look forward to seeing you on April 26th and 27th at the Faculty of Electronics in Nish! 


Code to Escape Challenge

Get ready for a challenge that combines the excitement of an escape room with the problem-solving skills of programming.

In this virtual escape challenge, your team of 2 to 3 coders will be tasked with solving puzzles, breaking codes, and overcoming obstacles in a virtual mission. Using your programming skills, you will work together to crack the code and escape as fast as possible. With a range of challenging puzzles and obstacles, this virtual escape challenge is a test of teamwork, creativity, and problem-solving skills.

Do you have what it takes to escape the virtual room? Gather your team and find out!

Sign up below and get a chance to win some cool prizes!

IMPORTANT:

  • yes, there will be rewards for the winning team(s)
  • must apply as a team, teams can consist of minimum of 2, and maximum of 3 members;
  • you have the option to code in any language you want: C, C#, C++, Python, Java, JavaScript, PhP, and more!
  • the escape room to be played will be picked before the start of the competition;
  • think smarter, not harder – it’s all about having fun and exploring options, rather than thinking about complex code
  • you’ll be competing on your own device – so bring your laptop!

Register Now!

IT Labs Establishes a Collaboration with the University “St. Kliment Ohridski” in Bitola

IT Labs Expanding the Collaboration with the University “Kliment Ohridski” in Bitola, North Macedonia

As IT Labs grows and expands as a brand, so does the company’s obligation to help up-and-coming tech professionals during their formative years – so we’re proud to announce that IT Labs has entered into a collaboration agreement with the University “St. Kliment Ohridski” in Bitola.

The signing of the collaboration was followed by an event – an IT Labs Open Day at the Faculty of Technical Sciences, at which visitors had the chance to follow presentations from IT Labs’ Kostadin Kadiev (Head of Technology), Frosina Zafirovska (Chief People & Talent Officer), and Blagoj Kjupev (CIO), as each of them covered the technologies and projects IT Labs team members work on and with, and the educational and growth opportunities we offer to aspiring techies. As part of the Open Day, IT Labs’ exciting new Chip Design with HDL Program  was also promoted.

 

As a company that looks to grow and develop tech professionals, we’re grateful to the University “St. Kliment Ohridski” in Bitola for recognizing us as a worthy partner in their efforts to help young people develop into top professionals. The focus is now on expanding the collaboration even further, helping aspiring techies turn their dreams of becoming highly skilled engineers into reality!

Closer collaboration and cooperation among IT Companies and academic institutions will help in providing better education to the next generation of techies, helping them secure their future, and spur innovation and invention.

 


IT Labs Expanding the Collaboration with the University “Goce Delchev”

IT Labs Expanding the Collaboration with the University “Goce Delchev” in Shtip, North Macedonia

On March 20th, IT Labs held an Open Day at the Faculty of Computer Science at the University “Goce Delchev“ in Shtip, North Macedonia, as part of IT Labs’ activities to deepen and strengthen the long-term collaboration the company has with the faculty. 

At the Open Day students and visitors had the chance to follow presentations from IT Labs’ Kostadin Kadiev (Head of Technology), Frosina Zafirovska (Chief People & Talent Officer), and Blagoj Kjupev, as each of them covered the technologies we work with, our projects, and the educational and growth opportunities we offer to aspiring techies. 

As part of the collaboration, a few IT Labs employees will also hold classes and presentations as subject matter experts in various fields, sharing their invaluable work experience with students. 

Closer collaboration and cooperation among IT Companies and academic institutions will help in providing better education to younger people, helping them secure their future, and spur innovation and invention. IT Labs is grateful for the opportunity provided by the faculty, and the focus is now on expanding the collaboration even further, helping aspiring techies turn their dreams of becoming highly-skilled engineers into reality!