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

0
votes
1answer
19 views

Java Fraction Class - Adding Together Two Objects [on hold]

I'm currently working on a fraction class. I've successfully figured out how to create a fraction object as well as check for errors but I've blanked and cannot figure out how to add together the two ...
2
votes
3answers
43 views

OOP Class properties automatically

One of my friend made a framework. He made an abstract class, called NullObject (see below). For his convenience, hid does this, so when he want to build an object from database, just inherit this ...
3
votes
0answers
62 views

How can I improve my game project design?

I'm just getting started with XNA and game development in general. I followed these instructions to create a basic game, then this article to get sprite animations working. Now, I'm trying to ...
2
votes
1answer
46 views

How to put XML results in the MVC pattern?

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 a result in XML, and I put this file ...
6
votes
4answers
124 views

Object's responsibility - how to determine what functions should be implemented in the class?

Long story short, I would like to use OOP for my new PHP project. It has a "login" requirement, ie. user will first need to enter the username and password (login.php), if it's correct, it will be ...
2
votes
2answers
48 views

PHP Object Oriented command processor [Req review]

I really need a review on the structure, and how things are done. I want to improve. Command.class: <?php /** * Command * Processing commands to the server, acting, receiving ...
5
votes
4answers
269 views

Simple class - returns true if even number of items, false if odd number of items

This is my first C++ program with classes, and I don't want to develop bad skills. It's very simple. It consist of 3 files. Please tell me if it's proper or not! parity.cpp file: #include ...
0
votes
0answers
70 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 ...
0
votes
1answer
47 views

Why isn't it giving me a color for my apple? [closed]

This is not homework; just an exercise I'm doing on my own. In my main: apple j = new apple(); j.Flavor = "sweet"; j.Color = "green"; Console.ReadKey(true); In a class: using System; using ...
3
votes
3answers
163 views

How to start with OOP JavaScript

I've been learning JavaScript for about 8 months now. 5 months ago, I found job as a Front End developer and I've been getting more deeply involved with JavaScript (which I love). Recently, I've ...
1
vote
1answer
60 views

Scrapy — Very Procedural — Better Alternatives?

class PropFinal(CrawlSpider): name = "propfinal" allowed_domains = [over 200 allowed domains here] start_urls = ...
1
vote
1answer
40 views

File Downloading, Unzipping and extracting Content - PHP script and tests

EDIT. Here is the new version after bumperbox's very helpful suggestions. I was thinking or renaming into Downloader or something but the problem is, I see downloading is performed at lower level of ...
0
votes
1answer
22 views

Android get multiple inputs from single EditText

userInputs.setOnKeyListener(new OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (event.getAction() == KeyEvent.ACTION_DOWN) ...
-1
votes
1answer
2k views

Small PHP Framework. Almost one year later

The following is a new question based on answers from here: Small MVC for PHP I have written a small template library that I would like some critiques on. The library is located here If you are ...
3
votes
4answers
102 views

Is this a qualified OOP script in PHP?

class Youtube { private $url = null; private $id; public function __construct($url) { $this->url = $url; $this->parseUrl($url); } protected function ...
2
votes
2answers
73 views

designing application using polymorphism

I have created a polymorphic system, but I don't know whether this is the correct way of doing it. Am I abusing Polymorphism here? Here is the code: class WriteObj { public string Obj1 { get; ...
1
vote
2answers
167 views

Designing classes and methods for hospital management system

I am working on hospital management system project. I have implemented it using the following design. Is it a good design? I have created four classes: Patient, Doctor, Hospital, and Demo. Inside the ...
2
votes
1answer
35 views

More simplified way of creating page links dynamically?

A little birdie suggested I bring this question here, so here it goes. Well I have a working script (see below) but it seems quite clunky and redundant; in my defense I wrote this code many moons ...
3
votes
2answers
207 views

I am applying for Object Oriented PHP jobs. Can I please get a general review of my OO skills?

I am new here, so hopefully it is ok to post a link to my github account where I am storing my code samples. https://github.com/arthaeus/war This particular sample is the card game 'war'. The ...
2
votes
0answers
29 views

Is this a good WP Post Type template script?

I have created this class for my WP theme, it allows you to create templates for a meta box which relates directly to a custom frontend template to have better control of the content displayed on the ...
7
votes
1answer
73 views

Is this code good to implement encapsulation with jQuery?

First of all: I know there are already other questions about oop/jquery, but this one is about the following specific code. 2ND: I'm and advanced mootools and AS3 programmer, so I'm used to 'regular' ...
2
votes
1answer
116 views

How to separate code into smaller classes using SOLID principles

I have a console application that basically retrieves xml content, writes to the xml file and sends the file to sftp site. This may seem long post but I believe it is simple stuff that need advise on ...
0
votes
0answers
83 views

Is my Javascript Object Oriented?

This was my first attempt at writing object oriented Javascript. It's a minesweeper clone in JQuery. I thought I had done an ok job, but I just received some feedback that it wasn't written in an ...
1
vote
1answer
29 views

__constructor mysqli variable options

I like the fact that I can create a class and have the connection details in one file if I need to update them and then pass them to the method I create in the class that defines my specific use of ...
2
votes
2answers
91 views

How to get two JavaScript classes to talk to each other?

I'm a budding JavaScript programmer, working on an exercise where I'm trying to create two classes (Books and Shelf) and need to have a shelf know what books are on it. I'm pretty new to OOP so I know ...
2
votes
3answers
107 views

Did I Needlessly Complicate This Function?

Background: We're using a class called Places (inspired by Allen Holub's great article on DrDobbs) that resolved our program paths based on the existence of a configuration file, environment variable ...
4
votes
3answers
293 views

How to refactor C# class to meet SOLID priniciple

I need to refactor following class: public class Message { public Guid ID { get; set; } public string MessageIn { get; set; } public string MessageOut { get; set; } public int ...
5
votes
2answers
117 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 ...
0
votes
0answers
81 views

Understanding OO JavaScript with a simple scenario

Coming from a Java kind of OOP, I miss a lot of things in JavaScript. I am working on a Node.Js project, and I would like to use an OO approach. Looking around and asking in StackOverflow I came up ...
0
votes
1answer
56 views

Searching for a better implementation to EnumBase

In a former question on SO I described a problem with a construct called 'EnumBase'. As I sad there, I am not involved when basic implementation happened. So I'm not sure why the thinks are a they ...
2
votes
2answers
102 views

Is this a bad way of setting properties inside of a class PHP

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 class that all other classes have ...
0
votes
1answer
61 views

Could my object use static methods? Anything I need to do to make the code better?

With the Zend coding convention in the back of my mind, I have set this up. It lets you communicate with the API of the vendor TargetSMS. They allow you to bill customers trough SMS. For now I've ...
1
vote
1answer
105 views

Class Design - Excel Report

I am working on a C#.Net application that will generate an Excel report from a template. Although the code's not in the app yet, it will pull data from a SQL Server database to populate the report. ...
0
votes
1answer
74 views

Java game selection + true/false game review needed

First of all, I won't include the spin game there, cause its very simple. just random formula. Ok, I went a bit deeper into object oriented since the last time, I learned array lists, using them with ...
2
votes
1answer
256 views

Very simple PHP PDO class

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 ...
3
votes
2answers
97 views

Template Vector Class Review

I am trying to implement a vector-like container of my own (just to gain a better understanding of how std::vector works under the hood). I've been using this as a reference. Although I've ...
2
votes
4answers
98 views

One or multiple classes? Better-looking way to create tetrominoes in game

Background A few weeks ago, I started working with Java. To get more familiar with the language, I decided to make a Tetris clone. So, as I finished the Tiles beans class , I went to the Tetromino ...
1
vote
2answers
164 views

OO Design in C#

I have a question about the best way to design / redesign my software. I have a program that uses a web services to perform certain tasks. Each task is a different set of request / response classes on ...
6
votes
1answer
288 views

Intern with no mentor struggling with refactoring and OOP

A little background I'm an intern at a large engineering company, and I'm also the only CS major in the entire building. The people on my team don't have technical backgrounds, but hired me to start ...
1
vote
1answer
71 views

Review a simple PHP OOP model

I wanted to write the best implementation I could think of the following really, super simple and stupid OOP model in php. class Number { private $number = false; function __construct($n) ...
0
votes
0answers
33 views

How to design a robust class for Packet Capturing tool

I need to design a class for packet capture tool. Class should provide service to start and stop a dumpcap packet capture. Class should be capable of accepting all sorts of inputs which includes ...
4
votes
3answers
165 views

Template Stack class review

I am trying to mimic std::stack in my implementation (just the basic interface - no iterators / allocators). Since I was having trouble handling all the memory allocation/deallocation, I read this. ...
2
votes
1answer
77 views

PHP review of object oriented GeoIP class

I wrote a little PHP wrapper class for GeoIP which looks like: <?php class GeoIP { private $ip; private $geo_ip_details; function __construct($ip) { $this->ip = $ip; ...
1
vote
1answer
87 views

Comparison with a range

I'm developing a class to compare prices. For example, give me products which price are above 50 or under 50. Here's my API: var indicator = new PriceIndicator(PriceComparison.Above, 50); var actual ...
0
votes
0answers
35 views

factory method inside registry

I have some core objects that i am planning to store inside my registry class. Approach 1 In my index.php, I load the all required files and then create the objects and pass them on to the registry ...
1
vote
1answer
60 views

Is there any better way to fetch two tables in one statement or query?

The 'Do' method is for prepared statements and returns (by fetchall()). I am also using two looping statements. Is there any better way to fetch two tables in one statement or query? If not, what ...
3
votes
2answers
122 views

OOP Methods/Functions that can return a value or an exception

Introduction I'm currently working through a series of bugs in an application. Our application is written in C#/ASP.NET (on the server) and HTML/CSS/JavaScript (on the client). We are using ELMAH to ...
0
votes
0answers
14 views

Designing with Unidirectional relation vs bidirectional relation in JPA

Suppose I have two entities User and Action @Entity class User { String name; } @Entity class Action { User actionee; } A User has many actions. (One to Many) Also if a user deleted, there is no ...
3
votes
1answer
87 views

Small project architecture review

This app is a simple taxi emulator. The only feedback I've got on it was "bad internal architecture", that's why I would be grateful to receive more adequate and humiliating review. Speaking simple, ...
1
vote
3answers
121 views

Look over my code for PDO and MVC

I'm building this website with PDO and Pattern MVC. I'm currently working on the login page and would like to know if this structure is correct for MVC pattern. I'd also like your opinions and ...