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

Add virtual field pattern #52

Open
SupaHam opened this issue May 10, 2015 · 18 comments
Open

Add virtual field pattern #52

SupaHam opened this issue May 10, 2015 · 18 comments

Comments

@SupaHam
Copy link

SupaHam commented May 10, 2015

There's a new (I think) pattern called the Virtual field pattern, introduced in Java 8. https://kerflyn.wordpress.com/2012/07/09/java-8-now-you-have-mixins/ Scroll half way through till you find "Another Approach".

@iluwatar
Copy link
Owner

Thanks, we'll look into it.

@iluwatar
Copy link
Owner

Ok I've read the article and can see what can be done with virtual extension methods.

There is discussion about it on this mailing list and it seems that Mr. Brian Goetz, who is the Oracle's Java Language Architect, is strongly against using Java 8 this way, for behavior and state multiple inheritance.

So I'm thinking that this is hardly a best practise or recommended solution a problem.

@iluwatar
Copy link
Owner

Reopened, see #638

@iluwatar iluwatar reopened this Sep 30, 2017
@reegnz
Copy link
Contributor

reegnz commented Sep 30, 2017

I will implement an example for this. But first I need to go read your contribution guidelines.

@iluwatar
Copy link
Owner

Ok @reegnz

@iluwatar
Copy link
Owner

@reegnz are you still implementing this?

@reegnz
Copy link
Contributor

reegnz commented Dec 25, 2017

Slowly but surely.

@iluwatar
Copy link
Owner

iluwatar commented Oct 5, 2019

@reegnz how slowly? I will mark this issue ready for taking again.

@reegnz
Copy link
Contributor

reegnz commented Oct 5, 2019

No problem. I don't develop Java nowadays.

@ramazansakin
Copy link

Hi @iluwatar ,

I can add a simple app for virtual-pattern but when I studied the code a little, I saw some files that need to be added. How can I create these files. Or if I just add the sample project, would it be enough?

@iluwatar
Copy link
Owner

iluwatar commented Sep 1, 2020

What files do you mean? I expect that implementing this pattern brings quite many new files anyway. You're not talking about source code files, are you?

@ramazansakin
Copy link

I made a png file for uml diagrams but not similar with other samples and .puml file and also I saw a block almost every sample as "The MIT License

  • Copyright © 2014-2019 Ilkka Seppälä".
    Is this necessary to add any sample ?

@iluwatar
Copy link
Owner

iluwatar commented Sep 1, 2020

puml file is autogenerated from code. From that you can generate the image and it will be similar as in other pattern examples.

Similarly there is a license checker plugin in the project that will add the missing licenses for you.

@ramazansakin
Copy link

@iluwatar Yes, I saw the other samples, and I researched a little and I found plantUml plugin and I tried to generate them but still I can not auto generate them. Also, I researched about auto generating for uml and png part but still could not. I implement a sample for virtual field pattern and also blackboard but just left etc folders

@iluwatar
Copy link
Owner

iluwatar commented Sep 2, 2020

Can you give a link to your code? I could take a look.

@ramazansakin
Copy link

@iluwatar , I forked the project and added a module as virtual-field, and I can not push my changes its getting denied error. Some permission problems or anything else ?

@iluwatar
Copy link
Owner

There shouldn't be any problems if you are trying to push to your forked repository. I can imagine that it fails if you are trying to push to the master repository - that's only allowed for collaborators.

pratigya0 pushed a commit to pratigya0/java-design-patterns that referenced this issue Aug 3, 2023
@iluwatar
Copy link
Owner

More information about the pattern: https://stackoverflow.com/questions/47101072/java-virtual-field-pattern

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

No branches or pull requests

4 participants