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

quick question on the pipe methos #26

Closed
tzookb opened this issue Jul 13, 2016 · 2 comments
Closed

quick question on the pipe methos #26

tzookb opened this issue Jul 13, 2016 · 2 comments

Comments

@tzookb
Copy link

tzookb commented Jul 13, 2016

I noticed when you pipe, you must do:

$pipeline = $pipeline->pipe(WHATEVER);

as the pipe clones the old pipeline and returns the cloned pipeline.

Now if we have 100 pipes (just an example)

isn't it better to simply return the same pipeline and not wasting memory
on never used old pipelines that were cloned....

@GreatOwl
Copy link

@tzookb , the main concept being implemented here is called immutability. It's growing in popularity amongst object oriented communities because of its ability to simplify maintain ability of a codebase. Your comment on use of memory is a common criticism of immutability when it comes to speed, but the speed implications are minimal and this architecture pattern can actually assist in allowing your application to scale (there's more to it but this helps).

Here's a link that covers some of the key features and criticisms of immutability in php briefly. But I encourage you to do more research as its a very important topic in modern code communities. https://www.phproundtable.com/episode/immutability-and-functional-concepts-in-php

@tzookb
Copy link
Author

tzookb commented Jul 19, 2016

Thanks @GreatOwl ,

for your time posting that message and great content link.

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

No branches or pull requests

2 participants