Search Results

Search found 5 results on 1 pages for 'sprottenwels'.

Page 1/1 | 1 

  • Building a database class in PHP

    - by Sprottenwels
    I wonder if I should write a database class for my application, and if so, how to accomplish it? Over there on SO, a guy mentioned it should be written as an abstract class. However, I can't understand why this would be a benefit. Do I understand correctly, that if I would write an abstract class, every other class that methods will need a database connection, could simply extend this abstract class and have it's own database object? If so, how is this different from a "normal" class where I could instantiate an database object? Another method would be to completely forget about my own class and to instantiate a mysqli object on demand. What do you recommend?

    Read the article

  • Should I close database connections after use in PHP?

    - by Sprottenwels
    I wonder if I should close any unnecessary database connection inside of my PHP scripts. I am aware of the fact that database connections are closed implicitly when the block stops executing and 'manually' closing the connections could kinda bloat the codebase with unnecessary code. But shouldn't I do so in order to make by code as readable and as easy understandable as possible, while also preventing several possible issues during run time? Also, if I would do, would it be enough to unset() my database object?

    Read the article

  • Modern workflow / project architecture with PHP

    - by Sprottenwels
    I wonder how one professional developer would design the backend-part of his application. I try to use PHP as seldom as possible and only for data serving/saving purposes. To do so, i would create a module/class for every greater part of my application, then write some single script files which are called by javascript. E.g: User clicks a "retrieve data" button javascript will call retrieveData.php retrieveData.php will create an instance of the needed class, then executes myInstance-retrieve() the data is returned to my JS by retrieveData.php However, i see some disadvantages in this practice: I will need a single scipt file for every action, (e.g retrieveData.php, saveData.php etc) I need a man-in-the-middle step: from JS to my single script, to my classes How are modern applications designed to accomplish what i need to do?

    Read the article

  • What parts of functionality should be refactored into a directive?

    - by Sprottenwels
    I am creating an application from legacy code using AngularJS. I wonder what parts of my code should be moved into a directive. For example, iI had thought of moving a table which is used multiple times across the application into a directive. The tables alter from headings and size. Is it worth the effort or even a good practice to turn such things into their own directives or should I create each table in a unique way?

    Read the article

  • Whar parts of functionality should be refactored into a directive? [AngularJS]

    - by Sprottenwels
    I am creating an application from legacy code using AngularJS. I wonder what parts of my code should be moved into a directive. For example, i had thought of moving a table which is used multiple times across the application into a directive. The tables alter from headings and size. Is it worth the effort or even a good practice to turn such things into their own directives or should i create each table in a unique way?

    Read the article

1