Questions tagged [object-oriented]

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

Filter by
Sorted by
Tagged with
54
votes
2answers
59k views

Class for reducing development time

There are many PHP PDO classes out there, agreed. However I find they do not allow for flexibility. So I created one that helps reduce development time as little as it may be but it does the job (...
28
votes
1answer
4k 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 ...
13
votes
1answer
2k views

VBA Class to persist and restore Excel Application properties

Very often on Stack Overflow, and even on Code Review, I've seen questions and answers that have code that begins by persisting Excel properties like DisplayAlerts ...
7
votes
1answer
2k views

OOP-style FizzBuzz program in PHP

I've tried to write a configurable OOP-style FizzBuzz program in PHP for learning purposes. I hope everything is quite easy to understand. What do you think of the overall architecture? Are OOP ...
9
votes
1answer
1k views

Critique Request: PHP Request-Method Class

I'm working on a general Requestmethod class which sanitizes and recasts the input of users in an automatic fashion. I've also tried to do array-access in cookies. ...
41
votes
5answers
34k views

Designing a coffee machine

I was recently rejected from what looked like a really promising string of interviews. I did very well in a questionnaire style review, and then they handed me this assignment (more or less): ...
19
votes
2answers
4k 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 ...
13
votes
2answers
668 views

Finding the cheapest hotel

I thought this question made a good excuse for some basic OOP code, so I whipped up a little bit of code to demonstrate it in VBA; the idea is to have tutorial-grade code, to show how interfaces and ...
10
votes
2answers
812 views

Basic Imitation of C# Enumerable in VBA - or any other static class

Since implementing static classes in VBA actually seems possible I came up with an idea to try to imitate C#' Enumerable class (well, to some extent...). This is ...
11
votes
3answers
5k views

WinForms dice roller

I am writing a dice roller winforms application using C# 2012 VS. Dice roller is set up for playing Shadowrun tabletop. I feel that there might be too much code going into the GUI, but I am unsure ...
10
votes
5answers
17k 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? ...
1
vote
0answers
170 views

My included in every script file - follow-up -1

In this particular question, I need the reviewers help to judge my understanding to MVC and OOP as it was my biggest problem in my original question a month ago. I included in the question the contact ...
25
votes
3answers
3k views

Simple object-oriented calculator

After studying several ways of doing OOP in JavaScript I think I finally came up with one that seems OK to me. Is it okay? Do you see some problems I can face by using OOP in JavaScript like this? ...
8
votes
2answers
1k views

Selection Sort Algorithm (Python)

Selection Sort The selection sort algorithm sorts a list by finding the minimum element from the right unsorted part of the list and putting it at the left sorted part of the list. The ...
6
votes
2answers
339 views

Simple object-oriented calculator - follow-up

This question is an improvement I did based on recommendations from this other question: Simple object-oriented calculator JSFiddle ...
3
votes
2answers
84 views

Mixed Duo String Generator

I've create a program that finds mixed duo within a string. It removes characters from a string that do not form the first mixed duo. It does not rearrange the order of the string, it ony remove ...
2
votes
1answer
599 views

Printing results in XML

I have been writing PHP programs in the MVC pattern for quite some time. But I am not sure if I am doing it right. For instance, I have this PHP file that prints results in XML, and I put this file ...
2
votes
1answer
62 views

Android app class serialization

I am attempting to build an Android APP with the custom serializable class User. The public method Save is to save class ...
59
votes
11answers
13k views

Sales tax calculator, rejected for being not OOP

I applied for an Application Developer position. They require all their applicants to complete 1 of 3 programming assignments. I picked one for sales tax calculation. It was quite simple. Write ...
11
votes
1answer
5k views

Extending the VBA Extensibility Library

The Microsoft Visual Basic for Applications Extensibility library let's us meta-program VBA, but the way it handles (or rather, doesn't handle) getting to the actual subs and functions is clunky at ...
14
votes
4answers
2k views

Shell Sort, Insertion Sort, Bubble Sort, Selection Sort Algorithms (Python)

There is a follow-up question available: shell-sort-insertion-sort-bubble-sort-selection-sort-algorithms-python. Selection Sort The selection sort algorithm sorts a list (array) by finding the ...
21
votes
3answers
2k views

How to Train Your Dragon

I started out practicing on implementing the builder pattern and somehow ended it up with this 2 hours later. It isn't really much, but it works and I'm hoping review should bring about a lot of ...
11
votes
2answers
11k views

Binary Calculator in Java

I'm a beginner in Java and I tried to create a program that will perform basic arithmetic operations on binary numbers. BinaryOperations class: ...
4
votes
2answers
369 views

What would be a better way of adding the functionality to "add" a student?

I have the following Student class: ...
11
votes
2answers
842 views

Solution for Parent/Child circular references: WeakReference class

Sometimes in advanced OOP scenarios, a class needs to hold instances of another class which needs to hold a reference to the "parent". For example when you have a dynamic ...
6
votes
1answer
803 views

Console-based BlackJack in C# - Follow-Up

I have done some code-refactoring of my console-based BlackJack in C#. Finally found a better solution to solve Ace problems (double Aces should be value 22 and third Ace should be value 1). I still ...
4
votes
2answers
5k views

Setting properties inside of a class

Instead of using multiple setter functions within a class like public function setAction() public function setMethod() etc I've been using a method from a base ...
16
votes
2answers
3k views

A completely overkill BrainFuck lexer/parser

I'll need to build a syntax tree (AST) for Rubberduck, but since VBA has dozens of tokens and complex rules, I needed a simpler language to play with first, so I thought BrainFuck would be a perfect ...
12
votes
1answer
310 views

BattleShip Grid: Classes and Tests

In my ongoing quest to demonstrate how VBA code can absolutely be object-oriented, I've started implementing a game of Battleship in pure VBA. This is a rather large project, so I'll split the ...
10
votes
5answers
2k views

Beginnings of a Poker hand classifier part 2

Part 1 - Beginnings of a Poker hand classifier I'm a beginner programmer I've been working on a poker hand classifier to improve my object orientation and programming skills, I've improved and ...
6
votes
2answers
3k views

Custom enumeration classes

Lately I've been using a lot of enums in my project and the lack of generic Enum constraint seems to be quite problematic. This combined with few other headaches ...
5
votes
1answer
311 views

Managing Excel Tables (ListObjects) with OOP Approach

Objective: Manage what happens when users interact with Excel Tables (ListObjects) Possible interactions: Update an existing Excel table Add rows/columns to the table Update a cell or a range of ...
5
votes
1answer
501 views

Router to match URL to Controller Method

I wrote a router class which accepts a URL and calls the appropriate controller method based on it. I'm a little worried about the amount of dependencies it has (eg ...
4
votes
4answers
2k views

School grading string calculator

For my training, i've been given an assignment to build a simple, extendable 'grade' String calculator by a given grade. For now, I had to work by this table: When the ...
3
votes
2answers
1k views

Create database connection and run the insert, delete, update queries class

Recently while developing our demo project I had to a write a lot of repetitive code for executing the database queries (insert, update, delete). So, I have put all the repetitive code into a class ...
9
votes
2answers
4k views

MySQL class to add user/database

I'm creating tool to add new virtualhost on UNIX-box. One of tasks is to add a new user and database to MariaDB (aka MySQL) server. In fact - this my first 'real' attempt to use OOP. Here is class, ...
7
votes
5answers
3k 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. ...
7
votes
1answer
3k views

Particle Swarm Optimization

I wrote my first python code to conduct PSO. I am wondering about the best practices for Python. While my code works, I want to make sure it's orthodox as well. For example, here is my class I use ...
6
votes
1answer
6k views

Generic menu class for console applications

Expanding the title: my goal (for hobby project) was to create simple, generic (customizable) and cross-platform menu class for console applications (mostly simple, text-based games). That's what I ...
6
votes
2answers
2k views

Minimalistic mysql db class

I am really just looking to make sure I am not making any weird mistakes that could hurt me in the long run or if something seems odd in the way I imagine it to work. This code does work for the way I ...
6
votes
3answers
152 views

Generic Two Dimensional Data Plane with Manipulation Methods For C#

I know that there is a generic data structure System.Array could be used to create customized type array. I want to focus on the two dimensional data structure that ...
5
votes
1answer
3k views

Building a model-view-controller application in PHP

I've seen at least two recent PHP questions that would do well from a Model-View-Controller ('MVC' from here-on-out in this question) setup. Now, me, being the horrible person I am, I wanted to build ...
4
votes
1answer
378 views

Guess how many are in the jar game in Java - Take 2

Original question can be found here I took the advice I got to heart, and re-wrote it. Once again I'd appreciate any advice as to how I can improve this using best practices. Jar.java ...
3
votes
0answers
91 views

Writing Go object code that respects Go guidelines

I'm learning Go and I wrote this for a programming challenge. It is working (building and running) but I feel the code is not what Go code should be: Am I using the ...
3
votes
1answer
2k views

Object-oriented Linux networking library

I needed to perform network communications in my Linux C++ project. I thought that it was a good idea to operate on a higher level of abstraction than raw system calls. Also I love OO design. So I'm ...
3
votes
2answers
106 views

A SubPlane Method for Generic Two Dimensional Data Plane in C#

This is a follow-up question for Generic Two Dimensional Data Plane with Manipulation Methods For C#. Thanks to cliesens's and Rick Davin's detailed answer. Moreover, the mentioned ...
3
votes
1answer
219 views

Simple object-oriented calculator - part 3

This question is an improvement I did based on recommendations from these other questions: Simple object-oriented calculator Simple object-oriented calculator - follow-up To those looking this ...
1
vote
2answers
2k views

Object oriented approach to Dijkstra's algorithm

I'm seeking a code review for the following C++ implementation of Dijkstra's algorithm. I'm trying emphasize code reusability and extensibility but performance is also potentially important. ...
8
votes
1answer
431 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 ...
7
votes
4answers
526 views

General advice on a practice linked_list for C++ classes/templates

Introduction I'm learning C++ (Coming from Haskell, C, and Assembly - and other languages sparsely) and this was my practice with classes and templates. It's a linked list that you can call in this ...

1
2 3 4 5
8