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

Abstract Class design pattern in Go #11

Open
huan opened this issue Apr 3, 2020 · 4 comments
Open

Abstract Class design pattern in Go #11

huan opened this issue Apr 3, 2020 · 4 comments
Labels
question Further information is requested
Milestone

Comments

@huan
Copy link
Member

huan commented Apr 3, 2020

Questions from WIP: add user/message.go #4

Q3

Q3: In my understanding, Puppet should be an interface definition, different protocols to implement different classes, but some methods of Puppet have logic, and they cannot have logic in Go's interface definition. I don't know what to do.

Sorry, maybe my understanding of wechaty and wechat-puppet is too simple, and I may need to read and understand them as a whole.

If I'm understanding correctly, our problem is the Go Lang does not permit an abstract class to have any implementation in it?

Please feel free to correct me if I'm wrong.

To be updated... I'm going to study Go now...

Updated Links

@huan huan added the question Further information is requested label Apr 3, 2020
@dchaofei
Copy link
Collaborator

dchaofei commented Apr 3, 2020

Can write logic in "Puppet struct" method, I think #4 code is pretty good now

@suntong
Copy link

suntong commented Apr 11, 2020

Go Lang does not permit an abstract class to have any implementation in it

Not true, I've defined some common functions in my base / abstract class, taking a look at #4 now...

@suntong
Copy link

suntong commented Apr 11, 2020

BTW,

You know there is a tool to "Convert TypeScript types to GO" right? -- https://app.quicktype.io/#l=Go
Meaning that we should make TypeScript type definitions as individual files, separate their implementations from them. So whenever the types get changed, the Go/Java/Python type definition files can be changed semi-automatically as well. Maybe it is already happening, but I'm just shooting into the dark.

@huan
Copy link
Member Author

huan commented Apr 12, 2020

@suntong Thank you very much for letting us know the "Convert TypeScript types to GO" project!

I believe that's definitely we should use because the wechaty-puppet will be upgraded frequently and we have to build an automation process to sync other languages like Go from the TypeScript without needing any human helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants