Questions tagged [reinventing-the-wheel]

For when you know you are reinventing the wheel, but are doing it anyways. Questions with this tag involve code that is already fully implemented (such as from a library).

Filter by
Sorted by
Tagged with
6
votes
1answer
389 views

Implementing `split`

I implemented the split function in Haskell: ...
1
vote
1answer
1k views

JavaSE client: is this how to get a new JPA EntityManager each time? (DAO)

This class functions, in that the program can be left open for hours and it will still reconnect to the database when the user prompts for a CRUD operation. I've read about DAO, and some other ...
7
votes
3answers
1k views

Lazily Load CSS and JS

I have written this piece of JS and CSS loading code and I would like some advice on it. Anything some of the JavaScript gurus could possibly point out would be much appreciated. The code works, but I ...
12
votes
7answers
23k views

C++ 3D Vector Implementation

I have been learning C++ now for 2 months and this week I started reading a book on 3D graphics. I like coding whatever mathematical stuff I learn so I can understand it better, so when I learnt about ...
3
votes
3answers
1k views

Hexadecimal to string without C++ standard library functions

For the purposes of this code review, I will use the standard library, but pretend that <cstddef> is <stddef.h>, ...
7
votes
2answers
1k views

BigDecimal made simple

Here is my take on (a lighter version of) Java's BigDecimal. I originally wrote this as a replacement for BigDecimal in order to ...
5
votes
3answers
10k views

Binary search tree with tree traversal

Although there are several implementations of binary search tree, I have made my own implementation for practice. The following code does the followoing operation - Create a binary tree - search ...
9
votes
4answers
52k views

Simple implementation of HashMap

I have implemented a HashMap which supports insertions of integer key value pairs. The approach uses an array for simplicity and uses a standard hash function. ...
9
votes
4answers
62k views

Binary Search Tree C++ Implementation

I've implemented a simple binary search tree for practice purposes: ...
10
votes
2answers
460 views

Minimalistic rmdir

In my eyes most of the GNU stuff is bloated and doesn't really fit my view of how a Linux environment should look like. I have come up with my own minimalist implementation of the GNU Coreutils, but ...
6
votes
1answer
388 views

Tiny DOM builder

My goal was to create a tiny DOM builder library that made creating element trees less gross. This is the syntax I decided on: ...
4
votes
2answers
17k views

STL List Implementation

I've implemented a simple C++ STL like list. It's pretty simple, all the constructors and methods haven't been implemented here, but majors are. ...
12
votes
3answers
11k views

STL queue implementation

I've implemented a simple C++ STL like queue. (I've tried to follow @LokiAstari stack implementation code fashion) ...
19
votes
4answers
78k views

STL vector implementation

I've implemented a simple vector-like structure. I would appreciate all criticism relevant to code, style, flow, camelCase vs underscore, and so forth. ...
24
votes
2answers
14k views

Thread pool worker implementation

As an exercise in using C++11 features I decided to make a thread pool class. I would like to have a review on the code with focus on: Standards compliance / Portability issues / Best practices ...
5
votes
4answers
3k views

Sorting Algorithms

A group of basic sorting algos. Based on Algorithms, 4th Edition - Robert Sedgewick | Kevine Wayne. Just making sure all of my logic and everything is correct. ...
4
votes
4answers
5k views

LinkedList to be used in a stack or queue

This all works. Just wanted to make sure I didn't miss anything. Coming from C++ and working my way through Algorithms, 4th ed. Here is my LinkedList class: ...
9
votes
2answers
398 views

Single class unit test framework in Java

This is a single class and dependency free1 unit test framework for Java. The only assertion available is assertTrue (this can be used for all test cases). (...
3
votes
3answers
17k views

Split string by character in Java

I have this code, which goes through a string and split it using a char delimiter. I am concerned where it can be improved. Main concerns are speed and memory usage with speed as the priority. Any ...
3
votes
3answers
793 views

Simple shared pointer

I wrote a simple shared pointer, which I think works pretty well. I would like to see your review of it. This is the header file: ...
4
votes
1answer
2k views

Extendable PDO Wrapper Class

I've created a PDO wrapper. I understand PDO could be used on it's own, and I'm reinventing the wheel as there are solutions like Laravel's Eloquent that would do a better job. I'd like advice on ...
2
votes
0answers
86 views

NodeJS, status propagation to interface

If you have an interface served by a NodeJS API, what is the most clean way to propagate status changes to the interface? For example, I have a page that has 2 statuses, user logged in and guest. How ...
7
votes
1answer
87 views

Unix 'sleep' clone - unsure of safety

I decided to try making some simple clones of the various user-space Unix utilities in an effort to learn the system-specific headers and improve my C skills. The code that follows is a clone of ...
5
votes
3answers
286 views

Confusing control flow

Currently, the following code runs and produces the expected and desired output. However, I'm sure that there's much wrong with it. This project queries the (flat) database, instantiates each row as ...
5
votes
3answers
7k views

Iterator for a list of objects

Given a list of objects, return an iterator for such a list. Looking for code-review, optimizations and best practices. Verifying complexity to be O(n) where n is sum of all objects, including ...
22
votes
3answers
3k views

Look 'ma, I can read code

I have put together a naive implementation of a VB6/VBA parser, and I'd like to see if the CR community sees the same things as I see can be improved with this code, before I start refactoring. I've ...
6
votes
1answer
2k views

Reverse Polish Notation Calculator

Working through Learn You a Haskell, I made a Reverse Polish Notation calculator. Please critique it. ...
2
votes
4answers
3k views

Detect if a tree is complete binary tree

Detect if tree is complete binary tree. This question is improvement over previously asked here. Looking for code-review, optimizations and best practices. Verifying both space and time complexity to ...
9
votes
3answers
2k views

Platform independant thread pool v4

This is a continuation of this question. Following the previous advise, the thread pool now can handle almost all types of input, except for one key form, where the function/functor requires one of ...
5
votes
1answer
98 views

Bi-directional atoi()

I am implementing atoi() by traversing a string from the beginning as well as from the end. Is there anything I can improve? ...
3
votes
2answers
932 views

Platform independant thread pool v2

This is a continuation of this question, v3 can be found here Taking into account the advise given by Loki, an implementation of the threadpool using a ...
3
votes
1answer
38 views

Implementing `randoms`

Learn You a Haskell presents the randoms function. I implemented it as follows: ...
10
votes
1answer
2k views

Platform independant thread pool

v2 of this question is here and v3 is here To get a better understanding of C++11/C++14, I thought I would develop a thread pool, even if it has been done to death! The only dependency outside of ...
1
vote
1answer
169 views
5
votes
2answers
958 views

Providing const- and non-const overloads of a strstr() implementation

In a question about reimplementing strstr(), I posted an answer. I pointed out a need for const- and non-const versions of the function, and provided ...
7
votes
3answers
7k views

strstr() implementation

In this strstr implementation, I am basically skipping the already matched and checked characters with an if else condition. Is ...
12
votes
4answers
345 views

Bare-bones string library

After years of criticizing others, I've finally found the time and worked up the courage to polish up one of my bits of code and solicit criticisms of my own. This is a simple dynamic-string library ...
10
votes
1answer
1k views

PHP-framework with MVC architecture and Active Record pattern for the DB management

I tried to create the PHP-framework, with no experience in the task like this: Folders: ...
4
votes
2answers
809 views

Exercising in copy constructors and assignment operators

I've just created an implementation of array to train myself in copy constructors, assignment operators, and exception safety. Please look at this code and tell me what is wrong here. ...
7
votes
2answers
4k views

Multiply two hexadecimal values

I've written an algorithm which can multiply two hex values and return a hex as a result. What do you think about the below solution? ...
2
votes
2answers
463 views

Merge Sort Java Implementation

Can someone check my Merge Sort implementation on Java? Is it good/bad and can it be improved further? ...
12
votes
3answers
78k views

Simple authentication in ASP.NET MVC 5

I am building an ASP.NET MVC 5 application and, for reasons which are irrelevant at this point, I am attempting to build my own means of authenticating users. I'm still very new to programming, ...
1
vote
3answers
231 views

Function Composition: $ versus `.`

Learn You a Haskell offers the findKey function: Here's the book's implementation: ...
2
votes
1answer
113 views

Implementing `zip4` in Haskell

Learn You a Haskell explains zip4: --ghci> zip4 [2,3,3] [2,2,2] [5,5,3] [2,2,2] -- [(2,2,5,2),(3,2,5,2),(3,2,3,2)] ...
3
votes
2answers
1k views

Implementing Haskell's `insert`

Learn You a Haskell shows the insert function. insert takes an element and a list of elements that can be sorted and inserts it into the last position where it'...
1
vote
1answer
2k views

Implementing Haskell's `union`

Learn You a Haskell shows the union function: union also acts like a function on sets. It returns the union of two lists. It pretty much goes over every ...
2
votes
1answer
1k views

Implementing Haskell's \\ (Set Difference)

Learn You a Haskell presents the \\ function. \\ is the list difference function. It acts like a set difference, basically. For every element in the right-hand ...
2
votes
1answer
2k views

Implementing Haskell's `delete`

Learn You a Haskell shows the delete function. delete: deletes first occurrence of item ...
6
votes
3answers
1k views

Implementing Haskell's `unwords`

Learn You a Haskell explains the unwords function. $unwords ["hey","there","mate"] "hey there mate" Here's my implementation. ...
2
votes
1answer
2k views

Implementing Haskell#words

Learn You a Haskell shows the words function. words and unwords are for splitting a line of text into words or joining a list of words into a text Example: <...