Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody,
I' m doing online tutorials in learnvisualstudio.net with Bob Tabor of Microsoft to improve my c# and asp.net coding abilities(since I like both) .At the excercises we get, a lot of times I make a totally different solution(than the professor's solution) with the same results the excercise needs.No memory difference but different logic.Is this wrong or this is the magic of programming?

Thank you.
Posted
Comments
Andy Lanng 2-Oct-15 8:06am    
There are always many ways to achieve the same result. Few times will there be more than one "best" way, but that entirely depends on how you measure the codes 'fitness'. For me, I try for the most concise code but it will need to be maintained, possibly by someone else so the "best" way is often the most readable / understandable. This would not be so for a game for eg, where performance is priority.
George Tourtsinakis 2-Oct-15 8:26am    
Thank you also for great answer .

1 solution

One of the neat things about programming is that there are usually many ways to solve the same problem. Some are better than others, but often it's just a stylistic difference.

The only time you and your instructor's different solutions would matter, all else being equal, is that there is a particular technique which you were expected to apply and you didn't - even if your solutions is superior it would not be solving the problem as the technique, itself, was part of the problem's solution.

 
Share this answer
 
v2
Comments
George Tourtsinakis 2-Oct-15 8:10am    
Thank you sir.I understand .I always use the technique needed and asked so I can learn it else no point as you said.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900