nansat icon indicating copy to clipboard operation
nansat copied to clipboard

Make Nansat immutable

Open akorosov opened this issue 8 years ago • 2 comments

There was a suggestion on Nansat lectures to make Nansat immutable: https://github.com/nansencenter/nansat-lectures/issues/3

That implies that reproject, crop, etc do not change the object but rather return new, modified object. Two Advantages:

  • it is possible to reason about n without tracing all possible mutations;
  • you can express multiple processors starting at n without worrying that one will mutate n and make it unusable for the other;
  • Operations can be easily chained: n.reproject(...).write_figure(...)
  • Assurance during processing by tiles in a distributed (cluster) environment

Something to read about: http://programmers.stackexchange.com/questions/151733/if-immutable-objects-are-good-why-do-people-keep-creating-mutable-objects

akorosov avatar Mar 17 '16 08:03 akorosov

+1 seems a more logical approach

aleksandervines avatar Mar 17 '16 08:03 aleksandervines

+1 yes, these are good arguments.

2016-03-17 9:49 GMT+01:00 Aleksander Vines [email protected]:

+1 seems a more logical approach

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/nansencenter/nansat/issues/164#issuecomment-197768571

knutfrode avatar Mar 17 '16 08:03 knutfrode