AI aided software development

Programming applications for making music on Linux.

Moderators: MattKingUSA, khz

Post Reply
User avatar
d.healey
Established Member
Posts: 611
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 279 times
Been thanked: 101 times

Re: AI aided software development

Post by d.healey »

For programming tasks I use ChatGPT as a kind of aggregator for programming searches. Before ChatGPT I would type a question into a search engine and then trawl through pages of stack overflow. Now I type the same question into ChatGPT and it's already done the trawling and just gives me the answer.

I'm not asking it to write a program for me, I'm asking it to give me a specific answer to a specific programming problem. One where I know what I want and the principles of how to do it but not necessarily the exact syntax to use.

For example yesterday I wanted to know how to find for multiple substrings within another string using PHP. My usual approach would be stristr and a loop but I was pretty sure there was a regex way to do it. ChatGPT provided a perfect answer that I was able to adapt for my needs.

Code: Select all

$haystack = "This is a sample string.";
$needles = array("sample", "string");

$pattern = '/' . implode('|', $needles) . '/';
if (preg_match($pattern, $haystack)) {
    echo "At least one of the needles was found in the haystack.";
} else {
    echo "None of the needles were found in the haystack.";
}

I also find it incredibly helpful for writing bash scripts, sometimes it can do the entire thing for me.

For example I asked it to write a script that converts a folder of wave files to ogg. Yes I could have written this myself, but it was much faster to get the bot to do it.

Code: Select all

#!/bin/bash

# Check if the input folder argument is provided
if [ $# -eq 0 ]; then
    echo "Please provide the input folder as an argument."
    exit 1
fi

# Get the input folder from the argument
input_folder="$1"

# Check if the input folder exists
if [ ! -d "$input_folder" ]; then
    echo "Input folder does not exist."
    exit 1
fi

# Create the output folder within the input folder
output_folder="$input_folder/ogg"
mkdir -p "$output_folder"

# Convert each WAV file to OGG format
for file in "$input_folder"/*.wav; do
    # Get the filename without the extension
    filename=$(basename "$file" .wav)
    
# Construct the output file path output_file="$output_folder/$filename.ogg" # Convert WAV to OGG using ffmpeg ffmpeg -i "$file" "$output_file" done echo "Conversion completed."
David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
GMoon
Established Member
Posts: 51
Joined: Sat Oct 03, 2020 1:10 pm
Has thanked: 11 times
Been thanked: 20 times

Re: AI aided software development

Post by GMoon »

I'm trying to use Bard to help create Makefiles.

It's actually being helpful. I don't expect it work without tweaking, of course.

GMoon
Established Member
Posts: 51
Joined: Sat Oct 03, 2020 1:10 pm
Has thanked: 11 times
Been thanked: 20 times

Re: AI aided software development

Post by GMoon »

AFA programming, they say ChatGPT has an edge over Bard, but these tools are changing so rapidly, so who knows????

Regarding AI, I'm of a mind to agree with: "AI won't kill us, it will drive us insane." By amplifying all the divisive effects of disinformation, societal stresses and the negative mental health impacts that "social" media have already exposed (and monetized).

BTW, The quote "AI won't kill us, it will drive us insane" was said by Jaron Lanier, a computer scientist and virtual reality guy, in an article in The Guardian earlier this year. I know that because I asked Bard who said it. :wink:

User avatar
sadko4u
Established Member
Posts: 989
Joined: Mon Sep 28, 2015 9:03 pm
Has thanked: 2 times
Been thanked: 361 times

Re: AI aided software development

Post by sadko4u »

d.healey wrote: Fri Jun 23, 2023 2:35 pm

For example yesterday I wanted to know how to find for multiple substrings within another string using PHP. My usual approach would be stristr and a loop but I was pretty sure there was a regex way to do it. ChatGPT provided a perfect answer that I was able to adapt for my needs.

Regex is way slower if we're talking about the performance.

LSP (Linux Studio Plugins) Developer and Maintainer.
User avatar
d.healey
Established Member
Posts: 611
Joined: Fri Sep 22, 2017 8:33 pm
Has thanked: 279 times
Been thanked: 101 times

Re: AI aided software development

Post by d.healey »

sadko4u wrote: Sun Jul 02, 2023 9:26 am
d.healey wrote: Fri Jun 23, 2023 2:35 pm

For example yesterday I wanted to know how to find for multiple substrings within another string using PHP. My usual approach would be stristr and a loop but I was pretty sure there was a regex way to do it. ChatGPT provided a perfect answer that I was able to adapt for my needs.

Regex is way slower if we're talking about the performance.

Performance wasn't critical for this task and it made the code look cleaner and easier to understand to use regex. In fact ChatGPT offered several ways to do it, include my usual method, and laid out the pros/cons.

David Healey
YouTube - Free HISE scripting and sample library dev tutorials
Libre Wave - Freedom respecting instruments and effects.
User avatar
peter.semiletov
Established Member
Posts: 119
Joined: Thu May 11, 2023 1:09 pm
Has thanked: 25 times
Been thanked: 82 times
Contact:

Re: AI aided software development

Post by peter.semiletov »

ChatGPT is a good liar. Altough, I use it to make draft translations of big texts, when I have no time or lazy to write it by myself.

User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: AI aided software development

Post by khz »

falkTX wrote:

as a note of warning here, using these tools to generate code produces results that unsuitable for any open-source project due to its unclear licensing.

the code these tools scrapped is under all sorts of licenses, some incompatible with each other, even with just that the results would be a mess to sort out licensing-wise. but there is also the issue of machine-generated output not being copyrightable, thus we can’t put authorship on it and place it under our name under a license of our choosing (because it is not our own work to begin with)

perhaps it is fine to use small snippets of code generated by these AI tools, as far as I know small portions of code are not copyrightable

but I am not a lawyer and this is not legal advice yada yada…

bigger opensource projects already started putting advisories against the use of such tools, for example OBS https://github.com/obsproject/obs-studi ... ing-policy

Source: https://forum.mod.audio/t/some-ideas-fo ... on/10029/5

. . . FZ - Does humor belongs in Music?
. . GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
  • I don't care about the freedom of speech because I have nothing to say.
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 358 times

Re: AI aided software development

Post by j_e_f_f_g »

artix_linux_user wrote:

if an accident occurs, it is the fault of the AI.

No, it's always the fault of the lowest level worker who can't pass the blame any further down the chain.

And that's the person who gets punished too.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

Basslint
Established Member
Posts: 1516
Joined: Sun Jan 27, 2019 2:25 pm
Location: Italy
Has thanked: 385 times
Been thanked: 299 times

Re: AI aided software development

Post by Basslint »

I think nobody should be surprised that a software can "write code", it's what a compiler already does, for example. I think the worst side-effect of AI-aided software development is the time it takes away from reasoning, which is the most important part of it. I know that some will deny this and claim that it just frees more time for more cerebral tasks, saving time on apparently mundane tasks (like the one shared by @d.healey); but, from a bottom-up perspective, is software development not made of mundane tasks that are coordinated (by the software engineer) into a coherent user interaction? For example, many famous websites are just "CRUD" at their core but still, millions of people find some value in them.

I would argue that just like playing scales and chords on an instrument is necessary to be a good musician, writing mundane code is necessary to be a good software developer. Not because of the code itself but because the reasoning it involves, which would be dignified in itself (it makes us human) even if coding did not have positive effects on our lives (but some claim it does).

Frankly, I would prefer to keep my code AI-free as long as possible, if anything just to use my brains. Also because the copyright issues are worrying, if you know a bit how these LLMs work.

The community of believers was of one heart and mind, and no one claimed that any of his possessions was his own, but they had everything in common. [Acts 4:32]

Please donate time (even bug reports) or money to libre software 🎁

Jam on openSUSE + GeekosDAW!
Post Reply