Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 120114

Object-oriented programming is a programming paradigm using "objects": data structures consisting of data fields and methods together with their interactions.

1 vote

Design Pattern - Abstract Factory Pattern Implementation in PHP

The class Products seems better named as Product (singular) since a table is a type of product, as is a chair. The methods in WoodenFactory could simply be static methods since they don't appear to d …
Sᴀᴍ Onᴇᴌᴀ's user avatar
2 votes

Adding and Retrieving Players in a simple Pre-Flop Poker Hud with Local Storage

Is there a benefit to using Classes? Classes are "primarily syntactical sugar over JavaScript's existing prototype-based inheritance"1 . It is more efficient to declare methods on the prototype inst …
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote

Dependency Container

Before addressing the main question, I would like to compare two of the primary methods: register and get. The register method is written well in terms of returning early. public static function re …
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote

Parse a clean slug URL

Perhaps Simon is right with the comment: FWIW I think you should just use input parameters, it's not like anyone is going to type this out. But if you don't agree with that, then perhaps the si …
Sᴀᴍ Onᴇᴌᴀ's user avatar
3 votes
Accepted

Switched from MySQL to MySQLi requires the connection parameter

Use object-oriented style: $con = getCon(); $result = $con->query("SELECT * FROM sometable WHERE deleted=0"); Refer to Example #1 on the PHP documentation for mysqli_query(), as well as the Dual in …
Sᴀᴍ Onᴇᴌᴀ's user avatar
2 votes

Custom shapes objects using polymorphism in JavaScript

[I] want to know if it properly represents PolyMorphism in JavaScript? Your code could be considered a representation of polymorphism when considering that the noOfSides() function was changed fo …
Sᴀᴍ Onᴇᴌᴀ's user avatar
2 votes

Min-Heap in JavaScript

One other aspect I noticed is that the swap inclusion line uses the const statement. You could use const and let where appropriate. For example, in the method delete(), this line: var parent = this …
Sᴀᴍ Onᴇᴌᴀ's user avatar
2 votes

Weapon class firing logic in JavaScript

The getter method Weapon.timePerShot will return 1 / this.fireRate. There doesn't appear to be anything to prevent fireRate from being 0. If that is the case, Weapon.timePerShot would return Infinity, …
Sᴀᴍ Onᴇᴌᴀ's user avatar
2 votes

Class to build and execute dynamic SQL statements

Potential for SQL injection Before getting to the main question I’d like to mention the code is vulnerable to SQL injection- possibly via methods like update(). It is explained in this article An SQL …
Sᴀᴍ Onᴇᴌᴀ's user avatar
3 votes

List interface implementation

In the above code, Are there improvements? Yes there are quite a few improvements that can be made. Below are a few simplifications. There are a few places where else is used following a conditional …
Sᴀᴍ Onᴇᴌᴀ's user avatar
0 votes

PHP class to send CRM records to Five9 API

Feedback The class looks like it is organized well for the most part- the methods generally handle a single task. However, some of those methods are a bit lengthy so could be broken up into smaller su …
Sᴀᴍ Onᴇᴌᴀ's user avatar
4 votes

Simple Vehicle speed representation

Suggestions Before addressing the main question, there are some suggestions to mention first. S.O.L.I.D. principles If you aren't already familiar with them, look into the SOLID principles. The S is f …
Sᴀᴍ Onᴇᴌᴀ's user avatar
6 votes
Accepted

Wrap a js function with a fixed this arg

is there a better way to achieve this functionality? You can use Function.bind() to create a function with the this context bound to Wyg.Editor: const node = document.getElementById('myFavoriteNode' …
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote

Laravel Account models

How can the code be rewritten more efficiently? I see lot of repetition in it. Yes there is a lot of repetition in the code. The most common thing I spot is multiple places where AccountJournal::cre …
Sᴀᴍ Onᴇᴌᴀ's user avatar
1 vote

Tic tac toe OOP

How can I get rid of functions in methods? You can start by making those in-line functions methods. For example, currentStep (the click handler) can be a method that accepts a click event argumen …
Sᴀᴍ Onᴇᴌᴀ's user avatar

1
2 3 4 5
15 30 50 per page