How to build my own Java Math library?

Building website for math students, first-time programmer, need some guidance.

  • Building website for math students, first-time programmer, need guidance. I posted http://ask.metafilter.com/223769/What-are-the-most-marketable-computerprogramming-skills-in-the-Seattle-job-market a month ago regarding learning programming after an MA in Math. I finished Think Python in about a month and wrote code to solve virtually all the exercises (good exercises), but accidentally sudo rm'ed them from the Unix shell, so I lost all but three or four programs. I'm still disappointed about this, but I still have code where I programmed a game of N-player tag, and simulated (Monte Carlo) probabilities of various Poker hands, correct to .001. Right now I'm halfway through a 600-page book on Java (Schildt's intro book; exercises are dull). I finally have an idea of a real project for myself, as opposed to these toy exercises. I'd like to build a website for my (college) math students with games and tests to incentivize and improve their performance. It'd be private (they'd have to log in with a password), they'd select their own avatar and name, their scores and performance will be recorded, and they'll compete against one another in various ways. It'll be entertaining and fun, with a nice GUI. I'd like to get a shell up before I start making the interface fancy, but I'm mildly ambitious about the end product. It'd also be a general "course webpage", with accessible private information such as grades, as well as public announcements such as course policies and announcements. I think this could go somewhere, but I've never done this before. What should I know and study besides Java and Python with an eye towards this project? Is it too early in my development, am I moving too fast, etc.?

  • Answer:

    The point is to gain programming experience, and make those novice mistakes and learn what they are, so I can avoid them in the future. The thing is that in many cases you wouldn't necessarily realize you're making mistakes -- instead of learning from them, you'd just be ingraining bad habits. You can learn a lot more about good coding practices by working closely with a well-written framework than by floundering around on your own. If you're just looking for an excuse to play around and write some code, that's great, reinvent all the wheels you want. But you're talking about exposing real student data, including grade information -- until you have a solid grounding in web security and common code exploits, this is a Very Bad Idea Indeed. Not to mention the satisfaction of building something for myself and not just appropriating someone else's work. Using frameworks isn't "appropriating someone else's work," it's getting past the boilerplate code so you can focus on the parts you really care about. It's also a way of ensuring that the boilerplate actually works, has been thoroughly tested, and is reasonably secure, so you're not building on a foundation of sand. In a very real sense, no software is written from scratch anymore: you're always dependent on other people's work (including everything from frameworks to engines to code library dependencies to the server environment in which your code exists.) 80% of being a good developer is making good decisions about which code to depend on, and when it's better to use existing battle-tested code versus building from scratch. (Further reading: "build versus buy," "not invented here syndrome"). I don't want to use anyone else's interface; I want to use my own. The college I teach at has a math course management system popular with a few instructors, but it strikes me as clunky and not nice to look at. All course management systems include a way to customize the interface. Some are more flexible at this than others -- if you have specific interface needs, determining whether a given framework can support them is an important part of the selection process. As a secondary point, good interface design is hard; it's a skillset separate from but as difficult as -- and as time-consuming as -- the nuts-and-bolts writing of code. Your planned process (write code first and bolt an interface on after the fact) is pretty much one of the classic mistakes-you-won't-know-you're-making. (It's also one made by far too many professional developers, unfortunately: it's very very easy to slip into designing your interface around the way your code works as opposed to designing your code around the way your interface should work -- I'm primarily an interface designer but even I catch myself doing this sometimes when I'm in a code-writing headspace.)

brighteyes7 at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Don't try to build this from scratch. Plenty of course management systems already exist, including https://moodle.org alternatives-- you don't want to get bogged down in wheel-reinvention, and working with an existing framework rather than a blank slate can help you avoid a lot of novice mistakes.

ook

I don't want to use anyone else's interface; I want to use my own. The college I teach at has a math course management system popular with a few instructors, but it strikes me as clunky and not nice to look at. The point is to gain programming experience, and make those novice mistakes and learn what they are, so I can avoid them in the future. Not to mention the satisfaction of building something for myself and not just appropriating someone else's work.

brighteyes7

One of the most important lessons in programming is how to leverage other people's products effectively. But if you want to do this, the first thing to study would be a web framework like Django. Also effective backup practice.

grouse

Web development is a whole field on its own, so if your goal is to make a web site, I would hold off on Java for now and study HTML5, Javascript, and CSS. Java is worth knowing, but it sounds like Python will meet your current needs fine. Once you can build basic web pages, you can come back to Python for your server-side code. I think grouse is right that Django is a good framework to start with - it supports a variety of development styles and will get you off the ground quickly. I would get used to the idea of building on other peoples' code, since you invariably will be: you aren't going to write your own operating system, or web server, so don't feel weird about not writing your own web framework, Javascript libraries, etc. Before you start in earnest, get familiar with a source control tool like Subversion or Git and get your backups under control, so you won't lose your code again. Lastly, security is a very tricky subject with a lot of subtleties to master. I would avoid putting any truly private or sensitive data into something you plan to use with your students, since they may well break it wide open.

pocams

Thanks everyone. I think I'll try to make a pared-down version of the site and activities first. I didn't think it would be so complicated that I'd have to re-use other people's pre-existing code - but maybe I gave the wrong impression. Certainly I'll have to get used to that practice.

brighteyes7

As an example, my phd adviser and his buddy both did their phds in France concurrently. Both did some kinda computationally heavy combinatorics. At the end, they each had written about 50k lines of code; they compared their output and found that about 49,000 lines were redundant: stuff they had both written. They had each spent months building up these libraries, only to provide that 2% that was really specific to their respective theses. (They went on to do a lot of work on http://sagemath.org.) Collaboration and using pre-existing code can save you many, many months of effort. Let other people be experts in web security and interfaces; what you're really interested in is building these multi-player applications. So build those, and then figure out how to interface them with Moodle (or whatever) to submit the results of the multiplayer activities to the grading scheme. FWIW, it sounds like an awesome project to me (I work a lot with using computers and awesome activities to make math accessible to Kenyan undergrads and school students), and I would love to see the outcome!

kaibutsu

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.