DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • June 22, 2017, 06:49:56 PM
Home Forums News Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
Search

Pages: 1 2 [3]   Go Down
  Print  
Author Topic: Code Update Help.  (Read 14637 times)
0 Members and 1 Guest are viewing this topic.
Nder'
Codemeister
****
Offline Offline

Posts: 256


Google is our savior!


View Profile
« Reply #30 on: July 15, 2014, 09:29:45 AM »

What we're asking is how we can help. My knowledge on SQL is limited but I can help re-write modules to fit the new structure that has been discussed. However, we can only help if you ask for specific things.
Logged

insert sympathy here

Message me!
BlackScorp
Militia
**
Offline Offline

Posts: 25


View Profile
« Reply #31 on: July 15, 2014, 09:43:43 AM »

well first good step would be to move every action into seperate file, for example in create.php you have op=="forgot" https://github.com/BlackScorp/logd/blob/master/create.php#L117 this leads to so if things in the script, i think it would be easier to see how many actions(operation) exists if all of them would be seperated into own files (e.g forgot_password.php)

another usefull thing could be, add small description of the logic in the file. i mean the real business logic, things like insert stuffs in DB are not interesting at all.

as example in create.php you have there following logic

before create an account there are some checks
- username should not contains special words
- user schould not be banned
- username schould be at least 3 characters
if email is required , the email schould be checked

just a small list about what each file has to be done, so i dont have to read the entire code and just recreate the methods.

so feel free to make pull requests;)
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1745


You're welcome.


View Profile WWW
« Reply #32 on: July 15, 2014, 10:11:49 AM »

well first good step would be to move every action into seperate file, for example in create.php you have op=="forgot" https://github.com/BlackScorp/logd/blob/master/create.php#L117 this leads to so if things in the script, i think it would be easier to see how many actions(operation) exists if all of them would be seperated into own files (e.g forgot_password.php)

The update's looking good... But on this, easier to see perhaps, but do you realize how many files you're going to end up with if you separate each and every action? Jussayin'.
Logged

BlackScorp
Militia
**
Offline Offline

Posts: 25


View Profile
« Reply #33 on: July 15, 2014, 10:38:34 AM »

did you realized how hard it is to refactor current code base because ppl are scared to create many classes and put as much as possible inside one file? the idea is to have LOTS of small classes, but each class will have about 100 lines of codes not more, so you can see entire functioniality on one screen without scrolling it. if you dont like a functioniality of a class, you can just drop it, without affecting other parts.

the architecture is called Clean Code Architecture, or Entity Boundary Interactor or Onion Archictecture or Data Context Interaction

Single Responsiblity Principle can be realizied with small classes.

https://www.youtube.com/watch?v=WpkDN78P884  here is a small video Cheesy
Logged
Aeolus
Mod God
*****
Offline Offline

Posts: 1745


You're welcome.


View Profile WWW
« Reply #34 on: July 15, 2014, 12:38:40 PM »

Luckily for us, then, I'm talking about the massive number of resulting pages, not the number of classes. Wink Tongue But just wanting to do it so you can read it quicker is just laziness IMO. It's really not that hard to just scroll through code. xD

But, you're doing the updates, so you do what you want. Tongue
Logged

ArthuruhtrA
Mod God
*****
Offline Offline

Posts: 572


chown -R us ./base


View Profile WWW
« Reply #35 on: July 15, 2014, 03:17:18 PM »

Like The Doctor said, the amount of resulting files is ridiculous.
The question is, will this be an advantage or disadvantage in terms of the speed of the resulting engine?
On one hand, it means more files to load, meaning extra overhead. On the other, when a specific class is called, in a module, for example, we only need load the data for that class.
Logged

Tynastera!
I'm around rarely, If you wish to contact me, please email me.
My Modules, such as can be found here.
BlackScorp
Militia
**
Offline Offline

Posts: 25


View Profile
« Reply #36 on: July 15, 2014, 11:20:42 PM »

Like The Doctor said, the amount of resulting files is ridiculous.
The question is, will this be an advantage or disadvantage in terms of the speed of the resulting engine?
On one hand, it means more files to load, meaning extra overhead. On the other, when a specific class is called, in a module, for example, we only need load the data for that class.

you know, there is no extra overhead at all, since php5 there exists a method calls __autoload this method is triggered automaticly if you create a new instance of a class, so in first case on development systems on each instance the autoloader will take a look at folder and search for a specific class and include them, only files which are currently required will be included.

then iam using composer, which can generate an autoloading classmap file, this file contain all classes and their file locations, so if the autoloader is triggered, it has not even have to look in the folders for a file, i can just pick the file path and include it.

Beliefe me or not, the bottleneck of an PHP Application is the Database not filesystem

@Doctor well it a bit of laziness, but currently i dont know each special case, so often i have to look in a special method to see what its doing, its not that hard but it would save time if i can see quickly what are the core functioniality of the file is. btw take a look at this huge amount of if else stuffs https://github.com/BlackScorp/logd/blob/master/battle.php i have to scroll to the right.. now it is harder to read

and btw, this is just for now the huge amount of files, later of course, the interaction will be moved into controller and controller will be bound to a router. The Result you can see on my other project

https://github.com/Opentribes/Core/blob/develop/silex/Provider/Account.php#L57

this basicly means, if you open http://localhost/create with get or post request, the account controller with the action create will be executed. https://github.com/Opentribes/Core/blob/develop/silex/Controller/Account.php#L47-L65  this is the create action. and some other things will be added to the route, like what should happen if the process failed, waht schould happen if the process succeed or what schould happen before and after the request in general. but thats for later:D

first step would be, just put each interaction in a custom file , after this, add a router and controllers
« Last Edit: July 15, 2014, 11:32:44 PM by BlackScorp » Logged
austenmc
Militia
**
Offline Offline

Posts: 54



View Profile WWW
« Reply #37 on: November 03, 2015, 05:39:54 PM »

Looks like this thread has stalled.

Happy to take any help on a project with similar goals: http://dragonprime.net/index.php?topic=12736.msg106302
Logged
Pages: 1 2 [3]   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Welcome to DragonPrime - The LoGD Resource Community!

Support Us
No funds raised yet this year
Your help is greatly appreciated!
Recent Topics
DragonPrime LoGD
Who's Online
25 Guests, 0 Users
Home Forums News Downloads Login Register Advanced Search