Skip to content
This repository has been archived by the owner on Apr 27, 2024. It is now read-only.

Splitting the source code #37

Open
kewalsk opened this issue Aug 11, 2019 · 6 comments
Open

Splitting the source code #37

kewalsk opened this issue Aug 11, 2019 · 6 comments

Comments

@kewalsk
Copy link
Contributor

kewalsk commented Aug 11, 2019

Is it possible to split the one big file Periscope_Web_Client.user.js into several smaller?
The best would be one main menu function per file. Just for better maintenance.
However, I don't know the consequences.

@gitnew2018
Copy link
Owner

It is possible, I like one big file though 😎

@Max104t
Copy link
Contributor

Max104t commented Aug 12, 2019

Splitting parts of API is in pull request: #39

@gitnew2018
Copy link
Owner

gitnew2018 commented Aug 16, 2019

I don't have enough experience to judge if splitting the code is good or not.
What are the benefits?
While reviewing the Pull request, I noticed that it makes it harder to read because many variables and functions are undefined, my linter is mad about it 🙄 and I can't easily jump to function definition etc.
I guess it was a lot of work to split it and i don't want to close this PR without hearing why you did it.

edit: I decided to let you lead on this, still hoping for explanation.

@kewalsk
Copy link
Contributor Author

kewalsk commented Aug 16, 2019

Usually a serious software source code is maintained in separate files. In Java for example you have to keep each class separately - there is no other possibility. The one big file is not good for maintenance especially when more than one programmer is working on development. Each commit will cause conflicts which has to be manually resolved. That's why I suggest to do that. However I'm not JavaScript expert so I could not know all the consequences in this case.

What is "linter" and what do you mean by "mad about it"?

I'm using IDE (InteliJ but I'm sure Eclipse or other will do the work also) and there is no problem to jump into definition (Ctrl-B) even if the definition is in different file.

@Max104t
Copy link
Contributor

Max104t commented Aug 17, 2019

During the code breaking, things may be hard, but once we reach a good state the MVC model, and separation of shared code it will be much easier to navigate.. Breaking the code also hides irrelevant details like the re-implementation of GM_xmlhttpRequest for Node.js in PeriscopeApiWrapper.js the callers should not bother with such details (if possible) and just call Periscope api they need.. the work is not done yet.. I rather have a logical abstraction of Periscope APIs instead of doing the HTTP calls.

@gitnew2018
Copy link
Owner

gitnew2018 commented Aug 17, 2019

@kewalsk

Wikipedia:

Generically, lint or a linter is any tool that detects and flags errors in programming languages, including stylistic errors.

I'm using visual studio code and because of the way it is split it doesn't let me jump into definition etc. I'm going to investigate if I can do something about it.

Thanks to both of you!

edit: Added jsconfig.json file and it detects functions from other files now 🎉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants