Giter VIP home page Giter VIP logo

Comments (4)

ttsuru avatar ttsuru commented on May 30, 2024

初めてコメントさせていただきます。
クラス変数とはメンバ変数のことでしょうか。

全てをメンバ変数とするとメモリがオブジェクトのdestroyまで開放されず、オブジェクトのシリアライズなどにも影響する気がしますが、いかがでしょうか。
OOPの中で、本来の意味でメンバ変数とするべきものはメンバ変数で、それ以外はローカル変数にしてもよいのではないでしょうか。

あるいは、メンバ変数は必ずphpdoc形式のコメントつきでclassの先頭で宣言を行うなどはいかがでしょうか。

from ec-cube.

izayoi256 avatar izayoi256 commented on May 30, 2024

issue内には記載がないのですが、
開発方針にはaction()内の規約として規定されているように読み取れます。
action()以外の関数でローカル変数を使用することに関しては問題ないのではないでしょうか。
action()からビジネスロジックを排除すれば可読性が上がりますし、
SC_FormParamのインスタンス等をメンバ変数に移動すれば
プラグインの連携もしやすくなるように思います。

from ec-cube.

shinichi-takahashi avatar shinichi-takahashi commented on May 30, 2024

@ttsuru @izayoi256

コメントありがとうございます。
プラグインでローカル変数の書き換えができないという問題を解決するために、この方法でどうかとissueを立てました。
なので

開発方針にはaction()内の規約として規定されているように読み取れます。
action()以外の関数でローカル変数を使用することに関しては問題ないのではないでしょうか。

上記で@izayoi256 のおっしゃる通り、action()以外では問題ございません。
混乱を招かぬようissueの表題を変えておきますね。

また、「action()からビジネスロジックを排除すれば可読性が上が」る件に関しては、 #7 と関連が深くなってきそうなので、別でissueをたてたほうがよいかもしれません。

from ec-cube.

shinichi-takahashi avatar shinichi-takahashi commented on May 30, 2024

Silexの採用に伴い、action()がそもそもなくなったのでCloseさせていただきます。

from ec-cube.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.