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

learn more… | top users | synonyms (1)

2
votes
0answers
31 views

PHP database layer class

Im trying to get familiare with (i dont even know how this is called) database handling Can you guys point out my errors and what i should change? I want to learn new methods, i just dont want to ...
3
votes
0answers
17 views

Honey I shrunk the view

Going down the rabbit hole, I wanted to be able to change the size of a form, and not have to worry about the layout of the controls. vba doesn't support user-resizeable forms, but forms still have a ...
3
votes
0answers
15 views

Down the rabbit hole with MVP

Following-up on this post where I implemented a Repository Pattern in vba to abstract ADODB and enable testing my Excel app without hitting a database backend; curious about how far vba would let me ...
2
votes
1answer
57 views

Structuring Class Objects And Defining The Variables

I am trying to create an outline of what a character is in a game. Then I want to create 10 different characters and compare their stats at different levels. I am creating an interface called ...
9
votes
2answers
73 views

YARPI: Yet Another Repository Pattern Implementation

Following-up on this post, I wanted to be able to put a copy of that Excel workbook on a USB key and take it home to keep working on the code a bit (there's more than just one or two tables to ...
13
votes
3answers
1k views

How is my CMS design? Any security, design, or other issues?

I am trying to learn PHP in depth by creating this personal CMS. I try to utilize OOP concepts and do best I can... The way I am trying to design this CMS is to keep including 'modules' within a page ...
6
votes
2answers
429 views

Animal choir simulator

I got a PHP developer interview test to solve for a company. I didn't get the job but I would like to know where I was wrong. Did I understand the test completely? ...
9
votes
2answers
102 views

First domain-driven User entity class

I'm still learning about domain driven design, and I have created my first entity class User. Is this fully compliant with the DDD principles? Particularly my ...
1
vote
1answer
62 views

Returning information about the result of a file processing, without using output parameters [closed]

As part of a C# class CsvConverter that converts various file types to CSV, I am designing a private class CsvConversionResult. ...
3
votes
1answer
48 views

Revised worker movement AI for strategy game

A while ago I posted this question about worker AI and Job Queues for a strategy game. I have posted other questions about the Job Queue, and now I would like to post this revised question about ...
7
votes
1answer
40 views

Command line flashcard game

I've built a simple command line flashcard game for learning Korean. I'm a beginner programmer, so I just wanted to make sure I'm following best practices, especially pertaining to OOP principles. ...
6
votes
2answers
51 views

Attempting to utilize OOP with a user-management class

Originally, this isn't how I would have done this at all. I was told by someone I know who is a programmer that I needed to include several functions: one for removing and adding users, one for ...
1
vote
1answer
39 views

Extend or Encapsulate [closed]

I couldn't find proper tips anywhere, since searching for these general terms isn't very efficient. I deal with this almost everyday, creating Java SWT widgets in particular. Each time I create a ...
7
votes
2answers
127 views

Displaying a scrolling stock exchange ticker in a window

I've written my first OOP program (194 lines including docstring and comments) in Python that uses Tkinter as GUI and Threads. The program shows a window and displays a scrolling stock exchange ...
12
votes
4answers
160 views

Tic Tac Toe game in Java OOP

I have written a simple GUI Tic Tac Toe Application and since this is my first shot, I think it can be improved a lot. Please tell me what you think about it and what you see I made wrong so I can ...
1
vote
1answer
19 views

Implementing use of 'with CustomClass() as foo' in own class with DB-Connection

I'm building a GameClient-Class in Python which handles user input and has to read from a database (MongoDb). I want to know if that is the best practice to implement it, so that I can use it with ...
5
votes
3answers
104 views

Confusing control flow

Currently, the following code runs and produces the expected and desired output. However, I'm sure that there's much wrong with it. This project queries the (flat) database, instantiates each row as ...
3
votes
0answers
52 views

Debug log wrapper

Please review code correctness, best practices, design and code formatting. I will be adding functionality and most likely additional refactoring, however a stringent review would be welcome before I ...
3
votes
2answers
69 views

Controller: Sign up action clean up

I don't know if it's just me, but I feel like my sign up action method has gotten a bit messy. I think that perhaps instead of setting error messages in a controller, I should set error codes which I ...
3
votes
2answers
46 views

Using `exec()` in an autoloader

After reviewing autoloader functions on the site, I didn't see anything like this, and I was wonder what may be wrong with this? ...
7
votes
5answers
318 views

Fraction class implemented in Objective-C

Inspired by this question: Fraction (rational number) structure with custom operators, I have written this class for doing some simple work with fractions. ...
3
votes
1answer
48 views

Refactoring this producer consumer class to minimize what is exposed

I don't like the service class below, specifically, the way it exposes the internals of the producer. While it would be possible to combine all three classes into one producer-consumer, I would ...
7
votes
2answers
474 views

Protect database from SQL Injection and similar attacks - PHP

I am doubtful about the security of my PHP code. I am new to programming, but want to learn how to secure things, protect my databases from SQL injection, and other best practices. I'd like to know if ...
13
votes
6answers
561 views

Classes for sentence-like readability

If we have a set of classes or structs such as: ...
0
votes
0answers
9 views

What's a good simple way to combat the n+1 problem? [migrated]

I'm trying to better understand performance in PHP. One issue I'm thinking about is the n+1 problem. By n+1 I mean something like this: ...
5
votes
2answers
75 views

Revised Job Queue for Strategy Game

After posting my previous question about this Job Queue, I decided I wasn't actually very happy with it. I am embarrassed to admit that upon further testing it did not function properly in all ...
0
votes
5answers
56 views

Should I declare all of the outer functions inside the object literal?

I am working on an HTML5/jQuery todo list app and here is my code so far. As you might notice, there are some functions called at the beginning of the JS code. These functions work perfectly right ...
9
votes
2answers
206 views

Sessions and Authentication

I've a feeling I'm overdoing my Auth class, and that it could be done in a simpler and more understandable way. Could you give me advice on this, please? This is ...
6
votes
5answers
173 views

Casting base to derived class according to a type flag

I have been writing an event class for my game engine and I came across to the following problem: Is casting a base class object to a derived class object given a type flag a good programming design? ...
5
votes
2answers
163 views

DB abstraction, private methods in OOP PHP library

This library registers a new user. Questions: Where should the DB class instantiation happen for user class? I tried instantiation in the constructor but that property doesn't seem to be available ...
4
votes
1answer
42 views

Nodes and Boundary Conditions in Finite Element Method

The problem: A Node is located in a specific coordinate (x, y, z). A Node can be one of these types: ...
4
votes
1answer
92 views

First attempt at making a user class

I've just begun creating my first user class. First, I need some clarifications. Am I using try and catch correctly? To ...
9
votes
2answers
307 views

OO design for Tic Tac Toe program

I am practicing object oriented design and have taken Tic Tac Toe as an example. I have written first all the requirements and then started writing code. I would like to get it reviewed so that I can ...
6
votes
1answer
107 views

Simple chat console app

I wanted to practice using sockets and multithreading. This is simple code where I start a Server and connect to it via Client ...
2
votes
0answers
23 views

Application Class Security

Is my Application.php class secure for continuing development? The Application.php acts as a registry for the whole application. I tried not to rewrite already working code that is being pulled from ...
13
votes
2answers
113 views

Nokogiri crawler

The following code works but is a mess. But being totally new to Ruby I have had big problems trying to refactor it into something resembling clean OOP code. Could you help with this and explain what ...
5
votes
3answers
107 views

Job Queue for Strategy Game

I've posted a revised version of this here. I posted about this basic problem a while ago, and I got the recommendation to move the code for managing the Jobs of my game to another class. I have ...
1
vote
1answer
38 views

Cleaning up a class that contains the object it represents [closed]

I've recently started writing a tic-tac-toe game (following the Odin project) and am trying to write a class to hold the board game. What I'm not sure about, is that the board class holds all the ...
1
vote
1answer
53 views

More efficient way to loop through an object

There's a part in my page where you can add, edit or delete school details, and it wasn't supposed to save entries to the database until the user hits Enter, so I save all data in an object first. My ...
4
votes
2answers
66 views

Finite Element Method analysis

Please take a look at this class and point out its flaws. I am developing a simple Finite Element Method analysis with PHP. What this class basically does: Given an input set (coordinates, ...
7
votes
1answer
144 views

Less-repetitive code for document-analyzer

I've refactored my code such that every function has only one responsibility. Now I'd like like to work on making it DRY. I'm noticing a lot of duplication in the ...
1
vote
1answer
51 views

Better PHP Autentication Class [closed]

Authentication and keeping information secure is my goal with writing my Authentication class while making sure it is extendable completely as possible over making it usable for anything over just ...
11
votes
2answers
414 views

Inventory - how to handle items?

I've been designing a game server, where a player has inventory, bank, and other features with items. There are some definitions of what item can be in my game: Item is either stackable or not ...
3
votes
2answers
162 views

Updating necessary data using just one function

My objective is to update necessary data using one function instead of having different functions to update different fields. So, I've created one and I think this is not really elegant, efficient or ...
0
votes
0answers
23 views

Re-factoring restrictions validation functions for proper OOP design in MVC framework

I am aware that code review is for refactoring code from an existing code. Let me first to say that the following code works but inefficiently and its very convoluted, so I would like to apologize if ...
4
votes
2answers
114 views

Skill Upgrades for Strategy Game

I built a simple class to handle skill increases for the workers in a strategy game for iOS. The basic idea is that whenever a worker finishes a job, their skill (which starts at 0) will increase by ...
2
votes
2answers
84 views

Validator extended to handle domain objects / entities

I started improving my validator library even more, and I think I'm at the last final element (domain object / entity validations) before I can gladly say that my Validator library is completely done ...
3
votes
1answer
90 views

My first login class in PHP with PDO and bcrypt

This is the first time using a class. Please review this and tell me if it's secure and if it's the right way to do it. The code itself is working, but I have doubts in the way I used all this. ...
3
votes
1answer
51 views

Dynamically create a table with values from an object

I want to create a table that looks like this: ...
5
votes
1answer
78 views

Controller for handling user registration

I spent a lot of time doing Go Horse Extreme programming, but now I want to be a better person. How can I make this method smaller, better, more OOP? ...