What is the difference between routine , method , procedure , function ? please explain it with example?
a method is named and attached to an object. so, for example, a method is like a function but is contained inside a class. its scope is limited to that class, and cannot affect variables outside that class, even global variables. if you need to affect a variable outside of a class, just use a function (or routine) that is not contained in a class.
a function is named and returns a value.
a routine is like a function but does not need to return a value.
a procedure is named and may or may not return a value, but receives parameters.
i think the distinctions between a function and a routine are sort of old school. i don't think that distinction is important anymore.
so a function is like
function addOne(n) {
return n++;
}
routine is like
function doStuff(){
makeStuffHappen();
}
and a method is like
thing.destroy(){
thing.destroyed = true;
}
a procedure is like
makeApples(x){
makes x apples
}
edit: typos and made bad examples>.<;
What is the difference between routine , method , procedure , function ? please explain it with example?的更多相关文章
- MySQL:procedure, function, cursor,handler
Procedure & Function Procedure 语法: CREATE [DEFINER = { user | CURRENT_USER }] PROCEDURE sp_name ...
- scala之method和function的区别
在我没有学习scala的时候,主要用java和python做日常工作开发,印象中,没有特别的刻意的去区分method和function的区别,这个关系,正如我们日常生活中,没有刻意的去区分质量和重量. ...
- SQL1042C running a fenced routine (stored procedure/UDF)
Relation to this link http://www-01.ibm.com/support/docview.wss?uid=swg21399105 2015-01-11-13.38.19. ...
- oracle 备份数据库对象(存储过程PROCEDURE,FUNCTION,VIEW,TRIGGER...)
开发过程中,需要不停的备份数据库对象, 特别是存储过程, 每次手动备份不免很低能啊 历经几次修改终于, 完美了,O(∩_∩)O哈哈~ (当然,你也可以再改简便一点~~~) select db ...
- 深入学习Java8 Lambda (default method, lambda, function reference, java.util.function 包)
Java 8 Lambda .MethodReference.function包 多年前,学校讲述C#时,就已经知道有Lambda,也惊喜于它的方便,将函数式编程方式和面向对象式编程基于一身.此外在使 ...
- 存储过程和函数 PROCEDURE & FUNCTION
SQL语句执行的时候,要首先编译,然后在被执行.在大型数据库系统中,为了提高效率,将为了完成特定功能的SQL语句集进行编译优化后,存储在数据库服务器中,用户通过指定存储过程的名字来调用执行. 具体而言 ...
- different between method and function
A method is on an object. A function is independent of an object. For Java, there are only methods. ...
- Java细节----method和function的区别
面向对象的语言叫方法 面向过程的语言叫函数 在java中没有函数这么一说,只有方法一说.属于概念上的区别. 硬要说区别. Method必须依赖于Object. Function 是独立的,不需要依赖于 ...
- 修改Mysql procedure,function and view definer
1 一次性修改遇到错误 update mysql.proc set definer='root@%'; update mysql.proc set definer='root@%'; ERROR 10 ...
随机推荐
- 微服务之Swagger
Swagger使用 1. Swagger UI 按以下步骤配置,项目启动后访问:http://localhost:8080/swagger-ui.html 1.1 添加依赖 <dependenc ...
- RDIFramework.NET框架Web中datagrid与treegrid控件自动生成右键菜单与列标题右键菜单
在实际应用中常可以看到数据展示控件有右键菜单的功能,对应的列标题也可以右键弹出快捷菜单设置指定列的显示与隐藏等功能.在我们的RDIFramework.NET Web框架中,只要是使用了EasyUI的D ...
- python脚本生成exe可执行文件
1.先安装第三方插件: py2exe. Get py2exe from http://www.py2exe.org/ 在download里下载与自己python对应的版本 2.写一个测试python文 ...
- 关于dll的一点收获
蒙贾神指点. 对于kernel32.dll这种系统dll, 每一个进程都会加载一份, 映射到自己的进程空间. 实际上物理内存上还是只有一份dll. 如果对进程自己的dll进行修改, 这时操作系统会触发 ...
- C++ MFC控制台输出调试信息
1.#include <conio.h> 2.在需要开启控制台窗口的地方调用 AllocConsole();//注意检查返回值 3.在需要输出调试的时候调用_cprintf等函数 如_cp ...
- python numpy包
在numpy包中我们可以用数组来表示向量,矩阵和高阶数据结构 首先导入numpy包: from numpy import* 初始化numpy数组有多种方式,比如说 1.python列表或元祖 2.使用 ...
- Windows Phone 二、WP控件
- 20.谈谈对mvc的认识。
MVC是 模型(Model) .视图(View).控制器(Control) 的英文首字母的缩写,核心思想是:视图和用户交互 通过事件导致控制器改变 控制器改变导致模型改变 或者控制器同时改变两者 模型 ...
- linux-bash shell学习
什么是shell?shell就相当于是计算机给我提供的一个操作系统的接口,这里说的bash shell是一种命令行方面的软件,提供给用户来操作系统.
- MySQL命令大全:MySQL常用命令手册、MySQL命令行大全、查询工具
1.连接Mysql 格式: mysql -h主机地址 -u用户名 -p用户密码 1.连接到本机上的MYSQL.首先打开DOS窗口,然后进入目录mysql\bin,再键入命令mysql -u root ...