What type of program should this be?
from AstroLightz@lemmy.world to programming@programming.dev on 06 Jun 06:07
https://lemmy.world/post/47820587

Let’s says you want to make a program that takes user input and follows the CRUD structure for some data. This program would be executed from the terminal and wouldn’t be used in any other projects.

If this program was made in a language that supports creating packages for other programs (e.g. Python, Rust, NodeJS), should this program be a ‘package’, or should it be a standalone program that has a simple “setup” script?

Assume this is a CLI/TUI app that runs in a Linux terminal.

EDIT: I’ll provide some more details since it seems I was too vague:

This program would allow the user to create ‘Script’ objects that would be saved to a file on their system. These objects would contain metadata such as a name, the command to run, and a description.

These Script objects would only be used by this program, and by the user. (i.e not a system program)

#programming

threaded - newest

Phoenix3875@lemmy.world on 06 Jun 06:51 next collapse

It doesn’t matter if it’s truly a one-off.

However, the conventional wisdom is to split the potentially reusable part as a library package and the executable to be a thin layer on top of that library.

In this way, for example, testing can just depend on that library. In the future, if there are requests that calls for a separate executable, the library can be reused.

Azzu@leminal.space on 06 Jun 07:41 next collapse

It entirely depends on what you want the user experience to be like, and what ecosystem you choose.

So, no idea, give exact specifications.

Gonzako@lemmy.world on 06 Jun 07:50 next collapse

You’ll need to go to some specifics if you want some pointers. Atm, I use Python to bridge a booking program into the financials one through the creation of xml files.

Ephera@lemmy.ml on 06 Jun 08:33 next collapse

Coming at it from the Rust ecosystem, I’d primarily opt for uploading release binaries somewhere. You don’t particularly need a setup script, since Rust programs are generally self-contained.

Publishing a package in addition to that really isn’t hard, but would be my secondary choice, since users are not likely to have cargo on their system.
Well, and cargo compiles on the target machine, which is great for supporting unusual architectures, but you may have C libraries included where it’s just a gamble whether you can compile them on a given target system.

FizzyOrange@programming.dev on 06 Jun 09:24 next collapse

This is too vague to get good answers. What language are you using?

AstroLightz@lemmy.world on 06 Jun 16:23 collapse

Python. I updated my post with some more info.

MonkderVierte@lemmy.zip on 06 Jun 09:44 next collapse

A library that exposes classes to a standalone program?

Maddier1993@programming.dev on 06 Jun 10:01 next collapse

Does this program need to save the data for the CRUD part?

If so, it’s best to make it into a standalone program that writes to a DB and maybe also provides APIs to external programs to query the data from the DB.

GiorgioPerlasca@lemmy.ml on 06 Jun 10:24 next collapse

It would be a module in a modular monolith architecture

talkingpumpkin@lemmy.world on 06 Jun 14:57 collapse

No idea what you are talking about… did you get an assignment to implement some CLI program and want ideas for what to do?

If this program was made in a language that supports creating packages for other programs (e.g. Python, Rust, NodeJS), should this program be a ‘package’, or should it be a standalone program that has a simple “setup” script?

I’d assume what you call “packages for other programs” would be plugins? In that case, unless you have a specific existing program you want to write a plugin for, then yours would be a standalone program.

About the “setup script”, if you mean that’s an installer of sorts, then no, your program must not necessarily have an installer (you or others may write standalone installers or packages for various package managers, but that’s another story).