DEV Community

Cover image for How To Approach Problems As A Developer
Sotiris Kourouklis
Sotiris Kourouklis

Posted on • Updated on • Originally published at sotergreco.com

How To Approach Problems As A Developer

Learning is a constant on the developer career journey. This won't change for a long time. Daily learning of new things is a must if you want to stay up-to-date with the latest trends and technologies.

Most of you have reached a point where you needed to learn a new technology or implement a feature that you've never seen before. I am going to discuss how I approach such problems and what is the best and fastest way to implement them.

Introduction

OAuth is something I've never used before, primarily because most of the software I have created were APIs for B2B applications with only a couple of users. Now, I want to add the famous login with Twitter button to my new SaaS product.

I followed a few simple steps which I am going to share with you and in just 2 days I didn't only implement the feature but I also understood everything about OAuth and how it works.

Image description

General Understanding

The first thing I did before starting was to understand what is under the hood of all the OAuth buttons and how they work. For that, the first thing you always need to do is watch 1-2 videos or read 1-2 articles that explain the infrastructure.

At this point, we need to understand the system design of OAuth and nothing more. Because if you know how something works, then you can implement it.

Laying Down The Options

OAuth has 2 different implementations: OAuth1 and OAuth2. The first thing is to find out what each one is and where it is used. After some digging, I found that OAuth1 is not being used a lot anymore and most companies have migrated to OAuth2.

You need to understand that I haven't done any coding yet. It is better to spend half of your time reading and understanding rather than starting with half the information.

Misinformation is much worse than no information.

Preparing For Coding

Now that you understand how the feature you want to implement works under the hood, you can start getting into the specifics for each language or framework.

For my tech stack, Spring Boot with Kotlin and Web Components on the frontend, I found that Spring Boot by default supports OAuth2. This research is essential before you get to the coding part.

You don't want to start creating something that already exists. Although for the article's purposes, I've done that, so if you want to see how I implemented OAuth1, you can check my other article here:

https://sotergreco.com/first-time-implementing-oauth-on-x-thoughts

To move on, the simple thing I googled was "OAuth2 Spring Boot Kotlin." That way, I not only found that OAuth2 support existed but also found code examples.

Chat-GPT is something you need to keep in mind as well. Asking things like "how to implement OAuth2" can be helpful. But for this implementation, I decided to go with Grok. That's because I am trying to do an X implementation, so using the X AI should do the job better.

Documentation

Digging through the documentation is really important. Some products have poor documentation, so you need to determine if it is well-written or not. X has very good documentation (https://developer.x.com/en/docs/authentication/oauth-2-0). I read the steps I needed to follow.

For Spring Boot, the first part of OAuth2 is built-in. However, the second part, the callback, was not, so I had to create the functions to handle it.

With the new version of Chat-GPT4o, you can give it the documentation, and it can read it for you and provide help. You can check my chat here: https://chatgpt.com/share/3414ccca-5f3a-4050-89e7-db94f4a448ba.

This is the question I asked: "Read this documentation and give me some bullet points on how I can implement this on Spring Boot with Kotlin. I want to add OAuth2 to my API. https://developer.x.com/en/docs/authentication/oauth-2-0/user-access-token"

Debugging and Copilot

As you can see developing new features is much different from 3 years ago. You main friend now is AI. Of course you read the docs or watch videos but most of the work is done by the AI.

Copilot and autocompletion is very important. That's because if nows the syntax for you. This is a lot helpful when you are working on environments that you are not familiar. Use copilot for syntax related tasks and it will give you an advantage on Speed.

In the old days we were google even for syntax, now copilot knows the syntax of both libraries and languages. As you can see here I am using I library for Http requests on Kotlin and Copilot helped me a lot on that. There is no need to google "OkHttp Kotlin Building Requests"

Image description

Building a Learning Routine

Establishing a consistent learning routine is crucial for continuous growth as a developer. Allocate specific times each day or week dedicated to learning new technologies, reading technical blogs, or experimenting with coding techniques.

Consistency is key, even small, regular efforts can lead to significant improvements over time. Also don't forget to use AI to enhance you learning experience.

Final Words

In conclusion, tackling new problems as a developer involves a structured approach: understanding the underlying concepts, thoroughly researching options, utilizing available tools and resources, and continually learning.

By leveraging AI tools, maintaining a consistent learning routine, and dedicating time to understanding documentation and system design, developers can efficiently implement new features and stay ahead in the ever-evolving tech landscape.

Thanks for reading, and I hope you found this article helpful. If you have any questions, feel free to email me at kourouklis@pm.me, and I will respond.

You can also keep up with my latest updates by checking out my X here: x.com/sotergreco

Top comments (0)