Questions tagged [modules]

A logical subdivision of a larger, more complex system.

Filter by
Sorted by
Tagged with
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 ...
1
vote
1answer
85 views

Making a news widget webpage

I have finished the assignment but would love some feedback. Data.json contains news articles data. Requirements for assignment: Fetch the data and render it on the page. Initially the page ...
5
votes
1answer
158 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: (...
2
votes
2answers
441 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 ...
6
votes
2answers
813 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 ...
7
votes
2answers
1k 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 ...
2
votes
0answers
416 views

Modular Angular structure with Browserify

I am trying to create a basic angular template where all files are sorted into a modular structure and referenced using the browserify require method. I am very new to browserify and the CommonJS-...
2
votes
1answer
225 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 ...
0
votes
1answer
133 views

Designing a public API for a JavaScript module

I am writing a module that can access localStorage through a public API which exposes methods that allow string or array returns. It doesn't feel as though I'm ...
3
votes
1answer
228 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 ...
1
vote
2answers
1k views

Including the necessary polyfills for every combination of browser support

My project uses a Promise polyfill and the fetch polyfill, that I am only including if the browser does not yet support it ...
2
votes
1answer
83 views

Finding expiring/expired documents

This code is to find expiring/expired documents. It was included in one of the models, say Document. Is this good approach of using constant variables which holds ...
1
vote
2answers
170 views

Separate Ajax code in separate modules

This is the first time I am working on OOJS code and I am a beginner in JS. I think I have pretty much messed it up. I am planning to modularize my code, but with the inclusion of ...
2
votes
1answer
108 views

Node.JS Twitter Count Module

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%...
5
votes
1answer
1k views

RSS parser for Node.JS

I would like someone to 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 ...
2
votes
1answer
701 views

Move through a basic roguelike text map

I have a basic outline for the best way I can come up with to move a character through a basic text map. I want to implement this module in my simple text RPG. I know there has to be a better way to ...
3
votes
1answer
73 views

Framework to define and require JavaScript modules

I'm working on a webapp that I use gulp to build. It uses useref to gather and concatenate/uglify the assets used in the HTML files. In this case, as things are getting concatenated, it doesn't make ...
3
votes
0answers
113 views

Sourcemap translator service

This is my first attempt to a serious Node.js application, I've tried to follow the async style of Node at my best, but I have several doubts and I am sure that this code can be massively improved. ...
7
votes
1answer
174 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 ...
4
votes
1answer
130 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 ...
2
votes
1answer
360 views

Switching from functional jQuery code to object-oriented

I've been happily using jQuery, creating vars and binding events in my modules (which have only a little bit of JS). But recently I needed to add an anonymous functions to my code and after ...
3
votes
1answer
158 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 ...
10
votes
2answers
25k 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 ...
3
votes
1answer
534 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....
1
vote
0answers
52 views

Injecting required functions by synchronous script loading

I have a file HintBox.js containing a JS prototype of the same name which requires our internal JS library (call it $lib) in ...
9
votes
1answer
485 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 ...
2
votes
1answer
94 views

Custom module of common functions

I got sick and tired of writing certain functions over and over again, so I made a module that has those functions whenever I need them. I don't use it for code I plan on sharing, so I don't need to ...
6
votes
2answers
258 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: ...
3
votes
1answer
190 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
0answers
154 views

Implement.js JavaScript module pattern

I have been playing with a new JavaScript module pattern to see what I can come up with. I think it's quite powerful and wanted to know if it is something people would find useful? I'm looking for ...
2
votes
1answer
212 views

Am I using the JavaScript “module pattern” correctly?

I am reading this article about how you can organize JavaScript code for large projects. I am attempting to write a simple events calendar as a way to play with some of these design patterns. Using ...
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
106 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.... ...
16
votes
2answers
41k 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 ...
5
votes
1answer
228 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 ...
6
votes
2answers
681 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 ...
3
votes
1answer
73 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 ...
1
vote
1answer
112 views

Calling a Class Method on a Module

I have a module (in file dialect.rb) defined as such: ...
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
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, ...
3
votes
4answers
151 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 ...
2
votes
1answer
193 views

Javascript code pattern

I have been working on a javascript heavy project. There are sales, purchases, reports etc. What I've done is created a separate module for each i.e. a separate module for each i.e. a separate one for ...
4
votes
1answer
115 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 ...
2
votes
2answers
319 views

Finding correct format? Arrays and Modulation

I am fairly new to programming and I am having difficulty modulating the following code. The program reads a file, selects certain requirements, and displays them. I have tried to use passing arrays ...
4
votes
1answer
306 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 ...
3
votes
1answer
384 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 ...
0
votes
2answers
1k views

A flexible Ruby Observable module

I was learning a bit about about observers. Ruby has an Observable module, but I decided to make my own with a few tweaks. The first important feature is that this ...
3
votes
1answer
7k views

JavaScript modules loading with eval()

I recently asked to use eval() for a module function. Now I ended up doing a very weird function which does what I want. I like the idea I made it but I'm not so ...
1
vote
1answer
746 views

Mixin both instance and class methods in Ruby

I have a Ruby class into which I want to include both class and instance methods. Following the pattern described in "Ruby Pattern: Extend through Include", I'm currently using the following: ...
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 ...