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 (3)

11
votes
2answers
369 views

3D perspective rendering in Windows console

This is something I put together from a 3D Soft Renderer I previously wrote in Java. I have less experience in C++, but I thought that being able to render 3D shapes in a console simply by printing ...
15
votes
2answers
862 views

C++ Shop Keeper Program

I have made a little shop keeper program and I would love someone to critique it and list all of the improvements I could make. This is my first time using OOP techniques so I imagine there is a lot ...
3
votes
1answer
44 views

Learning with an OOP CMS

I want to learn OOP and I am creating a little CMS for practice and to use it as a base for other projects in the future. This is the complete code: GitHub My major concerns are code structure, ...
4
votes
1answer
48 views

php url generator

I have the following code to generate an URL based on alias and args provided ...
7
votes
1answer
68 views

Refactoring of a client API to avoid duplicated code and unclear passage of parameters

I need to develop an API. The functions of the API are requests that call the services exposed by a server. Initially the API worked like this: ...
-1
votes
0answers
20 views

PHP: How to make testable static methods [on hold]

I decided to make my own poor man's ORM framework. Since I did not know how to go about it I decide to develop before testing. Github. After making it work the way I want, I realise that my code was ...
4
votes
1answer
18 views

Polymorphic customer classes for employees and affiliates

I was trying to achieve a simple problem : If the user is an employee of the store, he gets a 30% discount If the user is an affiliate of the store, he gets a 10% discount I came up with the ...
5
votes
1answer
51 views

Model of an mp3 player with state and prototype design patterns

After reading about design patterns in general, I decided to try and incorporate them in an actual program. I chose a State machine for my first exercise, or, more concretely, an MP3 player. The ...
-1
votes
1answer
34 views

template for checkers game for single player

i make template for checkers game. while there is the functionality for only one player. but it worked. Checkers can already move ...
8
votes
2answers
70 views

A 3-D vector class built on top of numpy.array

I wanted a convenient class to easy access the parameters inside. I am using a lot of math in my game; that's why a wanted to access them through x, ...
8
votes
0answers
49 views

Simple Oriented Graph implementation in Java

I wanted to implement a simple oriented graph as part of an exercise in both Object Oriented Programming and Data Structures. I wanted to make it as class-focused as possible, so I don't know if my ...
-2
votes
0answers
29 views

relationships in class diagram [closed]

I am studying class diagrams and I have doubts on modeling aggregation, compositions etc. The picture below represents a simple application where the user inserts names on the database. The ...
8
votes
1answer
90 views

Creating Inheritance hierarchy using function constructor

Problem statement You need to create the Animal base class having four fields: a. name b. ...
10
votes
1answer
75 views

A classy wine collection - Construction vs. Initialization

The following is for a chapter exercise in C++ Primer Plus, 6/e by Stephen Prata, for the first part of Chapter 14 which deals with code reuse through composition. The problem is to implement a ...
4
votes
1answer
60 views

Creating a configuration Class in php

I am creating a system for a client that loads information from an XML file and then parses the information where needed. For this, I have got this class: ...
5
votes
1answer
106 views

C# - Make the static class thread safe [closed]

I have a simple class that I use to logging errors and other informations from my applications. I wondering what will happen when 2 or more threads of the same application would like to log something ...
3
votes
2answers
52 views

Python Tree/Node Class from scratch

I decided to try to make my own tree style class. I may use it in a project, but it's primarily to practice. I would appreciate any feedback for improvements, best practices, etc. ...
-1
votes
2answers
60 views

Is there a better way of modeling the routines in my operations that doesn't involve PROTECTED fields?

In my application, well-defined operations on collections of business entities are modularized and carried out using one or more routines, each of which operates on a unique type of data associated ...
7
votes
1answer
57 views

2 Player Battleship Game

This is an adaption of a single player Battleship game. I made it two player, and I also tried to implement OOP and DRY principles. I would like my code to be reviewed for OOP, DRY, PEP8, and overall ...
3
votes
2answers
20 views

OOP, FP and IMP condensed in Rock, Paper and Scissors

Rock Paper and Scissors is a pretty basic program. The reason I wrote this program is because I wanted to see what a small script that used all of the main programming paradigms looked like. My code ...
2
votes
2answers
55 views

How to fully make use of oop in Python and use __init__(self)

I have this project about using OOP in python. Can someone please check my code and help me revise it. Below is my code: ...
5
votes
0answers
71 views

Using commands as deferred behaviour

I was thinking of building a really flexible fluent API for my persistence layer. One of my goals is to achieve somehow the following result: ...
-1
votes
0answers
29 views

Mapping a set of objects onto another in java

I'm trying to map a dataset(Set1) onto another(Set2). The mapping is done by applying an operation to a subset of ...
-4
votes
1answer
52 views

XmlControl class

I've written this code that connects to a .xml file at a given url, parses it and outputs the values of some specific elements to the console. I want to write reusable and appropriate code ...
2
votes
0answers
24 views

String to Class: Conversion Class or Base Conversion Method?

I'm working on a project where I builded a structure composed by a basic class "TFuncao", two descendant classes "TSolicitacao", "TResposta" and as many as needed descendant classes, all of them are ...
1
vote
1answer
27 views

Calculating a quality score of something based on attributes

I'm willing to have a way to calculate a quality score of an object; in this case an addressbook contact. I believe there are way better approaches to do this and I'd like to hear your references. ...
8
votes
2answers
281 views

Solar System model

I have a model that works, as far as I know, but it's so messy! I am very new to Java, so I'd really appreciate some help tidying up. In particular, a lot of my constructors are empty which is ...
20
votes
6answers
3k views

To 'this' or not to 'this'?

I was given a homework and I have 2 solutions: one that uses this and other one that doesn't. I tested it on jsPerf but sometimes it says the version with ...
5
votes
1answer
90 views

Transform Python math game to OOP

Background: I'm trying to learn basic OOP with Python. I have this program I wrote to help my son practice math problems. It does addition, subtraction, multiplication, and division. He can choose ...
5
votes
1answer
43 views

Listening from Mongodb always and triggering

I am using classes for the first time. In this program I want the object to run infinitely so that any change in the MongoDB will trigger the function and do the necessary processing. I am little ...
3
votes
1answer
48 views

Mapping different classes to the same database table

I have several very similar subclasses that I (think I) want to be stored in the same database table. Most of the fields are identical, with each subclass adding 1 or 2 custom fields. My code is using ...
5
votes
2answers
42 views

Static utility functions to turn arrays into SQL statements

I have an object that houses only static functions. The functions are stand alone and are not dependent on the state of the object. I hear that static functions are a nightmare in terms of testing, ...
5
votes
4answers
308 views

Calculating length with different units

We have an exercise to design a simple library, which can calculate some length with different unit, e.g. 2m*2 + 20cm/2 - 5mm and the result can be any of: ...
3
votes
3answers
66 views

Logic Gate Simulator - Proper Encapsulation

So I was checking out the courses on InteractivePython, and I came across this example to demonstrate inheritance. My focus is on the Connector class and how it ...
3
votes
0answers
43 views

Moving buttons is very slow

I have a very simple app which removes buttons and re-adds buttons to certain layouts when a button is clicked. The problem is this process is taking a very long time. How do I speed this process up? ...
4
votes
2answers
39 views

Batch Processing : Design check with SRP and OCP prinicple

I have to create a batch process which reads data from DB , process it and saves it in db . The batch data is fetched organization wise ( each organization has set of data to be processed) at once.We ...
4
votes
1answer
64 views

Php Login Class - Security and Logic check

I write a simple php login class that only operate on php sessions to login user in the system. My Question is that this class is secure enough to be used on production environment ? NOTE : Die ...
1
vote
4answers
221 views

Matrix operations using classes

So I recently had a practical exam in which I was told to execute a function of a menu oriented matrix operation program using classes. The code I made was supposedly wrong as I hadn't used classes ...
0
votes
1answer
39 views

Mixing in-class initialization and initializer lists [closed]

From this question, I do know that initialization list and in-class initialization are different things. The class in the following code has members with in-class ...
3
votes
1answer
37 views

Test cases for an elevator simulator

I'm trying to test an elevator simulator program that runs in the console and requires user interaction. At the moment, my tests look like this: ...
1
vote
1answer
66 views

Checking if a user can withdraw money

This is purely testing my skills; I am not actually coding for a bank. This is part of a bank account class. ...
1
vote
2answers
89 views

IoC.Resolve deep in the project or Constructor Injection on entry point of app

I'm building cross-platform application (every mobile/desktop OS + web in ASP.NET). I'm using Xamarin, so I can do everything in C#. But before I start working on UIs, I want to build soild, flexible ...
2
votes
1answer
29 views

Create AsyncCursor wrapper

Is this good OOP style? Do I need to split this class into two classes? If so, how do I do this? What methods should I need to add to the interfaces? ...
1
vote
0answers
23 views

Recursively merge objects with corresponding property names

I have such objects that I need to merge: ...
1
vote
3answers
113 views

Visitor Pattern in C++ 11

I have referred some class diagram to actually create visitor. ...
1
vote
1answer
84 views

Price calculator for motors and pumps

Note This question was born in request to post more details from this question on Programmers. Since details may uncover new/different complexity, I'm asking another question here. I also will use ...
-1
votes
1answer
36 views

Returning a tuple utilizing this script [closed]

The script below is taken from this site. It doesn't currently work, but I have made it work at my own computer (not currently accessible) by changing what BeautifulSoup looks for. The script is ...
3
votes
1answer
46 views

JavaScript ajax formquestion editor

This is the JavaScript file that i use for my editor that allows people to edit questions from a form. I'm wondering if this sort of approach to use JavaScript objects is good or that I kind of miss ...
4
votes
2answers
49 views

Python object-oriented pipe cooling simulations

Here is my code simulating liquid in a pipe cooling under different conditions. How did I do approaching this in an object orientated way? Is there any way I can improve this code? ...
2
votes
0answers
60 views

Class that generates records after performing business logic

I wrote a small class that does a database lookup and it generates a collection/Array. The Collection is resorted based on values returned from the database. Finally, the records can be retrieved ...