4

When I start a new project, I tend to look at other people's source code who have implemented the same project. This gives me an idea on how the overall project is supposed to be created and the basic flow and the implementation logic of the program.

The problem with this approach, I feel, is that I am not thinking for myself from scratch, and my own project ends up being almost like a clone of the other project.

Currently I am trying to make a chess engine, and to get started I will have to look at other open source chess engines out there. This will give me an idea of how a chess engine is supposed to work and what its different components are, but as a drawback, I will then just be copying over someone else's design and their personal implementation.

When faced with a new project which is of a reasonable complexity, how do people get started?

  • see Where to start? – gnat Jul 3 '17 at 17:09
  • Sadly I think this is off-topic, because it actually is a pretty interesting question. You might be able to phrase it in a way that's relevant to the Computer Science Educators SE, but you should check their help center (or ask in their chat)- I don't want to make a recommendation only for it to get closed over there too. – Ben Aaronson Jul 3 '17 at 17:18
  • It is not art, you do not have to be original. On the other hand, no one is stopping you from thinking about it for while before you look how others have done it. You are not stealing anything, everything you find will be based on a combination of proven patterns. And if not (if it is really original), they probably didn't know what they were doing. – Martin Maat Jul 3 '17 at 17:29
  • Break it down into pieces. For your chess game, you need a board, tokens, a set of rules, turns, and some other things. Some are more abstract than others. Tackle each one separately in some order that makes sense. When you're done, you'll find that you have a working chess game, without having looked at any other projects. Use third-party libraries for things as appropriate. – mmathis Jul 3 '17 at 18:28
  • 3
    FWIW, for something like a chess game, I think it would be pretty pointy-headed to ignore decades of research and try to reinvent an engine from scratch. However, just trying to analyse someone else's source code is IMHO not the most efficient way for learning how chess engines work - there are whole book shelves available with high level descriptions about the theory of chess algorithms. – Doc Brown Jul 3 '17 at 19:08
2

Creativity

As you noticed yourself, this way of proceeding slows down your own brain, which puts itself in a comfortable passive mode. We all know that reading great novels, will not make us good writers !

Furthermore, you limit yourself to already existing designs. This will prevent you from making real breakthrough, innovate radically and differentiate your product from similar ones.

Remember Henry Ford: "If I would have listened to my clients, I would have invented faster horses". It's very similar, when looking at other's software.

Legal threats

In most countries around the world, ideas are free: you can protect the expression of an idea (copyright), you may protect an implementable technical solution (patent), or you could protect its secrecy (trade secrets). But you can't protect the idea itself.

Therefore, most of us think, that rewriting a software from the scratch, just with some knowledge of what other did, will avoid any intellectual property issue. Unfortunately, this is not the case. You may very well make a non-litteral copy without even realizing that you did.

Conclusion

Software is certainly a field where you learn best by doing yourself. So don't look for inspiration in other's code: build your own, refactor it, improve it, generalize it. But of course: don't reinvent the wheel; don't be ashamed of using available libraries or frameworks, so that you have more time to focus on what really makes the difference.

  • Reading great novels will not make us good writers, but not reading great novels won't do this, either. – Doc Brown Jul 3 '17 at 19:11
  • @DocBrown sure ! I didn't mean that one should never read code. Of course, it helps to read a couple of books before writing one's own. What I meant was that it's not a great idea to read a lot of books on exactly the same topic that you want to write on. And that you develop more creativity by trying to write than by reading. – Christophe Jul 3 '17 at 19:26
  • Good response! However, learning best by doing ourselves would not really work when the scope of project is very ambiguous and you have no clue even on how to break the project into smaller components. For this reason you do have to get that initial inspiration and a general idea by looking at other people source code. But as i mentioned this way indirectly we are limiting ourselves to the ideas of the original author and making a non literal copy without even realizing it! – Saad Jul 3 '17 at 19:39
  • For example if i am making an operating system, i would have to consult books and other research papers, but there is no way just reading those is gonna give me the nitty gritty details on how to implement it. Surely i would have to look at someone else toy operating system, and see how they have implemented it. And this way indirectly i will be using their idea to bootstrap my own project. I might have some new inspiration or creativity to add to it. But i dont think i can call it 100% as my own original invention. – Saad Jul 3 '17 at 19:45
  • 1
    @Saad if it's for learning purpose, why not start with less ambitious work and build up gradually ? For example, start with an othello, then read a book about ai, like for example patrick winston's, the revisit your othello, then start with chess, then read a book about chess strategy that speaks of position valuation/scoring, then go to v2 of your game, and so on ? Starting with something too complex generally ends up being demotivating. – Christophe Jul 3 '17 at 19:48
0

To implement a program just like someone else is pointless.

Better is to do some analysis, and see what they did well, and what they didn't do so well. This way, you can, during your redesign, make it better.

Concentrate on the algorithms used, and not so much of the structure. Try to figure out better, more efficient ways to implement those algorithms. Better still, try to figure out and implement better algorithms.

Have fun, and good luck.

-2

Try to search for a code, don't search for a idea because if you see anyone's idea basically our mind will be set for that idea. that doesn't allow you to think apart from that. Try to think own-self for a idea. While starting the project need to analysis requirements of the project. Re-usability is important that makes project as efficient.

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