Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typed language #13

Open
AbdelRahmanSalah opened this issue Jul 14, 2018 · 25 comments
Open

typed language #13

AbdelRahmanSalah opened this issue Jul 14, 2018 · 25 comments

Comments

@AbdelRahmanSalah
Copy link

AbdelRahmanSalah commented Jul 14, 2018

Your work is very nice but I highly recommend to refactor the code to typed language (that compile to Javascript) like Typescript or ELM, this will make the project maintainable, readable and extendable

@DrWaleedAYousef
Copy link
Member

Currently, we are still working on forming the team. If you are interested in developing, pull requests are welcome.

@AbdelRahmanSalah
Copy link
Author

yes I'm very interesting, I will refactor some code to typescript then send work in progress pull request to discuss the new design

@ndrwnaguib
Copy link
Collaborator

Dear @AbdelRahmanSalah, if you are still interested, would you please tell me when do you expect to submit your pull request? Also, you said:

I will refactor some code to typescript

Which parts of the code you are going to refactor it? So, we can work on the other parts.

@AbdelRahmanSalah
Copy link
Author

Yes I'm still interested, and I'm currently going through the code to select the part which I can refactor to typescript, I will tell you shortly ISA the part i will refactor and the expected pull request date

@AbdelRahmanSalah
Copy link
Author

Dear @andrewnaguib I will begin with Transform.js and I think it will take one week ISA according to my time

@ndrwnaguib
Copy link
Collaborator

Okay great, good luck and thanks for your willingness to contribute.

@AbdelRahmanSalah
Copy link
Author

@andrewnaguib
I want to share with you some things I want to change and take your opinion:

  • Functions should not depend on any global variables like lib.GoG_JSON[obj.data] all function requierment should be pass as function parameters so if I want to re-write the power function it should be like pow(obj: {power: number, field: string, name: string}, dataTable: Array<{[x: string]: any}>) this will make the power function maintainable and can be tested when we begin to write test cases

  • we should try to avoid data mutation for data loaded from the source (like data loaded from csv )
    https://slemgrim.com/mutate-or-not-to-mutate/

  • dynamic function call like results.push(Transform.prototype["R_" + i["function"]](i.properties)) very good but if user not send the function name right this line will throw exception and user will not know where is the error so I think we should handle function call manually by switch on the function name that sent from the user and throw meaning exception

@DrWaleedAYousef
Copy link
Member

GoG is a library to be called by higher level graphical software to render to the browser. Therefore, before spending the time of converting to Typescript we need to make sure that this conversion will not throttle the rendering or cause calling limitation. The graphical software may call GoG to render hundreds of thousands of points or more.

@AbdelRahmanSalah
Copy link
Author

Convert to typescript should not effect on performance or add any limitations.
my changes I recommend just general good practice and to help other contributors to understand the code flow

@AbdelRahmanSalah
Copy link
Author

I recommend to begin use npm as a package manager because we should not push the third party libraries in the GOG github repository, I notice we use

@HishamElamir
Copy link
Collaborator

I think that we need in future to make GOG a standalone lib.

@AbdelRahmanSalah
Copy link
Author

I think before adding any new feature we should refactor the repository to be suitable for contributors

@HishamElamir
Copy link
Collaborator

I know that, we should take in consideration the full documentation when we are working in code re-factor.

@DrWaleedAYousef
Copy link
Member

DrWaleedAYousef commented Jul 26, 2018 via email

@AbdelRahmanSalah
Copy link
Author

@DrWaleedAYousef I'm very happy you remembered me 😄
أهلا أهلا يادكتور

@AbdelRahmanSalah
Copy link
Author

@HishamElamir could you create new branch by name refactoring for example so we can send pull requests on it before merge to master branch

and I have question Are you work with typescript before, cause I need to know the specification object type

@HishamElamir
Copy link
Collaborator

First things first, i think i do not have this type of permission that allows me to create branches.
And Second of all, yes i worked before with typescript, but i need to know what do you mean by

I need to know the specification object type

@AbdelRahmanSalah
Copy link
Author

The specification object that used on HTML files and pass it to gog parser can you type it

@DrWaleedAYousef
Copy link
Member

DrWaleedAYousef commented Jul 27, 2018 via email

@HishamElamir
Copy link
Collaborator

I checked the following @DrWaleedAYousef,

  1. there's two branches master and 2015(created by yousef mohammed)
  2. i do not have any branches in this repo

@DrWaleedAYousef
Copy link
Member

Ok, I have created a new branch now called TestingRefactoring It is initialized with the same code at master. Please everyone check.

@AbdelRahmanSalah
Copy link
Author

AbdelRahmanSalah commented Aug 11, 2018

@HishamElamir First PR submitted please review I create folder tsVersion then we can begin convert each lib to typescript in this folder then we can remove all js files

@DrWaleedAYousef
Copy link
Member

DrWaleedAYousef commented Aug 11, 2018 via email

@AbdelRahmanSalah
Copy link
Author

I don't think I have permission to push directly to the repository
And I recommend three steps before merging code on hci-lab/gog
1- each contributor should fork from the main repo to his own repo
2- after contributor make changes in his repo, he should send Pull request to hci-lab/gog refactoring branch
3- his changes reviewed from the main contributors in the repository if they approved the changes, one of them can merge the code

@DrWaleedAYousef
Copy link
Member

DrWaleedAYousef commented Aug 11, 2018 via email

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

No branches or pull requests

4 participants