<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Patrick Jung on Medium]]></title>
        <description><![CDATA[Stories by Patrick Jung on Medium]]></description>
        <link>https://medium.com/@pddstudio?source=rss-60521da8fe0a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*AWRIhckNl2S-4Wj3ktdkpw.jpeg</url>
            <title>Stories by Patrick Jung on Medium</title>
            <link>https://medium.com/@pddstudio?source=rss-60521da8fe0a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 18:10:15 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pddstudio/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mobile Assistant: Create a Telegram Bot Using ChatGPT & Kotlin]]></title>
            <link>https://medium.com/arconsis/mobile-assistant-create-a-telegram-bot-using-chatgpt-kotlin-e7c991e14579?source=rss-60521da8fe0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7c991e14579</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[chatbots]]></category>
            <dc:creator><![CDATA[Patrick Jung]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 14:01:49 GMT</pubDate>
            <atom:updated>2023-06-15T14:01:49.239Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y19jbZDCaGYKSNbs" /><figcaption>Photo by <a href="https://unsplash.com/@christianw?utm_source=medium&amp;utm_medium=referral">Christian Wiediger</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’ve been using ChatGPT for a while now, mostly for work purposes, but it has also simplified my personal life here and there. It’s quite handy to be able to ask someone all sorts of questions and get an answer right on the spot. The only downside so far is that once I’m away from my computer, having a convenient ChatGPT-powered assistant on the phone either requires the use of the browser or one of the ChatGPT-powered services that offer mobile-optimised chatbots, all of which are paid services (at least the ones I’ve found so far; excluding already exisiting self-hosting open source solutions).</p><p>But instead of using one of those services, I wanted something that’s more like a personal assistant. Ideally, I’d like to reach my assistant the same way I reach out to my friends and family: by using a chat app.</p><p>Since WhatsApp is a bad thing (and does not offer a public API anyway), the decision to use Telegram was a quick one. <a href="https://core.telegram.org/bots/features">Telegram also has a nice API</a> and a very easy and convenient way to create your own bots.</p><p>I won’t go deeper into detail on how to set up your bot. If you’re interested in creating your own bot, check out <a href="https://core.telegram.org/bots/features#creating-a-new-bot">Telegram’s guide</a> on how to do it.<br>Once you’ve created your bot, you can use your token to authenticate against Telegram’s API. We’ll save the token for now, as we’ll need it later.</p><p>Besides that, we’ll also need our OpenAI API key, which you can <a href="https://platform.openai.com/account/api-keys">find or create here</a>.</p><p>Since I wanted to use Kotlin for this project, I checked out some repositories on GitHub and collected two libraries that I’ll use for my approach:</p><ul><li><a href="https://github.com/kotlin-telegram-bot/kotlin-telegram-bot">Kotlin Telegram Bot</a></li><li><a href="https://github.com/aallam/openai-kotlin">OpenAI Kotlin</a></li></ul><p>That’s really all we need. Let’s start cooking!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Ftenor.com%2Fembed%2F25702406&amp;display_name=Tenor&amp;url=https%3A%2F%2Ftenor.com%2Fview%2Fwalter-white-cooking-gif-25702406&amp;image=https%3A%2F%2Fmedia.tenor.com%2Fl7-ORI8t6IwAAAAC%2Fwalter-white-cooking.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=tenor" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/f770693408d9d6e6111e56002f1cd55f/href">https://medium.com/media/f770693408d9d6e6111e56002f1cd55f/href</a></iframe><h4>Building the Assistant</h4><p>First things first: I created a new Kotlin project which is using Gradle as a build system. Once the project is set up, I create an entry point for my application, which for now just prints “<em>Hello World”</em>.</p><pre>fun main() {<br>    println(&quot;Hello World!&quot;)<br>}</pre><p>You can now run the main function to check that everything works as expected. There should be no errors and the “Hello World” message should appear on your terminal.</p><p>The next thing we need to do is add our external dependencies to the project. These are added in the build.gradle.kts (or build.gradle if you’re not using the Kotlin DSL).</p><pre>/* ... */<br><br>repositories {<br>    mavenCentral()<br>    maven(&quot;https://jitpack.io&quot;) // required for telegram bot dependency<br>}<br><br>dependencies {<br>    // OpenAI dependency (BOM)<br>    implementation(platform(&quot;com.aallam.openai:openai-client-bom:3.2.3&quot;))<br>    implementation(&quot;com.aallam.openai:openai-client&quot;)<br>    runtimeOnly(&quot;io.ktor:ktor-client-okhttp&quot;)<br><br>    // Telegram Bot dependency<br>    implementation(&quot;io.github.kotlin-telegram-bot.kotlin-telegram-bot:telegram:6.0.7&quot;)<br><br>    testImplementation(kotlin(&quot;test&quot;))<br>}<br><br>/* ... */</pre><p><strong><em>Hint:</em></strong><em> If you are having trouble configuring your dependencies, check out the READMEs of the projects for more details.</em></p><p>Once the dependencies are added, we can start setting up our bot.<br>The first thing we want to do is configuring our Telegram bot to listen for incoming messages.</p><pre>import com.github.kotlintelegrambot.bot<br>import com.github.kotlintelegrambot.dispatch<br>import com.github.kotlintelegrambot.dispatcher.message<br><br>fun main() {<br>    val bot = bot {<br>        token = &quot;YOUR_API_KEY&quot;<br>        dispatch {<br>            message { <br>                // HANDLE INCOMING MESSAGE HERE<br>            }<br>        }<br>    }<br>    bot.startPolling()<br>}</pre><p>Now we’re ready to listen to incoming messages and process them with our own logic. From here you can go crazy and implement all kinds of commands or additional logic – but for me the only purpose of the bot at the moment is to accept incoming messages, process them via OpenAI and then send the result back to the sender of the message.</p><p>So let’s configure the OpenAI part so that we can process the incoming message and send the results back. This is what it might look like:</p><pre>fun main() {<br><br>    val openAiClient = OpenAI(<br>        OpenAIConfig(<br>            token = &quot;YOUR_OPENAI_TOKEN&quot;,<br>            logLevel = LogLevel.Info,<br>        )<br>    )<br><br>    val bot = bot {<br>        token = &quot;YOUR_API_KEY&quot;<br>        dispatch {<br>            message {<br>                <br>                update.message?.text?.let { message -&gt;<br>                    val chatId = ChatId.fromId(update.message!!.chat.id)<br><br>                    val result = bot.sendMessage(<br>                        chatId = chatId,<br>                        text = &quot;Processing...&quot;<br>                    )<br><br>                    val messageId = result.get().messageId<br><br>                    val chatCompletionRequest = ChatCompletionRequest(<br>                        model = ModelId(&quot;gpt-3.5-turbo&quot;),<br>                        messages = listOf(<br>                            ChatMessage(<br>                                role = ChatRole.User,<br>                                content = message<br>                            )<br>                        )<br>                    )<br><br><br>                    runBlocking {<br>                        val response = openAiClient.chatCompletion(chatCompletionRequest)<br>                        val responseText = response.choices.firstOrNull().message?.content ?: &quot;A completion error occurred!&quot;<br>                        bot.editMessageText(<br>                            chatId = chatId,<br>                            messageId = messageId,<br>                            text = responseText<br>                        )<br>                    }<br>                }<br><br>            }<br>        }<br>    }<br>    bot.startPolling()<br>}</pre><p>Let’s look at the above changes in more detail:</p><p>First, we’ll create the OpenAI client before creating the Telegram Bot instance, so we can reference it later when processing messages. Also, we only need one instance of this class for the whole runtime.</p><p>Once a message is received, we’re creating a ChatCompletionRequest for OpenAI to handle the messages (this is part of the OpenAI API, you can read more about completions <a href="https://platform.openai.com/docs/guides/chat">here</a>). You can adjust additional parameters here, such as temperature or the language model, but for simplicity’s sake we’ll stick with the defaults provided.</p><p>As soon as we receive the request from the Telegram bot, we immediately send back a &quot;Processing…” message. This has two purposes:</p><ul><li>To notify the sender that the message has been received and is now being processed</li><li>For the bot to have a chat message reference, which it can later update with the actual response</li></ul><p>When the info message is sent to the user, we proceed with sending the completion request to OpenAI. As soon as a response is received, we’ll pass it on to the user by updating the &quot;Processing…” message we sent earlier.</p><p>That’s all we need for the very basic implementation. Let’s run the application and see if it works.</p><h4>Running the Assistant Standalone</h4><p>At the moment we’re only able to start the assistant from within the IDE, which works fine during development. Ideally, however, we would like to be able to run it without having to rely on our development environment all the time.<br>Since we’re using a JVM-based language, we can easily create a fat jar so that we can run the project on any machine that has the Java Runtime installed.</p><blockquote>What is a fat jar? <strong>TL;DR</strong> A fat jar is a Java archive that contains both, your own compiled classes and all your dependencies, allowing you to run the application standalone.</blockquote><p>To create such a jar file, we add a new gradle task called fatJar. We can do this by adding the following snippet to our build.gradle.kts file:</p><pre>tasks.register&lt;Jar&gt;(&quot;fatJar&quot;) {<br><br>    duplicatesStrategy = DuplicatesStrategy.EXCLUDE<br><br>    archiveClassifier.set(&quot;fat&quot;)<br><br>    manifest {<br>        attributes[&quot;Main-Class&quot;] = &quot;com.arconsis.bot.MainKt&quot; // reference your application entrypoint here<br>    }<br><br>    from(sourceSets.main.get().output)<br><br>    dependsOn(configurations.runtimeClasspath)<br>    from({<br>        configurations.runtimeClasspath.get().filter { it.name.endsWith(&quot;jar&quot;) }.map { zipTree(it) }<br>    })<br>}</pre><p>Once the snippet is added, we can run the build from the command line:</p><pre>./gradlew fatJar</pre><p>Once the build is finished, we can find our jar file in the build folder: build/libs/{APP_NAME}.{APP_VERSION}-fat.jar.</p><p>To run the bot, all you have to do is execute the jar file:</p><pre>java -jar build/libs/{YOUR_FAT_JAR}.jar</pre><p>Is the bot started, you can open your chat app and start messaging with your newly created bot!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3m_gtYUaPtW86OQ1dL12jw.gif" /><figcaption>Chatting with the Chatbot</figcaption></figure><p>And that’s about it… well, at least for this article. I hope you found it interesting and I was able to help you get started creating your own virtual assistant. Please keep in mind that this article is limited to the very basics for showcase purposes only. <strong>Always make sure that you do not include your API keys in the source code! Do not share your API keys with anyone!</strong></p><p>If you’re looking for some handy/useful additions, here are some ideas that I’ve implemented in my own bot, which are not part of this article:</p><ul><li><strong>Implement streamed responses.</strong> Instead of waiting a few seconds until the complete OpenAI response is received, you can also stream chunks of the response as it is generated (similar to ChatGPT’s Website). This makes your bot look and feel more responsive.</li><li><strong>Add support for voice messages.</strong> OpenAI provides a <a href="https://platform.openai.com/docs/guides/speech-to-text">transcription API</a>. You can use it to transcribe incoming voice messages into text, then process the transcribed text and send the response back. This will save you a lot of time because you won’t have to type your questions anymore, but can simply record a voice message instead. So far, this feature came in most useful for me. It even works with multiple languages!</li><li><strong>Make the assistant context aware</strong> so that it can respond to follow-up questions. Currently, each incoming message is handled separately, without any reference to the previous messages.</li><li><strong>Security &amp; Containerisation: </strong>Remove all hardcoded values and load them dynamically from the environment (or similar). Create a Docker image for your bot to deploy to any cloud infrastructure you like. A compose stack also works well for VPS/VMs.</li><li><strong>Roll out your assistant to more platforms.</strong> By splitting the codebase, you can create a reusable architecture that allows you to extend your assistant to more platforms (e.g. if you don’t like Telegram, you can use it with other platforms like Discord, etc… — or even run them all together in parallel).</li></ul><p>If you’re interested in a follow-up part where I go deeper into these features and how you can implement them, feel free to let me know.<br>In case you want to read more about experiments with ChatGPT or technology in general, check out and follow us at <a href="https://medium.com/arconsis">arconsis</a>.</p><p>Thanks for reading and have a good one! ✌️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7c991e14579" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arconsis/mobile-assistant-create-a-telegram-bot-using-chatgpt-kotlin-e7c991e14579">Mobile Assistant: Create a Telegram Bot Using ChatGPT &amp; Kotlin</a> was originally published in <a href="https://medium.com/arconsis">arconsis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ChatGPT Experiment:  Migrating a Project from JVM to Rust?]]></title>
            <link>https://medium.com/arconsis/chatgpt-experiment-migrating-a-project-from-jvm-to-rust-a62c7938c469?source=rss-60521da8fe0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/a62c7938c469</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Patrick Jung]]></dc:creator>
            <pubDate>Thu, 04 May 2023 15:52:26 GMT</pubDate>
            <atom:updated>2023-05-04T15:52:26.308Z</atom:updated>
            <content:encoded><![CDATA[<h3>ChatGPT Experiment: Migrating a Project from JVM to Rust? (3/4)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fV-fQ1XlR5r4uAvvQFmZIw.png" /><figcaption>Cover Image created by Midjourney</figcaption></figure><p><em>As the year 2022 drew to a close, a new era of excitement and innovation began with the release of ChatGPT by OpenAI. From tech enthusiasts to industry experts, people around the globe are exploring the full range of capabilities offered by this cutting-edge technology. In this series, we’re taking a look at different aspects of the new AI tool to evaluate how it could help developers in their daily life.</em></p><p>Over the past month, we’ve been experimenting with ChatGPT as a virtual assistant for software developers and evaluating different ways to use the tool in our daily lives. If you haven’t read the series yet and are interested, feel free to check out our previous articles about ChatGPT after finishing reading this one (of course 😉):</p><ul><li><a href="https://medium.com/arconsis/chatgpt-the-ultimate-developers-assistant-1-4-4a8904e0bf0d">ChatGPT — The ultimate developers assistant? (1/4)</a></li><li><a href="https://medium.com/arconsis/chatgpt-creating-code-with-the-ultimate-developers-assistant-2-4-cea7b6698edd">ChatGPT — Creating code with the ultimate developer’s assistant? (2/4)</a></li></ul><p>Besides ChatGPT, we’ve also had our colleagues Evangelos and Alexandros reviewing and benchmarking Quarkus vs. SpringBoot, which is definitely worth a read as well:</p><p><a href="https://medium.com/arconsis/spring-boot-vs-quarkus-part-2-jvm-runtime-performance-af45d0db116e">Spring Boot vs Quarkus Part 2 (JVM Runtime Performance)</a></p><p>We don’t want to spoil too much here, but looking at the benchmarking numbers, we quickly thought about how the JVM frameworks compare to something that is running more native… — like Rust maybe?</p><p>We have some colleagues at arconsis who like to use Rust, but since they don’t have the time to implement the benchmark on short notice, I thought about a different way to achieve this goal: Using our beloved new virtual assistant ChatGPT to create the code — and me as the one who puts it all together.</p><h4>The Given Situation</h4><p>Before going into more detail about how the experiment itself went, let’s take a moment to talk about what the <a href="https://github.com/arconsis/server_benchmarks">bookstore service</a> we’re trying to migrate actually is:<br>It’s a simple REST service with CRUD operations, deployed in a cloud-native environment on AWS Elastic Container Service, rather than a specifically prepared environment. We’re using this setup to have a real-world-like scenario to measure the runtime performance of certain languages and frameworks, such as <a href="https://kotlinlang.org/">Kotlin</a> and <a href="https://quarkus.io/">Quarkus</a>.</p><p>With that out of the way, let’s talk briefly about the idea that we had in mind. Since ChatGPT is able to understand Kotlin and is also able to generate Rust, it was pretty simple:</p><blockquote>“Just copy the Kotlin classes into ChatGPT, generate the equivalent in Rust, put it all back together, and off we go.”</blockquote><p>That’s the theory. But how well does it work in practice?</p><p><strong>Disclaimer:</strong> It’s worth mentioning here, that this was the first time ever I’ve come into contact with Rust. Even though we at arconsis love exploring and trying out new technologies, for the sake of this experiment, I <strong>deliberately</strong> tried to <strong>avoid reading the documentation — for both — Rust itself and also the frameworks we’re about to use.</strong></p><h4>But why?</h4><p>There’s an actual reason for that:</p><p>We want to evaluate if it would be possible to create a project clone or migrate an entire project from one programming language to another, without actually being able to use or understand that language at all.</p><p>Of course, we’re all software engineers, and of course, we (should) know how to code, but that doesn’t necessarily mean that we’re able to read and write in any language we want without having to learn the basic language features or additional platforms and frameworks. So it’s going to be an interesting journey — let’s get started!</p><h4>Into the Wo(u)nderland (yes, it was painful)</h4><p>Since we can&#39;t just drag and drop a whole project into ChatGPT and expect it to generate the equivalent in a different language, we needed to come up with a plan to go through all the steps:</p><ol><li>Install Rust and create a project setup</li><li>Find equivalent frameworks for our requirements (Webservice &amp; Database)</li><li>Migrate the code (aka. have ChatGPT convert it to Rust)</li><li>Put it all together</li><li>Compile, execute &amp; benchmark</li></ol><h4><strong>Install Rust and create a project setup</strong></h4><p>Since this is not a tutorial, we’ll skip the part about installing &amp; setting up Rust. The only important part to mention here is that we’ll be using cargo for the project setup. <br>In case you don&#39;t know,cargo is the npm for Rust (aka a package manager). How do we know? Well, we asked ChatGPT:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*FX-Rd4dgeoCZCla3qwur8A.png" /><figcaption>ChatGPT explaining how to set up a new Rust project</figcaption></figure><p>Thanks to ChatGPT’s explanation, we now know how to create the new project setup and what the files it generates are used for. This is quite handy as it will help us in future steps when we need to add our dependencies and start converting and assembling the code.</p><h4><strong>Find equivalent frameworks for our requirements</strong></h4><p>We continued with finding the right frameworks for the requirements. The bookstore itself is a pretty simple implementation for benchmarking, so we basically only need two things:</p><ul><li>A web services framework that can handle our client requests</li><li>A database framework that we can use to read/write our data to a persistent volume</li></ul><p>So let’s continue the journey and ask ChatGPT for some good alternatives that we can use. Ideally, the frameworks should be easy to use and well-known/maintained. We’ll start with the yet-to-be-determined web framework we “want” to use:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*MbI1kbvLhIWP5bB-zk6f_g.png" /><figcaption>ChatGPT introducing Rocket Framework</figcaption></figure><p>Looks like solid code at first glance, right? But remembering that ChatGPT is only trained on data up to 2021, we better double-check that the dependency version is up to date (spoiler alert: it wasn’t).</p><p>After adding Rocket to our dependencies, we can proceed with the next framework we need: Something to access the Postgres database.</p><blockquote>What’s a good and easy to use database framework that works with rocket and is also performant</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*2-vD8kGk1-AfaCK4xIUimQ.png" /><figcaption>ChatGPT explaining how to use Diesel, an ORM library for Rust</figcaption></figure><p>Nice – there’s an ORM library in Rust as well, so we should be good to go. By adding Diesel to the dependencies, we now have all the necessary frameworks we need to use and can continue with the next part.</p><h4>Migrate the code (aka. letting ChatGPT convert it to Rust)</h4><p>ChatGPT is context-aware and already knows what we’re trying to achieve: A web service that is able to serve some requests and also query and persist data. All we have left to do now is give it the Kotlin code as input and use the generated output in our project setup. In this example, we’ll use the <a href="https://github.com/arconsis/server_benchmarks/tree/main/bookstore-quarkus">Quarkus variant of our bookstore service</a> to generate the Rust equivalent of the required classes we need:</p><ul><li>A controller that provides all the endpoints</li><li>A repository that’s able to query &amp; persist data</li><li>Some sort of mapping from the DB entity to the JSON response model (ideally)</li></ul><p>We’ll start with the <a href="https://github.com/arconsis/server_benchmarks/blob/main/bookstore-quarkus/src/main/kotlin/com/arconsis/http/books/BooksResource.kt">BooksResource</a> and instruct ChatGPT to generate the equivalent of the Kotlin implementation in Rust:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/611/1*CmHiQvxucYH8algQmPdbhg.png" /><figcaption>ChatGPT’s generated Rust output based on Kotlin input</figcaption></figure><p>We’ll put it in our main.rs and keep it there for later, as we still need to create the database functionality that we’re using in the generated code above. Otherwise, the code will be simply invalid and won’t compile due to missing declarations &amp; functionality.</p><p>Let’s continue with that. We’re using the <a href="https://github.com/arconsis/server_benchmarks/blob/main/bookstore-quarkus/src/main/kotlin/com/arconsis/data/books/BooksDataStore.kt">BooksDataStore</a> implementation from the Quarkus project to have ChatGPT generate an equivalent for this in Rust.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*ioC9WIShmtrJ8ya-fN8M-A.png" /><figcaption>ChatGPT trying to convert the BooksDataStore from Kotlin to Rust</figcaption></figure><p>Once again, it looks like valid code that includes all the features we need to have the same functionality as the Kotlin equivalent. As ChatGPT mentioned in the last sentence, it assumes that we have already defined the data schema for our entities. But we don’t— so let’s create them.</p><p>We’re using the <a href="https://github.com/arconsis/server_benchmarks/blob/main/bookstore-quarkus/src/main/kotlin/com/arconsis/data/books/BookEntity.kt">BookEntity</a> as input for the conversion:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*01mzTw5t6FQGXWcybI5h7Q.png" /><figcaption>From Kotlin to Rust converted entity model</figcaption></figure><p>We copied the code into our project and realized that everything is red — the code is not usable out of the box and the project does not compile.</p><p>At arconsis, we have already used ChatGPT for such purposes, so we actually expected this. It’s also a good sign for us (developers) that we will keep our jobs at least a little longer.</p><p>But for the sake of completing the experiment, let’s (try to) fix the broken code:</p><h4>Putting it all together</h4><p>This is going to be the most interesting part because, as mentioned, we’re trying to use a language that we’ve never used before with some frameworks we don’t know to create something similar to an already existing solution.</p><p>This means that we basically lack all the prerequisites we should have when using a programming language, such as</p><ul><li>The ability to use common programming concepts (variables, mutability, data types, functions, control flow…)</li><li>Structuring related data (classes and data structures)</li><li>Managing a growing code base (packages, modules, etc.)</li></ul><p>just to name a few.</p><p>Without this knowledge, all we can do is rely on the various error messages we get from the compiler and try to fix them manually by applying our knowledge from other programming languages. <br>This turned out to be harder than we initially thought because Rust behaves and works quite differently than more well-known and taught languages like Kotlin or JavaScript.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5VyK7ZIccTMyHhJ81eVfAQ.png" /><figcaption>One of the various errors thrown by Rust — related to the DB Framework</figcaption></figure><p>So this is the part where the experiment seemed to fall apart very quickly:</p><p>Without being able to look at the documentation, it’s basically impossible to create a properly working implementation until ChatGPT generates a fully valid and working codebase. It’s just not ready yet to be used by someone without any programming knowledge, which is once again a good thing because it keeps us developers employed (a little bit) longer before chairmen are able to replace us with AI.</p><p>However, if you’re familiar with the language and frameworks you’re using, you might be able to create a working project setup and ChatGPT might become quite more helpful. If you’re interested in this topic, feel free to read our article about using ChatGPT to create a portfolio website:</p><p><a href="https://medium.com/arconsis/chatgpt-creating-code-with-the-ultimate-developers-assistant-2-4-cea7b6698edd">ChatGPT — Creating code with the ultimate developers assistant? (2/4)</a></p><p>While it’s amazing to see ChatGPT’s ability to convert code snippets from one programming language to another, there’s still a requirement that the developer using the tool has to be able to understand the output received from ChatGPT and use it properly.</p><p>Make sure to follow arconsis to not miss any new posts in the future. Thanks for reading!</p><p><em>This article series was written by </em><a href="https://medium.com/u/135a3c6b2faa"><em>Markus Lindner</em></a><em> and </em><a href="https://medium.com/u/60521da8fe0a"><em>Patrick Jung</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a62c7938c469" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arconsis/chatgpt-experiment-migrating-a-project-from-jvm-to-rust-a62c7938c469">ChatGPT Experiment:  Migrating a Project from JVM to Rust?</a> was originally published in <a href="https://medium.com/arconsis">arconsis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ChatGPT — Creating code with the ultimate developers assistant? (2/4)]]></title>
            <link>https://medium.com/arconsis/chatgpt-creating-code-with-the-ultimate-developers-assistant-2-4-cea7b6698edd?source=rss-60521da8fe0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/cea7b6698edd</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Patrick Jung]]></dc:creator>
            <pubDate>Sat, 25 Feb 2023 10:26:47 GMT</pubDate>
            <atom:updated>2023-03-13T20:14:33.369Z</atom:updated>
            <content:encoded><![CDATA[<h3>ChatGPT — Creating code with the ultimate developer’s assistant? (2/4)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s73r536ryeqRNBLIZUdnrA.png" /><figcaption>“AI Assistant” — created by Midjournal</figcaption></figure><p><em>As the year 2022 drew to a close, a new era of excitement and innovation began with the release of ChatGPT by OpenAI. From tech enthusiasts to industry experts, people around the globe are exploring the full range of capabilities offered by this cutting-edge technology. In this series, we’re taking a look at different aspects of the new AI tool to evaluate how it could help developers in their daily life.</em></p><p>In our first article, we gave you an overview about how ChatGPT can help developers in their daily job. If you haven’t read it yet, feel free to check it out:</p><p><a href="https://medium.com/arconsis/chatgpt-the-ultimate-developers-assistant-1-4-4a8904e0bf0d">ChatGPT — The ultimate developers assistant? (1/4)</a></p><p>Today, however, we want to find out how ChatGPT can actually assist us in creating code.</p><p>With its ability to understand and respond to natural language input, ChatGPT can help developers write and debug code more efficiently and effectively. It’s a powerful tool that can empower developers to quickly create high-quality code, making it easier to build and maintain software applications.<br>Keeping that in mind, ChatGPT seems to have the potential to revolutionize the way developers work besides being a promising progress in the world of AI. <br>But how well can you use it for this use case right now? Let’s find out.</p><h4>What does this mean? What do we want to do?</h4><p>For our test case, let’s assume we don’t have any codebase yet. We are starting completely from scratch.</p><p>Since web technology is the easiest way to share and view code that is where we’re starting with this project. The goal is to let the tool create a portfolio website about ChatGPT &amp; Open Source and why it’s important to contribute to Open Source projects. Ideally, we don’t have to write a single line of code ourselves as everything will be generated automatically.</p><p>To save some time, we’re using the React &amp; TypeScript template from <a href="https://stackblitz.com/%22%20/t%20%22_blank">StackBlitz</a> to have a ready-to-work-on React project in the browser. This allows us to create the boilerplate for the project setup whithout writing any code, and also has the advantage that it can be embedded directly into this article.</p><h4>Creating a website using ChatGPT</h4><p>There are many examples on the web showing ChatGPT’s potential for creating code. Also, there’s a <a href="https://beta.openai.com/codex-javascript-sandbox">JavaScript Playground</a> that you can use in order to give it some instructions and it will generate the correct HTML &amp; JS content for you which you can preview in your browser right away. Nevertheless, it should be mentioned that this Playground uses a slightly different language model than ChatGPT, called <a href="https://beta.openai.com/docs/models/codex">Codex</a>, that is a descendant of the GPT-3 model, optimized for code generation.</p><p>So, let’s get started with our experiment. Since we are living in a modern age where web frameworks are a thing and you basically don’t do plain HTML at all anymore, we wanted to take it a step further and also make sure we are using a modern web framework when creating the code:</p><blockquote>Create a portfolio website that can be used for ChatGPT to reference it’s open source contributions. Include an introduction about open source and why it is important to contribute to open source topics. Use a modern framework like React and use TypeScript as programming language</blockquote><p>That was the instruction we gave to ChatGPT. Since, we’re using the official <a href="https://chat.openai.com/">Chat Website</a> in that case, it first responded by providing detailed text instructions on how someone could set up such a website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k4dMwpU69mxh5CsyTYhaqQ.png" /><figcaption>ChatGPT explaining how we can achieve the planned goal (textual)</figcaption></figure><p>But we don’t want explanation — we want the code! Fortunately, ChatGPT remembers the previous conversation and will update its responses if you iterate over it with sufficiently detailed instructions on what it should change:</p><blockquote>Generate the code using React and TypeScript. Also make use of the <a href="https://mui.com/">Material-UI</a> library.</blockquote><p>Even though this is a pretty basic sample, it immediately gave a nice suggestion of how a project setup might look like. But of course, this is far from a finished solution that works out of the box.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZIvIt3tLmWBtIrvw6kYGFA.png" /><figcaption>ChatGPT generated code prefix</figcaption></figure><pre>import React, { FC } from &#39;react&#39;;<br>import {<br>  List,<br>  ListItem,<br>  ListItemText,<br>  Typography,<br>  makeStyles,<br>} from &#39;@material-ui/core&#39;;<br><br>interface Project {<br>  name: string;<br>  url: string;<br>  description: string;<br>}<br><br>interface Props {<br>  projects: Project[];<br>}<br><br>const useStyles = makeStyles({<br>  list: {<br>    margin: &#39;20px 0&#39;,<br>  },<br>});<br><br>const Projects: FC&lt;Props&gt; = ({ projects }) =&gt; {<br>  const classes = useStyles();<br>  return (<br>    &lt;div&gt;<br>      &lt;Typography variant=&quot;h4&quot; gutterBottom&gt;<br>        Open Source Contributions<br>      &lt;/Typography&gt;<br>      &lt;List className={classes.list}&gt;<br>        {projects.map((project) =&gt; (<br>          &lt;ListItem key={project.name}&gt;<br>            &lt;ListItemText<br>              primary={&lt;a href={project.url}&gt;{project.name}&lt;/a&gt;}<br>              secondary={project.description}<br>            /&gt;<br>          &lt;/ListItem&gt;<br>        ))}<br>      &lt;/List&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default Projects;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j3fJKbrEijYfYSIzfHn0Iw.png" /><figcaption>ChatGPT generated code postfix</figcaption></figure><p>While ChatGPT does generate code — it does so only in a very limited amount. For example, it may give you the code for one or two classes that are required to answer your question in that case, but it won’t generate the whole project setup files out of the box (at least not yet).<br>But since this is the research preview, we can basically chat forever — which means we can iterate over the conversation (aka the code &amp; project setup) with ChatGPT and let it generate the project as we want it, piece by piece. All we have to do is put the puzzle together.</p><p>What’s even more impressive is that while generating code for you, ChatGPT also explains the code it generated in a nice and comprehensible way, so you don’t just copy and paste answers (we’ve all been on Stack Overflow in our lives), but you can actually understand the code you’re using.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*37qgvHo6Bb_SDx4vHPjQsQ.png" /><figcaption>Example of ChatGPT explaining the code it generated</figcaption></figure><h4>It’s just not completely ready yet</h4><p>One of the downsides we have to mention, however, is the limitations we faced due to the high demand that ChatGPT had and still has. This seems to affect every individual account. Often the conversation ends abruptly without ChatGPT being able to finish the sentence or code it was about to generate. <br>Anyways — ChatGPT’s ability to remember the previous conversation comes in very handy. You can just ask it to repeat its previous answer, or even better, continue its answer from a specific point, so you don’t waste time waiting countless minutes for the same paragraph you have already seen endlessly being generated over and over again.</p><h4>Completing the Puzzle</h4><p>After several hours of conversations and countless iterations of the various components it generated, we finally had a website that represented a portfolio of ChatGPT.</p><p>Of course, you don’t have to like the design and colors of the final result. Those were the instructions we gave to ChatGPT and it followed them along. But it’s astonishing to see what we were able to build code-wise without creating a single class or function ourselves.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fstackblitz.com%2Fedit%2Freact-ts-eae77q%3Fembed%3D1%26view%3Dpreview&amp;display_name=StackBlitz&amp;url=https%3A%2F%2Fstackblitz.com%2Fedit%2Freact-ts-eae77q%3Fembed%3D1%26view%3Dpreview&amp;image=https%3A%2F%2Fsocial-img.staticblitz.com%2Fprojects%2Freact-ts-eae77q%2F07f0ac24b37d008722a5b5ce5609decc&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=stackblitz" width="745" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/7edc8336055ee44fcbafc56c9dc1dc04/href">https://medium.com/media/7edc8336055ee44fcbafc56c9dc1dc04/href</a></iframe><p>We’ve put the code together on <a href="https://stackblitz.com/edit/react-ts-eae77q%22%20/t%20%22_blank">StackBlitz</a> for you, so if you’re interested, feel free to check out the source code.</p><p>Even though ChatGPT created all the code, it was still our job to put it in the right place and in a file structure we liked. We also had to make sure we were asking the right questions in order to get the right results. <br>If you’re not sure how to structure your files or what architecture to use, you can ask ChatGPT and it will provide you with some good examples.</p><p>It is worth mentioning, however, that in the fast-paced world of JavaScript, frameworks and their APIs change all the time. And while ChatGPT is trained on data up to 2021, you may find that it generates code that was valid then — but is outdated now. For example, the Material UI package we used was renamed from @material-ui/coreto @mui/material in 2022, so we had to adjust the imports to properly resolve the components.</p><h4>Conclusion</h4><p>The use of ChatGPT to create a website from scratch has been an extremely positive and remarkable experience. The tool was able to handle all of our requests with ease and provided us with accurate and valid answers, whether we were asking for code to be generated or for explanations.</p><p>Aside from the downsides, mostly caused by the fact of being in the public preview, we have to conclude that ChatGPT was able to pass the experiment of creating our website without us having to write a single line of code overall. <br>We strongly encourage other developers to tinker with this tool to see how it can improve their workflow.</p><p>If you’re interested in this topic and want to stay up to date with our series about ChatGPT, make sure to follow <a href="https://medium.com/arconsis">arconsis</a> to not miss any new posts.</p><p><em>This article series was written by </em><a href="https://medium.com/u/135a3c6b2faa"><em>Markus Lindner</em></a><em> and </em><a href="https://medium.com/u/60521da8fe0a"><em>Patrick Jung</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cea7b6698edd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arconsis/chatgpt-creating-code-with-the-ultimate-developers-assistant-2-4-cea7b6698edd">ChatGPT — Creating code with the ultimate developers assistant? (2/4)</a> was originally published in <a href="https://medium.com/arconsis">arconsis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ChatGPT — The ultimate developers assistant? (1/4)]]></title>
            <link>https://medium.com/arconsis/chatgpt-the-ultimate-developers-assistant-1-4-4a8904e0bf0d?source=rss-60521da8fe0a------2</link>
            <guid isPermaLink="false">https://medium.com/p/4a8904e0bf0d</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Patrick Jung]]></dc:creator>
            <pubDate>Fri, 10 Feb 2023 18:13:51 GMT</pubDate>
            <atom:updated>2023-02-25T08:55:08.571Z</atom:updated>
            <content:encoded><![CDATA[<h3>ChatGPT — The ultimate developer assistant? (1/4)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SSxx6TAVMKRkv6gLVaA31A.png" /><figcaption>“AI Assistant” — created by Midjourney</figcaption></figure><p>As the year 2022 drew to a close, a new era of excitement and innovation has begun with the release of ChatGPT by OpenAI. From tech enthusiasts to industry experts, people around the globe are exploring the full range of capabilities offered by this cutting-edge technology.</p><p>At <a href="https://medium.com/arconsis">arconsis</a>, we pride ourselves on staying at the forefront of technological advancements. As software developers, we are constantly seeking new ways to improve our productivity and workflow. In this article, we will take a first look at the potential of ChatGPT as a valuable tool to assist developers in their daily tasks. Will it revolutionize the way we work or prove to be just another passing trend? Join us as we explore the possibilities.</p><h4>(How) Can ChatGPT assist a Software Developer?</h4><p>So, in order to find out how ChatGPT can improve a developer&#39;s daily life we thought we’d ask ChatGPT itself, and let it summarize everything in a short article. The response it gave us was quite interesting, and the idea to evaluate everything it wrote, was quickly born.</p><p>In fact, we wanted to go deeper into each topic, so we decided to create a new series out of it. You’re currently reading the first article of this series, hence the (1/4) in the title.</p><p>Our goal is to thoroughly examine each of ChatGPT’s advertised functions and capabilities. Using both simple and complex examples, we will evaluate the potential of AI as a valuable assistant for developers. We will explore the scenarios in which AI can be utilized most effectively, and how it can potentially improve developer productivity and workflow.</p><p>But first things first! Let’s start with the input we gave ChatGPT to kick everything off:</p><blockquote>Write an interesting article about how ChatGPT can assist a developer in it’s daily job</blockquote><p>It started with a first short introduction sentence about itself which couldn’t be more generic and obsolete, but it was coming straight to the point immediately afterward:</p><blockquote>ChatGPT, the large language model trained by OpenAI, has the ability to assist developers in a variety of ways in their daily job.</blockquote><blockquote>One of the most useful ways ChatGPT can assist a developer is by helping to generate code. ChatGPT can be trained on a specific programming language and then be used to generate code snippets based on a given prompt. This can save developers a significant amount of time and effort, as they no longer have to write repetitive or complex code from scratch.</blockquote><h4>Creating Code using ChatGPT</h4><p>Sounds interesting, doesn’t it? But how well does it work in practice?</p><p>ChatGPT can greatly benefit developers by generating code snippets based on a prompt. This is made possible by training the model in a specific programming language, enabling it to provide relevant code snippets. Since we’re just using the language model and are not able to train it to a specific use case beforehand, we’re “training” the AI by telling it what we’ve planned to do and which programming language and frameworks we want to use. The use of ChatGPT can streamline the development process by reducing the time and effort required to write repetitive or complex code. As a result, developers can save valuable time and focus on more important tasks.<br>At least that’s the theory.</p><p>In the next part (2/4) of this series, we will dive deeper into the use of ChatGPT. We’re starting from nothing (<strong>no existing</strong> <strong>codebase</strong>) and our goal is to create a Portfolio Website for the tool itself. To make it a more realistic evaluation, we want to use a common web framework and modern UI components.</p><h4>Using ChatGPT with existing Code</h4><p>But that is just the beginning. Maybe you don’t need to create new code because you already have an existing project, but rather need assistance with that? Let’s take a look at how ChatGPT continued the conversation:</p><blockquote>ChatGPT can also be used to help with documentation and commenting. By training ChatGPT on a specific codebase and documentation style, it can generate detailed and accurate documentation and comments for the code. This can make it easier for others to understand and work with the code, and can also serve as a useful reference for the original developer.</blockquote><p>Generate documentation? Write tests? Are our dreams coming true?</p><p>Even though it is part of our daily jobs, there are always tasks you don’t like doing all the time. Whether it is because the task is repetitive, boring, or just consumes too much time — there’s always that piece of work you’d like to outsource without having to worry about someone else having to do the work you don’t like. <br>Apparently now you can, and we will give this a try in our upcoming Part (3/4) of this series.</p><h4>Troubleshooting Issues &amp; Problems with ChatGPT</h4><p>Last but not least there’s one more interesting paragraph in ChatGPT’s response that we want to have a look at:</p><blockquote>Finally, ChatGPT can also be used to help with troubleshooting and debugging. By providing ChatGPT with information about the error or problem, it can suggest possible solutions or areas to investigate. This can save developers a significant amount of time and effort when trying to identify and resolve issues.</blockquote><p>Reading this, it sounds like you’ll now be able to pair-program or discuss where you’re currently stuck on the fly without having to worry if you have a colleague that’s available right now.</p><p>We will give this a try in part (4/4) of our series and see if it works as promisingly as it sounds.</p><h4>Changing the future or just a fast-passing trend?</h4><p>Reading about the ideas that ChatGPT has generated to help developers in their daily job makes it sound really awesome, and maybe a little scary if developers will become obsolete at some point in the future — but do we really need to worry?</p><p>We’re looking forward to publishing our evaluations of the mentioned points and giving you more insights into <strong>if and how</strong> the tool is able to help us with everything we consider to be part of our daily lives.</p><p>Thank you for reading and make sure you’re following <a href="https://medium.com/arconsis">arconsis</a> to not miss any new posts in this series — or anything else we’re writing about — for example:</p><p><a href="https://medium.com/arconsis/spring-boot-vs-quarkus-part-2-jvm-runtime-performance-af45d0db116e">Spring Boot vs Quarkus Part 2 (JVM Runtime Performance)</a></p><p><em>This article series was written by </em><a href="https://medium.com/u/135a3c6b2faa"><em>Markus Lindner</em></a><em> and </em><a href="https://medium.com/u/60521da8fe0a"><em>Patrick Jung</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4a8904e0bf0d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/arconsis/chatgpt-the-ultimate-developers-assistant-1-4-4a8904e0bf0d">ChatGPT — The ultimate developers assistant? (1/4)</a> was originally published in <a href="https://medium.com/arconsis">arconsis</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>