Page 1 of 1

Application:Code Library

Posted: Mon Jan 02, 2017 9:26 am
by collectordave
I was looking for a code library to make an attempt at organising my attempts at programming. After a few search here and on internet decdided to roll my own. Here is my first attempt.

This application when run allows you to store Whole Applications,Custom Gadgets,Example of use, Modules and procedures\Macros.

The procedures\macros are stored directly in the database and when required can be copied to the clipboard for easy insertion into your current project. All the others are stored in sub folders from the folder in which the programme is run. these can all be copied out any time you wish to any folder you choose so any application can be used as a template for your new application etc modules and custom gadgets can be copied into your project folder at any time for inclusion.

All the files required are available on GitHub herehttps://github.com/collectordave/PureBasic-Code-Library:-

Let me know of any problems or needed features.

Regards

cd

Re: Code Library

Posted: Mon Jan 02, 2017 10:01 am
by infratec
Hm...

for that I use the inbuild 'code snippet tool'.

In the german version:
'Werkzeuge'->'Code-Bausteine'

In the english version:
'Tools'->'Templates'

Bernd

Re: Code Library

Posted: Mon Jan 02, 2017 10:11 am
by collectordave
Hi

How do I get the inbuilt tool to store a whole application including image files, databases and any custom gadgets used in the application?

Regards

cd

Re: Code Library

Posted: Mon Jan 02, 2017 10:44 am
by Kukulkan
I never needed and used such a tool. GIT and a server (Linux, CentOS) as Git repo-server (incl. backup) did it for me..

What it the benefit of using such tool? I'm just curious...

Re: Code Library

Posted: Mon Jan 02, 2017 11:00 am
by collectordave
Well for me.

I move around quite a lot and the internet is not allways available. So git etc of limited use.

I am also not allways on the same computer but want access to the latest version of any software I am writing.

So storeing all my code on a USB stick or drive was the first answer. This works ok.

I also start new projects and wanted to use a working project as a template knowing I had programmed one somewhere similar to what I needed. Finding that was a headache.

So the tool saves all the code etc when required and can be searched for then I can copy the code out to any folder I wish at that time. I can then make changes etc in the knowledge that the original is not being changed so when I make a mess of it I just need to copy it again from the tool. Then if I actually get things right I can easily store all the work back into the tool.

There is the first advantage for me it stops me cluttering up my work folder with lots of little snippets etc as when I finish doing what I wish I update my work on the tool and delete everything from my work folder.

It also allows me to keep working copies of any custom gadgets, modules etc safe from my interfering hands.

The advantages of storing the procedure etc are the same as for the template tool included with PureBasic.

For me the storage and the ability to search for a piece of code on just a keyword on any computer I am working on are the great advantages.

Regards

cd

Re: Code Library

Posted: Mon Jan 02, 2017 11:26 am
by Kukulkan
Thank you for that explanation. I think I understand.

I personally don't like the idea to copy and paste code multiple times for several projects. In my experience, this is a source for bugs and an enhancement to a function in one program does not enhance it at the next compile of the other program. Instead, I have many copies of the same functions/code around in all the projects. Such a code manager seems to be exactly what I don't like :-)

So I prefer another way. First, GIT is perfect for being offline, as you commit the changes and sync/merge them later if you are back online. This is how all the distributed Linux developers work, too. You always have a full copy of the code on your machine (eg Laptop) and you can commit changes at any time, even being offline. If you are back online, just pull/push and (if not done automatically) merge. In some cases you might have to fix conflicts, but not really if you are the only developer working with the repo.

I created a GIT repo called "includes". It contains a .pbi file called first.pbi. This includes all other files in includes. For language handling, string manipulation, proxy-dialogue, my own gadgets, modules, registry functions, curl wrapper etc. Also, the repository contains generic images like logos, setup-images etc. Upon this, every new project simply includes the first.pbi and all functions I developed in the past are automatically available. And if I enhance such a function (eg enhancing speed or enhancing a module), all other projects benefit automatically on the next build. I also do not have multiple copies of the same functions around.

At the end, a project always consists of the "includes" repository and (mostly) a dedicated repository for the project code and files. So I'm always fine, no redundancy. I simply write XIncludeFile "../includes/first.pbi" at the beginning of a project and I'm done. PB does not compile and include unused functions in the executable, so no problem if the includes repository gets bigger by containing many unused functions...

But anyway, seems a matter of taste.

Best,

Kukulkan

Re: Code Library

Posted: Mon Jan 02, 2017 11:51 am
by collectordave
Hi
I have many copies of the same functions/code around in all the projects
That is exactly why I use it. Once a copy is in the programme I am writing the original stays unchanged all the projects compile and work as they shouls if I "enhance" a procedure or other item only the code in that project is changed the saved code is a deleiberate action on my part so none of my other projects need with just one enhancement to be updated at all.

I use Git now but only after I have checked as much as I can that all is ok. I am now keeping each project in a separate repo as well to keep them all separate.

Thought of using one big include but then checking it is right for each programme became a headache. :lol:

I now delete as much as possible from each project before commiting to Git.

Still getting the hang of it though.

Cheers

cd