ChatGPT and FLTK: should I be happy or scared?

18 views
Skip to first unread message

melcher....@googlemail.com

unread,
Jan 5, 2023, 6:08:43 AM1/5/23
to fltk.coredev
My son is still at school and told me about ChatGPT, the OpenAI natural text tool that can write entire essays for you. With my mind currently wrapped around FLTK, naturally I had to find out what ChatGPT knows about our software:

>>> "FLTK (Fast Light Toolkit) is a cross-platform, lightweight graphics library for developing graphical user interface (GUI) programs. It provides a simple, easy-to-use interface for creating windows, buttons, menus, and other GUI elements, and has been widely used for developing applications in a variety of fields, including engineering, scientific computing, and finance. FLTK is written in C++ and is released under the GNU Lesser General Public License (LGPL)." 


So, here is my first surprise. Sure, our synopsis is similar, but even as a non-native English speaker, this "new" synopsis seems to have much more flow to it.

When I write documentation, my German always shines through. Senteces are stilted and overly complicated, not to mention all the typos. Naturally, I asked ChatGPT for help:

> Rephrase "Widget_Bin_Window_Button: This button is used by the widget bin to create new windows by drag'n'drop. The new window will be created wherever the user drops it on the desktop."

>>> "The Widget Bin Window Button allows users to create new windows by dragging and dropping it onto the desktop using the widget bin. The location where the button is dropped on the desktop determines where the new window will appear."

Not only did ChatGPT create a nicer sentence structure with better flow, but it feels like it added information (I never wrote anything about dropping on the desktop). It feels like it read the entire FLUID docs already and has a grasp of the context. And if you don't like the response, just click "Regenerate".

Now on to the scary part. I asked:

> write a unittest for Fl_Group::add()

>>> Here is an example of a unit test for the add() method of the Fl_Group class in FLTK:
#include <FL/Fl_Group.H>
#include <FL/Fl_Button.H>
#include "gtest/gtest.h"
TEST(FlGroupTest, AddButton) { 
  // Create a group and a button
  Fl_Group group;
  Fl_Button button("Button");
  // Add the button to the group
  group.add(button); 
  // Check that the group has one child
  EXPECT_EQ(group.children(), 1);
  // Check that the child is the button
  EXPECT_EQ(group.child(0), &button); 
}
This test creates a group and a button, adds the button to the group using the add() method, and then checks that the group has one child and that the child is the button. The test uses the Google Test framework to define the test case and to check the expectations.

I mean, holy shit, it obviously knows not only that FLTK exists, it knows that FLTK has a method named Fl_Group::add(), it not only knows what that function does, it even knows how to write a freaking test to see if that function works correctly, outputting a complete and compilable piece of code that I could paste into FLTK and nobody would know. Actually I would probably be praised for adding the first true unittest.

Is that insane or what?

Maybe I can finally write the urgency needed documentation for FLUID... .

 - Matthias

melcher....@googlemail.com

unread,
Jan 5, 2023, 6:15:50 AM1/5/23
to fltk.coredev


Or, to rephrase my last paragraph:

"It is impressive that this entity is aware of the existence of FLTK and the Fl_Group::add() method, and is able to provide a detailed explanation of the function's purpose and usage. Furthermore, it can generate a functional unit test for the add() method, including code that can be compiled and integrated into FLTK. This demonstrates a high level of knowledge and skill, and one could potentially benefit from using this entity for testing and debugging purposes within FLTK."

One last thing: "How can we improve FLTK?" (Click on "rephrase" and it comes up with more an more things. Scary.)

"There are several ways that FLTK could be improved:
  1. Add support for modern GUI features: FLTK is a relatively simple and lightweight toolkit, which can make it difficult to implement some modern GUI features such as high DPI support and animated transitions. Adding support for these features could make FLTK more appealing to developers.

  2. Improve cross-platform compatibility: While FLTK is already cross-platform, there may be some issues with compatibility on certain platforms. Improving compatibility across different operating systems and hardware configurations could make FLTK more widely useful.

  3. Increase the speed of the library: FLTK is already known for its fast performance, but there may be opportunities to further optimize the library for even faster rendering and interaction.

  4. Enhance the documentation and developer resources: Providing more comprehensive documentation and additional resources for developers, such as tutorials and examples, could make it easier for new users to learn and use FLTK.

  5. Add support for newer C++ language features: As C++ evolves, FLTK may benefit from adopting newer language features to make the codebase more modern and easier to maintain."

Reply all
Reply to author
Forward
0 new messages