Posts: 2,171
Threads: 222
Joined: Apr 2022
Reputation:
103
Some folks mostly love to use programs, others love to develop them.
Out of curiosity, do you think if we had a lot of usable libraries on the boards, would you use them to build your programs, or prefer to make your own routines?
Pete
Posts: 1,586
Threads: 59
Joined: Jul 2022
Reputation:
52
11-07-2022, 10:49 PM
(This post was last modified: 11-07-2022, 10:50 PM by mnrvovrfc.
Edit Reason: Loading non-BMP was "natively" available but not saving
)
I had created a small BASIC code library that I used to compile to QLB, that I don't even use anymore, but I should try to use some of them. However, many of them were text-graphics like drawing boxes or creating menus that accepted input. At this time I have a couple of "BM" suffix files lying around and I'm just copy-pasting from them, not bothering to include one of them whole any longer.
This reminds me of something: I might start a thread about it. Or I should finally create an account with Github, ugh, want to avoid that if possible.
I like other's routines, the problem is I have to learn how to do the function call and what the parameters do. Such as the word-wrap thing that Terry did a short time ago. I was getting quite used to the version that he first posted before he changed it.
I really wanted to use Steve's library for loading and saving image files other than BMP, but on Linux. Right now I have to export everything to BMP, because I also have to leave open the possibility of programming in Freebasic. I like QB64PE's ability to include C/C++ code with "dot-H" files, not having to use some external DLL, SO or alike which is clunky. That said, I didn't mind the "overhead" that the old SDL version of QB64 required but those DLL's could eat some valuable disk space.
Despite the new "open" and "save" file dialogs I think that, only for uniqueness, I would continue using Dav's function on Linux. "Don't fix it if it isn't broken" but only if I had hundreds of source code files needing to display an open file dialog. At this moment I did only one program, which I had to delete from this forum due to the lack of interest. It was a program that read a text file having floating-point "x" and "y" values, one per line and plotted them by line on the screen. That was a bit complicated and therefore sought another solution. Such as the math expression parser that Steve and others did. I had used Lua, calling it via "SHELL" to produce the output text file. Using the Lua API is tricky and would require "liblua.dll" or "liblua.so" involved in creating the user program. But I really need to sit down and figure out how to do the "virtual machine", to send it a string which is a Lua script, and to obtain the output of that script (or error message) as a VLS.
Posts: 276
Threads: 14
Joined: Apr 2022
Reputation:
27
There's a lot of really good stuff to choose from already. Some things that others have written just get plugged into my programs. Things like Steve's MBS function and Bplus' Rotozoom3 are favorites. They're easy to use and I don't always try to re-invent the wheel. Where I know the source, I try to put a citation in the comments, even if I've modified it for my purposes.
Other things I prefer to do myself, since one generally has a better intrinsic understanding of something they wrote themselves. I've been mulling over a library for doing 2D & 3D vector manipulations, since I've always used my own UDT system for them. It's a kind of shorthand system, which I imagine others might find too cryptic.
Mostly I avoid libraries if it's something I'm going to post. I assume it's more of a PITA if one has to download a zip of multiple files. Easier to copy/paste and F5.
DO: LOOP: DO: LOOP
sha_na_na_na_na_na_na_na_na_na:
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
Well, as you guys can see in the Libraries section, I'm one of those fellows who tend to try and write everything in a library-style format. I believe strongly in the concept of "write code once, get it working, and reuse it forever and ever".
Libraries, once written, only expand and get better over time -- which doesn't hold true if one is talking about just writing code from scratch. Take the SaveImage library for example -- it started with just BMP export ability. Once that started working, I could expand it to work with PNG files. Then GIFs. The JPG files... If I had to write a routine to save an image from scratch, there's a very good chance that whatever I wrote would be error-prone, limited-case use, and nowhere near as flexible or powerful.
The more you use and reuse library code, the more refined it gets. It only gets better over time.
Posts: 1,272
Threads: 119
Joined: Apr 2022
Reputation:
100
11-08-2022, 12:22 AM
(This post was last modified: 11-08-2022, 12:24 AM by TerryRitchie.)
I would gladly use a ready made library on one condition ... it includes useful documentation with examples. Before I released any of my libraries I always made sure to create documentation for the programmer to reference.
I used to use many libraries with QB4.5, the most often used one being the SVGAQB library by Zephyr Software. I even paid to update to the latest version somewhere around 2008 when I was working on Super Mega-Bug before I discovered QB64. (They were quite surprised to have someone update a library offered in the 90's in 2008, LOL) The first thing I always did when I decided to pay for a library and use it was to print out the documentation and 3 hole punch it into a binder and place on my shelf for reference.
I wish more QB64 programmers with specialized skills would create libraries. I've seen amazing things done by Qb64 programmers, especially in the 3D realm. A 3D library would be awesome. A higher math library also comes to mind. A 2D real world physics/graphics library (think Angry Birds)!
Posts: 200
Threads: 5
Joined: Apr 2022
Reputation:
22
11-08-2022, 03:33 AM
(This post was last modified: 11-08-2022, 03:35 AM by JRace.)
Most of my programming is for personal reasons. I don't hold myself to productivity quotas and I've always preferred to write software entirely by myself, so I've never been a big user of libraries. Libraries certainly have their benefits, and a well-built library can be a major time saver and headache preventative, but I've always preferred to develop my own code in my own way whenever possible. (This hands-on-everything approach is for my programming only; I'm CERTAINLY not that way in regards to my car or my house!)
In regards to creating libraries for general consumption: um, well.... Many times in the past I've started putting together various libraries for personal use, but in many cases evolving goals & feature creep made many of them unwieldy to use, while in other cases my needs & approach had changed and functions that were just fine for one project needed to be heavily reworked for another.
So while I MIGHT use a well-crafted library, at least in the initial stages of program development, I am by nature biased against pre-packaged code libraries, except for those that come with a compiler.
Posts: 733
Threads: 103
Joined: Apr 2022
Reputation:
14
11-08-2022, 06:23 AM
(This post was last modified: 11-08-2022, 06:45 AM by madscijr.)
It depends. I'm with Terry on needing the library to include useful documentation with examples. Especially that! For I am a bear of very little brain, and monkey see monkey do. If I have a concrete example to get me up and running, that counts for a lot.
I agree with Steve on writing something once and reusing it forever and ever. That is, until I find out I've been doing it wrong, and find some better way, and even then, it will have to be enough of an improvement that I'm compelled to go back and rewrite and/or refactor my program(s) around the new method. A semi recent example being drawing 2D multicolor tile-based graphics: I have functions that work, and then bplus educates me on super speedy hardware images, which are dramatically faster, but require a different enough approach that it's been months and months and I am still procrastinating rewriting this game's graphics routines to take advantage of that method!
I completely suck as a programmer, and sometimes it's easier for my monkey's brain to comprehend my own retarded logic than someone else's done the right way. But not always. I built this input mapping module that detects keypresses and gamepad input for upto 8 players, and it's pretty ugly. It works, but everytime I have to go through the rigamarole of tying it into a new program, I am reminded that maybe I oughta check out that other guy's library which is probably less of a headache (unless it's not! but it's worth trying).
.)
Also, like JRace, most of my programming is for personal reasons & I generally write software by myself. I find that everyone seems to have their own style and way of thinking, and my code sometimes makes people run away screaming, and vice versa. I don't hold myself accountible for productivity, but generally my motto is "cheap and easy" so if a reusable routine helps me get something done faster and is easy for everyone to understand, I'll use it. I have found that often the more "full featured" a library is, the easier it is to be confused by, and less flexible it will be to adapt as a solution for my specific case. Not always, but I have seen this often, especially when trying to write my own reusable libraries. Similar to what jrace said, the more fancy it is, the harder it becomes to rework when my needs change for a different project.
So I think that instead of a library, I would find individual functions and routines the most useful.
I hope this helps answer your question! :-D
Posts: 2,171
Threads: 222
Joined: Apr 2022
Reputation:
103
These have all been very interesting, informative, and fun reads.
Personally I have made some libraries, but like others, I very often needed to modify them to fulfill other or additional needs of the app I was building. To that end, I'd rather code an app than spend more and more time tweaking a library for every given situation.
So what if I have to start a lot of projects from scratch? That seldom bothers me, unless I'm pressed for time. Firstly, it's fun to code just about any project. Secondly, as I get older, I find coding things I've coded before helps to slow the cognitive declining process. Now if I could just find my keys... Anyway, the biggest jaw drop moment I had in regard to aging was the pleasure of meeting an MIT professor of mathematics at my bank, about 15 years ago. He was 75. I started asking him some questions about his experiences and he quickly told me that back in the day he could speak for hours on theorems and equations, but today he was just happy he could balance his check book! [Insert horror smiley.]
So I think I fall more into the camp of reinventing the wheel. Now Steve would tell you that most wheels leave tread marks on the road, but mine tend to leave a few corner indentations along the way.
Pete
|