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
51
votes
2answers
57k 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 (...
10
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 ...
23
votes
1answer
3k 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 ...
6
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 ...
8
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. ...
15
votes
2answers
2k 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 ...
10
votes
2answers
636 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 ...
1
vote
0answers
159 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 ...
24
votes
3answers
2k 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? ...
6
votes
2answers
268 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
82 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
587 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 ...
54
votes
11answers
12k 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 ...
38
votes
5answers
24k 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): ...
10
votes
1answer
4k 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 ...
12
votes
2answers
461 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 ...
11
votes
4answers
39k views

Text-based RPG game using classes

I am studying for a degree in "Bachelor of Engineering in Information and Communication Technologies." I am currently on vacation, just after we started learning C++ at the end of the semester. I ...
4
votes
2answers
365 views

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

I have the following Student class: ...
20
votes
3answers
1k 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
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 ...
11
votes
2answers
9k 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
1answer
185 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 ...
15
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 ...
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 ...
10
votes
1answer
201 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 ...
5
votes
1answer
417 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 ...
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
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 ...
5
votes
1answer
1k 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
366 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
1answer
1k 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
1answer
165 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 ...
8
votes
1answer
375 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
523 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 ...
6
votes
4answers
1k views

Beginnings of a Poker hand classifier

For practicing/learning object orientation, I made a Card class and am practicing doing stuff with it such as shuffling decks and dealing hands etc... I have a ...
6
votes
0answers
268 views

Battleship MVC Architecture

The entry point is the Macros module, which - for now - includes only a single procedure, at a very high abstraction level - I'm quite happy with this: ...
6
votes
5answers
753 views

DP solution to min triangle path

I am studying for interviews for various companies. I wrote a solution to this problem, but if an experience programmer looks at it I am sure there are certain areas the code can be made in to a more ...
5
votes
2answers
989 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
2answers
8k views

User class design

Explained what I'm doing in the comments: ...
5
votes
1answer
168 views

Arabic language lesson program Part 2

This is the second time I am asking for a review of this code (first time can be found here: Arabic language lesson program). The goal of the program hasn't changed - to house Arabic language lessons ...
5
votes
2answers
196 views

Validator refactored to be OO

Based on my previous post I completely re-factored my code to make it object oriented. Anything I could improve when it comes to: Object oriented code; Efficiency; Readability. Any other ...
5
votes
2answers
116 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 ...
3
votes
2answers
486 views

User class, taking on login and registration capabilities

Based on the Single Responsibility Principle, I have been looking at my User class, trying to figure out how I can break out more functionality into separate classes. But it seems like all the ...
3
votes
2answers
1k views

Structure of API wrapper

I'm building an API wrapper for a bookkeeping SOAP API. I have some questions regarding bast practice for structure of the wrapper and for error handling. For now i've structured it like this: ...
3
votes
0answers
83 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
89 views

Follow-up 2: Copy File, remove spaces in specific lines

This is an iterative review: The Original Question | Follow up 1 Differences to Follow up 1 This iteration tries to take the previous review to heart and see how it turns out. It sacrifices the ...