Friday, February 11, 2011

What's the single most important piece of documentation?

You are joining a project to maintain an existing system. There is no written documentation at all, but the previous team offers to write one piece of documentation. And they are going to let you decide what it should cover: What is the single most important piece of documentation?

This is a poll: give only one document type per answer and let other readers vote.

  • Full system test specification for the whole system.

    jop : +1. I'll ask my friends to vote for this too. :)
    Greg Dean : It appears that you have 7 friends. Stop using SO
    From David
  • If I can only get one part of the documentation, I want to know the overall design and how things are supposed to fit together and work with each other. The hardest part of any new system is figuring out the landscape. The rest is just work.

  • A high level roadmap. Where do I find the major functional areas, and how do they tie together?

    From Andrew
  • Doxygen (or doxygen-like) documentation for the source code. Completed, please, no forgetting to write the tags for half the classes.

    From Throctukes
  • Crazy question - "one piece"? What is the "piece" of documentation?

    My request would be to create a "complete documentation, at least 500 pages of written text". Is that one piece? :)

    1800 INFORMATION : You mean "8 meters of written documentation", right? http://thedailywtf.com/Articles/Very,_Very_Well_Documented.aspx
    From Suma
  • How to set up the development environment: A step-by-step instruction which gives you a complete environment in which to check-in/check-out code, build, debug, deploy, test, run and perform all your daily tasks.

  • Contact details for the original development team.

    Failing that, I would definatly say a software build document describing how to manage, modify and build the codebase. Alongside a list of known 'gotchas'.

    brian d foy : Along with that, what sort of beer they like to drink so you know how to bribe them :)
    From TK
  • A Good (TM) description of the problem domain and what the application is supposed to do.

    6eorge Jetson : Agreed! When the problem domain is well understood, the typical slew of use cases can be refactored/reduced to an underlying core set. Programming against this core set should position the app to be within small solution domain tweaks to address the "edge case/last mile" requirements
    Andrew : The business should be able to supply that. It shouldn't need to come from the previous team.
  • Detailed requirements of what the application is supposed to do. Good luck though, I have never managed to get this. Even from an army of documenters, willing to write billions of documents.

    From Greg Dean
  • obviously there's no real answer to this situation. whatever technical documentation you choose, you're going to have to dig into the system and figure it out. IMHO, and I'm not trying to be a smart ass here, the most important piece of documentation in this case is "how things got to be the way they are"- an organization politics/resources review of the conditions that led to the "no documentation and project is being transferred to another team" situation.

    Arne Evertsson : Interesting answer! I didn't think of the political aspect.
    From Amir Arad
  • Not documentation in the traditonal sense, but a virtual machine or ghosted image of the working build/test machine would be very useful.

    How to set up the development environment would be most useful though.

    From Ash
  • For existing projects, assuming that the testing is end to end, the test scripts act as an accurate source of status-quo. Most often documents don't get uplifted to represent the updates, but test cases are. However, the test cases are seriously limited in that they fail to provide the rational behind why the system is designed so/exists so. An architecture diagram is needed complement this.

    From questzen
  • Step-by-Step disaster recovery procedure.

  • What the business rules & reasons for each decision are.

    Everything else can be done by any good developer - but without knowing the business reasons for functionality, you're doomed.

  • For databases ERD. All else, unit tests.

  • Project log - we're great believers that when key decisions are made you should be recording why you chose to go down a particular route and more importantly why you chose not go down an alternative route.

    Having this in place helps to stop future developers from making the same mistakes again and wasting a lot of time.

    From Carl
  • I want the docs for all of the data structures. When and how they are used, what each of their members are, and what they store. I especially want to know how the data structures map to the problem being solved. If I understand the data structures, then I can often skip most of the code, because I can guess what it does. If I don't understand the data structures, then I need to read a bunch of code to figure out when and how they are changed and what they're supposed to hold and why.

    From Glomek
  • this is a pretty good question, not that you would ever get a situation like this (you will generally get zero documentation).

    my choice is a toss-up between two things: a system test plan as others have said, so no surprise there. reason being is that test-cases teach you how the software works. at least the style of test plan i use does (i did a blog article on this, shameless plug -> http://pm4web.blogspot.com/2008/07/writing-system-test-plan.html).

    the other one i would go with, and this may seem a little strange, so bare with me - is a project schedule. i dont know how relevant this would be for an already established system, but i have had it a few times now where ive arrived at a new company and been greeted with a disaster zone (i.e. projects running behind schedule, clients laying siege to our office, etc). the single biggest help would of been if i stopped and created a project schedule, outlining all the tasks needed to achieve the business objectives. you cant create a decent schedule without understanding the system along the way.

    • LM
    From louism
  • A list of administrator logins.

    From elmnoise

Automatic Update and checkin of AssemblyInfo.cs files occasionally causes partial fail

We have TFS 2008 our build set up to checkout all AssemblyInfo.cs files in the project, update them with AssemblyInfoTask, and then either undo the checkout or checkin depending on whether the build passed or not. Unfortunately, when two builds are queued close together this results in a Partially completed build as the AssemblyInfo.cs files seem to be checked out at an earlier version to the previous checkin.

In order to get around this I thought that I could use the "Get" task to force the AssemblyInfo.cs files to the latest version before updating them, but this appears to have no effect. Any ideas?

<Target Name="AfterGet" Condition="'$(IsDesktopBuild)'!='true'">
<Message Text="SolutionRoot = $(SolutionRoot)" />
<Message Text="OutDir = $(OutDir)" />
<!-- Set the AssemblyInfoFiles items dynamically -->
<CreateItem Include="$(SolutionRoot)\Main\Source\InputApplicationSln\**\$(AssemblyInfoSpec)">
  <Output ItemName="AssemblyInfoFiles" TaskParameter="Include" />
</CreateItem>

<Message Text="$(AssemblyInfoFiles)" />

<!-- When builds are queued up successively, it is possible for the next build to be set up before the AssemblyInfoSpec is checked in so we need to force 
    the latest these versions of these files to be got before a checkout -->
<Get Condition=" '$(SkipGet)'!='true' " TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Workspace="$(WorkspaceName)" Filespec="$(AssemblyInfoSpec)"  Recursive="$(RecursiveGet)" Force="$(ForceGet)" />

<Exec WorkingDirectory="$(SolutionRoot)\Main\Source\InputApplicationSln"
    Command="$(TF) checkout /recursive $(AssemblyInfoSpec)"/>

  • Does your build re-write the AssemblyInfo files and then check them back in? Or do you just modify the AssemblyInfo files locally. Personally I prefer the latter approach - as documented over at the TFSBuild recipies site:

    http://tfsbuild.com/AssemblyVersioning%20.ashx

    I've never actually sat down and checked but I was wondering if you checked in the AssemblyInfo files then could the following be happening which might be causing your problems...

    1. Request a build, current changeset = 42
    2. Build 1 for changeset 42 starts running
    3. Request a build, current changeset = 42 (still)
    4. Build 2 for changeset 42 queued
    5. Build 1 checks in new assemblyinfo files, current changeset = 43
    6. Build 1 completes
    7. Build 2 for changeset 42 starts, dows a get of changeset 42 meaning AssemblyInfo files are the fold ones.

    As I say, not exactly sure when the changeset number is determined for the build - at the time of queuing or at the time of running. It would make more sense for it to be at the time of queueing though.

    Damien Ryan : You're right, we check out, modify and then, once the build has succeeded, check in again. This is to make sure that the modified AssemblyInfo.cs matches our modified build number and to help if we need to rebuild a previous version. I'm assuming the second get command isn't the way to go?
  • Changing:

    <Get Condition=" '$(SkipGet)'!='true' " TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Workspace="$(WorkspaceName)" Filespec="$(AssemblyInfoSpec)"  Recursive="$(RecursiveGet)" Force="$(ForceGet)" />
    

    To:

    <Get Condition=" '$(SkipGet)'!='true' " TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Workspace="$(WorkspaceName)" Filespec="$(AssemblyInfoSpec)"  Recursive="True" Force="True" />
    

    Has forced the AssemblyInfo.cs files to be overwritten with top of tree. It's been working so far, but is more of a hack than something elegant.

wxPython: displaying multiple widgets in same frame

I would like to be able to display Notebook and a TxtCtrl wx widgets in a single frame. Below is an example adapted from the wxpython wiki; is it possible to change their layout (maybe with something like wx.SplitterWindow) to display the text box below the Notebook in the same frame?

import wx
import wx.lib.sheet as sheet

class MySheet(sheet.CSheet):
    def __init__(self, parent):
        sheet.CSheet.__init__(self, parent)

        self.SetLabelBackgroundColour('#CCFF66')
        self.SetNumberRows(50)
        self.SetNumberCols(50)


class Notebook(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, size=(600, 600))
        menubar = wx.MenuBar()
        file = wx.Menu()
        file.Append(101, 'Quit', '' )
        menubar.Append(file, "&File")
        self.SetMenuBar(menubar)
        wx.EVT_MENU(self, 101, self.OnQuit)
        nb = wx.Notebook(self, -1, style=wx.NB_BOTTOM)
        self.sheet1 = MySheet(nb)
        self.sheet2 = MySheet(nb)
        self.sheet3 = MySheet(nb)
        nb.AddPage(self.sheet1, "Sheet1")
        nb.AddPage(self.sheet2, "Sheet2")
        nb.AddPage(self.sheet3, "Sheet3")
        self.sheet1.SetFocus()
        self.StatusBar()

    def StatusBar(self):
        self.statusbar = self.CreateStatusBar()

    def OnQuit(self, event):
        self.Close()


class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(450, 400))
        self.text = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE)
        self.Center()

class MyApp(wx.App):
    def OnInit(self):
        frame = Notebook(None, -1, 'notebook.py')
        frame.Show(True)
        frame.Center()
        frame2 = MyFrame(None, -1, '')
        frame2.Show(True)
        self.SetTopWindow(frame2)
        return True


app = MyApp(0)
app.MainLoop()
  • You can use a splitter, yes.

    Also, it makes sense to create a Panel, place your widgets in it (with sizers), and add this panel to the Frame.

    bvmou : Could you add a few tips on how I might do that, with reference to the above classes?
  • Making two widgets appear on the same frame is easy, actually. You should use sizers to accomplish this.

    In your example, you can change your Notebook class implementation to something like this:

    class Notebook(wx.Frame):
        def __init__(self, parent, id, title):
            wx.Frame.__init__(self, parent, id, title, size=(600, 600))
            menubar = wx.MenuBar()
            file = wx.Menu()
            file.Append(101, 'Quit', '' )
            menubar.Append(file, "&File")
            self.SetMenuBar(menubar)
            wx.EVT_MENU(self, 101, self.OnQuit)
            nb = wx.Notebook(self, -1, style=wx.NB_BOTTOM)
            self.sheet1 = MySheet(nb)
            self.sheet2 = MySheet(nb)
            self.sheet3 = MySheet(nb)
            nb.AddPage(self.sheet1, "Sheet1")
            nb.AddPage(self.sheet2, "Sheet2")
            nb.AddPage(self.sheet3, "Sheet3")
            self.sheet1.SetFocus()
            self.StatusBar()
            # new code begins here:
            # add your text ctrl:
            self.text = wx.TextCtrl(self, -1, style = wx.TE_MULTILINE)
            # create a new sizer for both controls:
            sizer = wx.BoxSizer(wx.VERTICAL)
            # add notebook first, with size factor 2:
            sizer.Add(nb, 2)
            # then text, size factor 1, maximized
            sizer.Add(self.text, 1, wx.EXPAND)
            # assign the sizer to Frame:
            self.SetSizerAndFit(sizer)
    

    Only the __init__ method is changed. Note that you can manipulate the proportions between the notebook and text control by changing the second argument of the Add method.

    You can learn more about sizers from the official Sizer overview article.

    bvmou : This is extremely helpful, thank you DzinX
    From DzinX

Disable the error message box while loading an external movie with actionscript 3

I have a compiled swf file and a I can't edit it, but the movie is working fine (but gives an error message with a message box).

I am using it from an other movie (load with as3 code). When the loader movie loads it the error message box appears.

I wonder is it possible to disable the errors while loading a movie with as3.


Here is the error in the message box:

"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at motionsound11_fla::_all_29/motionsound11_fla::frame249()"
  • Can you elaborate on what the error is? This might help figure out if there's a workaround for that specific error, or maybe that its not possible to supress (for example, the box warning of a blocked local or network access attempt).

    If you google for 'swf decompiler' you'll find a myriad of options for generating some actionscript for your SWF, which might allow you to fix the problem directly, or at least diagnose it further.

    From Paul Dixon
  • Yes. Here is the error message (editted my first post):

    "TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at motionsound11_fla::_all_29/motionsound11_fla::frame249()"
    

    And I don't want to decompile my movie. It becomes more complex when decompiled. Yes, for understanding the problem I did. But my first problem is disable the error message box.

    Thanks so much.

  • I might be wrong here, but I'm not sure the release version of Flash player plugin would produce an error like that - are you running this in the debug plugin? What you could do is test on a box you know has never been used for development - it's possible the error simply won't appear when you deploy your application.

    That said, any Flash developers who use your app might still see it!

    Hasan Tayyar BEŞİK : The loader wont be on a web page. It will be used as .swf file or executable file
    Hasan Tayyar BEŞİK : Now i decide to publish as web page. This way, the project will be more secure and dynamic. Thanks
    From Paul Dixon
  • Yes, You are right. There is no error in a browser (with flash player plugin). My project wont be in a browser. It will be an executable file (.exe) or .swf . So people who have "Adobe Flash CS3" on their computers will see the error in swf format file.

    (i will add this information to my question : " The loader wont be on a web page. It will be used as .swf file or executable file" )

    And your answer is acceptable. I will publish as html page not .exe or .swf. This will be more secure,dynamic and has no platform dependence.

    Thanks.

What happens when I edit web.config?

I need to edit the web.config file on a live Sharepoint environment, but I'm unsure what will happen if I do (I want to output custom errors).

Will this cause the IIS6 worker process to recycle?

Will active users lose their session state because of this?

Or can I safely edit the file?

  • I believe this resets the application and user's will lose session state.

    From RyanFetz
  • It will make the application restart.

    From Kristian
  • The app pool recycles and as such session state is lost.

    From SteveCl
  • Yes, the AppPool will recycle and session state will be lost.

    From JacquesB
  • The application pool will restart and session state will be lost. Imagine each ASP.NET application (as defined in IIS) is a program on the desktop. Saving web.config will do something similar to closing the program and reopening it.

    1. Yes. It will be recycled.
    2. Yes. They will lose their session.
    3. Yes. You can safely edit the file. I suggest you to read this MSDN article : Working with web.config Files in Windows SharePoint Services
    willem : A very useful MSDN article. Thank you!
  • If you have any thoughts of editing the web config, please look into the SPWebConfigModification class.

  • As already mentioned by some people: the application pool of the site in IIS will restart (this typically takes a couple of seconds). As a result the next page request(s) will be slower (since nothing will be cached anymore). Also the session state of the users will be lost; BUT in WSS session state is not used by default, in MOSS it is used by InfoPath Form Services. So it could be that you don't have big issues related to losing session state.

    On the other side; to overcome those issues: what is typically done is to create a SharePoint Solution (WSP) that deploys and starts a Timer Job to make the changes to the web.config from code (using the SPWebConfigModification class of the Object Model). The nice thing is that you can schedule the execution of the change, so your users won't notice it.

  • Also if Session state is configured as out-of-process (database or service) then recycling the app pool won't lose any session state. This is as true for Sharepoint as it is for vanilla ASP.Net.

    From piers7
  • Concur with all of the above, I'd also like to point out that a backup (just a quick file copy even) of any manually edited web.config file is handy in case you screw up a quotation mark somewhere and break your website :-)

    From tekiegreg

What kind of programming environment do you use to write your Windows-based Games?

I've used XNA and Visual Studio 2005 integrated with Flash. I'm curious to see what environments other people use and prefer.

  • Same. XNA 2.0 in VS2005 or XNA 3.0 in VS2008.

    I've also dabbled in darkGDK when I feel like some C++.

    Joe Morgan : I'll have to check into darkGDK - I've not done C++ in 3 or 4 years, but it's where I got my start. Thanks for the suggestion.
    From JTA
  • Although not Windows-specific, I have used pygame, which can use DirectX as a backend.

  • I use Dev-C++ and SDL

    From jwarzech
  • I developed some cross-platform 2D games (Windows as well) and used C++ with Geany and SDL.

    I find SDL to be a great library to make casual games. Of course, if cross-platform means Windows and XBOX for you, then there are other libraries that might be a better choice.

  • At Flying Lab for Pirates of the Burning Sea we used Visual Studio 2005. At Divide by Zero for we use Visual Studio 2008.

    From Joe Ludwig
  • Visual Studio 2008 with XNA 3.0 CTP is what I'm using at the moment. A lot of game development shops are still using VS05, however.

    From TraumaPony

Properly file Designer Files in ASP.NET Web Sites

I need to get existing web pages into an existing ASP.NET web site in Visual Studio 2008. I simply tried to drag and drop the whole file folder content into the Visual Studio Solution Explorer or even to copy them into the web site folder.

Both ways, Visual Studio seems unable to map the .designer.cs files to the corresponding .aspx (or .master) file, even after restarting the whole IDE. The Solution Explorer entry looks in a way like this:

- Main.aspx
    Main.aspx.cs
  Main.aspx.designer.cs

Can I make Visual Studio file the designer-file below the aspx-file in any way? Building the website becomes a problem too that way, but that's the next problem I'm going to work on. :-)

I strongly hope there is a simpler way than manualle creating each file and copying and pasting the contents into each file by hand.

Thank you for any idea!

Cheers Matthias

  • try copying the files through the filesystem and then right clicking on the project and selecting to add an existing item at which point you can choose all at once and this usually puts them in the proper places.

    From YonahW
  • Kind of partially self-answering my question:

    In a web project - in contrast to a web site - it works perfectly through drag and drop onto the solution explorer, as I did for the web site before. To make the decision which type of "web site unit" to use there is another thread here on stackoverflow: ASP.NET Web Site or Web Project.

    In a web site I can't even use YonahW's solution, because I can't just put files into the proper web site directory without causing them to be added to the web site automatically. Thanks to you anyway, YonahW. :-)

    From Mudu
  • It sounds like you are trying to bring web application files into a web site. IIf that is the case, The designer files are not even needed. Just dont include them. They are generated and compiled in at runtime when the website runs.

    Mudu : Thank you! Sometimes solutions are that simple and comprehensible, but you just need to know...
    From mattlant