4 ms·
* Not a composer package * Uses arcane define() statements to set configuration * No ORM -- provides a slim wrapper around mysqli * Uses singleton classes --
by ihsw 13y ago
* Not a composer package
* Uses arcane define() statements to set configuration
* No ORM -- provides a slim wrapper around mysqli
* Uses singleton classes -- makes any potential unit testing very cumbersome
* Rudimentary routing system -- doesn't support anything beyond /$CONTROLLER/$ACTION/$ARGS...
* Rudimentary templating system that does simple string-replacement -- doesn't support looping or conditional control structures
* Database::safeQuery() is anything but safe, in fact it's quite dangerous -- prepared statements should be used at a minimum rather than blind string replacement (see mysqli::prepare())
This seems like it was an interesting learning exercise for the author, but it's not much beyond that.
The next step would probably be to make it PSR-1 and PSR-2 compliant (note how public/private accessors are absent in many places, and indentation swaps between spaces and tabs), and make it fit within the composer packaging system.
- masom 13y ago* No logging * No unit tests
- superice 13y agoTrue. Logging could be implemented quite easily using events, unit testing, well, I have no idea. I don't unit test that much, and I know, good practice and blahblah, but I tried and do not see the benefits for my projects. (Generally my projects are quite small)
- lukeholder 13y agoyeah as soon as i saw it was not using composer i knew it wasn't a "cool" framework.
- stephenr 13y agoI am not defending this project, I have complaints about it myself but some of your issues are ridiculous. > Not a composer package Thats like saying "its not web 2.0" frankly. If you can't manage to checkout a library/framework and make use of it without being reliant on a specific package manager, you shouldn't be writing software. > Uses arcane define() statements to set configuration I don't think you know what arcane means. Also, using constants to set application options can work very well if used properly. > Uses singleton classes I'd much rather a project that makes smart use of Singletons than the ridiculous SuperMegaObjectFactoryConstructorHelperFactoryFactory shit that is apparently the "in" thing. > make it PSR-1 and PSR-2 compliant PSR is a fucking joke. Code consistency within a project is important. Between a million different projects? Not so much. The "goal" of PSR has never been "hey heres the best way to do things". Its purely an exercise in documenting the MOST COMMON way a set of projects do things. > make it fit within the composer packaging system Also, the author must only eat fishes on fridays and must devote his sunday to the FSM. Composer is not jesus, PSR is not the bible. Stop acting like they are magical items sent from the heavens.
- Navarr 13y ago> Thats like saying "its not web 2.0" frankly. If you can't manage to checkout a library/framework and make use of it without being reliant on a specific package manager, you shouldn't be writing software. Honestly, I would not start a new project with a library that does not support composer if I could help it. Supporting composer is easy and makes my life easy - not because I /can't/ checkout the library, but because I don't have to store the library in my VCS and I don't have to bother with transmitting it back and forth between servers or dealing with Pull Requests with massive file changes whenever I update the library.
- stephenr 13y agoIf your default plan without composer is "download X, Y and Z and add them to my own repo" I have some news for you.
- superice 13y ago* I don't like composer. This isn't some big framework everyone should use because it is good practice, or because it is such a great thing. It's easy. The way I like it. * define() is a great way for < 4 variables. Seriously, whats the point of creating a whole config class when I could just execute 4 times a define(); Heck, maybe I should put them in the same file! * Jep, MySQL only. As I said, this isn't some cool framework which can be used everywhere. It's simple. Very simple. * Whoa, those singletons aren't needed. I'm not quite an expert on unit testing, but I am sure unit testing won't be much harder this way. * As of the rudimentary routing, you are right. I probably should support custom routes in some way. * The templating system blows. But again, one doesn't need more when setting up a simple project. * Database::safeQuery() is indeed not great. I'll make it an issue. Someone pointed it out earlier to me and I forgot to fix it the right way. It used to be even more vulnerable. Shame on me. It was an interesting learning experience, and I don't think I'm done yet. But I thought maybe some people think it's interesting, and it turns out some do. (See the number of upvotes/stars/comments) PSR-1 and PSR-2 is not my style. Indentation sucks, I'll change that, but I will not change everything into PSR compliant code. Again: simplicity. I am pretty constant in my code style, so that can't be an issue.
- ihsw 13y agoI'm really glad you replied. I'm not trying to be a dick, but I'm comparing it other frameworks that I'm familiar with. I disagree quite strongly with not trying to adhere to composer packaging guidelines, since it's common to many PHP developers (especially those on HN) that using it shouldn't be an issue. Also, tying into composer would help you as a developer as well -- there is a very large body of packages available that are quite stable and reliable. A lot of what I went over is mostly semantics/preference, however those are important to me. No shame, no guilt -- just constructive criticism.
- superice 13y agoSure, no hurt feelings ;) I hope I didn't sound like I thought of you like a dick in my previous comment, that was not my intention. I'll look at composer, that certainly looks promising. (But quite hard too...) I'm always in for some constructive criticism, you do have valid points. But the thing is this framework isn't designed to be professional, it's designed for a simple copy-paste-program workflow. (Or in this case: 'git clone'-program). I never intended to write a great framework that can be used in any situation and is exactly following the standards to the last indentation, so that's not where I'll put my effort into. Big mistakes, however, like the Database::safeQuery(), are worth fixing. At first I didn't have events too, until someone alerted my that might come in handy, so I added it, and I am sure I'm going to use that one a lot.