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?

aschultz
  • 107
  • 1
  • 7
Saad
  • 151
  • 2
  • see [Where to start?](https://softwareengineering.meta.stackexchange.com/a/6367/31260) – gnat Jul 03 '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 03 '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 03 '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 03 '17 at 18:28
  • Of course yes, but do cite the works you have glanced into – Basile Starynkevitch Jul 03 '17 at 18:57
  • 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 03 '17 at 19:08
  • Start here: https://chessprogramming.wikispaces.com/. The list of publications here https://chessprogramming.wikispaces.com/Search may explain better what I am talking about. – Doc Brown Jul 03 '17 at 19:14

3 Answers3

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.

Christophe
  • 74,672
  • 10
  • 115
  • 187
  • Reading great novels will not make us good writers, but not reading great novels won't do this, either. – Doc Brown Jul 03 '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 03 '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 03 '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 03 '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 03 '17 at 19:48
  • This was meant to be one of those projects of things which i am passionate about. I wanted to create a chess engine which i could call my own. There are several tutorials and video series out there which goes over concepts by providing source code, which is great to understand and learn how a chess engine is suppose to work. But just following along others, i dont think i will have something which i can call own creation. – Saad Jul 03 '17 at 19:58
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.

Robert Baron
  • 1,132
  • 7
  • 10
-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.

Logesh
  • 1
  • 1