Programming Theory

Programming theory deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual features, along with introductory programming concepts like program structure, variable declaration and conditional and looping constructs. Sub-disciplines include the formal semantics of programming languages, type theory, program analysis and transformation, comparative programming language analysis, metaprogramming, domain-specific languages, compiler construction and run-time systems.

Share tech news, updates, or what's on your mind.

Sign up to Post


I am new to github and it is being used in my company for issue tracking.

Anyone knows how to mark an issue "on hold" in git hub?

I have the disadvantage of coming from a procedural programming background. I've been studying OOP for several years now, and I'm working on a test project to improve my skills.

I'm hoping someone can help me transition my thinking to OOP.

Initially I think of the design in terms of data flow and what needs to be done:
Data Flow DiagramI then create classes for the various functions:
Data SourceData Reader is observable, using Publish/Subscribe for loose coupling. (The property is the data value. When the property changes, it fires a Property Change Event. Listeners subscribe and are handed the new data value.)
Data Reader
Data Smoother has a data Averager strategy which can change. In this example I use a Moving Average to smooth out the data. Moving Average strategy can easily be replaced with something else.

Not shown here, Data Smoother is a Property Change Listener which listens to the Data Reader. Data Smoother is also observable, so the Data Converter can subscribe to it.
Smooth DataData Converter then applies the function to the data. Data Converter subscribes to the Data Smoother. Data Converter is in turn observable.
Data Converter
Now I realize my class names are focused on the FUNCTION of what they do, rather than on the DATA, so I go back and rename my classes.

DataSource becomes RawDataSource
Raw Data SourceDataReader becomes RawData
Raw DataDataSmoother becomes SmoothedData.
CalculateMovingAverage becomes MovingAverage.
Smoothed DataDataConverter becomes ConvertedData
Converted DataMy flow diagram is:
Flow DiagramNow my qustion is:

I'm moving from a SQL and VBA background into Visual Basic .net.

I have a Question about Best Practice Class Structure.
I have an order that is saved in the database with fields
The CompanyID, OrderType and OrderStatus are just ID's that link to the appropriate Tables

Now in .net does my Order Class include properties for BOTH the ID's and the Names for these? (As Below)
Public Class Order

    Public Property ID As Integer
    Public Property CompanyID As String
    Public Property CompanyName As String
    Public Property TypeID As Integer
    Public Property StageID As Integer
    Public Property TypeNameID As String
    Public Property StageName As String

End Class

Open in new window

Or should the Order Class just include the ID's and get the names "On the Fly" somehow?
(I could retrieve the names from separate classes but wouldn't that involve more calls to the database?)

   New Perspectives on JavaScript, 2nd Edition
   Tutorial 4
   Case Problem 2

   Author:  Alexsaya Melendez   
   Date:      11/16/2015

   Filename:  puzzle.js

   Function List:
      Initializes event handlers for the cells within the Hanjie

      Toggles the background color of the active cell between
      black and white

      Shows the solution of the Hanjie puzzle

      Hides the solution of the Hanjie puzzle

      Checks the user's solution of the Hanjie puzzle

      Restores the user's solution of the Hanjie puzzle
      to its original state

   Global Variable List:

      An object variable referencing all of the clickable cells
      within the Hanjie puzzle


window.onload = setPuzzle; 

var allCells = new Array();
	function setPuzzle() {
	var puzzleTable = document.getElementById("puzzleCells");
	allCells = puzzleTable.getElementByTagName("td");

	for (var i = 0; i< allCells.length; i ++) {
		allCells[i].style.backgroundColor = "white";
		allCells[i].onclick = changeColor;
	document.getElementById("solution").onclick = showSolution;
	document.getElementById("hide").onclick	= hideSolution;

Open in new window

I have used a pattern I recall named something similar to "Model Value Attribute".

It enables me to have a list of items and each item can have unique attributes.

Know what I am talking about?

Can you recall the correct name?
I've tried unit tests in the past, but I'd give up out of frustration. For example, I had a Silverlight project and trying to get unit tests to work there was a headache. This time, I'm more determined than ever.
   We have a few restrictions here: For example, I can only use the tools that come with Visual Studio 2015 Enterprise edition. Using apps that are available through Nuget are outside the scope of this specific question. My company has some strict policies on that. We can come back to those tools in future questions that I will surely be asking.
   Another restriction is that I'm not testing private or internal accessible methods. I understand that there is a big debate among developers as to whether or not private methods should be tested. For now, I'm keeping it simple. I'm only testing public methods.
   Another restriction is that I'm not doing Test Driven Development yet; the key word being "yet." I'm building up to that. Also, I'm not doing "test first, code later" yet either. I'm building up to that also. For now, I'm just creating tests for the legacy code that I've started on already.
   My self-education plan is to first learn to test my legacy code, then understand the "test first" method, then grasp Test Driven Development, and finally graduate to full test driven development with design patterns and all that. (baby tortoise steps).

   Here is what I've done so far. I found a simple method and I changed it from internal to public. (I know it is …
Why would I ever use a generic method when I can just pass in an interface parameter.

Here is an example that uses a generic method:
        internal T DoSomething<T>(T value) where T : IDoIt
            return value;

Open in new window

Here is an example that uses an interface:
        internal IDoIt DoSomething(IDoIt value)
            return value;

Open in new window

   It seems to me that generics are only useful for basic types and for when an interface is not available. When would a programmer want to use one of the examples above instead of another ? Why use the generic method with the IDoIt constraint when he can just use an IDoIt parameter?  
   When is it better to use the generic method, and when is it better to use an interface parameter? Where would a generic parameter in a method be a better choice than an interface parameter in the method, and vice versa? For example, I can imagine a Strategy design pattern using either.

This is my program's code links on drop box

I need a such a program in which I could manage multiple programs in the same mdi window and also I need a menu from where I could arrange thes opened programs in the same project horizontally or vertically
Plese help me
I'm trying to convert some Legacy code to OOP, and I'm wondering how to deal with Logging.

I have a Main routine, which establishes a Log file.

Then I have some classes to instantiate, and code in those classes would like to write to the Log file.

The two choices I see are:
1. Pass something about the log file to the classes as a parameter
2. Have a global somewhere which everyone tries to write to

The first option leads to endlessly passing a log file parameter around.

The second option makes the code dependent on external environment. (The code is no longer encapsulated, loosely coupled.)

What's the third option I'm missing?

To further complicate the issue, I'm trying to merge 8 nearly identical but subtly different copies of the code (yes over time they made 8 different versions). My idea is to move the duplicate parts into a common Library.

I've examined other projects. I see one which uses a static Logger class (all the methods are static). It looks like I might be able to reuse it.

The other thing I would like is to print log messages both to the console and also to the log file, so somewhere I need a tee function. Where would such a function belong? The current Logging module I'm looking at appears to use the Strategy pattern, so you can log to a file, OR to the console, but not both.

How would I convert this to have the option to send log messages to more than one place, without making a bunch of modifications to …
Our embedded product is based on Renesas RH850F1L Microcontroller.  We have large code base written in 'C' language.

The following function returns EEPROM value to calling library.

signed short GetDeltaMin ( void )  
     signed short param;
     NVM_Read ( ( unsigned char * ) &param );
     return (signed short) param;

Another software module needs to control value returned by GetDeltaMin ( ).   If another software module passes 1, return value from EEPROM, just like it's implemented above.  
If another module passes 0, return 0 to calling library instead of returning value from EEPROM.

How to design, and code this requirement ?

I'm thinking about providing following input interface to the user or another module.
I'll create new .c  and .h file as follows:

New File Activate_Deactive_I.c

void Enable_Disable ( Boolean State)
     /* user will pass 1 or 0 to this function. */
    /* Please finish wirting this function. */
   /* How will this function interact with GetDeltaMin ( ) function above ?  Please modify GetDeltaMin ( ).   */

New File Activate_Deactivate.h
extern void Enable_Disable ( Boolean State);   /* user will need to include this header file */
/* I don't think Activate_Deactive_I.c needs to include this header file ?   */
Hi Experts
i have Time attendance machine Finger Print and Card (we use only card)
it come with time attendance application called ZKSoftware
it a bit good but the output reports very bad
i need a good application can manage just our company attendance (No Payroll needed)
I've attempted to produce a flowchart (of sorts) of how my coding logic should work.  But, as you can see from the diagram, there are 7 key points (shown as empty Stars) where if an error occurs, I'm not sure how to handle it.

This is an app that will allow a user to manage a custom mailing group.  For that group, there will be one DL that contains all the members, and then a security DL that lists those that can send to it.

I want to allow them to make changes through this tool -one or many.  They can modify the display name, the owner, the sending size limit, etc.  Some of these are adjustments that would be made in AD.  A couple are changes that would only be reflected within the notes field of the member DL (and later, a SQL database).

My problem is, the way it's arranged, if they want to change the name, owner and members, it could modify the name and owner, but if the membership minimum isn't met, it would abort the process, leaving that info field not updated with the prior two successfull changes.

How can I design this process so that it will work correctly?

One thought is to test the membership adjustment up front, but that could leave me with the same issue if there's an error with other changes.

The other thinking was that I update that info field for every successful change - perhaps call a function.  I imagine that's the correct approach, but I wanted extra opinions.
I was in a discussion today, and I heard someone ask a Scrum Master:  How did you manage the pools

What did he mean when he asked this question.

What does the phrase (manage pools) refer to, and how what would be the options?

Can any one show me  - C# Coding Standards and Best Programming Practices document or some guide to follow.Thanks
In the contexts in which I studied Scrum, it is usually development oriented, with a Product owner assigning priorities to tasks and negotiating their level of effort and acceptance criteria with the dev team.

My question is how do you use Scrum in a maintenance environment, where you have a stable system, and what usually happens is trouble tickets or reports will come in, and the project leader will assign the problem to various personnel.  Does Scrum work in this environment.  I ask because the management concerns would probably bring a lot of pressure to change assignments of the most proficient programmers if a problem with a huge severity comes in during the middle of a sprint.

How would Scrum work in this case, and would Scrum actually be a good and useful candidate to lead such a project given the realities of the situation.  Do firms currently use Scrum when handling maintenance issues, and if so how would they handle a problem with a huge severity during the middle of a sprint?
I'm reading lookahead construct in regular expression. It seems it has to be more with understanding how regular expression engine precedence rule. Below is the explanation of lookahead, but I'm not exactly understanding when the engine evaluate the ?! and ?= condition. Does the engine goes to all the way to end of Regex expression, then evaluate 'match' or 'fail', then come back to the very begining and reevaluate?
The last example becomes more complicate.

First, let's see how the engine applies q(?!u) to the string Iraq. The first token in the regex is the literal q. As we already know, this causes the engine to traverse the string until the q in the string is matched. The position in the string is now the void after the string. The next token is the lookahead. The engine takes note that it is inside a lookahead construct now, and begins matching the regex inside the lookahead. So the next token is u. This does not match the void after the string. The engine notes that the regex inside the lookahead failed. Because the lookahead is negative, this means that the lookahead has successfully matched at the current position. At this point, the entire regex has matched, and q is returned as the match.

Let's try applying the same regex to quit. q matches q. The next token is the u inside the lookahead. The next character is the u. These match. The engine advances to the next character: i. However, it is done with the regex inside …

Request is for a design solution that can be applied to a number of processes.

A Business organization want to use another organization's processes to run their institution. The latter's processes have unique literals specific to the organization.  The programmer is being asked to do a mass retrofit of all object's containing literals specific to the one's organizations.

For those with PeopleSoft experience -- the objects below will be familiar to you.

First part of the plan:  Find the literal
1. SQR Objects (like database scripts) -- use perl to extract the literal references in batch
2. Component Interfaces - use component interface to access fields stored on pages or in events (not sure about app packages but we don't have many of the latter)
3. App Engines - use the PeopleSoft metasql to search out the literal

Second part: Replace with a variable
1. sqr programs --- I could use a LOAD LOOKUP
2. Component Interface --- need to understand a bit more
3. App Engine programs -- Update sql steps  -- need to examine more.

Third Part: Reference the variable that contains the literal >>>>>>Stuk at the moment <<<<<<<<.  What would be the most efficient way of accessing this.
ie Run Control page where you populate each time???? Reference Table.

Note : The organization will have there own separate database but use the same 'retrofitted' programs.  

This is just some of the brainstorming I am beginning to do.  Any …
0 uses the term ScrumMaster (one word), where uses the term Scrum Master (two words).  however, ScrumAlliance was the original organization and still has more members and a larger network, especially the education network.  

So which term is the industry standard when describing the position:  ScrumMaster or Scrum Master?

How often does a Product Backlog  Refinement occur?  Every Sprint?  Every three monts, etc.

There does not appear to be a specific recommendation in the Sprint definitions, what happens in reality?

Once a Sprint planning meeting has been completed, the PBI's that were accepted by the dev team are placed into the sprint backlog.

So does the Sprint backlog contain only the PBI to be completed in this sprint, or does it contain the tasks that the dev team identified had to be completed during the sprint

As I tell people about Scrum, many people ask the same question:  since the object is to become self-organizing and you have changed the role of the traditional project leader, how do you (or the ScrumMaster) handle alpha-employees who try to take over the role of leadership within a self-organizing team?

Any thoughts or commentary ?

Many thanks
Are unions in C++ what the Gang of Four Design Patterns book refers to as singletons?
I have read the Scrum Guide and seen many presentations on Scrum, and I can probably list out all the responsibilities of a Scrum Master, things like remove impediments, coach the team, etc.

I think I can easily see what the Product Owner does, as I have performed similar responsibilities as a Project Manager, but I can not quite wrap my head around what the Scrum Master does for a living.

Beyond the summation of roles performed, I need to understand what the Scrum Master does practically.

Could someone please give me  a more specific example of something Scrum masters do, or perhaps point me to a YouTube video showing what he does (I say the video of what the Scrum Master should NOT do)

I was looking at this site explaining Scrum Burn-down charts

What caught my eye was the following:

Sprint Duration – 2 weeks 
Team Size       - 7 
Hours/Day       – 6 
Total Capacity  – 420 hours

Open in new window

So the total hours per day during being used in this example is six,, not eight.

Is that normative for planning purposes.

Would the six hours per day include daily sprints, sprint reviews, sprint retrospectives, etc.

In general:

Are Product Owners assigned to more than a single team at one time ?

Are Scrum Masters assigned to more than a single team at one time ?

Do most organizations employ  the same number of Product Owners as Scrum Masters ?


Programming Theory

Programming theory deals with the design, implementation, analysis, characterization, and classification of programming languages and their individual features, along with introductory programming concepts like program structure, variable declaration and conditional and looping constructs. Sub-disciplines include the formal semantics of programming languages, type theory, program analysis and transformation, comparative programming language analysis, metaprogramming, domain-specific languages, compiler construction and run-time systems.