{"action":"closed","issue":{"url":"https://api.github.com/repos/imfrancisd/PowerShell-Assert-Library/issues/7","labels_url":"https://api.github.com/repos/imfrancisd/PowerShell-Assert-Library/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/imfrancisd/PowerShell-Assert-Library/issues/7/comments","events_url":"https://api.github.com/repos/imfrancisd/PowerShell-Assert-Library/issues/7/events","html_url":"https://github.com/imfrancisd/PowerShell-Assert-Library/issues/7","id":71718005,"number":7,"title":"Abstract the creation of assertion messages.","user":{"login":"imfrancisd","id":11506276,"avatar_url":"https://avatars.githubusercontent.com/u/11506276?v=3","gravatar_id":"","url":"https://api.github.com/users/imfrancisd","html_url":"https://github.com/imfrancisd","followers_url":"https://api.github.com/users/imfrancisd/followers","following_url":"https://api.github.com/users/imfrancisd/following{/other_user}","gists_url":"https://api.github.com/users/imfrancisd/gists{/gist_id}","starred_url":"https://api.github.com/users/imfrancisd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/imfrancisd/subscriptions","organizations_url":"https://api.github.com/users/imfrancisd/orgs","repos_url":"https://api.github.com/users/imfrancisd/repos","events_url":"https://api.github.com/users/imfrancisd/events{/privacy}","received_events_url":"https://api.github.com/users/imfrancisd/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/imfrancisd/PowerShell-Assert-Library/labels/on%20hold","name":"on hold","color":"fbca04"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-28T21:53:58Z","updated_at":"2015-08-15T05:30:29Z","closed_at":"2015-08-15T05:30:29Z","body":"# Problem\r\nAlthough the user of the library can combine the functions in this library to create new assert functions, the user must still create Verbose, Debug, and Error messages manually.\r\n\r\nFor example:\r\n````\r\n    function Assert-MyObject\r\n    {\r\n        [cmdletbinding()]\r\n        param($myObject)\r\n        try\r\n        {\r\n            assert-true (test-number $myObject.x -gt $myObject.y -type int32, int64, double -matchtype)\r\n            assert-true (test-string $myObject.name -normalizationform formc)\r\n            assert-exists $myObject.members {param($member) [object]::equals($member.z, $myObject.z)}\r\n        }\r\n        catch\r\n        {\r\n            # user must create and display failing message\r\n        }\r\n        # user must create and display passing message\r\n    }\r\n````\r\n\r\nThe problem with the user creating messages is that it will be difficult for the user to create assert functions that feel like the assert functions in the library.\r\n\r\nIn other words, the library has \"primitive expressions\" and has ways of \"combining those expressions\", but the library needs more support for \"abstracting those expressions and combinations\".\r\n\r\n### Sources\r\nThe Elements of Programming\r\nhttps://mitpress.mit.edu/sicp/full-text/sicp/book/node5.html\r\n> A powerful programming language is more than just a means for instructing a computer to perform tasks. The language also serves as a framework within which we organize our ideas about processes. Thus, when we describe a language, we should pay particular attention to the means that the language provides for combining simple ideas to form more complex ideas. Every powerful language has three mechanisms for accomplishing this: \r\n> \r\n> • primitive expressions, which represent the simplest entities the language is concerned with, \r\n> • means of combination, by which compound elements are built from simpler ones, and \r\n> • means of abstraction, by which compound elements can be named and manipulated as units. \r\n> \r\n> In programming, we deal with two kinds of elements: procedures and data. (Later we will discover that they are really not so distinct.) Informally, data is ``stuff'' that we want to manipulate, and procedures are descriptions of the rules for manipulating the data. Thus, any powerful programming language should be able to describe primitive data and primitive procedures and should have methods for combining and abstracting procedures and data. \r\n\r\nLecture 1A | MIT 6.001 Structure and Interpretation, 1986\r\nhttps://www.youtube.com/watch?v=2Op3QLzMgSY&t=28m08s\r\n"}}