What is the use for having several projects in one solution?

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 2568 Views - Last Post: 03 October 2014 - 06:03 PM Rate Topic: -----

#1 Hikaros   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 24-September 14

What is the use for having several projects in one solution?

Posted 02 October 2014 - 12:27 PM

I've seen some people when doing examples of design patterns use projects instead of just going for simple classes.
What is the point of it? that made me wonder about something. If i'm making a desktop application that has a main parent form and then several dozens of children forms is it better to make a project for each children form or is it okay if i just create everything in a single project organizing everything neatly in folders?
Is This A Good Question/Topic? 0
  • +

Replies To: What is the use for having several projects in one solution?

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 15684
  • View blog
  • Posts: 62,805
  • Joined: 12-June 08

Re: What is the use for having several projects in one solution?

Posted 02 October 2014 - 12:34 PM

Typically I would say have it all in one folder, but if you need to share forms across different projects (like you have some sort of utility class) then make them separate.
Was This Post Helpful? 1
  • +
  • -

#3 rusoaica   User is offline

  • They're watching you, Neo!
  • member icon

Reputation: 220
  • View blog
  • Posts: 691
  • Joined: 10-March 12

Re: What is the use for having several projects in one solution?

Posted 02 October 2014 - 12:36 PM

Here is an example where you might want to use two projects inside a solution: lets say you design a custom control that you want to use into another project and maybe, reuse it even in other solutions. You create a project for that custom control. But then, you want to use that control you just created into some program. Instead of mixing the codes of your control class among the forms of your program, you use a solution that has two separate projects: one contains the class of the custom control, the other is your actual program. In order to use your custom cotrol inside your program, all you need to do is add a reference of the control project to the dependencies of your program project. That way, you keep your control separated from your program and you can work cleanly, without making a mess out of your program. This way, you can also easily set the output of the custom control project to a Dynamic Link Library, which you can use into other projects.
Hope this helps!
Was This Post Helpful? 2
  • +
  • -

#4 tlhIn`toq   User is offline

  • Xamarin Cert. Dev.
  • member icon

Reputation: 6537
  • View blog
  • Posts: 14,450
  • Joined: 02-June 10

Re: What is the use for having several projects in one solution?

Posted 02 October 2014 - 01:59 PM

First: If you are starting a new project in WinForms jump in your time machine and leave 1980's. Join the rest of us in the 2010's.

Second: Multiple projects in one solution examples:
  • Client & Server. Client is one project, server is one project, shared classes is one project
  • Program and library(ies): Your custom controls are one project, your program, networking library, RFID reader library, shared RegEx library, blahblahblah library
  • Multi-target: Main program, 64bit code, 32bit code, Windows PC code, Windows phone code

Was This Post Helpful? 3
  • +
  • -

#5 Hikaros   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 24-September 14

Re: What is the use for having several projects in one solution?

Posted 02 October 2014 - 04:18 PM

Ohhh i understand, thanks guys.


First: If you are starting a new project in WinForms jump in your time machine and leave 1980's. Join the rest of us in the 2010's.


hahahahahaha why would you say that? what is in 2010? xD
Was This Post Helpful? 0
  • +
  • -

#6 Damage   User is offline

  • Lord of Schwing
  • member icon

Reputation: 300
  • View blog
  • Posts: 1,989
  • Joined: 05-June 08

Re: What is the use for having several projects in one solution?

Posted 02 October 2014 - 04:31 PM

check out his signature, WPF
Was This Post Helpful? 0
  • +
  • -

#7 Hikaros   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 24-September 14

Re: What is the use for having several projects in one solution?

Posted 02 October 2014 - 04:48 PM

ooohh WPF hahaha i guess i'll take a trip to 2010 and see what's good because i've never seen WPF stuff before. (i'm not even that old >.< ) Thanks!
Was This Post Helpful? 0
  • +
  • -

#8 Skydiver   User is offline

  • Code herder
  • member icon

Reputation: 7357
  • View blog
  • Posts: 24,846
  • Joined: 05-May 12

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 05:38 AM

Lately, even for my simplest non-trivial code that has a command line only interface, I have a solution with at least 2 projects: The first project contains the shipping code, and the second project contains my unit tests for the shipping code.
Was This Post Helpful? 0
  • +
  • -

#9 Hikaros   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 24-September 14

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 07:07 AM

View PostSkydiver, on 03 October 2014 - 05:38 AM, said:

Lately, even for my simplest non-trivial code that has a command line only interface, I have a solution with at least 2 projects: The first project contains the shipping code, and the second project contains my unit tests for the shipping code.


But if i'm not wrong that is kind of forced, isn't it? i mean, i don't think you can have unit tests classes in a normal project, or can you?

For other things i find it kind of pointless (i am quite inexperienced so i don't really know). Like for that one video i saw where someone was explaining the MVP design pattern and for the model he used one project, the view was another and the presenter another. I thought it was over complicating something simple but since i didn't really know i came to ask x_x

This post has been edited by Hikaros: 03 October 2014 - 07:09 AM

Was This Post Helpful? 0
  • +
  • -

#10 rusoaica   User is offline

  • They're watching you, Neo!
  • member icon

Reputation: 220
  • View blog
  • Posts: 691
  • Joined: 10-March 12

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 07:30 AM

Its always a good practice to separate things that DO different things. You should never mix a unit test with your other codes (even if it is possible). On simple projects, it may look as if its not worth the complication, but in larger projects, it will give you hard times finding things, organizing or working with them. If you teach yourself to always split your work in at least the big functional parts, you will find it easy when you will jump in for the larger projects.
A quick example: what if a major software company would put all the codes in a single project? Can you imagine what a mess would Skype's codes look like if they were all in one place, for instance?

This post has been edited by rusoaica: 03 October 2014 - 07:30 AM

Was This Post Helpful? 2
  • +
  • -

#11 Hikaros   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 24-September 14

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 07:36 AM

hahaha i guess you are right. i suppose i should start doing that.
Was This Post Helpful? 0
  • +
  • -

#12 rusoaica   User is offline

  • They're watching you, Neo!
  • member icon

Reputation: 220
  • View blog
  • Posts: 691
  • Joined: 10-March 12

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 07:40 AM

Even if some programming practices may look odd or over-complicated to a beginner, they simply exist because more experienced programmers before you encountered some problems and they developed solutions for them, that stood the test of time. And the sooner you start learning to program correctly, the better. You will find its difficult to correct some bad habits, after you got used to them. The extra time you will spend now to learn the right principles of programming will save you BIG headaches and countless hours of extra work later ;)/>

This post has been edited by rusoaica: 03 October 2014 - 07:42 AM

Was This Post Helpful? 3
  • +
  • -

#13 Hikaros   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 24-September 14

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 08:21 AM

You are right, it is just so confusing at the beginning though x_x
Was This Post Helpful? 0
  • +
  • -

#14 rusoaica   User is offline

  • They're watching you, Neo!
  • member icon

Reputation: 220
  • View blog
  • Posts: 691
  • Joined: 10-March 12

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 08:35 AM

I was in your position a few years ago, and to my shame, i had my share of bad programming practices. First, i was that kid of programmer that wanted to create PC games in a month, and didn't quite bother to read much theory. I just jumped into codes. I must admit, that also had a good part, but unfortunately, it was the hard way of doing things. When i got to the point where i was banging my head against the walls because of problems, i realized i need to organize the process of learning to program. That's where i started to learn theory, to learn what debugging is, what are the correct ways of programming, etc. Now, i like to think about myself as an average programmer, with strong programming knowledge, willing to improve myself. :)/>

This post has been edited by rusoaica: 03 October 2014 - 08:51 AM

Was This Post Helpful? 1
  • +
  • -

#15 Curtis Rutland   User is offline

  • (╯□)╯︵ (~ .o.)~
  • member icon


Reputation: 5106
  • View blog
  • Posts: 9,283
  • Joined: 08-June 10

Re: What is the use for having several projects in one solution?

Posted 03 October 2014 - 12:49 PM

Quote

i mean, i don't think you can have unit tests classes in a normal project, or can you?


There's actually nothing that requires unit test "classes" to be in a unit test project. You can add the required references to any project and include the [TestMethod] attributes and such, but it's more trouble than it's worth (and it's not worth any trouble at all, it's better to keep it separate).
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2