@youkaihiei thanks. Are there benefits of passing as arguments?
11th August, 2018
10th August, 2018
@PatrickL Thank you for your reply. The code is just an example of the approx implementation. That is more a code design question. I am not sure what is the best OOP approach when you build classes.
I am confused with instantiating object in PHP.
I have this files:
Index.php(Actually WordPress plugin's main file but let's stick with index.php)
autoloader.php(A custom autoloader because of custom standards)
src/Plugin.php(It supposed to have everything i need for the core like versions, paths etc)
src/FrontendScripts.php(It extends a Scripts class and implements a Hook interface)
src/BackendScripts.php(It extends a Scripts class and implements a Hook interface)
In index file i do:
$autoloader = new Autoloder(); $autoloader->register(); // so here i can use any of those classes without require them manually. $plugin = Plugin::getInstance(); $frontend_scripts = new FrontendScripts( 'app', 'test' ); // list of script names that should be registered $backend_scripts = new BackendScripts( 'admin' ); // the same as for frontend
What is the best practice of instantiating those FrontendScripts and BackendScripts objects? Should i pass them to the main plugin class as args? Should i just make instances inside the Plugin class without any arguments passed to the main class?
30th July, 2018
lievikoff started a new conversation How Do You Deal With Project Structure, Naming, And Code Organizing As Well? • 2 months ago
I always have problems with structure my projects or naming files/methods/functions. This happens because i want to keep it as much maintainable as possible. I had experience in supporting some projects that should be long term but they created on a knee and not by me. I know how terrible might be supporting those bad smell code. I caught myself spending a lot of time thinking about how to structure a project or name methods.
I assume that happens because of missing experience in code design or useless perfectionism.
How do you deal with that? Are there any good books you can recommend about code design or how to get rid of code perfectionism?
A quick example:
I am currently working on a WordPress Plugin that supposed to work with ReactJS. And here it goes...
Should i make src/dist folders or just keep things like
assets/scss and then exclude those sources folders from a production version etc.
28th July, 2018
@brightstormhq I had never seen MBP 13" in real life so thank you for sharing your experience! I will try and get one.
@ohffs thank you. Then i will just buy a MBP 13".
@brightstormhq I agree with you about MBP 13" power. That is quite enough for me. The only thing i am not sure is the screen size. Do you think 13" would be enough for coding without an external monitor? Unfortunately, where i live, there is no apple store to see it in real life and test.
27th July, 2018
I used to work on MacBook Pro 15” but it is no longer with me. Unfortunately, I don’t have enough money to buy a new one.
Maximum what I can buy is MacBook Air 13” minimal specification.
Should I give up on Mac OS and love windows?
Is there possible alternatives for budged in $1000?
The main requirements:
21st July, 2018
Hi. Could you please help me understand best practice of naming classes in PHP using namespaces?
Example: We have two classes called the same - "Assets" but they have different namespaces: App and App/Admin.
Want to change your profile photo? We pull from gravatar.com.