How do you design your code?
-
Good grief. A question that is both simple and complicated at the same time. I start designing my code by thinking about the user and the problem. I come up with an idea of the data that needs to be managed and I figure out what needs to be persisted. From that I start with a schema using an schema editor I wrote to get some basic tables. I start mocking up some UI's either on paper or in a designer to see what sort of views I need to visualize the data. Once I have the views I can wire them up to the UI's and do some testing of the user workflow/storyboard. I figure out an initial plan for the different components and their relationships to each other, which I diagram out in Visio. If the interactions are complicated enough, I use UML sequence diagrams. If I'm writing an API or a framework, I'll do some class modeling, but mostly for high-level application components, I write execution workflows using pre-canned methods. I figure out what application specific stuff needs to go into plug-ins that the execution workflow can interface with. If the application needs to manage runtime state, I'll usually do a state diagram in Visio then enter the state information in this XML state designer I use. Sometimes determining state transitions is complicated so I use this XML decision tree designer to create the if-then-else decision tree. That same component is used not just for state but for other things like validation and certain types of business logic. On occasion, I'll use UML actor diagrams to create a high level view of the actors and the interaction between the actors. Umm, I think that's about it. I'm too sleepy to think of anything more. Marc
Marc Clifton wrote:
Good grief. A question that is both simple and complicated at the same time.
I try my damndest to confuse myself like a pro :laugh: Great post, I appreciate the insight into your process. I think that creating execution workflows and/or story boards for different scenarios is a must for future scalability. Maybe I should be diving into the new visio as well to see what 2007 brings. Thanks
-
I personally follow some steps that I defined for myself. 1.) I start out by writing a list of requirements in xml, prioritized. No schema, just simple xml. 2.) Following the list, make sure I know how to implement every single one of them. If I don't, I create a so-call spike solution to figure out how something is done in code. This step is important, otherwise, your estimation will most likely inaccurate. 3.) At this point, I create some uml diagrams to visualize the how things should look like. Don't try to specifies all type members in Uml diagrams, you really don't want to spend time maintaining it just to keep it in-sync with your code. 4.) Create a schedule at this point and use excel or xml to sort out the tasks. 5.) Code & Test :)
.jpg wrote:
2.) Following the list, make sure I know how to implement every single one of them. If I don't, I create a so-call spike solution to figure out how something is done in code. This step is important, otherwise, your estimation will most likely inaccurate.
Like Gi-Joe says "Knowing Is Half The Battle!" I tend to keep a dev solution open for random forms and functionality tests at all times throughout the day. that way I don't clutter my solutions but I can still test or demonstrate as needed. I believe even the Microsoft Solutions Framework has a learning phase where team skills are measured against application needs and skill/training is aquired/handed out appropriately. Thanks For The Insight, It Is Greatly Appreciated
-
i think about it, then i start typing. things rarely end up looking like my initial estimation, but they end up doing what they need to do.
image processing toolkits | batch image processing | blogging
Similar approach here. Think a bit and try to get a basic concept of how it would work in my head. Once I have that i tend to create classes in the top down approach.. highest level to hide the details, then dummy classes/methods etc. to build as I go along
'Howard
-
werD420 wrote:
Are there any UML tools that you've found exceptional for certain tasks like generating UML from existing code or vice-versa? or any other resources/communities you've found helpful?
StarUML has a few bugs and qwerks, but will get the job done. Enterprise Architect is far more advanced, but costs a pretty penny. Metamill I have used successfully also. If you are willing to put in the effort to learn the tools, those and many others will help you. I do suggest getting one that will generate a skeleton, or better yet modify existing methods (adding a parameter, or a method, or a property, etc.). This can save you some of the redundant code outlining after design is done. the design generates the skeleton and you put in the rest. It just helps return some of your design time.
_________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
-
werD420 wrote:
Are there any UML tools that you've found exceptional for certain tasks like generating UML from existing code or vice-versa?
I've found Enterprise Architect[^] to be really handy. Cheers, Drew.
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
Not very hight tech, but I use a pen and notebook. I have tried software and such, like StarUML, but I realized that I would have to learn so much just to make it right that I went back to a pen and paper. I will still learn UML, just not "today".
Ben
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
For me, it's all about breaking the problem into chunks that are small enough that I can get a real grasp on them. I'll likely document them with some form of 'box and line' drawing that illustrates the layering of the components or their interactions and some text that gives the scope and responsibilities of each of the components. I've always been of the opinion that you don't want to get too het up about the design - I've worked on safety-critical projects that (quite reasonably, given the constraints on these projects) have very detailed design. You really don't want to do that for your average PC application.
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
It depends, at work if I'm starting a large project I'll design it all in UML first. We've just started using Enterprise Architect for that and it can create you're base classes and method stubs for you but I'm kind of picky over code layout and presentation so I code it all by hand anyway. At home and for some smaller projects I'll sketch out a diagram of what I want first, build the business objects, design and write the data access layer if I need one, write the presentation layer, hook it all together and then create the GUI. You know I can remember a time when I'd just write it and re-factor it if needed, when the hell did this start getting so long and complex? One thing I'll avoid at all costs is anything which creates code for me (except for the GUI part), I use to use Dreamweaver and that tainted my opinion of automatically generated code for life. Now I'm going to go and get a coffee, review a weeks worth of Dilbert cartoons and reminisce about the good old days when programming was programming and not object lifetime diagrams :laugh:
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
-
Coding without a plan??? how can you see your targets... Even Harry Potter had a plan and that made it successful!!!!
Here's my perspective as someone who has returned to programming after a break of 20 years (who stole my Pascal compiler and my 6502 assembler?) - when all these fancy design aids weren't even dreamt of! Here, I'm not referring to anything big, just an addition to a project that will probably not require more than 3,000 lines or so. Working on my own app I get nobody to give me a set of requirements so the first step is always to make the decision as to what is the most useful functionality to include out of the list of ideas that is always at the back of miy mind. I decided there was one feature that was of vital importance to add to the (nearly complete project). I spent most of the weekend just thinking about this from a user's point of view. By definition, the process would have to involve quite a bit of user interaction so what would be the easiest method for a user? Having narrowed this down to two techniques, I then began to think about (roughly) how I could accomplish the task, in outline and two different "technologies" soon became leaders of the pack. I preferred the use of one (because it involved one less step that the user could get wrong) but thought it might be a lot harder to implement than the other. Spent a few hours experimenting with a test (on the harder method) to extract and analyze data from a certain file type to ensure that I could do what I wanted. It worked thus deciding whih technology to use. The result of this test re-inforced further thought about which way to implement the process from the user's point of view. I'm now strting to think about how the UI should behave and this leads to thoughts about data structures, what the user could do "wrong" etc. I then started to design some pages of user information as though I was writing an insruction manual. Get someone else to read it. Is it as clear as you imagined? At this stage, the words can run away with you and suddenly you have a document three times the size you imagined as the brain suddenly thinks of refinements or problems that hadn't occured to me before. With the big decisions taken, I then used Word (yeah sorry) to type out a skeleton design in what, in 1983, was called pigeon Algol. This tended not to get down to the method level but quite close to it. From this position, it was very quick to go to code. Day 1 (Monday) and I have 1250 lines of code, unit tested and working which is far superior to my output when I've started to code with a less clear idea of what I want to achieve. I genu
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
You just do it. In all sincerity - it's just sort of there. Or, put another way, you kind of know what to do. Some of that comes from experience - but much of experience is learning defensive techniques against the enemy hoards (i.e., end users). Now, that doesn't mean you don't occasionally slash-and-burn something (visual or code), and I don't mean because the specs were changed. You will occasionally have a rethink. The rest is simply problem solving for the occasional new situation (grin). How matter-of-fact it all is! In all seriousness, I counsel you against too many bells & whistles in your design tools. They should be there to do the dirty work when you are manifesting your thoughts. When you stop getting "I just thought of a better way" moments, you may consider seeking employment in a less challanging environment.
"The difference between genius and stupidity is that genius has its limits." - Albert Einstein
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
I usually read all I can about the inputs and outputs and requirements (if there are any) and then take a nap. After that I usually have a really good idea on what I'm going to do. I usually write down a few notes to remind me what I'm going to do so I don't forget. I then drink a redbull type out the code. After the app is complete my boss comes back to me and says we need to do design reviews and code reviews. (So I take another nap :laugh:) Joe Q PS This is how I really do it except for the last nap.
-
a borne natural programmer would never ask just a question. I start in the middle and work it out from there. programming is a creative endeavour, so your question is a bit like asking a novelist how to write a novel - aarrrrrggghhh perhaps that's why so many contemporary novels seem to be the same - they all went to writers school, and they all learned to write in the same way - like houses made of ticky tacky p
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
Just start typing ideas and build on them as I go along. Eventually rewrite everything to make it more usable. Definitely not the best way, but it works for me.
-
i think about it, then i start typing. things rarely end up looking like my initial estimation, but they end up doing what they need to do.
image processing toolkits | batch image processing | blogging
To be honest, I'm very design heavy. I often come up with solutions that is a bit of overkill. The reason why I do this is I want something for free after my given project is done. So if a control is needed, then I make sure that I push my assumptions out to some form of config file and then everything else is really general. That way, being the "lazy programmer" that I am, I get to take that control with me to other projects. Sooner or later, I look like a super star with a large bag of magical tricks. As for design tools, I use UML on paper (I like to write OO if available in the given language). I also use the internal tool in VS2005 that is quasi-UML. I think it's called class designer. As for conceptual models I use Design Patterns. Why should I have to come up with robust conceptual solutions when its already done for me :) ? I find a lot of the software industry in South-Western Ontario Canada (including TO), is focused more on time than on quality and reuseability. To me this seems ass-backward cuz if you write a giant, heavily-coupled, monolith you don't have anything to show for the next project and maintenance is a total pain. I could go on forever. Have fun.
-
Very Interesting post. I haven't dealt much with UML, but its a very exciting concept. I've just read the introduction to UML on the OMG site and im about to crack into the spec now. Are there any UML tools that you've found exceptional for certain tasks like generating UML from existing code or vice-versa? or any other resources/communities you've found helpful? Thanks a lot
Actually, I'd like to hear this too. The Class Designer in VS2005 is a little on the weak side. Better tools are great. But to be honest, I don't want to have to pay 10K$ for one of these either. That seems to be more the case than anything for UML to code tools.
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
How I design my code depends a lot on the size and scope of the project. If I'm just writing a new module for an existing system, I'll probably take an existing module and just modify that, with very little actual "deisgn" involved. If I'm working on a new single program I tend to do a lot of brainstorming and note taking with basic pen and paper. If I'm working on an entirely new system, I'll spend a lot more time with the planning, but it's still mostly pen and paper. I find that medium much more conducive to creative thought that any software I've tried. For the most part the mechanics of using a software package for planning and design just gets in the way of my creative process (whatever that is) and hinder rather than help. If someone every manages to design a program that enhances rather than interferes with the design process they could make a fortune.
Meddle not in the affairs of dragons, For you are crunchy, and good with mustard.
-
I’ve been trying out different methods for planning out projects and code. I've tried some things like mindmanager http://www.mindjet.com/us/[^] and freemind but still usually end up just typing a rough draft/outline in visual studio and fill in the blanks from there. So, I was wondering what everyone else uses for this sort of thing? Is there a built in productivity tool for doing your code architecture that I'm missing or a nice third party app that gives me a nice visual representation for colleagues but doesn't slow down my code writing process 'Thanks 'DrewG
I am using the old school which means analysis and then design. Using analysis methodologies like bottom-top and then top-bottom (which take more time than today expectations) will give results very accurate. What tools for design? You can use pencil and paper is necessary (but you will have to know at least one or more methodologies), the most important is to understand methodologies like bottom-top and/or top-bottom. At the end you will have OOT,P,D,A, etc. Programming will be extremely easy since you will have everything on pseudo-code. :-D Roberto