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
38
votes
6answers
17k views

Random IP Address Generator

randip.py I know there are probably better, easier ways to do this. It was just a bit of a learning exercise for the sake of familiarising myself with Python. It takes a single argument (positional ...
30
votes
1answer
3k views

Yet another 'any' class implementation, named 'some'

This is a follow-up of 'any' class implementation. After posting my answer, I kept working on the code towards parameterizing with respect to memory management as I had promised. I ended up in some ...
28
votes
5answers
6k views

C++ logging library

I am creating a logging library in C++, and I wanted your opinion on code quality and performance within some methods. You may ask why yet another logger - the answer is simple. This logging library ...
28
votes
5answers
5k views

C++ Vector Clone

I'm learning C++, so I decided to make a simpler clone of std::vector. Concerns: I have seen people defining methods outside of the class, and only prototyping ...
27
votes
7answers
6k views

Python program to calculate GCD

...
24
votes
5answers
12k views

Implementing realloc in C

I have an assignment to implement realloc in C, This's my code please review it. ...
24
votes
6answers
5k views

C++ string operators

I'm trying to practice my C++ on my own; At the moment I'm trying to implement the concept of operator overloading making my own string class/function. I think I handled this correctly; the code ...
24
votes
4answers
3k views

IEEE 754 square root with Newton-Raphson

I have an implementation of the sqrt function that uses a combination of IEEE 754, packed bitfields, and the Newton-Raphson algorithm: ...
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 ...
23
votes
8answers
5k views

Optimize custom double.parse()

In my company's code, they use double.tryParse() which is quite good but sets too much security for our needs. As we sometimes have to parse a few billion strings, ...
22
votes
5answers
10k views

Linked List in C#

I was searching for a implementation of a Linked List with the same power as a native List. I wanted functionality closer to a ...
22
votes
6answers
4k views

Implementing any_of in C++

I've decided to implement Python's any in C++. I've gone about this using templates to allow multiple types of data to be passed, instead of overloading the ...
21
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 ...
21
votes
2answers
37k views

Generic DAO written in Java

I initially thought that this was just an architecture issue so I placed it on programmers as Thoughts on refactoring a generic DAO. Then I asked on codereview meta here and decided to put up the code ...
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. ...
17
votes
2answers
4k views

It's Friday! - Zeller's Congruence Revisited

A couple of date-related questions have come up recently, and on both occasions I have been taken back to my 'early' days where one of my first forays in to programming involved implementing Zeller's ...
17
votes
2answers
354 views

Re-implementation of `std::tuple` for MCUs

Background I'm writing code for an 8-bit MCU with very limited RAM (1KiB) and program flash space (64KiB). I have a C++14 capable compiler with no standard library implementation available. This is a ...
16
votes
4answers
69k views

Join List with Separator

I was implementing something similar to Python's join function, where join([a1, a2, ..., aN], separator :: String) returns ...
16
votes
2answers
2k views

ECDH implementation in python

I wrote an implementation of elliptic curve Diffie-Hellman key exchange in python. I would like to know if I could make it faster, cleaner or more secure: ...
16
votes
2answers
264 views

YAVI (Yet another vector implementation)

I am a C# game developer currently learning C++. I am trying to implement some simplified STL containers. Here is my implementation of vector, which does not have the allocator (because ...
16
votes
1answer
301 views

Implementation of std::any

Today, I decided to implement std::any using the cppreference page. I've never actually used std::any before and after seeing ...
15
votes
7answers
7k views

Why does caching of string objects perform faster?

I'm trying to implement String-Pool. I'm maintaining a HashMap<String,String> to store the keys. ...
15
votes
4answers
2k views

String Queue implementation

Is the implementation clean enough & can be used in production? I tried to write clean & bug-free code. It looks good to me. I would appreciate any improvement suggestions. One question I ...
15
votes
7answers
13k views

Hexadecimal to integer conversion function

I am working through Kernighan and Ritchie to brush up on my C skills, so I thought I would invite critiques of my code. Here is my Hex-to-int function: ...
15
votes
5answers
18k views

Sine function in C / C++

Due to software constraints, I cannot use the standard libraries, cmath, algorithm, templates, inline, or boost. I am also using ...
15
votes
3answers
677 views

Super calculator in C

For my mathematical research, I am to deal with very large numbers and I know that the standard C types are not going to stand a chance against them due to their limited capacity, so I decided to ...
15
votes
1answer
15k views

Min/Max Heap implementation in Python

I'm refreshing some of my datastructures. I saw this as the perfect opportunity to get some feedback on my code. I'm interested in: Algorithm wise: Is my implementation correct? (The tests say so) ...
14
votes
3answers
1k views

Stack Implementation in C++ with Exceptions

Appreciate your thoughts and feedback... Stack.h ...
14
votes
1answer
2k views

Merge n sorted iterators

Over the weekend I was curious about efficiently merging multiple sorted iterators together, and for them to be in sorted order. This is quite like a challenge on HackerRank: You’re given the ...
13
votes
6answers
5k views

Modern Vector implementation

Please give me some feedback on my attempt at a vector. I wanted this to be the lowest level concept of a vector that I'm using, so I'm primarily concerned with speed, and I would build wrappers ...
13
votes
5answers
3k views

Stack class in Java 8

I have a exercise where I have to write a Stack class with the push and pop methods. The code compiles and works as it should. Are there better practices to use in my code? Is there something I should ...
13
votes
3answers
24k views

Min / Max function of 1D array in C / C++

Due to software constraints, I cannot use the standard libraries, <math.h>, <algorithm>, templates, ...
13
votes
3answers
8k views

Python implementation of SHA1

Here is a implementation of the cryptographic hash function SHA1 written in Python. It does not use any external libraries, only built-in functions. I know that it would be faster to use an external ...
13
votes
2answers
4k views

Reimplementing Python's enum.auto() for compatibility

In Python >= 3.6 there is an enum.auto() function. The auto() function can be used like this: ...
13
votes
1answer
2k views

Implementation of std::deque (obsolete)

Warning: This implementation is obsolete, because it doesn't meet the standard. Specifically, while the standard guarantee any pointers and references to elements to remain valid after insertion or ...
13
votes
1answer
222 views

Logging library

Due to several limitations of the standard library's logging module, I wrote my own. Below are the most important parts. You can find the whole library here. Any feedback is welcome. ...
13
votes
1answer
6k views

Graph implementation adjacency list 2.0

Version 1: Graph implementation adjacency list 1.0 Please note the following: All edges are directed A user of the class Graph shall never be able to aces an object of type ...
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) ...
12
votes
2answers
2k views

Implementation of memmove

Here is my implementation of memmove; where can I improve? ...
12
votes
3answers
12k views

Simple C# HashTable Implementation

Haven't put one of these together since college. How does this look overall? ...
12
votes
2answers
2k views

Templated doubly-linked-list

I've been wanting to revise what I knew on templated classes so thought I'd write a doubly linked list to practice. It works fine, so all is well and good on that front, but is there something I've ...
12
votes
5answers
22k views

Python Hash Table Implementation

I'm attempting to implement a basic hash table in Python using only lists. Any tips would be appreciated (including better hash functions). I intend this to handle collisions with separate chaining. ...
12
votes
5answers
15k views

Implementation of atoi()

I implemented the atoi() function! Here is my code: ...
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, ...
12
votes
1answer
17k views

malloc(), free(), realloc() using brk() and sbrk()

I recoded malloc() by using brk() and sbrk(). I just want some "reviews" to see if it 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 ...
12
votes
1answer
813 views

std::string implementation attempt

The following is my attempt at a string class that behaves like std::string. Any feedback would be appreciated. my_string.h ...
12
votes
2answers
774 views

Modern C++ singly linked list

This is a rather minimal (though fully functional) implementation of a singly linked list. It supports \$\mathcal{O}(1)\$ front insertion and deletions, as well as \$\mathcal{O}(1)\$ random insertions ...
12
votes
1answer
174 views

Pure python range implementation

I implemented class Range as an equivalent to Python built-in range for practicing purposes. No features were added. Hope it ...
11
votes
7answers
8k views

Numbers to byte-arrays and back

As the title explains, this is a series of extension methods that convert certain numeric types to and from byte-arrays, for certain actions which work better on byte-array types than numeric types. ...

1
2 3 4 5
16