使用原型模式动态配置app(configuring app dynamically using prototype pattern)
我正在阅读GoF书中的原型模式。 这是文本片段
动态配置应用程序:某些运行时环境允许您动态地将类加载到应用程序中。 原型模式是利用C ++等语言开发此类工具的关键。
想要创建动态加载的类的实例的应用程序将无法静态引用其构造函数。 相反,运行时环境在加载时会自动创建每个类的实例,并向原型管理器注册。 然后,应用程序可以向原型管理器询问新加载的类,没有的类;或者与程序一起使用
我上面的问题
作者的意思是“想要创建动态加载类的实例的应用程序将无法静态引用其构造函数”? 例如,如果我们使用动态链接库,我仍然可以使用new创建对象,那么作者的意思是什么,我们将无法静态引用构造函数?
请求举例说明如何使用原型模式动态地利用加载类应用程序。
I am reading about prototype pattern by GoF book. Here is the text snippet
Configuring an application with classes dynamically: Some runtime environments let you load classes into an application dynamically. The prototype pattern is the key to exploiting such facilities in a language like C++.
An application that wants to create instances of a dynamically loaded classes won't be able to reference its constructor statically. Instead, runtime environment creates an instance of each class automatically when it's loaded, and registers with a prototype manager. Then the application can ask the prototype manager for newly loaded classes, classes that weren't ;omled with the program orginally
My questions on above
What does author mean by "An application that wants to create instances of a dynamically loaded classes won't be able to reference its constructor statically" ? For example if we use dynamic link library I can still create object using new so what does author mean by we won't be able to reference constructor statically?
Request to give an example how prototype pattern is used to exploit load classes application dynamically.
原文:https://stackoverflow.com/questions/28214281
最满意答案
这应该做到这一点。
Select * FROM WorkItem WHERE WorkID Not in ( SELECT Distinct WIT.WorkID FROM WorkItemTrack WIT JOIN WorkItemTrack WIT1 ON (WIT.WorkID = WIT1.WorkID) AND (WIT1.Status=5) JOIN WorkItemTrack WIT2 ON (WIT.WorkID = WIT2.WorkID) AND (WIT1.Status=9) WHERE WIT.Status=3 )
This ought to do it.
Select * FROM WorkItem WHERE WorkID Not in ( SELECT Distinct WIT.WorkID FROM WorkItemTrack WIT JOIN WorkItemTrack WIT1 ON (WIT.WorkID = WIT1.WorkID) AND (WIT1.Status=5) JOIN WorkItemTrack WIT2 ON (WIT.WorkID = WIT2.WorkID) AND (WIT1.Status=9) WHERE WIT.Status=3 )
相关问答
更多-
序列中的间隙和岛屿是此问题的名称。 你读过这篇文章 Gaps and Islands in Sequences is the name of this problem. you read this article
-
您可以在SQL Server 2008 Express Edition中使用SQL Server更改跟踪 。 请参阅SQL Server 2008 R2版本支持的功能 。 You can use SQL Server Change Tracking in SQL Server 2008 Express Edition. See Features Supported by the Editions of SQL Server 2008 R2.
-
您可以使用LEAD窗口功能 - 对于SQL版本2012和更高版本... DECLARE @SampleData AS TABLE ( Id int, Department varchar(20), [Date] date ) INSERT INTO @SampleData VALUES (1,'English', 'Feb 3 2017'),(1,'English', 'Feb 4 2017'),(1,'Science', 'Mar 1 2017'), (1,'Maths', 'Mar ...
-
如何在sql server的Track Table中找到丢失的记录?(How to find the missing records in Track Table in sql server?)[2022-03-03]
这应该做到这一点。 Select * FROM WorkItem WHERE WorkID Not in ( SELECT Distinct WIT.WorkID FROM WorkItemTrack WIT JOIN WorkItemTrack WIT1 ON (WIT.WorkID = WIT1.WorkID) AND (WIT1.Status=5) JOIN WorkItemTrack WIT2 ON (WIT.WorkID = WIT2.WorkID) AN ... -
如果我理解正确,你想要找到所有已经取消分配但没有分配的人。 你可以这样做而not in : --First get all records that have a de-allocation SELECT LineID, PersonID, TransactionTypeID FROM TransactionHistory WHERE TransactionTypeID = 168 --Add not in clause to remove persons with that have an allo ...
-
没有看到你想要保存的数据很难确定,但我怀疑你有一个逻辑错误。 rowData的值是在循环中动态构建的。 哪个是对的。 rowData = wks_BackgroundData.Range("A" & iRowNo & ":AV" & iRowNo).value 但是,compare和value的值总是从循环内的相同位置读取。 所以delete语句会一遍又一遍地执行。 compare = wks_BackgroundData.Range("AV2").value value = wks_Background ...
-
罗嗦的问题,罗嗦的答案! ;) 我不是数据仓库专家,因此我不熟悉该领域的模式(和反模式)。 我说的只是一个可能做过类似事情的数据库开发人员。 就我而言,我们从处方药信息的大型源表中获取快照。 快照用于下游分析和报告。 用户指定快照标准,如日期和药物类型,通常会影响2米(相对于您的20米)记录。 这通常可以编译为120k(相对于您的10k)记录。 快照无限期保留,因为源表随时间而变化并且不是历史记录。 我分享了对快照拉动和存储冗余信息的担忧。 你的问题 - 你做的事情是愚蠢的吗? 有没有更好的办法? 从概念上 ...
-
我可能会建议采用暴力手段。 截断表格并插入所有值: truncate table UserSite; insert into UserSite(User, Site) select u.user, s.site from users u cross join sites s; 你可以用一个稍微复杂的查询来添加新的查询: insert into UserSite(User, Site) select u.user, s.site from users u cross joi ...
-
WITH Duplicates AS (SELECT Probe_id, Timestamp, ROW_NUMBER() OVER (PARTITION BY Probe_id, Timestamp ORDER BY Probe_id, Timestamp) AS [RowNumber] FROM Reading ) DELETE FROM Duplica ...
-
这真的需要多长时间吗? SELECT MIN(ID) + 1 FROM TableName t1 WHERE NOT EXISTS ( SELECT 1 FROM TableName t2 WHERE ID = t1.ID + 1 ) 编辑 :我已经在一张有大约1亿条记录的桌面上进行了测试,这真的花了一些时间,比我想象的要多。 12522150处缺少主键,查询耗时31秒。 您也可以使用ROW_NUMBER ,它可以在SQL-Server 2005上运行: WITH CTE AS ( ...