Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [modules]

A logical subdivision of a larger, more complex system.

15
votes
2answers
38k views

Exporting routes in node.js Express 4

I'm using Express 4 to provide routes to HTML/Jade files, and as well to provide an API. I want to separate routes from server file, and go even further- separate API from WWW. My code now looks like ...
11
votes
1answer
713 views

Minimal Python plugin mechanism

Is there a better way to have a minimal Python plugin mechanism than the following? (This was inspired from this post.) ...
8
votes
2answers
621 views

Python Export Decorator

In Python, we use __all__ to explicitly denote the public API of a module or package. That looks like this: ...
8
votes
1answer
639 views

Bitex - Cryptocurrency Exchange API Framework for Python

BitEx is a Python module I've been working on for a little over 9 months now, as a side project. It was published 6 months ago on GitHub, and as I edge closer to my 1.0 release, I wanted to take the ...
8
votes
1answer
451 views

Loading and Using Lua Scripts

I have been experimenting with integrating Lua into Objective-C. I have tried to do the bare minimum to get Lua to compute values and return them. I did not want to use any external libraries so I ...
7
votes
2answers
868 views

Perl recursive copy and move functions

I know a module like this already exists on CPAN, but I wanted to write my own simplified version that accepts wildcards in the input. I don't write many Perl modules so I figured I would post the ...
7
votes
1answer
149 views

Project Euler module

I use Project Euler to teach me programming and not to submit any results. As such I look up the expected return values to double check my solutions. To organise my files I use the following folder ...
7
votes
1answer
52 views

Python App that parses file for lines that match a format

I recently wrote some code that was dinged on not having well defined tests and poor modularity. Was hoping someone could review my code and give me pointers on how to create more well-defined tests (...
6
votes
2answers
113 views

MongoDB Perl Wrapper

I'm trying to create a custom "mongodb perl wrapper". I created the following perl module, which local on my machine runs. My questions to the community are: Would you create the module different? Do ...
6
votes
2answers
230 views

Physics particle collisions

I have a large file that I want to refactor. My idea is to make helper classes with helper methods so that I can modularize methods. Is that a good idea? For instance before refactoring: ...
6
votes
1answer
2k views

Improvements to an Angular ScrollSpy module

Things that I'm not sure about: Whether this works in all use cases - alongside routing and within templates etc Am I polluting the scope with all these variables? This seems to be the easiest way to ...
6
votes
2answers
664 views

Minimal but complete AMD implementation

I've got a minimal implementation (under 2k minified) of the Asynchronous Module Definition API. So far it handles all of the required stuff (I think; it passes the relevant unit tests, anyway), and ...
6
votes
1answer
3k views

Avoiding RequireJS circular dependencies

My app module bootstraps a Backbone.js application. I need app to be available in every other view for easy access to router, ...
6
votes
1answer
63 views

Laser cutter daily reports parser

In my Python journey I was looking for a "real life" problem and I think I have found a good one at my current work. The laser CNC machine I'm working with generates reports that contains timings of ...
6
votes
1answer
155 views

Modularised Document Construction

The goal: A set of configurable options, combined with a standardised data source, to produce a standardised Report. This question: One module of said document, with accompanying code. Input: (...
6
votes
1answer
1k views

Pig Dice Game: Luck game to get to 100 points

I have a dice game called Pig to play (a simple google search will show rules, they are included in my .js file as well). I am new to JavaScript and the main goal of this code review is to give me an ...
6
votes
2answers
713 views

Snake game using a canvas

I'm trying to reach good understanding of how to build scalable modular application structure. Recently I've been practicing with canvas and rewriting one of the popular snake game realizations. I've ...
6
votes
1answer
99 views

Extendable JavaScript module that converts between camelCase, PascalCase, and underscore_case

The basic idea is that by defining three functions--recognize, dissect, and combine--...
5
votes
2answers
17k views

List all classes in a package directory

I have a package directory pkg with several classes that I would like to build into a convenient dict property. The structure ...
5
votes
2answers
329 views

Optimizing a Text-To-Speech program with a lot of repetition

I have a Text-To-Speech program that will ask the user to input text, convert it to speech and then output that speech from within Pygame by loading the file into memory, getting Pygame to play the ...
5
votes
1answer
2k views

Monitor filesystem for continuous integration and build

I've written a simple Python module that depends on watchdog to monitor for modified files, then runs various integration and build processes. I'm fairly new to Python, so I'd appreciate all ...
5
votes
1answer
199 views

Module representing rational numbers

Taking inspiration from SICP Exercise 2.1, I decided to implement a module in Haskell for rational numbers. Some of my concerns include: Is this idiomatic Haskell? Besides ...
4
votes
2answers
184 views

Cursor module for a text-editor

A few weeks ago, I had started to write a text-editor in C++ using SFML library. The work is now paused pretty much because I am a lazy freak. So, I thought I might use this passive time to get ...
4
votes
3answers
513 views

Simple Java program - Coding bat sumNumbers

The problem is stated as follows: Given a string, return the sum of the numbers appearing in the string, ignoring all other characters. A number is a series of 1 or more digit chars in a row. (Note:...
4
votes
1answer
4k views

Module to validate and sum a string containing no negative numbers

To learn the language of JavaScript, I did a dojo exercise by Roy Osherove. Is there a better way to organize this so that the only method exported is add while ...
4
votes
1answer
114 views

Slider module and extending it further

I created this module, and I'm wondering if I did a good job. How would an experienced JavaScript developer improve this simple slider module further? Like, let's say that you want to use this module ...
4
votes
4answers
361 views

What is the shortest snippet that emulates `include` in JavaScript without third-party scripts?

JavaScript doesn't offer a module system. There are many third-party solutions, like require.js or jQuery's $.getScript. Most, ...
4
votes
3answers
131 views

Status display module

I've developed a template to modularize JavaScript code I write for client work. The example below is a simple class with 1 attribute and 3 functions. Rationale: Standardized constructor to add or ...
4
votes
1answer
140 views

A hash cracker for Python 3.0 and up (module)

I've worked on pycrack.py to improve it (hopefully). New features: Renamed to kronos (kronos.py). Attack modes: Bruteforce; Wordlist attack. Portability: Kronos can run on Windows, MacOS and Linux,...
4
votes
1answer
104 views

Merging with different modules

We have an action merge for two projects. In the projects we have different modules like Feed, Files, Post etc.... ...
4
votes
1answer
303 views

Loading 'Plugins' in Ruby

I have written a plugin loader in Ruby, and I would like to know if it uses the best technique to handle classes, or if anyone has any recommendations on how to improve my code. I have written a ...
4
votes
1answer
2k views

How are my javascript module pattern and promise pattern?

I'm working on an app that downloads some SVG paths from a server and draws them. Anything in here is open to critique, but specifically I'd like to review my use of a module pattern and my ...
4
votes
1answer
79 views

Pomodoro timer module

I have been learning javascript for some time and have just finished my first piece of code that not only actually does something, but is also longer than a few lines of code. It most likely is pretty ...
4
votes
1answer
125 views

Strategy to reduce duplicate code in many similar modules

The Situation I have created some code in the form of modules that each represent a medical questionnaire (I'm calling them Catalogs). Each different questionnaire ...
4
votes
0answers
37 views

Self-notification modules

Specifically, I have been working my way through Al Sweigart's Automate the Boring Stuff and was inspired to write my own util/module that I can use for sending myself SMS messages via Twilio. The ...
4
votes
0answers
1k views

RSS parser for Node.JS

I would like someone review this code and tell if it can be done better, or if the code is elegant and simple enough for the task at hand. I used code climate and I got 4/4 and my test coverage is 96%...
3
votes
2answers
434 views

Python exception handler to recommend package

Consider this python 3 snippet, where when an import exception is raised, a string 'e' is created that says: "No module named ' packageName'". The goal is to simply say on exit, that the import error ...
3
votes
4answers
150 views

A package for sort algorithms

I'm trying to learn basic algorithms which are typically taught in an introduction to CS course, which is usually taught in a compiled language like Java. However, I want to focus on JavaScript, so I ...
3
votes
1answer
199 views

Combat simulator - single page JavaScript with requirejs from a Java Applet

Single-page web app from Applet I'm seeking feedback on my first single-page web app using RequireJS and a web worker. I converted it from a Java applet, and the code is up on GitHub. It's a combat ...
3
votes
1answer
33 views

Snippet to get all local classes from a module

I'm working on a project which due to the complexity of the business logic has had to pull out some classes to do computation related to some values in a database. To link the code and database, both ...
3
votes
1answer
196 views

Somewhat less semi-primitive IRC bot - follow-up

As of now, instead of the previous 4 or 5 out of 10 (relative to my C# programming skill), I'd say I'm a solid 6, and some of that is thanks to the advice I got from the last revision. I realize the ...
3
votes
1answer
149 views

Listing an optional Python dependency in setup.py

I have a small project that requires a third-party module that's rarely updated (once every other year or so) and not maintained by any package management system. The context, here, is cognitive ...
3
votes
1answer
482 views

Binary index tree optimization

I have written code for a binary index tree. My problem is that there are many functions based on the binary index tree the function stores the sum of element within a given range of binary index tree....
3
votes
1answer
69 views

Return path to rubygems.rb

From the command line, I can easily find the path to rubygems.rb $ gem which rubygems /usr/lib/ruby/1.9.1/rubygems.rb and ...
3
votes
1answer
70 views

JavaScript module to filter data and render it as a table

I want to organize some JavaScript code using module pattern. The scenario is as follows: Having the following html table created dynamically ...
3
votes
1answer
64 views

Simple JavaScript Module “Loader”

I have written a simple JS module "loader" (loader is in quotes because it doesn't actually load the files) that is designed to resolve simple dependencies between modules. It is heavily inspired by ...
3
votes
1answer
189 views

Decoupling with a self-descriptive mediator function

I don't have a lot of experience writing libraries and just recently started thinking a lot about structure and patterns. I wrote a tiny module manager based on the facade and mediator design ...
3
votes
1answer
378 views

Correctly dealing with closures and modularity in Javascript

The code below is designed to deal with this situation: There is a Battle environment with Characters; these Characters obviously have certain characteristics and abilities, and they need to be ...
3
votes
1answer
135 views

JavaScript templating language: ivy-markup

This library is a markup parser which is intended to be used in node.js and browser environment. I've decided to use Jasmine for tests. The library's name is ivy-markup. URL: https://github.com/...
3
votes
1answer
50 views

Copying and resizing pictures, depending on user input

I'm working on a macro which copies some pictures to a new sheet, then resizes the pictures. The user can input a number 1, 2, ..., 5 and, depending on the number, the macro returns a different set of ...