Git Product home page Git Product logo

Comments (7)

narfbg avatar narfbg commented on May 18, 2024

This constant is useless, I'm voting to remove it.

from codeigniter4.

lonnieezell avatar lonnieezell commented on May 18, 2024

I agree with @narfbg. In the 10 or so years that I've been working with CI, I don't think I've ever found a need for that. And it's handled by the $systemFolder variable if you want to change it.

from codeigniter4.

lonnieezell avatar lonnieezell commented on May 18, 2024

It's been removed.

from codeigniter4.

sv3tli0 avatar sv3tli0 commented on May 18, 2024

I think that the same remove can be made and on other constants. Path Class is a lot better choice to register and handle paths..

from codeigniter4.

lonnieezell avatar lonnieezell commented on May 18, 2024

I don't see a path class being beneficial here. The way CI has always done it is simple, by creating constants for paths that are constant. They're available sitewide. And they use less resources than a class would.

from codeigniter4.

sv3tli0 avatar sv3tli0 commented on May 18, 2024

I can't give any 100% important reason to have class instead of just constants.
But at least what I understand from OOP developement, hard coded constants are not really beautiful solution.

Instead all over the code to check if file_exists(SOMEPATH. 'folder/file') and to require it..
You can just use 1 already loaded resource to get the existing path of the file which you need and if it doesn't you will get proper exception/error (not existing no permissions and etc)..

Of course this has something to do and with the Loaders..

from codeigniter4.

lonnieezell avatar lonnieezell commented on May 18, 2024

Like anything else, OOP design can be taken to extremes it really doesn't need to be.

In this case, you're right, that's more to do with a loader, or some other class. But if you go the route of creating OOP wrappers for all of PHP's non-OOP functions, things get a little crazy. :) In this case, your example, while a valid function (not necessarily requiring an entire class, but could be ...) would replace if file_exists calls with try/catch blocks throughout the code, which can harm performance, and isn't anymore beautiful when all you want to do is see if file exists....

I'm not saying your class idea doesn't have certain appeals for different situations, but for this one, I think it's overkill and complicates things instead of simplifies them.

from codeigniter4.

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.