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.

Does anyone design code outside of an IDE? I think that code design is great and all but the only place I find myself actually design code (besides in my head) is in the IDE itself. I generally think about it a little before hand but when I go to type it out, it is always in the IDE; no UML or anything like that. Now I think having UML of your code is really good because you are able to see a lot more of the code on one screen however the issue I have is that once I type it in UML, I then have to type the actual code and that is just a big duplicate for me.

For those who work with C# and design code outside of Visual Studio (or at least outside Visual Studio's text editor), what tools do you use? Do those tools allow you to convert your design to actual skeleton code? It is also possible to convert code to the design (when you update the code and need an updated UML diagram or whatnot)?

share|improve this question
add comment

migrated from stackoverflow.com Mar 15 '11 at 4:51

This question came from our site for professional and enthusiast programmers.

7 Answers

up vote 9 down vote accepted

When it comes to discussing a problem or designing, nothing beats the Whiteboard.

You should use a whiteboard and informal UML sketches to discuss things. After that you should go to the IDE.

It is slightly tedious to have formal and complete UML sketches for the design because, then you will have to maintain them as they tend to fall behind as code changes. Moreover, you can always generate a class diagram from your code using the IDE.

Also read UML as Sketch, UML as Programming Language and UML as BluePrint by Martin Fowler.

share|improve this answer
    
I just wanted to answer that my tools are pen and paper. I think the whiteboard is the same category, so +1. –  Philipp Mar 14 '11 at 16:10
    
@Philipp: Same principle, but a whiteboard is usually a bit easier if you are brainstorming and changing things a lot. –  Matthew Scharley Mar 15 '11 at 5:28
add comment

I sometimes use Enterprise Architect, It lets you design UML diagrams which allows you to generate an actual file of source code for the language of your choice. You do have to pay for it however they have a 30 day free trial so you can see how it works.

share|improve this answer
    
I'm very suspicious of this kind of feature - is the generated actually worth anything? –  delnan Mar 14 '11 at 15:51
    
It's definetly usable, formatted correctly and contains no fluff as it's only definitions for fields, methods etc.. –  Jamie Keeling Mar 14 '11 at 16:30
add comment

For C# the standard UML diagramming tool is Microsoft Visio. For Java, a popular UML tool is ArgoUML. Both have the ability to generate skeleton code from diagrams.

share|improve this answer
    
If the standard UML diagramming tool is Visio then that would explain it all as to why UML isn't as popular as one would expect. –  Dunk May 17 '12 at 15:28
add comment

I prefer to simply sketch out my more complicated designs on paper. I'd call it UML, but it's far from complete, and probably I use incorrect representations here and there. It only helps me to see how everything communicates.

When I have to create a design which involves more people, I create a decent UML and make sure I follow the standards. I still prefer to not create a complete UML, but only add those functions/members which are relevant.

I'm very interested in Model Driven Engineering however, but only to the extreme where all code is generated from a model (independant of the language), not just the skeleton. I'm also looking into different approaches than UML for these purposes, like DSLs.

share|improve this answer
    
It is generally agreed that no model can generate 100% of the application's code except for very trivial programs. You should then use a modeling approach that lets you include custom code for those parts that cannot be generated (Brooks calls it "essential complexity"). –  Rui Curado Sep 27 '11 at 15:07
add comment

I like to use the Class Designer that is built in to Visual Studio. It's simple to use and lets you easily jump back and forth betweeen code and the design, keeping them in sync with each other.

share|improve this answer
add comment

The question you ask is a very very common one in the software development community. People can see the value in having a UML model of their code, however they also realize there is extra overhead in designing the model and then writing the code (even if the code skeleton does come from the modeling tool).

My suggestion to ease yourself into it (without the overhead) is if you are doing a smaller project that your able to conceptualize in your head, then try writing your code first, then reverse engineering it into a tool such as Enterprise Architect. This is a non destructive process in that Enterprise Architect will not try and change or optimize any of your code and simply generate the UML class diagrams from the work you have done. This takes about 10 seconds.

From here you will have a new view on how your applications are put together and may find some ways of improving the design. At this point, if you choose, you can synchronize the model with your code again or make the changes to the code manually and sync the code with the model.

The other advantage is that you can now start building up a library of your code patterns which you can use to build your future applications quickly. As you have already solved those design problems in the past, you can just copy them from the previous project into your new project model. A good example of this a game engine - it basically stays the same from game to game, just the way the rest of the project interacts with that game engine changes.

Couple that with the extra features you get from modeling tools, including automatic documentation and integrated requirements management. You will find your projects should start to flow a lot smoother.

Code modeling is more than just UML, but its a good start. If i have been unclear about any point, feel free to ask!

share|improve this answer
add comment

Give NClass a try. It's a UML designer for C#. You can drag and drop classes, structures, and interfaces. You can even declare your classes as abstract. On top of that, you can declare functions, properties, and variables without writing a single line of code.

Then, once you're satisfied with the results, you can output your work as actual C# code, and build your program from there.

Pretty handy tool. And, it's free (as in free beer), and it's open source! I use it all the time.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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