Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am planning on writing a database. I know it's crazy and people will tell me there is no good reason to do so. I am really using it to get better at programming overall, this database wont be used in production. I am planning on writing it Ruby or Python. I have some experience with both languages, but no job or large project experience.

I don't want this to be a this is better than that randomly I really need some facts. The things that I need to know are which of the language are better at the following things.

  • Searching arrays/hashes?
  • Sorting?
  • Threading?
  • Sockets?
  • Memory management?
  • Disk Reads/Writes?
  • base64 encode/decode?

Again this is just a project for myself. I will port it on github for the hell of it, but I don't expect it to be amazing or going up against mysql or mongodb any day.

share|improve this question
add comment

closed as not constructive by gnat, Walter, Winston Ewert, maple_shaft Sep 13 '12 at 16:46

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

3 Answers

Neither Python nor Ruby give the user much direct control over memory management. All you can really do is try to anticipate and/or manipulate the garbage collector to do what you want. If your aim is to learn about memory mangement, you may want to consider writing a custom C module for Python that handles your "core" data objects. Or simply do the whole project in a language like C or C++.

The same is true of disk reading and writing. You just don't have the control in interpreted languages like Python/Ruby that you'd have in a "lower level" language. And so if your aim is to make something high-performance, then this isn't the route you want to go down.

On the other hand, things like sockets and threading are pretty well supported in both languages. I'm more partial to Python myself, but I believe Ruby has similar structures for threading.

Your other questions, around search, sort and string management are really where your programming skill would come in. If your intention is to learn about these things, then your choice of language is just preference; as it's these things you'll be implementing yourself; surely?

share|improve this answer
    
yeah i can understand why C or C++ would be better choices for this type of project I really plan on learning more ruby and python just because there are a lot more jobs looking for those skills and using this as a way to improve my understanding of the lanauges. I do understand that the search sorting and string mangngment will be mostly me, thank you so much –  WojonsTech Sep 13 '12 at 10:10
add comment

Python has many useful modules such as cpython, numpy, and gevent which might help greatly in speeding up writing as well as running the code. Python comes with threading and the ability to program with concurrency and asynchronously through the use of modules. I think designing your own database engine includes an intense amount of design and forethought, before any amount of code is considered.

As a suggestion to your aside in your post

" I am really using it to get better at programming overall"

and your comment

"I really plan on learning more ruby and python just because there are a lot more jobs looking for those skills and using this as a way to improve my understanding of the lanauges"

How about you consider what specific skills those jobs are looking for and learn more about that in specific. For example there are many Python web developer jobs out there, perhaps dive in to one of the well-known web frameworks and try and build yourself a small restful app or something.

share|improve this answer
    
The reason I am not looking to build my self a small restful app in python is because I have made two in PHP so far, so the skill to do it in python would not be to much of a new exeperancese, but building something like a database is something new. –  WojonsTech Sep 13 '12 at 11:41
add comment

I would probably run with python here. Mercurial, a DCVS which effectively does many of the things that a database would need to do, is written entirely in python and seems to be performant enough for anyone short of Linus.

share|improve this answer
    
you have a very good point on that. I will consider that for sure. –  WojonsTech Sep 13 '12 at 10:10
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.