About Store Forum Documentation Contact



Post Reply 
Reusable code
Author Message
Houge Offline
Member

Post: #1
Reusable code
Hi!

I found myself trying to create well-designed classes (for DB or network) and reuse them in my different projects.
The problem is that they are difficult to be moved/copied across many projects, as I can improve them by time. So when I do it, I need to copy-paste new version of code across all projects. The same problem was discussed here, but that thread is almost 4 years old.

What I want to see in EE is "code-like add-on" feature. I'll try to explain how I see it.
Add-ons like in Unity or UE4, that can extend Editor itself can be too complicated to make right now.
So when we create a new project, there should be an option, regular project or add-on one. If it's add-on, then when publishing it's not actually creating an .EXE (that is not cross-platform), but it creates an encrypted package with read-only header files (like EE headers) and encrypted bodies that can be "installed" in the editor. And when I create new project and new application inside it, i can set this add-on to "use this add-on" and I get it included as I already have all EE headers.
And when I edit this add-on and re-install it, it is automatically applied to all my projects.

The point is to keep code as "code" and not as binaries is to make add-ons really cross-platform and easy to use.
The other point is to be able to sell custom code classes in EE store and use them as real add-ons.
(This post was last modified: 01-15-2018 10:25 PM by Houge.)
01-15-2018 10:24 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #2
RE: Reusable code
I would have to assume you are wanting something like how static libraries/dynamic libraries function but in a way that it works and loads a modules inside EE editor to make them easier to access and with the ability to read the headers directly inside the editor.
if I've assumed correctly that would be a very neat feature to have. +1. smile
01-16-2018 12:24 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #3
RE: Reusable code
I thought about it a little and I think I have more ideas about that.
ZERVOX, I don't think that it would be good working like static libraries/dynamic libraries, because compilation to different platforms is complicated.

I think the following:
We don't need shared code only, we also need other types of project elements, for example Object Classes, Enums, Objects, etc.
Esenthel Store already has "Source code" section, where full projects are sold. I think that there is no reason to make "pre-compiled" reusable code, because it's much more difficult than "source" reusable code.

So now when we want to reuse the code, we need to copy all elements (code + other element types) to other project, if we have for example 5+ libraries it becomes difficult to manage latest versions of all of them. I want such project with reusable code and all elements be included into other project as a read-only package (where we can use all types of elements in it). So when we need to change its code, we open a project with it, make changes and all our projects that use this package get updated without reloading anything (because they keep only link to it, not a copy).
(This post was last modified: 03-25-2018 05:13 AM by Houge.)
03-25-2018 05:12 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #4
RE: Reusable code
(03-25-2018 05:12 AM)Houge Wrote:  I thought about it a little and I think I have more ideas about that.
ZERVOX, I don't think that it would be good working like static libraries/dynamic libraries, because compilation to different platforms is complicated.

I think the following:
We don't need shared code only, we also need other types of project elements, for example Object Classes, Enums, Objects, etc.
Esenthel Store already has "Source code" section, where full projects are sold. I think that there is no reason to make "pre-compiled" reusable code, because it's much more difficult than "source" reusable code.

So now when we want to reuse the code, we need to copy all elements (code + other element types) to other project, if we have for example 5+ libraries it becomes difficult to manage latest versions of all of them. I want such project with reusable code and all elements be included into other project as a read-only package (where we can use all types of elements in it). So when we need to change its code, we open a project with it, make changes and all our projects that use this package get updated without reloading anything (because they keep only link to it, not a copy).

You can have things work like something without taking every aspect of it, and to me this suggestion reads like how libraries is in Visual Studio with the exception of being a compiled binary, you link them, you edit the static library it loads all the differences, with the exception if you've added new headers, in which case you add links to them.

you are also using the same name, for Visual Studio it is also called linking.

so let's break it down.

you want
Project A(Contains useful classes)
Project B(Main project) and C(Sub project which also needs things from A)
B and C links to A.
You make changes to A,
B and C checks A's folder/project's Checksum, if it differs reloads Project A to get all files that has been added/removed and relinks the other ones.

This to me is very similar to how Visual Studio handles static/Dynamic linking with the exception of it being compiled binaries.
because if I want a Visual Studio project to load all the headers automatically, I just include/build my static library in a fashion that i can load all sub headers through a single header.h
03-25-2018 10:08 AM
Find all posts by this user Quote this message in a reply
Esenthel Online
Administrator

Post: #5
RE: Reusable code
I agree with the feature however it would take too much time to develop at this time.
03-25-2018 11:54 AM
Find all posts by this user Quote this message in a reply
Houge Offline
Member

Post: #6
RE: Reusable code
ZERVOX, sorry for misunderstanding smile I just thought you say we need to pre-compile "reusable code" into libraries and distribute them like that. So yes, it looks pretty as Visual Studio static/dynamic linking.

Esenthel, ok, but what about contributing? How much can it cost for contribution item (approximately)?

I think there just should be one more project element (as Library element is used to share code in a Project), because when we distribute reusable code, we want to include some examples in it (and if all examples get included to other projects as reusable code, it's not good). So all "reusable elements" can be included in "Reusable Library" element and it would be used by all projects in EE smile
(This post was last modified: 03-25-2018 05:47 PM by Houge.)
03-25-2018 05:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #7
RE: Reusable code
(03-25-2018 05:47 PM)Houge Wrote:  ZERVOX, sorry for misunderstanding smile I just thought you say we need to pre-compile "reusable code" into libraries and distribute them like that. So yes, it looks pretty as Visual Studio static/dynamic linking.

Esenthel, ok, but what about contributing? How much can it cost for contribution item (approximately)?

I think there just should be one more project element (as Library element is used to share code in a Project), because when we distribute reusable code, we want to include some examples in it (and if all examples get included to other projects as reusable code, it's not good). So all "reusable elements" can be included in "Reusable Library" element and it would be used by all projects in EE smile

I'd even settle for a way to set a project as a "library" element as its own project and allowing to set it as a global so it would be registered in the projects somewhat like how EsenthelEngine headers/library is registered.(not sure how much time this would take)

also a contribution might work.
(This post was last modified: 03-25-2018 07:21 PM by Zervox.)
03-25-2018 07:20 PM
Find all posts by this user Quote this message in a reply
Post Reply