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)

4
votes
3answers
258 views

Trip Advisor - Train routes

Gives advice to the user on which trains to take to reach a destination ...
3
votes
1answer
72 views

Example String Class in C

I wrote this small example piece of OOP being implemented in pure C. I wanted it to be reviewed for the following points: Portability Performance And especially Usability "How does it look" ...
6
votes
1answer
47 views

Bowling scores in Ruby

A little while back, I wrote in a review of a Ruby bowling sim that I might try my hand at modelling the game myself, focussing on the funky "deferred scores" system. Since a2bfay, who posted the ...
7
votes
1answer
74 views

Multiplayer bowling in Ruby (follow-up: injection, single responsibility)

This is a multiplayer bowling simulator in Ruby. It allows for variable skill levels, and produces weighted random results for each player's rolls based on those skill settings. This is a complete ...
8
votes
2answers
77 views

Generating and calling code on the fly

Delegate This class module defines what I'm calling, in this context, a Delegate - here a function that can take a number of parameters, evaluate a result, and ...
5
votes
3answers
315 views

Would I be better off re-factoring out these switches, in this case?

After I completed writing this code, I started to wonder if the switches should be replaced with a more OOP approach. I originally picked the switch approach because there will never be anymore skill ...
0
votes
0answers
44 views

A game similar to Tic Tac Toe using graphics and java OOP [closed]

I am working on a game that my friends invented - a little variation on tic tac toe: using a 4x4 board, one player (x) need to get 3 x's in a particular manner while the other can place one 'z' and ...
2
votes
1answer
34 views

Optimizing mcrypt encryption class further

The following is a very simple implementation of an Encryption class using mcrypt whereby the functions encrypt and ...
17
votes
7answers
3k views

Basic OOP Poker - Deck, Cards and Hands

I decided it would be interesting to simulate a game of Poker. Baby steps at the moment, and eventually I'll attempt to turn it into a GUI. The code I have so far is very basic such as populating a ...
0
votes
0answers
21 views

DI container in static variable [closed]

Is this a good approach to storing the instance of a class in the static variable of another and using this instance in an extended class? ...
3
votes
2answers
62 views

Booking validation in a big if-elseif block

I have pasted a part of my event handler code block. I understand this code really looks like a mess specially the object that is created every time the message is changing. Is cleanup possible in ...
9
votes
2answers
110 views

PDO connection via INI parser classes

A few days ago I asked this question and I've got an answer to work with interfaces. I've tweaked around with this to get myself a INI parser class. ...
8
votes
1answer
147 views

Breadth First Search not SOLID enough

The following code has a modified version of the Breadth First Search algorithm. It not only visits the nodes, but keeps track of the paths, so I can output various messages later. I would like to ...
0
votes
0answers
43 views

Proper code structure to not pollute JavaScript global namespace and use proper encapsulation

I have a number of DHTMLX pages that I need to create and want to start structuring my JavaScript better so that I'm not polluting the global namespace. Take the following pseudocode: ...
4
votes
2answers
101 views

Accept an object and generate a email

I have a question regarding optimizing a php email class. It's basically a wrapper class than needs to be able to accept different objects and always output an email. I'm trying to make it generic, in ...
4
votes
1answer
43 views

Defining a JavaScript internal method that needs to be accessible from inside obj and out

I'm trying to fully grasp JavaScript inheritance and encapsulation. Take the following example (here is a Fiddle): ...
2
votes
2answers
67 views

RAII and code duplication in constructor/destructor

I have a class hierarchy similar to this: ...
1
vote
0answers
39 views

Multi Threaded Report Generation

I have a requirement where i have to generate some report basically read from db and write data to Excel. I want your help in reviewing following things in my code. Data Base Connection Multi ...
11
votes
1answer
88 views

Extensible logging - DatabaseLogger

Recently I wrote a logging API that features an ILogger interface. I wanted to extend my library with a DatabaseLogger ...
12
votes
1answer
85 views

Extensible logging

Whenever I need logging functionality in .net, I use a logging framework, such as NLog. Obviously there's no logging framework for vba, at least none that I know of. As much as I love using NLog, the ...
1
vote
1answer
65 views

Is this use of JavaScript prototype functions for attaching event listeners going to meet design goals?

Please provide a sanity check on my below JavaScript pattern to be used for a custom edit control. The goals are: Centralized code Avoid name collisions Minimize memory use (putting functions on ...
5
votes
2answers
77 views

Counting occurrences of different categories of characters

This is a sort of follow up to my previous question: Counting the number of character occurrences This time I have written code that still counts the number of different characters in a string, but ...
6
votes
1answer
81 views

Deleting a user from a database

I was hoping if anyone could tell me if I'm doing this correctly, I know there are other questions like this but everyone codes different and I just feel that I'm not doing this right. I'm trying to ...
2
votes
1answer
97 views

What could be bad from using this form of dependancy injection?

I have a custom framework that I am not sure if certain things I have applied are wrong and if so, just why. I am not well versed in any framework, so I was forced to use mine. Here is an example ...
6
votes
2answers
67 views
+150

Ugly workaround to get the vbext_ProcKind of a procedure is breaking encapsulation

This is a follow up to Extending the VBAExtensibility Library. It turns out that code had a really nasty bug. Anytime vbeProcedure.StartLine got called, I was ...
3
votes
0answers
51 views

Universal Spreadsheet reader/writer

I have a project that reads spreadsheets as a rectangular list of lists (matrix) transforms the matrix and then writes it to another spreadsheet. I want to be able to read from and write to multiple ...
3
votes
3answers
130 views

Object Interaction in OOP (especially Python) [closed]

Say you have a number of similar objects (e.g. instances of the class Person). Each of these instances can belong to a number of Groups, also represented by a class. To stick with the examples of ...
0
votes
1answer
71 views

Aliasing utility class method in extended class

Consider this setup: ...
1
vote
2answers
151 views

Fractions in Java [closed]

Part I-IV recommend code changes as mentioned in link 1, for the initial code given at link 2. Can you please review the code changes for Part I-IV? Part I: Constructors (1 point) Modify the ...
4
votes
2answers
68 views

PHP Session Wrapper Class

I recently worked on a system for the company I work for and would love some feedback on the following class for managing sessions. I don't claim to be a PHP guru but I like to think I gave it a try! ...
8
votes
3answers
343 views

Singleton Database wrapper

Before everybody yells at me about why I wrote a PDO wrapper class, it's to avoid writing try/catch, ...
2
votes
1answer
39 views

User entity of my domain v2

I would appreciate a thorough review of my updated User entity class. It's still an anemic domain model, but behavior (like ...
3
votes
3answers
155 views

Is SList class an ADT?

As per the definition given in lecture, ADT is, With reference to this definition, I would like to call SList class an ADT following 6 invariants: Multiple ...
1
vote
2answers
49 views

Putting all desktop items into a new folder

I'm quite a newbie with Python, but I wanted to try my own little project, so I made a small script that puts all the desktop icons/folders into a newly created folder (called "Desktop1") if there are ...
6
votes
1answer
64 views

A hacked-up testing framework

Inspired by this post, I wanted to be able, in any vba project I could be working on, to create a test class and write test methods. Like this: ThisWorkbook Workbook | class module (client code) ...
2
votes
1answer
80 views

Encryption/decryption of a string with a salt

I have a new job coming up soon and want to increase my PHP knowledge. This is my first attempt at creating and using a class. I just want to know if it's the correct way to do things. It's very ...
1
vote
1answer
18 views

Create virtual host + MySQL tool

This tool adds a new OS user, create directories and configuration files for Apache + NGINX, MySQL (MariaDB) database and user. I tried to take into account the comments from my previous post. Hope - ...
9
votes
1answer
97 views

Unit Testing in VBA

Unit testing in VBA is... lacking. (What isn't lacking in VBA though?) Since I've become more interested in unit testing lately, I decided I needed something better than ...
9
votes
1answer
65 views

Yet Another Fraction

A recent question inspired me to implement a Fraction class. I decided to write this one in vba, because I like writing tools for the poor souls that still have to ...
6
votes
1answer
107 views

Pokemon Type Evaluator part 2

I started anew and completely refactored the way I implemented Pokemon Type Evaluator. Also, first use of a lambda expression (Case of using it, but still don't fully grasp how it's working). I'm ...
2
votes
1answer
86 views

Any improvements for my LoginController class?

This is probably going to be my final question regarding controllers. I feel like I have a good enough understanding of them now and am able to write them cleanly. I've recently adapted a less error ...
5
votes
1answer
98 views

Improving an IRC bot

I've recently started working on a java project, and the main purpose of it is to get better at Java. I've decided to make an IRC bot for twitch. But after some hours of progress I already see my Bot ...
1
vote
2answers
36 views

Reading certain values from an object

I'm trying to read certain values from an object. What would be the best practise to do so? ...
2
votes
1answer
28 views

How should I tell Rails which of these content types to load for a given feed?

I have content management system for an iOS app built with rails. Right now there a are three different types of content. The first two are just strings uploaded into a textfield by the user. One is ...
4
votes
3answers
297 views

JavaScript constructor and namespace in object literal style

Is this a good way to create a class with a constructor and namespace in object literal style? ...
6
votes
0answers
127 views

Is my LoginView class valid?

I know the Model, Controller and View's purpose, but I have never really found a good concrete class example of a View class. Usually I see people having some small ...
2
votes
0answers
35 views

Creating a menu for widgets with editable settings

I'm trying to create a menu for widgets with editable settings. As of now I'm setting these settings per object by coding them in like you can see below. How could I make this shorter / ...
2
votes
2answers
73 views

Rock-Paper-Scissors in procedural and object-oriented

I am comfortable with the procedural style, and learning the object oriented, so I have done a small Rock Paper Scissors game in both styles. This script is in procedural style and this one is in ...
2
votes
1answer
78 views

A wrapper class for Sessions in PHP

I have been using $_SESSION, $_POST, $_GET, $_SERVER ...
5
votes
1answer
107 views

Transforming jQuery form code into clean code

The following JS code handles when the form is submitted and some little extra stuff. I'd like to have it reviewed on the following aspects: Readability Efficiency Usability OOP It works exactly ...