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)

1
vote
0answers
15 views

Switching from functional jQuery code to object-oriented

I've been happily using jQuery, creating vars and binding events in my modules (which have only a little bit of JS). But recently I needed to add an anonymous functions to my code and after ...
-2
votes
1answer
58 views

Display multiple subtype objects in one page

I have a base class with 3 sub ones: Item <-- Book, MusicCD, Software They have some common and different properties but in the view I want to get a mixed list of them and show in one table: ...
5
votes
2answers
70 views

My Google Maps Script

I've written a script with the Google Maps JavaScript API v3. I've ran it through JSHint and everything seems to be valid. I'm wondering if my script has room for improvement. Any suggestions are ...
3
votes
4answers
152 views

Using readonly field instead of private setters in struct

This is supposed to be an immutable structure representing a time-stamped value. Since it represents a physical measurement, it cannot change, and I want to make sure it really doesn't change ...
10
votes
1answer
44 views

Class used for stochastic epidemic simulations

I've developed a class used for some epidemic simulations I'm doing. Individuals are 'S' (susceptible), 'I' (infected), or 'R' (recovered). These are standard abbreviations in the research ...
2
votes
1answer
54 views

Validating input against rules

I have created a method that validates inputs based on a set of rules. If an error is found, it is put into an array which can later on be used to display the errors to the user. Below is my code: ...
5
votes
3answers
67 views

Code redundancy issue while feeding dropdownlists

I have a dashboard to manage a learning center system. There are scenarios like admin create learning center and define a classroom in it and then assign some courses in it and assign students to ...
1
vote
1answer
47 views

Http Request/Response class

I would like to get a feedback on this. It is just a simple Response/Request classes. I tried to keep it simple, so I made two interfaces, and two classes. ...
-2
votes
0answers
16 views

4 game screens. They all draw spirits to the screen How to OO this? One large Drawer class, 4 smaller? [closed]

I'm designing a game. I have 4 different screens / screen classes. They all draw spirits to the screen. Some of the things they draw to the screen are the identical to each other. For example, two ...
7
votes
2answers
73 views

Correct usage of MVVM and object for method

I'm writing my first C# Windows Store app and am learning C# from scratch. I'm trying to implement MVVM as I understand it and object orientated patterns, obviously though I'm expecting to be doing it ...
7
votes
3answers
87 views

Better card validity check in JS card game

I am writing a card game in Javascript. The game is played with a 32 card deck. When a card is selected to be played by a user, i do a validity check on the server to check whether it matches the ...
7
votes
1answer
382 views

Math expression parser in C#

EDIT: Added refactored version 2.0 to the end! I have a parser that is supposed to take a string similar to a math expression and return a Tuple of: An array of strings where each string ...
8
votes
2answers
1k views

It's almost Friday, right?

This is my final post for my CS1 saga. Mostly all I had to do was just "class-ify" my past project in this post. Here are the requirements: Make all data members private and use constructors, ...
5
votes
1answer
158 views

Drying Up Very Similar Implementations of an Interface

Work continues on the Rubberduck VBA Editor Add-in. I have a need to call some VBA code from the add-in with Application.Run. Unfortunately, the ...
-1
votes
0answers
14 views

PHP Class dinamicly execute select query(MySQLI and PHP) [closed]

I have problem to execute select query, 'Select' function do not work, could you help me with it? here is DB.php class, on the end of class is Select function. ...
3
votes
1answer
48 views

Functional organisation of JavaScript functions

In one of the web apps I contribute to, the main.js file has multiple interacting "objects". Unfortunately, I'm so bad at OOP in JavaScript, despite studying other ...
0
votes
1answer
82 views

User Registration

I'm fairly new to PHP and am very interested in learning best practices, etc. I have just created a user registration system mostly in OOP that will dump user info into a database I've created. This ...
0
votes
2answers
52 views

Class CatalogWalker can walk thru a list of catalogs, calculate and report some statistics

Just for review and may be useful for somebody ...
1
vote
0answers
36 views

OOP QueryHandler in PHP

I have a simple database connection class which is using PDO: ...
6
votes
4answers
63 views

Using PostgreSQL effectively with a banking app

I'm kind of newbie for these things but I did something and I want to know how I can do this effectively. ...
2
votes
3answers
61 views

A class which represents an SQL table

I'm representing DB tables as classes (in this case PHP classes). This has the goal of modeling every section of the web page, where you will get inputs from the user. My actual base design is: One ...
13
votes
4answers
879 views

Design a chess game using object-oriented principles

I would like to know if my approach is correct and how could it could be improved? Also, is there a way to get rid of the relation between the Piece and the ...
0
votes
2answers
57 views

Insert into table class

This class should function as a simple insert into table. What do you think about it? How can I make my code better? ...
4
votes
2answers
66 views

Code organization when using threads

From OOP & OOD point of view, is it good idea to define Java-threads inside of the static method or in this case it's better to use instance-based method? ...
1
vote
2answers
76 views

PDO class extend

I am moving in to OOP PHP and having some problems extending my database class to my objects. I am still new to the variable scoping in OOP PHP, so if it a tiny syntax error I apologize. If my ...
3
votes
2answers
68 views

PHP OOP calculator form

I aim to improve my PHP OOP skills and made a simple calculator. Visitors can choose 2 numbers and a prefix, so they can add, subtract, divide and so forth. The output is the sum. The good thing is ...
1
vote
0answers
51 views

Making a CRUD function reusable

I uses slim router and made a folder model controller view, below is one of my model files; I made one database with one model. I have some problem in my project: there are several databases like ...
1
vote
0answers
28 views

Multicast Mining Rig Scanner [closed]

The class MulticastMinerScanner is a Runnable that scans for miners (computers running a mining client called CGMiner, which is configured to listen/respond for a multicast message containing the ...
0
votes
1answer
64 views

Using method which return a String or creating wrapper for String

Which approach is better and why? First approach (inner class for wrapping): ...
1
vote
1answer
31 views

Toggle dropdown menus for different menu items with Jquery

In a bigger project of mine I'm using angular to create a dropdown menu dynamically and then toggling a dropdown menu for some of the menu items. This is why I got a function that toggles the dropdown ...
4
votes
1answer
72 views

Animals in the Zoo

I am creating a zoo. In my zoo I want to have 3 types of animal: Mammal, Bird and Fish. I ...
1
vote
1answer
57 views

Breaking up a PHP class between a master class and subclasses

I have a huge class taking care of companies informations in my app. Arrived at 4000 lines of code (!), I finally decided to break it up. However I am not too sure if the way I am doing this is the ...
4
votes
2answers
67 views

Ruby object oriented Snakes and Ladders implementation

I'm not a beginner to programming, but I am to programming in OOP (effectively at least). So to learn better I wrote an object oriented game of Snakes and Ladders. For background, see this question. ...
5
votes
2answers
53 views

PHP Usersystem basic class

I've recently picked up OOP in Java and I'm trying to use it for my PHP usersystem. I've come up with the following generic.class. On my main site, I'll simply put a ...
2
votes
2answers
38 views

Lua program to clean up phone numbers

How idiomatic is my code? Since Lua does not have classical inheritance such as in OO languages. Feedback on the test and implementation are both appreciated/welcomed. The rules are: If the phone ...
1
vote
2answers
100 views

Simple deck of cards

I had recently completed one programming challenge where I've had to design a deck of cards. The time was limited but I tried my best. I designed the basic operations and am wondering if I can improve ...
2
votes
1answer
103 views

OOP bank database

I have been working on this: Design a class for a bank database. The database should support the following operations: ❍ deposit a certain amount into an account ❍ withdraw a certain ...
1
vote
2answers
111 views

Bank simulation using ArrayList

Problem Statement: Design a BALANCE class with account number, balance and date of last updation. Consider a TRANSACTION class with account number, date of transaction, amount and transaction ...
4
votes
3answers
62 views

PHP Bilingual Error System Ideas

I am building a php based mobile website that must be in both Spanish and English. This is my first bilingual site so I've been having to re-think a lot of coding practices I currently use to ...
1
vote
1answer
36 views

Using composition or inheritance to enhance this linked list

Problem Statement: A method called insertEnd() exists, but it runs in linear time, because every time it is called, it walks down the list to find the end. Without changing the meaning of this ...
0
votes
2answers
66 views

Dynamic connections classes

I have an abstract Connection class which looks like this: ...
6
votes
0answers
87 views

UIntArray class in PHP (part 2)

This question is the follow up of the question: UIntArray class in PHP @Brythan provided a really nice review and I have improved my class. I have addressed almost all the issues he pointed out ...
0
votes
1answer
55 views

Including a page specified in query string

This is how I include a page depending by name. Example URL: http://www.page.com/index.php?page=admin where ...
2
votes
0answers
37 views

Content management system for teaching PHP OOP to beginners

I created this basic content management system to teach object oriented PHP to beginners. However, I have concerns if I violate solid principles in App.php and Router.php. GitHub App.php: ...
2
votes
1answer
84 views

ArrayList for Shop implementatin

Problem statement: Design a system for the following scenario: An item list contains item code, name, rate, and quantity for several items. Whenever a new item is added in the list ...
0
votes
0answers
31 views

PHP Dependency Injection - magic methods injections?

I'm trying to get my head around DI. Am I doing it correctly for classes that follow DI pattern? ...
0
votes
1answer
51 views

Image manipulation PHP class using PHP's Image Functions

I am working on an image manipulation class for a project to re-size uploaded slider images to 780 X 397 and uploaded avatar pictures to 220 X 220. I am wondering if this is a good way to construct ...
12
votes
3answers
116 views

Creating an object oriented model in VBA using COM and ADODB from 2 depended SQL tables

The story... A bit of background info and how is the database designed... Please notice you don't really have to rebuild the tables in SQL but I shared an SQL Fiddle just in case and screenshots1 of ...
2
votes
2answers
263 views

c# best way to declare a class-level value in base class and set it at derived classes [closed]

I have a root class and I'd like to add an indicator to it (property, static field, readonly field, virtual method or something like that), that should give me the same string value for every instance ...