Results 1 to 5 of 5

Thread: Development Shortcuts

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2016
    Posts
    100

    Development Shortcuts

    Is there a way to cut down on development time for an application framework? Sort of like skinning? Where like in web design, you can simply buy or use free templates as a basis for your designs, and then simply tweak them to your liking. Can that be done for applications to reduce development time?

  2. #2
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,902

    Re: Development Shortcuts

    Yes, you just use inheritance. Have a read of the "TemplateMethod" pattern. It's normally used to define template behaviour but is just as applicable for template skins. You simple define your "skin" as an abstract class and then inherit your concrete implementations from it.

    Here's a fairly straightforward .Net example
    The best argument against democracy is a five minute conversation with the average voter - Winston Churchill

    Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd

  3. #3
    You don't want to know.
    Join Date
    Aug 2010
    Posts
    4,578

    Re: Development Shortcuts

    Eh, I don't know that there's an easy way. Current software engineering wisdom is if you're not careful with inheritance, it's just as likely to paint you in a corner as to help you out. "Code reuse" is an ideal, and it's often hard to tell today what you're going to reuse tomorrow.

    I'm not meaning to contradict FunkyDexter here. This is a topic where if you ask 5 people you should get about 8 answers. Here's what works for me so far:

    If you're doing the same kind of thing over and over again, you'll get a good feel for what kind of code you tend to reuse. If you try to write an application framework on the 2nd try, it's going to be garbage. If you try it on the third try, it'll be garbage that stinks a little less. If you try it on the 4th, it's better, and so on.

    This is why modern software engineering suggests writing very small classes with very loose coupling. I seriously mean it's OK, in this model, to have almost all of your classes define just 1 method. Sometimes 2. The parameters, if any, should be primitive types like String or Integer. Types like that are easy to just drop into any project, because they don't tend to be entangled with any specifics.

    So if I wrote a ZipCodeParser in project A, and it just has this method:
    Code:
    Public Function Parse(ByVal input As String) As Integer
    There's nothing stopping me from using that in ALL of my projects. But when I write my code like this:
    Code:
    Public Function ParseZipcode() As Integer
        Dim input As String = txtZipcode.Text
        ...
        Return <something>
    End Function
    Well, that's not very useful unless I've already done some work with my Form, right? It turns out a project with 100 1-method classes is usually a better treasure trove of reusable code than your typical "I have 3 forms and 30k lines split between them".

    Likewise, for UI: the first time you do a project just write whatever the heck you want. The second time, start paying attention to which things are the same between the two. The third time, start making UserControls and other convenient things for common tasks.

    For example, there's a user in .NET General who is trying to get some complicated "iterate over my Controls collection" code to figure out which of two radio buttons in a specific group box is checked. Older minds have suggested a UserControl that just exposes a String property, which is really what he wants in the end. He's still trying to make the Controls collection code work, bless his heart.

    The rule of thumb from The Pragmatic Programmer is "If you do something the second time, notice it. If you do it the third time, write some reusable code for it."

    There's no "right" way in the end. Just "Did I finish the project?"
    This answer is wrong. You should be using TableAdapter and Dictionaries instead.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Posts
    24,482

    Re: Development Shortcuts

    There is a trade off between granularity and utility. The more fine-grained the reusable code the more reusable it is, but the greater the effort required to reuse it and the amount of additional glue code to be rewritten for each such reuse.

    Looking for a recipe for success that applies universally is a sucker's game. Each case needs separate consideration, and that's where developer experience comes in.


    But this idea of coding based on templates has some merit. It is limited in practice though to a small set of canonical patterns or archetypes. This weakness is why 4GL "languages" didn't eat the world: they were based on a fairly small set of archetypes meant to cover 80% of needs but in reality met less than 10% of needs adequately.

    This sort of thing has pretty much died out except in newcomer communities where the hard lessons must be relearned from scratch. There is often far too much of a "not invented here" attitude that if nipped in the bud can save a lot of large-scale reinventing of wheels. Does anybody but a .Netter ever speak of "patterns" anymore? No, and this why .Net shops tend to be backwaters of anti-innovation that frequently miss deadlines and lead to very expensive project cancellations. Too many promises made, too little ability to deliver. Living huddled inside walls perpetually re-papered with self delusion does that.


    The truth is that the generic cases that these paint-by-numbers techniques address can either be handled with an off the shelf application or turned over to the cheapest of cannon fodder coders. Give them a RAD toolkit and you can reduce turnaround time too. Quantity over quality only takes you so far though. Look at the travesty known as Cordova for example.

  5. #5
    Smooth Moperator techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,538

    Re: Development Shortcuts

    Quote Originally Posted by JohnnyWaffles View Post
    Is there a way to cut down on development time for an application framework? Sort of like skinning? Where like in web design, you can simply buy or use free templates as a basis for your designs, and then simply tweak them to your liking. Can that be done for applications to reduce development time?
    Your analogy is off. Here's why - websites are generally the same, they have a header, footer, content, and some sort of navigation. What is different is how those elements are rendered and presented to the user. There may or may not be additional elements, but basically that's what makes up every website. Because they are all like that, it very easy to template them.

    Applications on the other hand, don't lend themselves to templating in the same manner as easily. A word processor works completely different from a spreadsheet, which is different from a web browser, which is different from an invoicing system. The others have talked about inheritance and reusability and so on. There's also frameworks and design patterns,things like MVC and MVVM that allow some templating to be used, but at the end of the day YOU still have to write that code that makes a word processor do what it does. Or a web browser. Or an invoicing system.

    So taken in the vein of the example in your post - no, there is no such thing. But taken as a more abstract question, yes, but only to a certain extent.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width